From 9f41c4da7f36df95e69b148d0f00672bbd21fa81 Mon Sep 17 00:00:00 2001 From: "Marcel S. Henselin" Date: Thu, 29 Jan 2026 14:10:25 +0000 Subject: [PATCH] feat: auto generated files and new structure (#4) ## Description relates to #1234 ## Checklist - [ ] Issue was linked above - [ ] Code format was applied: `make fmt` - [ ] Examples were added / adjusted (see `examples/` directory) - [x] Docs are up-to-date: `make generate-docs` (will be checked by CI) - [ ] Unit tests got implemented or updated - [ ] Acceptance tests got implemented or updated (see e.g. [here](https://github.com/stackitcloud/terraform-provider-stackit/blob/f5f99d170996b208672ae684b6da53420e369563/stackit/internal/services/dns/dns_acc_test.go)) - [x] Unit tests are passing: `make test` (will be checked by CI) - [x] No linter issues: `make lint` (will be checked by CI) Reviewed-on: https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/pulls/4 Reviewed-by: Andre_Harms Co-authored-by: Marcel S. Henselin Co-committed-by: Marcel S. Henselin --- .copywrite.hcl | 24 - .github/actions/build/action.yaml | 24 +- .github/workflows/publish.yaml | 114 + .gitignore | 5 + .goreleaser.yaml | 10 +- Makefile | 9 + cmd/cmd/buildCmd.go | 17 + cmd/cmd/publishCmd.go | 498 + cmd/cmd/rootCmd.go | 23 + cmd/main.go | 27 + .../postgresflexalpha_database.md | 4 +- .../data-sources/postgresflexalpha_flavors.md | 68 + .../postgresflexalpha_instance.md | 53 +- docs/data-sources/postgresflexalpha_user.md | 12 +- .../sqlserverflexalpha_database.md | 31 + .../sqlserverflexalpha_version.md | 35 + docs/resources/postgresflexalpha_instance.md | 68 +- docs/resources/postgresflexalpha_user.md | 12 +- docs/resources/sqlserverflexalpha_database.md | 36 + docs/resources/sqlserverflexalpha_instance.md | 24 +- go.mod | 29 +- go.sum | 60 +- golang-ci.bck.yaml | 95 - golang-ci.yaml | 3 + main.go | 2 +- pkg/albbeta/.openapi-generator/VERSION | 1 + pkg/albbeta/api_default.go | 2409 ++ pkg/albbeta/api_default_test.go | 767 + pkg/albbeta/client.go | 628 + pkg/albbeta/configuration.go | 38 + pkg/albbeta/model_active_health_check.go | 372 + pkg/albbeta/model_active_health_check_test.go | 11 + pkg/albbeta/model_certificate_config.go | 128 + pkg/albbeta/model_certificate_config_test.go | 11 + pkg/albbeta/model_cookie_persistence.go | 178 + pkg/albbeta/model_cookie_persistence_test.go | 11 + .../model_create_credentials_payload.go | 227 + .../model_create_credentials_payload_test.go | 11 + .../model_create_credentials_response.go | 127 + .../model_create_credentials_response_test.go | 11 + .../model_create_load_balancer_payload.go | 961 + ...er_payload_load_balancer_security_group.go | 178 + ...yload_load_balancer_security_group_test.go | 11 + ..._balancer_payload_target_security_group.go | 178 + ...ncer_payload_target_security_group_test.go | 11 + ...model_create_load_balancer_payload_test.go | 79 + pkg/albbeta/model_credentials_response.go | 276 + .../model_credentials_response_test.go | 11 + pkg/albbeta/model_get_credentials_response.go | 127 + .../model_get_credentials_response_test.go | 11 + pkg/albbeta/model_get_quota_response.go | 227 + pkg/albbeta/model_get_quota_response_test.go | 11 + pkg/albbeta/model_google_protobuf_any.go | 137 + pkg/albbeta/model_google_protobuf_any_test.go | 11 + pkg/albbeta/model_host_config.go | 177 + pkg/albbeta/model_host_config_test.go | 11 + pkg/albbeta/model_http_header.go | 178 + pkg/albbeta/model_http_header_test.go | 11 + pkg/albbeta/model_http_health_checks.go | 177 + pkg/albbeta/model_http_health_checks_test.go | 11 + .../model_list_credentials_response.go | 127 + .../model_list_credentials_response_test.go | 11 + .../model_list_load_balancers_response.go | 176 + ...model_list_load_balancers_response_test.go | 11 + pkg/albbeta/model_list_plans_response.go | 127 + pkg/albbeta/model_list_plans_response_test.go | 11 + pkg/albbeta/model_listener.go | 476 + pkg/albbeta/model_listener_test.go | 65 + pkg/albbeta/model_load_balancer.go | 961 + pkg/albbeta/model_load_balancer_error.go | 296 + pkg/albbeta/model_load_balancer_error_test.go | 107 + pkg/albbeta/model_load_balancer_options.go | 269 + .../model_load_balancer_options_test.go | 11 + pkg/albbeta/model_load_balancer_test.go | 79 + ...odel_loadbalancer_option_access_control.go | 128 + ...loadbalancer_option_access_control_test.go | 11 + pkg/albbeta/model_loadbalancer_option_logs.go | 178 + .../model_loadbalancer_option_logs_test.go | 11 + .../model_loadbalancer_option_metrics.go | 178 + .../model_loadbalancer_option_metrics_test.go | 11 + ...model_loadbalancer_option_observability.go | 174 + ..._loadbalancer_option_observability_test.go | 11 + pkg/albbeta/model_network.go | 286 + pkg/albbeta/model_network_test.go | 72 + pkg/albbeta/model_path.go | 178 + pkg/albbeta/model_path_test.go | 11 + pkg/albbeta/model_plan_details.go | 374 + pkg/albbeta/model_plan_details_test.go | 11 + pkg/albbeta/model_protocol_options_http.go | 128 + .../model_protocol_options_http_test.go | 11 + pkg/albbeta/model_protocol_options_https.go | 127 + .../model_protocol_options_https_test.go | 11 + pkg/albbeta/model_query_parameter.go | 178 + pkg/albbeta/model_query_parameter_test.go | 11 + pkg/albbeta/model_rule.go | 416 + pkg/albbeta/model_rule_test.go | 11 + pkg/albbeta/model_security_group.go | 178 + pkg/albbeta/model_security_group_test.go | 11 + pkg/albbeta/model_status.go | 226 + pkg/albbeta/model_status_test.go | 11 + pkg/albbeta/model_target.go | 178 + pkg/albbeta/model_target_pool.go | 320 + pkg/albbeta/model_target_pool_test.go | 11 + pkg/albbeta/model_target_pool_tls_config.go | 225 + .../model_target_pool_tls_config_test.go | 11 + pkg/albbeta/model_target_test.go | 11 + .../model_update_credentials_payload.go | 227 + .../model_update_credentials_payload_test.go | 11 + .../model_update_credentials_response.go | 127 + .../model_update_credentials_response_test.go | 11 + .../model_update_load_balancer_payload.go | 961 + ...model_update_load_balancer_payload_test.go | 79 + .../model_update_target_pool_payload.go | 320 + .../model_update_target_pool_payload_test.go | 11 + pkg/albbeta/utils.go | 385 + pkg/albwafalpha/.openapi-generator/VERSION | 1 + pkg/albwafalpha/api_default.go | 2778 ++ pkg/albwafalpha/api_default_test.go | 884 + pkg/albwafalpha/client.go | 628 + pkg/albwafalpha/configuration.go | 38 + .../model_create_core_rule_set_payload.go | 275 + ...model_create_core_rule_set_payload_test.go | 11 + .../model_create_core_rule_set_response.go | 226 + ...odel_create_core_rule_set_response_test.go | 11 + pkg/albwafalpha/model_create_rules_payload.go | 276 + .../model_create_rules_payload_test.go | 11 + .../model_create_rules_response.go | 227 + .../model_create_rules_response_test.go | 11 + pkg/albwafalpha/model_create_waf_payload.go | 325 + .../model_create_waf_payload_test.go | 11 + pkg/albwafalpha/model_create_waf_response.go | 276 + .../model_create_waf_response_test.go | 11 + .../model_get_core_rule_set_response.go | 226 + .../model_get_core_rule_set_response_test.go | 11 + pkg/albwafalpha/model_get_rules_response.go | 227 + .../model_get_rules_response_test.go | 11 + pkg/albwafalpha/model_get_waf_response.go | 276 + .../model_get_waf_response_test.go | 11 + pkg/albwafalpha/model_google_protobuf_any.go | 137 + .../model_google_protobuf_any_test.go | 11 + .../model_list_core_rule_set_response.go | 176 + .../model_list_core_rule_set_response_test.go | 11 + pkg/albwafalpha/model_list_rules_response.go | 176 + .../model_list_rules_response_test.go | 11 + pkg/albwafalpha/model_list_waf_response.go | 176 + .../model_list_waf_response_test.go | 11 + pkg/albwafalpha/model_status.go | 226 + pkg/albwafalpha/model_status_test.go | 11 + .../model_update_core_rule_set_payload.go | 275 + ...model_update_core_rule_set_payload_test.go | 11 + .../model_update_core_rule_set_response.go | 226 + ...odel_update_core_rule_set_response_test.go | 11 + pkg/albwafalpha/model_update_rules_payload.go | 276 + .../model_update_rules_payload_test.go | 11 + .../model_update_rules_response.go | 227 + .../model_update_rules_response_test.go | 11 + pkg/albwafalpha/model_update_waf_payload.go | 325 + .../model_update_waf_payload_test.go | 11 + pkg/albwafalpha/model_update_waf_response.go | 276 + .../model_update_waf_response_test.go | 11 + pkg/albwafalpha/utils.go | 385 + pkg/cdnbeta/.openapi-generator/VERSION | 1 + pkg/cdnbeta/api_default.go | 3137 ++ pkg/cdnbeta/api_default_test.go | 801 + pkg/cdnbeta/client.go | 628 + pkg/cdnbeta/configuration.go | 38 + pkg/cdnbeta/model_bucket_backend.go | 214 + pkg/cdnbeta/model_bucket_backend_create.go | 257 + .../model_bucket_backend_create_test.go | 11 + pkg/cdnbeta/model_bucket_backend_patch.go | 269 + .../model_bucket_backend_patch_test.go | 11 + pkg/cdnbeta/model_bucket_backend_test.go | 11 + pkg/cdnbeta/model_bucket_credentials.go | 170 + pkg/cdnbeta/model_bucket_credentials_test.go | 11 + pkg/cdnbeta/model_config.go | 516 + pkg/cdnbeta/model_config_backend.go | 163 + pkg/cdnbeta/model_config_backend_test.go | 11 + pkg/cdnbeta/model_config_log_sink.go | 123 + pkg/cdnbeta/model_config_log_sink_test.go | 11 + pkg/cdnbeta/model_config_patch.go | 545 + pkg/cdnbeta/model_config_patch_backend.go | 163 + .../model_config_patch_backend_test.go | 11 + pkg/cdnbeta/model_config_patch_log_sink.go | 128 + .../model_config_patch_log_sink_test.go | 11 + pkg/cdnbeta/model_config_patch_test.go | 11 + pkg/cdnbeta/model_config_test.go | 11 + .../model_create_distribution_payload.go | 552 + ...del_create_distribution_payload_backend.go | 163 + ...reate_distribution_payload_backend_test.go | 11 + ...el_create_distribution_payload_log_sink.go | 123 + ...eate_distribution_payload_log_sink_test.go | 11 + .../model_create_distribution_payload_test.go | 11 + .../model_create_distribution_response.go | 125 + ...model_create_distribution_response_test.go | 11 + pkg/cdnbeta/model_custom_domain.go | 218 + pkg/cdnbeta/model_custom_domain_test.go | 11 + .../model_delete_custom_domain_response.go | 127 + ...odel_delete_custom_domain_response_test.go | 11 + .../model_delete_distribution_response.go | 127 + ...model_delete_distribution_response_test.go | 11 + pkg/cdnbeta/model_distribution.go | 595 + pkg/cdnbeta/model_distribution_logs_record.go | 477 + .../model_distribution_logs_record_test.go | 11 + .../model_distribution_statistics_record.go | 346 + ...l_distribution_statistics_record_all_of.go | 214 + ...tribution_statistics_record_all_of_test.go | 11 + ...el_distribution_statistics_record_entry.go | 214 + ...stribution_statistics_record_entry_test.go | 11 + ..._distribution_statistics_record_regions.go | 297 + ...ribution_statistics_record_regions_test.go | 11 + ...del_distribution_statistics_record_test.go | 11 + pkg/cdnbeta/model_distribution_test.go | 79 + pkg/cdnbeta/model_distribution_waf.go | 211 + pkg/cdnbeta/model_distribution_waf_test.go | 11 + pkg/cdnbeta/model_domain.go | 367 + pkg/cdnbeta/model_domain_status.go | 121 + pkg/cdnbeta/model_domain_status_test.go | 11 + pkg/cdnbeta/model_domain_test.go | 58 + pkg/cdnbeta/model_error_details.go | 375 + pkg/cdnbeta/model_error_details_test.go | 65 + .../model_find_cache_paths_response.go | 125 + .../model_find_cache_paths_response_entry.go | 127 + ...el_find_cache_paths_response_entry_test.go | 11 + .../model_find_cache_paths_response_test.go | 11 + pkg/cdnbeta/model_generic_json_response.go | 174 + .../model_generic_json_response_test.go | 11 + pkg/cdnbeta/model_get_cache_info_response.go | 172 + ...l_get_cache_info_response_history_entry.go | 274 + ..._cache_info_response_history_entry_test.go | 58 + .../model_get_cache_info_response_test.go | 11 + ...el_get_custom_domain_custom_certificate.go | 171 + ...t_custom_domain_custom_certificate_test.go | 11 + ...l_get_custom_domain_managed_certificate.go | 126 + ..._custom_domain_managed_certificate_test.go | 11 + .../model_get_custom_domain_response.go | 168 + ..._get_custom_domain_response_certificate.go | 163 + ...custom_domain_response_certificate_test.go | 11 + .../model_get_custom_domain_response_test.go | 11 + .../model_get_distribution_response.go | 125 + .../model_get_distribution_response_test.go | 11 + pkg/cdnbeta/model_get_logs_response.go | 173 + pkg/cdnbeta/model_get_logs_response_test.go | 11 + pkg/cdnbeta/model_get_statistics_response.go | 125 + .../model_get_statistics_response_test.go | 11 + pkg/cdnbeta/model_http_backend.go | 259 + pkg/cdnbeta/model_http_backend_create.go | 267 + pkg/cdnbeta/model_http_backend_create_test.go | 11 + pkg/cdnbeta/model_http_backend_patch.go | 271 + pkg/cdnbeta/model_http_backend_patch_test.go | 11 + pkg/cdnbeta/model_http_backend_test.go | 11 + .../model_list_distributions_response.go | 173 + .../model_list_distributions_response_test.go | 11 + .../model_list_waf_collections_response.go | 125 + ...odel_list_waf_collections_response_test.go | 11 + pkg/cdnbeta/model_loki_log_sink.go | 170 + pkg/cdnbeta/model_loki_log_sink_create.go | 213 + .../model_loki_log_sink_create_test.go | 11 + .../model_loki_log_sink_credentials.go | 170 + .../model_loki_log_sink_credentials_test.go | 11 + pkg/cdnbeta/model_loki_log_sink_patch.go | 221 + pkg/cdnbeta/model_loki_log_sink_patch_test.go | 11 + pkg/cdnbeta/model_loki_log_sink_test.go | 11 + pkg/cdnbeta/model_optimizer.go | 126 + pkg/cdnbeta/model_optimizer_patch.go | 127 + pkg/cdnbeta/model_optimizer_patch_test.go | 11 + pkg/cdnbeta/model_optimizer_test.go | 11 + .../model_patch_distribution_payload.go | 176 + .../model_patch_distribution_payload_test.go | 11 + .../model_patch_distribution_response.go | 125 + .../model_patch_distribution_response_test.go | 11 + pkg/cdnbeta/model_purge_cache_payload.go | 129 + pkg/cdnbeta/model_purge_cache_payload_test.go | 11 + ...el_put_custom_domain_custom_certificate.go | 216 + ...t_custom_domain_custom_certificate_test.go | 11 + ...l_put_custom_domain_managed_certificate.go | 126 + ..._custom_domain_managed_certificate_test.go | 11 + .../model_put_custom_domain_payload.go | 176 + ...l_put_custom_domain_payload_certificate.go | 163 + ..._custom_domain_payload_certificate_test.go | 11 + .../model_put_custom_domain_payload_test.go | 11 + .../model_put_custom_domain_response.go | 172 + ..._put_custom_domain_response_certificate.go | 163 + ...custom_domain_response_certificate_test.go | 11 + .../model_put_custom_domain_response_test.go | 11 + pkg/cdnbeta/model_region.go | 121 + pkg/cdnbeta/model_region_test.go | 11 + pkg/cdnbeta/model_status_error.go | 329 + pkg/cdnbeta/model_status_error_test.go | 72 + pkg/cdnbeta/model_waf_config.go | 212 + pkg/cdnbeta/model_waf_config_patch.go | 174 + pkg/cdnbeta/model_waf_config_patch_test.go | 11 + pkg/cdnbeta/model_waf_config_test.go | 11 + pkg/cdnbeta/model_waf_mode.go | 117 + pkg/cdnbeta/model_waf_mode_test.go | 11 + pkg/cdnbeta/model_waf_rule.go | 219 + pkg/cdnbeta/model_waf_rule_collection.go | 213 + pkg/cdnbeta/model_waf_rule_collection_test.go | 11 + pkg/cdnbeta/model_waf_rule_group.go | 213 + pkg/cdnbeta/model_waf_rule_group_test.go | 11 + pkg/cdnbeta/model_waf_rule_test.go | 11 + pkg/cdnbeta/model_waf_status_rule_block.go | 127 + .../model_waf_status_rule_block_test.go | 11 + pkg/cdnbeta/model_waf_type.go | 115 + pkg/cdnbeta/model_waf_type_test.go | 11 + pkg/cdnbeta/utils.go | 385 + .../.openapi-generator/VERSION | 1 + pkg/certificatesbeta/api_default.go | 758 + pkg/certificatesbeta/api_default_test.go | 253 + pkg/certificatesbeta/client.go | 628 + pkg/certificatesbeta/configuration.go | 38 + .../model_create_certificate_payload.go | 325 + .../model_create_certificate_payload_test.go | 11 + .../model_create_certificate_response.go | 178 + .../model_create_certificate_response_test.go | 11 + .../model_get_certificate_response.go | 276 + .../model_get_certificate_response_test.go | 11 + .../model_google_protobuf_any.go | 137 + .../model_google_protobuf_any_test.go | 11 + .../model_list_certificates_response.go | 176 + .../model_list_certificates_response_test.go | 11 + pkg/certificatesbeta/model_status.go | 226 + pkg/certificatesbeta/model_status_test.go | 11 + pkg/certificatesbeta/utils.go | 385 + pkg/edgebeta/.openapi-generator/VERSION | 1 + pkg/edgebeta/api_default.go | 2530 ++ pkg/edgebeta/api_default_test.go | 796 + pkg/edgebeta/client.go | 628 + pkg/edgebeta/configuration.go | 38 + pkg/edgebeta/model_bad_request.go | 176 + pkg/edgebeta/model_bad_request_test.go | 11 + pkg/edgebeta/model_create_instance_payload.go | 221 + .../model_create_instance_payload_test.go | 11 + pkg/edgebeta/model_instance.go | 509 + pkg/edgebeta/model_instance_list.go | 125 + pkg/edgebeta/model_instance_list_test.go | 11 + pkg/edgebeta/model_instance_test.go | 72 + pkg/edgebeta/model_kubeconfig.go | 126 + pkg/edgebeta/model_kubeconfig_test.go | 11 + pkg/edgebeta/model_plan.go | 276 + pkg/edgebeta/model_plan_list.go | 127 + pkg/edgebeta/model_plan_list_test.go | 11 + pkg/edgebeta/model_plan_test.go | 11 + pkg/edgebeta/model_token.go | 127 + pkg/edgebeta/model_token_test.go | 11 + pkg/edgebeta/model_unauthorized_request.go | 176 + .../model_unauthorized_request_test.go | 11 + .../model_update_instance_by_name_payload.go | 178 + ...el_update_instance_by_name_payload_test.go | 11 + pkg/edgebeta/model_update_instance_payload.go | 178 + .../model_update_instance_payload_test.go | 11 + pkg/edgebeta/model_user.go | 172 + pkg/edgebeta/model_user_test.go | 11 + pkg/edgebeta/utils.go | 385 + pkg/gitbeta/.openapi-generator/VERSION | 1 + pkg/gitbeta/api_default.go | 2918 ++ pkg/gitbeta/api_default_test.go | 835 + pkg/gitbeta/client.go | 628 + pkg/gitbeta/configuration.go | 38 + pkg/gitbeta/model_authentication.go | 486 + pkg/gitbeta/model_authentication_list.go | 125 + pkg/gitbeta/model_authentication_list_test.go | 11 + pkg/gitbeta/model_authentication_test.go | 11 + .../model_create_authentication_payload.go | 413 + ...odel_create_authentication_payload_test.go | 11 + pkg/gitbeta/model_create_instance_payload.go | 327 + .../model_create_instance_payload_test.go | 58 + pkg/gitbeta/model_create_runner_payload.go | 125 + .../model_create_runner_payload_test.go | 11 + pkg/gitbeta/model_feature_toggle.go | 366 + pkg/gitbeta/model_feature_toggle_test.go | 72 + pkg/gitbeta/model_flavor.go | 415 + pkg/gitbeta/model_flavor_test.go | 72 + pkg/gitbeta/model_flavors_list.go | 125 + pkg/gitbeta/model_flavors_list_test.go | 11 + pkg/gitbeta/model_generic_error_response.go | 173 + .../model_generic_error_response_test.go | 11 + pkg/gitbeta/model_instance.go | 686 + pkg/gitbeta/model_instance_list.go | 125 + pkg/gitbeta/model_instance_list_test.go | 11 + pkg/gitbeta/model_instance_test.go | 86 + .../model_internal_server_error_response.go | 128 + ...del_internal_server_error_response_test.go | 11 + .../model_patch_authentication_payload.go | 374 + ...model_patch_authentication_payload_test.go | 11 + pkg/gitbeta/model_patch_instance_payload.go | 176 + .../model_patch_instance_payload_test.go | 11 + pkg/gitbeta/model_patch_operation.go | 325 + pkg/gitbeta/model_patch_operation_test.go | 58 + pkg/gitbeta/model_runner.go | 258 + pkg/gitbeta/model_runner_runtime.go | 307 + pkg/gitbeta/model_runner_runtime_list.go | 125 + pkg/gitbeta/model_runner_runtime_list_test.go | 11 + pkg/gitbeta/model_runner_runtime_test.go | 11 + pkg/gitbeta/model_runner_test.go | 11 + pkg/gitbeta/utils.go | 385 + pkg/iaasalpha/.openapi-generator/VERSION | 1 + pkg/iaasalpha/api_default.go | 3830 ++ pkg/iaasalpha/api_default_test.go | 966 + pkg/iaasalpha/client.go | 628 + pkg/iaasalpha/configuration.go | 38 + ...del_add_routes_to_routing_table_payload.go | 126 + ...dd_routes_to_routing_table_payload_test.go | 11 + ...model_add_routing_table_to_area_payload.go | 518 + ..._add_routing_table_to_area_payload_test.go | 11 + pkg/iaasalpha/model_create_network_ipv4.go | 144 + .../model_create_network_ipv4_test.go | 43 + .../model_create_network_ipv4_with_prefix.go | 239 + ..._create_network_ipv4_with_prefix_length.go | 173 + ...te_network_ipv4_with_prefix_length_test.go | 11 + ...el_create_network_ipv4_with_prefix_test.go | 11 + pkg/iaasalpha/model_create_network_ipv6.go | 144 + .../model_create_network_ipv6_test.go | 43 + .../model_create_network_ipv6_with_prefix.go | 239 + ..._create_network_ipv6_with_prefix_length.go | 173 + ...te_network_ipv6_with_prefix_length_test.go | 11 + ...el_create_network_ipv6_with_prefix_test.go | 11 + pkg/iaasalpha/model_create_network_payload.go | 416 + .../model_create_network_payload_test.go | 11 + pkg/iaasalpha/model_destination_cidrv4.go | 171 + .../model_destination_cidrv4_test.go | 11 + pkg/iaasalpha/model_destination_cidrv6.go | 171 + .../model_destination_cidrv6_test.go | 11 + pkg/iaasalpha/model_error.go | 170 + pkg/iaasalpha/model_error_test.go | 11 + pkg/iaasalpha/model_network.go | 600 + pkg/iaasalpha/model_network_ipv4.go | 286 + pkg/iaasalpha/model_network_ipv4_test.go | 11 + pkg/iaasalpha/model_network_ipv6.go | 237 + pkg/iaasalpha/model_network_ipv6_test.go | 11 + pkg/iaasalpha/model_network_list_response.go | 126 + .../model_network_list_response_test.go | 11 + pkg/iaasalpha/model_network_test.go | 11 + pkg/iaasalpha/model_nexthop_blackhole.go | 126 + pkg/iaasalpha/model_nexthop_blackhole_test.go | 11 + pkg/iaasalpha/model_nexthop_internet.go | 126 + pkg/iaasalpha/model_nexthop_internet_test.go | 11 + pkg/iaasalpha/model_nexthop_ipv4.go | 171 + pkg/iaasalpha/model_nexthop_ipv4_test.go | 11 + pkg/iaasalpha/model_nexthop_ipv6.go | 171 + pkg/iaasalpha/model_nexthop_ipv6_test.go | 11 + .../model_partial_update_network_payload.go | 416 + ...del_partial_update_network_payload_test.go | 11 + pkg/iaasalpha/model_route.go | 362 + pkg/iaasalpha/model_route_destination.go | 163 + pkg/iaasalpha/model_route_destination_test.go | 11 + pkg/iaasalpha/model_route_list_response.go | 126 + .../model_route_list_response_test.go | 11 + pkg/iaasalpha/model_route_nexthop.go | 243 + pkg/iaasalpha/model_route_nexthop_test.go | 11 + pkg/iaasalpha/model_route_test.go | 11 + pkg/iaasalpha/model_routing_table.go | 518 + .../model_routing_table_list_response.go | 126 + .../model_routing_table_list_response_test.go | 11 + pkg/iaasalpha/model_routing_table_test.go | 11 + .../model_update_network_ipv4_body.go | 192 + .../model_update_network_ipv4_body_test.go | 11 + .../model_update_network_ipv6_body.go | 192 + .../model_update_network_ipv6_body_test.go | 11 + ...l_update_route_of_routing_table_payload.go | 128 + ...ate_route_of_routing_table_payload_test.go | 11 + ...el_update_routing_table_of_area_payload.go | 322 + ...date_routing_table_of_area_payload_test.go | 11 + pkg/iaasalpha/utils.go | 385 + pkg/iaasalpha/wait/wait.go | 85 + pkg/iaasalpha/wait/wait_test.go | 216 + pkg/iaasbeta/.openapi-generator/VERSION | 1 + pkg/iaasbeta/api_default.go | 30658 ++++++++++++++++ pkg/iaasbeta/api_default_test.go | 7614 ++++ pkg/iaasbeta/client.go | 628 + pkg/iaasbeta/configuration.go | 38 + ...del_add_routes_to_routing_table_payload.go | 126 + ...dd_routes_to_routing_table_payload_test.go | 11 + ...model_add_routing_table_to_area_payload.go | 518 + ..._add_routing_table_to_area_payload_test.go | 11 + .../model_add_volume_to_server_payload.go | 226 + ...model_add_volume_to_server_payload_test.go | 11 + pkg/iaasbeta/model_affinity_group.go | 269 + .../model_affinity_group_list_response.go | 126 + ...model_affinity_group_list_response_test.go | 11 + pkg/iaasbeta/model_affinity_group_test.go | 11 + pkg/iaasbeta/model_allowed_addresses_inner.go | 138 + .../model_allowed_addresses_inner_test.go | 60 + pkg/iaasbeta/model_area_id.go | 150 + pkg/iaasbeta/model_area_id_test.go | 67 + .../model_availability_zone_list_response.go | 126 + ...el_availability_zone_list_response_test.go | 11 + pkg/iaasbeta/model_backup.go | 615 + pkg/iaasbeta/model_backup_list_response.go | 126 + .../model_backup_list_response_test.go | 11 + pkg/iaasbeta/model_backup_source.go | 172 + pkg/iaasbeta/model_backup_source_test.go | 11 + pkg/iaasbeta/model_backup_test.go | 11 + .../model_base_security_group_rule.go | 614 + .../model_base_security_group_rule_test.go | 11 + pkg/iaasbeta/model_boot_volume.go | 321 + pkg/iaasbeta/model_boot_volume_source.go | 172 + pkg/iaasbeta/model_boot_volume_source_test.go | 11 + pkg/iaasbeta/model_boot_volume_test.go | 11 + .../model_create_affinity_group_payload.go | 269 + ...odel_create_affinity_group_payload_test.go | 11 + pkg/iaasbeta/model_create_backup_payload.go | 222 + .../model_create_backup_payload_test.go | 11 + pkg/iaasbeta/model_create_image_payload.go | 894 + .../model_create_image_payload_test.go | 11 + .../model_create_isolated_network_payload.go | 272 + ...el_create_isolated_network_payload_test.go | 11 + pkg/iaasbeta/model_create_key_pair_payload.go | 370 + .../model_create_key_pair_payload_test.go | 11 + .../model_create_network_area_payload.go | 174 + .../model_create_network_area_payload_test.go | 11 + ...model_create_network_area_range_payload.go | 128 + ..._create_network_area_range_payload_test.go | 11 + ...model_create_network_area_route_payload.go | 126 + ..._create_network_area_route_payload_test.go | 11 + pkg/iaasbeta/model_create_network_ipv4.go | 144 + .../model_create_network_ipv4_test.go | 43 + .../model_create_network_ipv4_with_prefix.go | 239 + ..._create_network_ipv4_with_prefix_length.go | 173 + ...te_network_ipv4_with_prefix_length_test.go | 11 + ...el_create_network_ipv4_with_prefix_test.go | 11 + pkg/iaasbeta/model_create_network_ipv6.go | 144 + .../model_create_network_ipv6_test.go | 43 + .../model_create_network_ipv6_with_prefix.go | 239 + ..._create_network_ipv6_with_prefix_length.go | 173 + ...te_network_ipv6_with_prefix_length_test.go | 11 + ...el_create_network_ipv6_with_prefix_test.go | 11 + pkg/iaasbeta/model_create_network_payload.go | 416 + .../model_create_network_payload_test.go | 11 + pkg/iaasbeta/model_create_nic_payload.go | 764 + pkg/iaasbeta/model_create_nic_payload_test.go | 11 + pkg/iaasbeta/model_create_protocol.go | 144 + pkg/iaasbeta/model_create_protocol_test.go | 60 + .../model_create_public_ip_payload.go | 290 + .../model_create_public_ip_payload_test.go | 11 + .../model_create_security_group_payload.go | 468 + ...odel_create_security_group_payload_test.go | 11 + ...odel_create_security_group_rule_payload.go | 661 + ...create_security_group_rule_payload_test.go | 11 + ...del_create_security_group_rule_protocol.go | 127 + ...reate_security_group_rule_protocol_test.go | 11 + .../model_create_server_networking.go | 129 + .../model_create_server_networking_test.go | 11 + ...odel_create_server_networking_with_nics.go | 128 + ...create_server_networking_with_nics_test.go | 11 + pkg/iaasbeta/model_create_server_payload.go | 1229 + .../model_create_server_payload_all_of.go | 125 + ...create_server_payload_all_of_networking.go | 144 + ...e_server_payload_all_of_networking_test.go | 43 + ...model_create_server_payload_all_of_test.go | 11 + .../model_create_server_payload_test.go | 11 + pkg/iaasbeta/model_create_volume_payload.go | 851 + .../model_create_volume_payload_test.go | 11 + pkg/iaasbeta/model_destination_cidrv4.go | 171 + pkg/iaasbeta/model_destination_cidrv4_test.go | 11 + pkg/iaasbeta/model_destination_cidrv6.go | 171 + pkg/iaasbeta/model_destination_cidrv6_test.go | 11 + pkg/iaasbeta/model_error.go | 170 + pkg/iaasbeta/model_error_test.go | 11 + .../model_get_server_log_200_response.go | 128 + .../model_get_server_log_200_response_test.go | 11 + pkg/iaasbeta/model_icmp_parameters.go | 170 + pkg/iaasbeta/model_icmp_parameters_test.go | 11 + pkg/iaasbeta/model_image.go | 894 + pkg/iaasbeta/model_image_agent.go | 176 + pkg/iaasbeta/model_image_agent_test.go | 11 + pkg/iaasbeta/model_image_checksum.go | 172 + pkg/iaasbeta/model_image_checksum_test.go | 11 + pkg/iaasbeta/model_image_config.go | 882 + pkg/iaasbeta/model_image_config_test.go | 11 + pkg/iaasbeta/model_image_create_response.go | 171 + .../model_image_create_response_test.go | 11 + pkg/iaasbeta/model_image_list_response.go | 126 + .../model_image_list_response_test.go | 11 + pkg/iaasbeta/model_image_share.go | 176 + pkg/iaasbeta/model_image_share_consumer.go | 275 + .../model_image_share_consumer_test.go | 11 + pkg/iaasbeta/model_image_share_test.go | 11 + pkg/iaasbeta/model_image_test.go | 11 + pkg/iaasbeta/model_key_pair_list_response.go | 126 + .../model_key_pair_list_response_test.go | 11 + pkg/iaasbeta/model_keypair.go | 370 + pkg/iaasbeta/model_keypair_test.go | 11 + pkg/iaasbeta/model_machine_type.go | 356 + .../model_machine_type_list_response.go | 126 + .../model_machine_type_list_response_test.go | 11 + pkg/iaasbeta/model_machine_type_test.go | 11 + pkg/iaasbeta/model_network.go | 600 + pkg/iaasbeta/model_network_area.go | 368 + .../model_network_area_list_response.go | 126 + .../model_network_area_list_response_test.go | 11 + pkg/iaasbeta/model_network_area_test.go | 11 + pkg/iaasbeta/model_network_ipv4.go | 286 + pkg/iaasbeta/model_network_ipv4_test.go | 11 + pkg/iaasbeta/model_network_ipv6.go | 237 + pkg/iaasbeta/model_network_ipv6_test.go | 11 + pkg/iaasbeta/model_network_list_response.go | 126 + .../model_network_list_response_test.go | 11 + pkg/iaasbeta/model_network_range.go | 273 + .../model_network_range_list_response.go | 126 + .../model_network_range_list_response_test.go | 11 + pkg/iaasbeta/model_network_range_test.go | 11 + pkg/iaasbeta/model_network_test.go | 11 + pkg/iaasbeta/model_nexthop_blackhole.go | 126 + pkg/iaasbeta/model_nexthop_blackhole_test.go | 11 + pkg/iaasbeta/model_nexthop_internet.go | 126 + pkg/iaasbeta/model_nexthop_internet_test.go | 11 + pkg/iaasbeta/model_nexthop_ipv4.go | 171 + pkg/iaasbeta/model_nexthop_ipv4_test.go | 11 + pkg/iaasbeta/model_nexthop_ipv6.go | 171 + pkg/iaasbeta/model_nexthop_ipv6_test.go | 11 + pkg/iaasbeta/model_nic.go | 764 + pkg/iaasbeta/model_nic_list_response.go | 126 + pkg/iaasbeta/model_nic_list_response_test.go | 11 + pkg/iaasbeta/model_nic_test.go | 11 + ...del_partial_update_network_area_payload.go | 176 + ...artial_update_network_area_payload_test.go | 11 + .../model_partial_update_network_payload.go | 416 + ...del_partial_update_network_payload_test.go | 11 + pkg/iaasbeta/model_port_range.go | 170 + pkg/iaasbeta/model_port_range_test.go | 11 + pkg/iaasbeta/model_project.go | 359 + pkg/iaasbeta/model_project_list_response.go | 126 + .../model_project_list_response_test.go | 11 + pkg/iaasbeta/model_project_test.go | 11 + pkg/iaasbeta/model_protocol.go | 177 + pkg/iaasbeta/model_protocol_test.go | 11 + pkg/iaasbeta/model_public_ip.go | 290 + pkg/iaasbeta/model_public_ip_list_response.go | 126 + .../model_public_ip_list_response_test.go | 11 + pkg/iaasbeta/model_public_ip_test.go | 11 + pkg/iaasbeta/model_public_network.go | 172 + .../model_public_network_list_response.go | 126 + ...model_public_network_list_response_test.go | 11 + pkg/iaasbeta/model_public_network_test.go | 11 + pkg/iaasbeta/model_quota.go | 168 + pkg/iaasbeta/model_quota_list.go | 598 + .../model_quota_list_backup_gigabytes.go | 168 + .../model_quota_list_backup_gigabytes_test.go | 11 + pkg/iaasbeta/model_quota_list_backups.go | 168 + pkg/iaasbeta/model_quota_list_backups_test.go | 11 + pkg/iaasbeta/model_quota_list_gigabytes.go | 168 + .../model_quota_list_gigabytes_test.go | 11 + pkg/iaasbeta/model_quota_list_networks.go | 168 + .../model_quota_list_networks_test.go | 11 + pkg/iaasbeta/model_quota_list_nics.go | 168 + pkg/iaasbeta/model_quota_list_nics_test.go | 11 + pkg/iaasbeta/model_quota_list_public_ips.go | 168 + .../model_quota_list_public_ips_test.go | 11 + pkg/iaasbeta/model_quota_list_ram.go | 168 + pkg/iaasbeta/model_quota_list_ram_test.go | 11 + pkg/iaasbeta/model_quota_list_response.go | 125 + .../model_quota_list_response_test.go | 11 + .../model_quota_list_security_group_rules.go | 168 + ...el_quota_list_security_group_rules_test.go | 11 + .../model_quota_list_security_groups.go | 168 + .../model_quota_list_security_groups_test.go | 11 + pkg/iaasbeta/model_quota_list_snapshots.go | 168 + .../model_quota_list_snapshots_test.go | 11 + pkg/iaasbeta/model_quota_list_test.go | 11 + pkg/iaasbeta/model_quota_list_vcpu.go | 168 + pkg/iaasbeta/model_quota_list_vcpu_test.go | 11 + pkg/iaasbeta/model_quota_list_volumes.go | 168 + pkg/iaasbeta/model_quota_list_volumes_test.go | 11 + pkg/iaasbeta/model_quota_test.go | 11 + pkg/iaasbeta/model_regional_area.go | 176 + pkg/iaasbeta/model_regional_area_ipv4.go | 356 + pkg/iaasbeta/model_regional_area_ipv4_test.go | 11 + .../model_regional_area_list_response.go | 125 + .../model_regional_area_list_response_test.go | 11 + pkg/iaasbeta/model_regional_area_test.go | 11 + pkg/iaasbeta/model_request.go | 353 + pkg/iaasbeta/model_request_resource.go | 217 + pkg/iaasbeta/model_request_resource_test.go | 11 + pkg/iaasbeta/model_request_test.go | 11 + pkg/iaasbeta/model_rescue_server_payload.go | 127 + .../model_rescue_server_payload_test.go | 11 + pkg/iaasbeta/model_resize_server_payload.go | 127 + .../model_resize_server_payload_test.go | 11 + pkg/iaasbeta/model_resize_volume_payload.go | 126 + .../model_resize_volume_payload_test.go | 11 + pkg/iaasbeta/model_route.go | 362 + pkg/iaasbeta/model_route_destination.go | 163 + pkg/iaasbeta/model_route_destination_test.go | 11 + pkg/iaasbeta/model_route_list_response.go | 126 + .../model_route_list_response_test.go | 11 + pkg/iaasbeta/model_route_nexthop.go | 243 + pkg/iaasbeta/model_route_nexthop_test.go | 11 + pkg/iaasbeta/model_route_test.go | 11 + pkg/iaasbeta/model_routing_table.go | 518 + .../model_routing_table_list_response.go | 126 + .../model_routing_table_list_response_test.go | 11 + pkg/iaasbeta/model_routing_table_test.go | 11 + pkg/iaasbeta/model_security_group.go | 468 + .../model_security_group_list_response.go | 126 + ...model_security_group_list_response_test.go | 11 + pkg/iaasbeta/model_security_group_rule.go | 661 + ...model_security_group_rule_list_response.go | 126 + ..._security_group_rule_list_response_test.go | 11 + .../model_security_group_rule_protocol.go | 127 + ...model_security_group_rule_protocol_test.go | 11 + .../model_security_group_rule_test.go | 11 + pkg/iaasbeta/model_security_group_test.go | 11 + pkg/iaasbeta/model_server.go | 1233 + pkg/iaasbeta/model_server_agent.go | 128 + pkg/iaasbeta/model_server_agent_test.go | 11 + pkg/iaasbeta/model_server_boot_volume.go | 321 + pkg/iaasbeta/model_server_boot_volume_test.go | 11 + pkg/iaasbeta/model_server_console_url.go | 126 + pkg/iaasbeta/model_server_console_url_test.go | 11 + pkg/iaasbeta/model_server_list_response.go | 126 + .../model_server_list_response_test.go | 11 + pkg/iaasbeta/model_server_maintenance.go | 264 + pkg/iaasbeta/model_server_maintenance_test.go | 11 + pkg/iaasbeta/model_server_network.go | 549 + pkg/iaasbeta/model_server_network_test.go | 11 + pkg/iaasbeta/model_server_networking.go | 144 + pkg/iaasbeta/model_server_networking_test.go | 43 + pkg/iaasbeta/model_server_test.go | 11 + ...odel_service_account_mail_list_response.go | 126 + ...service_account_mail_list_response_test.go | 11 + pkg/iaasbeta/model_set_image_share_payload.go | 176 + .../model_set_image_share_payload_test.go | 11 + pkg/iaasbeta/model_snapshot.go | 467 + pkg/iaasbeta/model_snapshot_list_response.go | 126 + .../model_snapshot_list_response_test.go | 11 + pkg/iaasbeta/model_snapshot_test.go | 11 + pkg/iaasbeta/model_static_area_id.go | 115 + pkg/iaasbeta/model_static_area_id_test.go | 11 + .../model_update_attached_volume_payload.go | 226 + ...del_update_attached_volume_payload_test.go | 11 + pkg/iaasbeta/model_update_image_payload.go | 464 + .../model_update_image_payload_test.go | 11 + .../model_update_image_share_payload.go | 176 + .../model_update_image_share_payload_test.go | 11 + pkg/iaasbeta/model_update_key_pair_payload.go | 128 + .../model_update_key_pair_payload_test.go | 11 + .../model_update_network_ipv4_body.go | 192 + .../model_update_network_ipv4_body_test.go | 11 + .../model_update_network_ipv6_body.go | 192 + .../model_update_network_ipv6_body_test.go | 11 + pkg/iaasbeta/model_update_nic_payload.go | 370 + pkg/iaasbeta/model_update_nic_payload_test.go | 11 + .../model_update_public_ip_payload.go | 290 + .../model_update_public_ip_payload_test.go | 11 + .../model_update_regional_area_ipv4.go | 271 + .../model_update_regional_area_ipv4_test.go | 11 + ...l_update_route_of_routing_table_payload.go | 128 + ...ate_route_of_routing_table_payload_test.go | 11 + ...el_update_routing_table_of_area_payload.go | 322 + ...date_routing_table_of_area_payload_test.go | 11 + pkg/iaasbeta/model_update_server_payload.go | 225 + .../model_update_server_payload_test.go | 11 + pkg/iaasbeta/model_update_volume_payload.go | 321 + .../model_update_volume_payload_test.go | 11 + ...1_configure_network_area_region_payload.go | 176 + ...figure_network_area_region_payload_test.go | 11 + .../model_v2beta1_create_snapshot_payload.go | 467 + ...el_v2beta1_create_snapshot_payload_test.go | 11 + .../model_v2beta1_update_backup_payload.go | 615 + ...odel_v2beta1_update_backup_payload_test.go | 11 + ...eta1_update_network_area_region_payload.go | 127 + ...update_network_area_region_payload_test.go | 11 + ...el_v2beta1_update_route_of_area_payload.go | 128 + ...beta1_update_route_of_area_payload_test.go | 11 + ...l_v2beta1_update_security_group_payload.go | 226 + ...eta1_update_security_group_payload_test.go | 11 + .../model_v2beta1_update_snapshot_payload.go | 177 + ...el_v2beta1_update_snapshot_payload_test.go | 11 + pkg/iaasbeta/model_volume.go | 851 + pkg/iaasbeta/model_volume_attachment.go | 226 + .../model_volume_attachment_list_response.go | 126 + ...el_volume_attachment_list_response_test.go | 11 + pkg/iaasbeta/model_volume_attachment_test.go | 11 + .../model_volume_encryption_parameter.go | 358 + .../model_volume_encryption_parameter_test.go | 11 + pkg/iaasbeta/model_volume_list_response.go | 126 + .../model_volume_list_response_test.go | 11 + .../model_volume_performance_class.go | 320 + ..._volume_performance_class_list_response.go | 126 + ...me_performance_class_list_response_test.go | 11 + .../model_volume_performance_class_test.go | 11 + pkg/iaasbeta/model_volume_source.go | 172 + pkg/iaasbeta/model_volume_source_test.go | 11 + pkg/iaasbeta/model_volume_test.go | 11 + pkg/iaasbeta/utils.go | 385 + pkg/intakebeta/.openapi-generator/VERSION | 1 + pkg/intakebeta/api_default.go | 2502 ++ pkg/intakebeta/api_default_test.go | 882 + pkg/intakebeta/client.go | 628 + pkg/intakebeta/configuration.go | 41 + pkg/intakebeta/model_catalog_auth.go | 172 + pkg/intakebeta/model_catalog_auth_patch.go | 174 + .../model_catalog_auth_patch_test.go | 11 + pkg/intakebeta/model_catalog_auth_test.go | 11 + pkg/intakebeta/model_catalog_auth_type.go | 115 + .../model_catalog_auth_type_test.go | 11 + pkg/intakebeta/model_client_config.go | 172 + pkg/intakebeta/model_client_config_test.go | 11 + pkg/intakebeta/model_create_intake_payload.go | 313 + .../model_create_intake_payload_test.go | 11 + .../model_create_intake_runner_payload.go | 313 + ...model_create_intake_runner_payload_test.go | 11 + .../model_create_intake_user_payload.go | 319 + .../model_create_intake_user_payload_test.go | 11 + pkg/intakebeta/model_dremio_auth.go | 172 + pkg/intakebeta/model_dremio_auth_patch.go | 178 + .../model_dremio_auth_patch_test.go | 11 + pkg/intakebeta/model_dremio_auth_test.go | 11 + pkg/intakebeta/model_intake_catalog.go | 417 + pkg/intakebeta/model_intake_catalog_patch.go | 421 + .../model_intake_catalog_patch_test.go | 11 + pkg/intakebeta/model_intake_catalog_test.go | 11 + pkg/intakebeta/model_intake_response.go | 788 + pkg/intakebeta/model_intake_response_test.go | 72 + .../model_intake_runner_response.go | 599 + .../model_intake_runner_response_test.go | 65 + pkg/intakebeta/model_intake_user_response.go | 603 + .../model_intake_user_response_test.go | 65 + .../model_list_intake_runners_response.go | 174 + ...model_list_intake_runners_response_test.go | 11 + .../model_list_intake_users_response.go | 174 + .../model_list_intake_users_response_test.go | 11 + pkg/intakebeta/model_list_intakes_response.go | 174 + .../model_list_intakes_response_test.go | 11 + pkg/intakebeta/model_partitioning_type.go | 117 + .../model_partitioning_type_test.go | 11 + .../model_partitioning_update_type.go | 117 + .../model_partitioning_update_type_test.go | 11 + pkg/intakebeta/model_update_intake_payload.go | 321 + .../model_update_intake_payload_test.go | 11 + .../model_update_intake_runner_payload.go | 323 + ...model_update_intake_runner_payload_test.go | 11 + .../model_update_intake_user_payload.go | 325 + .../model_update_intake_user_payload_test.go | 11 + pkg/intakebeta/model_user_type.go | 115 + pkg/intakebeta/model_user_type_test.go | 11 + pkg/intakebeta/utils.go | 385 + pkg/kmsbeta/.openapi-generator/VERSION | 1 + pkg/kmsbeta/api_default.go | 5390 +++ pkg/kmsbeta/api_default_test.go | 1509 + pkg/kmsbeta/client.go | 628 + pkg/kmsbeta/configuration.go | 41 + pkg/kmsbeta/model_access_scope.go | 115 + pkg/kmsbeta/model_access_scope_test.go | 11 + pkg/kmsbeta/model_algorithm.go | 133 + pkg/kmsbeta/model_algorithm_test.go | 11 + pkg/kmsbeta/model_backend.go | 113 + pkg/kmsbeta/model_backend_test.go | 11 + pkg/kmsbeta/model_create_key_payload.go | 455 + pkg/kmsbeta/model_create_key_payload_test.go | 11 + pkg/kmsbeta/model_create_key_ring_payload.go | 176 + .../model_create_key_ring_payload_test.go | 11 + .../model_create_wrapping_key_payload.go | 405 + .../model_create_wrapping_key_payload_test.go | 11 + pkg/kmsbeta/model_decrypt_payload.go | 126 + pkg/kmsbeta/model_decrypt_payload_test.go | 11 + pkg/kmsbeta/model_decrypted_data.go | 126 + pkg/kmsbeta/model_decrypted_data_test.go | 11 + pkg/kmsbeta/model_encrypt_payload.go | 126 + pkg/kmsbeta/model_encrypt_payload_test.go | 11 + pkg/kmsbeta/model_encrypted_data.go | 126 + pkg/kmsbeta/model_encrypted_data_test.go | 11 + pkg/kmsbeta/model_http_error.go | 127 + pkg/kmsbeta/model_http_error_test.go | 11 + pkg/kmsbeta/model_import_key_payload.go | 172 + pkg/kmsbeta/model_import_key_payload_test.go | 11 + pkg/kmsbeta/model_key.go | 783 + pkg/kmsbeta/model_key_list.go | 125 + pkg/kmsbeta/model_key_list_test.go | 11 + pkg/kmsbeta/model_key_ring.go | 417 + pkg/kmsbeta/model_key_ring_list.go | 125 + pkg/kmsbeta/model_key_ring_list_test.go | 11 + pkg/kmsbeta/model_key_ring_test.go | 65 + pkg/kmsbeta/model_key_test.go | 86 + pkg/kmsbeta/model_protection.go | 113 + pkg/kmsbeta/model_protection_test.go | 11 + pkg/kmsbeta/model_purpose.go | 119 + pkg/kmsbeta/model_purpose_test.go | 11 + pkg/kmsbeta/model_sign_payload.go | 126 + pkg/kmsbeta/model_sign_payload_test.go | 11 + pkg/kmsbeta/model_signed_data.go | 170 + pkg/kmsbeta/model_signed_data_test.go | 11 + pkg/kmsbeta/model_verified_data.go | 126 + pkg/kmsbeta/model_verified_data_test.go | 11 + pkg/kmsbeta/model_verify_payload.go | 170 + pkg/kmsbeta/model_verify_payload_test.go | 11 + pkg/kmsbeta/model_version.go | 561 + pkg/kmsbeta/model_version_list.go | 125 + pkg/kmsbeta/model_version_list_test.go | 11 + pkg/kmsbeta/model_version_test.go | 86 + pkg/kmsbeta/model_wrapping_algorithm.go | 127 + pkg/kmsbeta/model_wrapping_algorithm_test.go | 11 + pkg/kmsbeta/model_wrapping_key.go | 780 + pkg/kmsbeta/model_wrapping_key_list.go | 125 + pkg/kmsbeta/model_wrapping_key_list_test.go | 11 + pkg/kmsbeta/model_wrapping_key_test.go | 79 + pkg/kmsbeta/model_wrapping_purpose.go | 115 + pkg/kmsbeta/model_wrapping_purpose_test.go | 11 + pkg/kmsbeta/utils.go | 385 + pkg/logsalpha/.openapi-generator/VERSION | 1 + pkg/logsalpha/api_default.go | 2048 ++ pkg/logsalpha/api_default_test.go | 712 + pkg/logsalpha/client.go | 628 + pkg/logsalpha/configuration.go | 38 + pkg/logsalpha/model_access_token.go | 600 + pkg/logsalpha/model_access_token_list.go | 125 + pkg/logsalpha/model_access_token_list_test.go | 11 + pkg/logsalpha/model_access_token_test.go | 58 + .../model_create_access_token_payload.go | 269 + .../model_create_access_token_payload_test.go | 11 + .../model_create_logs_instance_payload.go | 269 + ...model_create_logs_instance_payload_test.go | 11 + pkg/logsalpha/model_logs_instance.go | 755 + pkg/logsalpha/model_logs_instance_test.go | 65 + pkg/logsalpha/model_logs_instances_list.go | 125 + .../model_logs_instances_list_test.go | 11 + .../model_update_access_token_payload.go | 178 + .../model_update_access_token_payload_test.go | 11 + .../model_update_logs_instance_payload.go | 275 + ...model_update_logs_instance_payload_test.go | 11 + pkg/logsalpha/utils.go | 385 + pkg/logsbeta/.openapi-generator/VERSION | 1 + pkg/logsbeta/api_default.go | 2048 ++ pkg/logsbeta/api_default_test.go | 712 + pkg/logsbeta/client.go | 628 + pkg/logsbeta/configuration.go | 38 + pkg/logsbeta/model_access_token.go | 600 + pkg/logsbeta/model_access_token_list.go | 125 + pkg/logsbeta/model_access_token_list_test.go | 11 + pkg/logsbeta/model_access_token_test.go | 58 + .../model_create_access_token_payload.go | 269 + .../model_create_access_token_payload_test.go | 11 + .../model_create_logs_instance_payload.go | 269 + ...model_create_logs_instance_payload_test.go | 11 + pkg/logsbeta/model_logs_instance.go | 755 + pkg/logsbeta/model_logs_instance_test.go | 65 + pkg/logsbeta/model_logs_instances_list.go | 125 + .../model_logs_instances_list_test.go | 11 + .../model_update_access_token_payload.go | 178 + .../model_update_access_token_payload_test.go | 11 + .../model_update_logs_instance_payload.go | 275 + ...model_update_logs_instance_payload_test.go | 11 + pkg/logsbeta/utils.go | 385 + pkg/postgresflexalpha/api_default_test.go | 3242 +- pkg/postgresflexalpha/client.go | 5 +- .../model_create_instance_request_payload.go | 21 - .../model_get_instance_response.go | 113 +- .../model_instance_connection_info.go | 171 + .../model_instance_connection_info_test.go | 11 + pkg/runcommandbeta/.openapi-generator/VERSION | 1 + pkg/runcommandbeta/api_default.go | 982 + pkg/runcommandbeta/api_default_test.go | 312 + pkg/runcommandbeta/client.go | 628 + pkg/runcommandbeta/configuration.go | 38 + pkg/runcommandbeta/model_command_details.go | 620 + .../model_command_details_test.go | 72 + pkg/runcommandbeta/model_command_template.go | 223 + .../model_command_template_response.go | 127 + .../model_command_template_response_test.go | 11 + .../model_command_template_schema.go | 318 + .../model_command_template_schema_test.go | 11 + .../model_command_template_test.go | 11 + pkg/runcommandbeta/model_commands.go | 476 + pkg/runcommandbeta/model_commands_test.go | 72 + .../model_create_command_payload.go | 173 + .../model_create_command_payload_test.go | 11 + pkg/runcommandbeta/model_error_response.go | 172 + .../model_error_response_test.go | 11 + pkg/runcommandbeta/model_field.go | 415 + pkg/runcommandbeta/model_field_test.go | 11 + .../model_get_commands_response.go | 127 + .../model_get_commands_response_test.go | 11 + .../model_new_command_response.go | 128 + .../model_new_command_response_test.go | 11 + pkg/runcommandbeta/model_parameters_schema.go | 127 + .../model_parameters_schema_test.go | 11 + pkg/runcommandbeta/model_properties.go | 363 + pkg/runcommandbeta/model_properties_test.go | 11 + pkg/runcommandbeta/utils.go | 385 + pkg/sfsbeta/.openapi-generator/VERSION | 1 + pkg/sfsbeta/api_default.go | 4055 ++ pkg/sfsbeta/api_default_test.go | 1238 + pkg/sfsbeta/client.go | 628 + pkg/sfsbeta/configuration.go | 38 + .../model_create_resource_pool_payload.go | 469 + ...model_create_resource_pool_payload_test.go | 11 + .../model_create_resource_pool_response.go | 127 + ...te_resource_pool_response_resource_pool.go | 802 + ...source_pool_response_resource_pool_test.go | 11 + ...odel_create_resource_pool_response_test.go | 11 + ...l_create_resource_pool_snapshot_payload.go | 193 + ...ate_resource_pool_snapshot_payload_test.go | 11 + ..._create_resource_pool_snapshot_response.go | 127 + ...napshot_response_resource_pool_snapshot.go | 388 + ...ot_response_resource_pool_snapshot_test.go | 11 + ...te_resource_pool_snapshot_response_test.go | 11 + ...odel_create_share_export_policy_payload.go | 225 + ...create_share_export_policy_payload_test.go | 11 + ...create_share_export_policy_request_rule.go | 391 + ...e_share_export_policy_request_rule_test.go | 11 + ...del_create_share_export_policy_response.go | 127 + ...ort_policy_response_share_export_policy.go | 371 + ...olicy_response_share_export_policy_test.go | 11 + ...reate_share_export_policy_response_test.go | 11 + pkg/sfsbeta/model_create_share_payload.go | 290 + .../model_create_share_payload_test.go | 11 + pkg/sfsbeta/model_create_share_response.go | 127 + .../model_create_share_response_share.go | 479 + .../model_create_share_response_share_test.go | 11 + .../model_create_share_response_test.go | 11 + pkg/sfsbeta/model_error.go | 224 + pkg/sfsbeta/model_error_test.go | 11 + .../model_get_resource_pool_response.go | 127 + ...et_resource_pool_response_resource_pool.go | 802 + ...source_pool_response_resource_pool_test.go | 11 + .../model_get_resource_pool_response_test.go | 11 + ...del_get_resource_pool_snapshot_response.go | 127 + ...napshot_response_resource_pool_snapshot.go | 388 + ...ot_response_resource_pool_snapshot_test.go | 11 + ...et_resource_pool_snapshot_response_test.go | 11 + .../model_get_share_export_policy_response.go | 127 + ...ort_policy_response_share_export_policy.go | 371 + ...olicy_response_share_export_policy_test.go | 11 + ...l_get_share_export_policy_response_test.go | 11 + pkg/sfsbeta/model_get_share_response.go | 127 + pkg/sfsbeta/model_get_share_response_share.go | 479 + .../model_get_share_response_share_test.go | 11 + pkg/sfsbeta/model_get_share_response_test.go | 11 + pkg/sfsbeta/model_google_protobuf_any.go | 137 + pkg/sfsbeta/model_google_protobuf_any_test.go | 11 + ...model_list_performance_classes_response.go | 128 + ..._list_performance_classes_response_test.go | 11 + ...l_list_resource_pool_snapshots_response.go | 128 + ...t_resource_pool_snapshots_response_test.go | 11 + .../model_list_resource_pools_response.go | 128 + ...model_list_resource_pools_response_test.go | 11 + ...del_list_share_export_policies_response.go | 128 + ...ist_share_export_policies_response_test.go | 11 + pkg/sfsbeta/model_list_shares_response.go | 128 + .../model_list_shares_response_test.go | 11 + .../model_list_snapshot_schedules_response.go | 128 + ...l_list_snapshot_schedules_response_test.go | 11 + pkg/sfsbeta/model_performance_class.go | 227 + pkg/sfsbeta/model_performance_class_test.go | 11 + pkg/sfsbeta/model_resource_pool.go | 802 + .../model_resource_pool_performance_class.go | 227 + ...el_resource_pool_performance_class_test.go | 11 + pkg/sfsbeta/model_resource_pool_snapshot.go | 388 + .../model_resource_pool_snapshot_test.go | 11 + pkg/sfsbeta/model_resource_pool_space.go | 247 + pkg/sfsbeta/model_resource_pool_space_test.go | 11 + pkg/sfsbeta/model_resource_pool_test.go | 11 + pkg/sfsbeta/model_share.go | 479 + pkg/sfsbeta/model_share_export_policy.go | 371 + pkg/sfsbeta/model_share_export_policy_rule.go | 482 + .../model_share_export_policy_rule_test.go | 11 + pkg/sfsbeta/model_share_export_policy_test.go | 11 + pkg/sfsbeta/model_share_test.go | 11 + pkg/sfsbeta/model_snapshot_schedule.go | 178 + pkg/sfsbeta/model_snapshot_schedule_test.go | 11 + pkg/sfsbeta/model_status.go | 226 + pkg/sfsbeta/model_status_test.go | 11 + .../model_update_resource_pool_payload.go | 382 + ...model_update_resource_pool_payload_test.go | 11 + .../model_update_resource_pool_response.go | 127 + ...te_resource_pool_response_resource_pool.go | 802 + ...source_pool_response_resource_pool_test.go | 11 + ...odel_update_resource_pool_response_test.go | 11 + ...el_update_share_export_policy_body_rule.go | 391 + ...date_share_export_policy_body_rule_test.go | 11 + ...odel_update_share_export_policy_payload.go | 177 + ...update_share_export_policy_payload_test.go | 11 + ...del_update_share_export_policy_response.go | 127 + ...pdate_share_export_policy_response_test.go | 11 + pkg/sfsbeta/model_update_share_payload.go | 252 + .../model_update_share_payload_test.go | 11 + pkg/sfsbeta/model_update_share_response.go | 127 + .../model_update_share_response_share.go | 479 + .../model_update_share_response_share_test.go | 11 + .../model_update_share_response_test.go | 11 + pkg/sfsbeta/model_validation_error.go | 267 + pkg/sfsbeta/model_validation_error_all_of.go | 125 + .../model_validation_error_all_of_test.go | 11 + pkg/sfsbeta/model_validation_error_field.go | 172 + .../model_validation_error_field_test.go | 11 + pkg/sfsbeta/model_validation_error_test.go | 11 + pkg/sfsbeta/utils.go | 385 + pkg/sqlserverflexalpha/api_default.go | 239 +- pkg/sqlserverflexalpha/api_default_test.go | 328 +- pkg/sqlserverflexalpha/client.go | 5 +- pkg/sqlserverflexalpha/model_external_s3.go | 261 + .../model_external_s3_test.go | 11 + .../model_get_backup_response.go | 134 +- pkg/sqlserverflexalpha/model_list_backup.go | 134 +- ...el_restore_database_from_backup_payload.go | 170 + ...ore_database_from_backup_payload_source.go | 163 + ...atabase_from_backup_payload_source_test.go | 11 + ...store_database_from_backup_payload_test.go | 11 + pkg/sqlserverflexalpha/model_s3file_info.go | 178 + .../model_s3file_info_test.go | 11 + pkg/sqlserverflexalpha/model_source_backup.go | 228 + .../model_source_backup_test.go | 51 + .../model_source_external_s3.go | 365 + .../model_source_external_s3_test.go | 51 + pkg/vpnalpha/.openapi-generator/VERSION | 1 + pkg/vpnalpha/api_default.go | 2916 ++ pkg/vpnalpha/api_default_test.go | 825 + pkg/vpnalpha/client.go | 628 + pkg/vpnalpha/configuration.go | 41 + pkg/vpnalpha/model_api_error.go | 269 + pkg/vpnalpha/model_api_error_detail.go | 326 + pkg/vpnalpha/model_api_error_detail_test.go | 58 + pkg/vpnalpha/model_api_error_response.go | 125 + pkg/vpnalpha/model_api_error_response_test.go | 11 + pkg/vpnalpha/model_api_error_test.go | 11 + pkg/vpnalpha/model_bgp_gateway_config.go | 177 + pkg/vpnalpha/model_bgp_gateway_config_test.go | 11 + pkg/vpnalpha/model_bgp_status.go | 174 + pkg/vpnalpha/model_bgp_status_peers.go | 386 + pkg/vpnalpha/model_bgp_status_peers_test.go | 11 + pkg/vpnalpha/model_bgp_status_routes.go | 301 + pkg/vpnalpha/model_bgp_status_routes_test.go | 11 + pkg/vpnalpha/model_bgp_status_test.go | 11 + pkg/vpnalpha/model_bgp_tunnel_config.go | 225 + pkg/vpnalpha/model_bgp_tunnel_config_test.go | 11 + pkg/vpnalpha/model_connection.go | 397 + pkg/vpnalpha/model_connection_list.go | 125 + pkg/vpnalpha/model_connection_list_test.go | 11 + pkg/vpnalpha/model_connection_request.go | 397 + pkg/vpnalpha/model_connection_request_test.go | 11 + .../model_connection_request_tunnel1.go | 308 + .../model_connection_request_tunnel1_test.go | 11 + .../model_connection_status_response.go | 223 + .../model_connection_status_response_test.go | 11 + pkg/vpnalpha/model_connection_test.go | 11 + ...model_create_gateway_connection_payload.go | 397 + ..._create_gateway_connection_payload_test.go | 11 + .../model_create_vpn_gateway_payload.go | 358 + ..._vpn_gateway_payload_availability_zones.go | 172 + ...gateway_payload_availability_zones_test.go | 11 + .../model_create_vpn_gateway_payload_test.go | 11 + pkg/vpnalpha/model_gateway.go | 454 + pkg/vpnalpha/model_gateway_list.go | 125 + pkg/vpnalpha/model_gateway_list_test.go | 11 + pkg/vpnalpha/model_gateway_request.go | 358 + pkg/vpnalpha/model_gateway_request_test.go | 11 + pkg/vpnalpha/model_gateway_status.go | 119 + pkg/vpnalpha/model_gateway_status_response.go | 223 + .../model_gateway_status_response_test.go | 11 + pkg/vpnalpha/model_gateway_status_test.go | 11 + pkg/vpnalpha/model_gateway_test.go | 11 + pkg/vpnalpha/model_gateway_with_status.go | 407 + .../model_gateway_with_status_test.go | 11 + pkg/vpnalpha/model_gateways_response.go | 400 + pkg/vpnalpha/model_gateways_response_test.go | 11 + pkg/vpnalpha/model_phase.go | 216 + pkg/vpnalpha/model_phase1_status.go | 275 + pkg/vpnalpha/model_phase1_status_test.go | 11 + pkg/vpnalpha/model_phase2_status.go | 567 + pkg/vpnalpha/model_phase2_status_test.go | 11 + pkg/vpnalpha/model_phase_test.go | 11 + pkg/vpnalpha/model_plan.go | 527 + pkg/vpnalpha/model_plan_list.go | 223 + pkg/vpnalpha/model_plan_list_test.go | 11 + pkg/vpnalpha/model_plan_test.go | 58 + pkg/vpnalpha/model_quota.go | 168 + pkg/vpnalpha/model_quota_list.go | 125 + pkg/vpnalpha/model_quota_list_gateways.go | 168 + .../model_quota_list_gateways_test.go | 11 + pkg/vpnalpha/model_quota_list_response.go | 125 + .../model_quota_list_response_test.go | 11 + pkg/vpnalpha/model_quota_list_test.go | 11 + pkg/vpnalpha/model_quota_test.go | 11 + pkg/vpnalpha/model_region.go | 115 + pkg/vpnalpha/model_region_test.go | 11 + pkg/vpnalpha/model_tunnel_configuration.go | 308 + .../model_tunnel_configuration_phase1.go | 267 + ...odel_tunnel_configuration_phase1_all_of.go | 131 + ...tunnel_configuration_phase1_all_of_test.go | 11 + .../model_tunnel_configuration_phase1_test.go | 11 + .../model_tunnel_configuration_phase2.go | 582 + ...odel_tunnel_configuration_phase2_all_of.go | 446 + ...tunnel_configuration_phase2_all_of_test.go | 122 + .../model_tunnel_configuration_phase2_test.go | 122 + .../model_tunnel_configuration_test.go | 11 + pkg/vpnalpha/model_tunnel_status.go | 373 + pkg/vpnalpha/model_tunnel_status_test.go | 58 + ...model_update_gateway_connection_payload.go | 397 + ..._update_gateway_connection_payload_test.go | 11 + .../model_update_vpn_gateway_payload.go | 358 + .../model_update_vpn_gateway_payload_test.go | 11 + pkg/vpnalpha/model_vpn_tunnel_plan.go | 227 + pkg/vpnalpha/model_vpn_tunnel_plan_test.go | 11 + pkg/vpnalpha/model_vpn_tunnels.go | 385 + pkg/vpnalpha/model_vpn_tunnels_test.go | 58 + pkg/vpnalpha/utils.go | 385 + sample/postgres/outputs.tf | 1 + sample/postgres/postresql.tf | 91 +- sample/postgres/providers.tf | 5 +- sample/sqlserver/flavor.tf | 11 +- sample/sqlserver/providers.tf | 7 +- sample/sqlserver/sqlserver.tf | 65 +- sample/tf.sh | 11 +- scripts/check-docs.sh | 1 + scripts/lint-golangci-lint.sh | 1 + scripts/project.sh | 1 + scripts/replace.sh | 1 + scripts/tfplugindocs.sh | 1 + .../postgres-flex_database_config.yml | 24 + .../postgres-flex_flavors_config.yml | 9 + .../postgres-flex_instance_config.yml | 35 + service_specs/postgres-flex_role_config.yml | 9 + service_specs/postgres-flex_user_config.yml | 29 + .../postgres-flex_version_config.yml | 9 + .../sqlserverflex_backup_config.yml.disabled | 13 + ...qlserverflex_collation_config.yml.disabled | 8 + .../sqlserverflex_database_config.yml | 34 + .../sqlserverflex_flavors_config.yml | 9 + .../sqlserverflex_instance_config.yml | 24 + service_specs/sqlserverflex_user_config.yml | 24 + .../sqlserverflex_version_config.yml | 9 + .../databases_data_source_gen.go | 1180 + .../resources_gen/database_resource_gen.go | 39 + .../postgresflexalpha/flavor/datasource.go | 18 +- .../flavors_data_source_gen.go} | 37 +- .../postgresflexalpha/flavors/datasource.go | 70 + .../flavors_data_source_gen.go} | 37 +- .../postgresflexalpha/instance/datasource.go | 182 +- .../instance_data_source_gen.go | 1055 + .../instances_data_source_gen.go | 1174 + .../postgresflexalpha/instance/functions.go | 322 +- .../postgresflexalpha/instance/models.go | 63 - .../instance/planModifiers.yaml | 112 + .../postgresflexalpha/instance/resource.go | 773 +- .../instance/resource_test.go | 620 +- .../resources_gen/instance_resource_gen.go | 1597 + .../postgresflexalpha/instance/schema_test.go | 33 + .../services/postgresflexalpha/main.go | 1 + .../postgresflex_acc_test.go | 8 +- .../datasources_gen/roles_data_source_gen.go | 52 + .../testdata/resource-complete.tf | 1 + .../datasources_gen/user_data_source_gen.go | 94 + .../datasources_gen/users_data_source_gen.go | 1118 + .../user/resources_gen/user_resource_gen.go | 105 + .../postgresflexalpha/utils/planModifiers.go | 229 + .../versions_data_source_gen.go | 569 + .../sqlserverflexalpha/database/datasource.go | 67 + .../database_data_source_gen.go | 81 + .../databases_data_source_gen.go | 1180 + .../sqlserverflexalpha/database/resource.go | 217 + .../resources_gen/database_resource_gen.go | 99 + .../sqlserverflexalpha/flavor/datasource.go | 29 +- .../datasources_gen/flavor_data_source_gen.go | 1909 + .../sqlserverflexalpha/flavor/functions.go | 233 +- .../flavor/functions_test.go | 134 + .../flavor/list_datasource.go.bak | 79 - .../sqlserverflexalpha/flavors/datasource.go | 68 + .../flavors_data_source_gen.go | 1909 + .../instance/planModifiers.yaml | 120 + .../sqlserverflexalpha/instance/resource.go | 5 +- .../resources_gen/instance_resource_gen.go | 1457 + .../services/sqlserverflexalpha/main.go | 1 + .../sqlserverflex_acc_test.go | 2 +- .../testdata/resource-max.tf | 1 + .../testdata/resource-min.tf | 1 + .../datasources_gen/user_data_source_gen.go | 1118 + .../user/resources_gen/user_resource_gen.go | 111 + .../sqlserverflexalpha/version/datasource.go | 71 + .../version_data_source_gen.go | 569 + .../internal/wait/postgresflexalpha}/wait.go | 72 +- .../wait/postgresflexalpha}/wait_test.go | 2 +- .../internal/wait/sqlserverflexalpha}/wait.go | 14 +- .../wait/sqlserverflexalpha}/wait_test.go | 2 +- stackit/provider.go | 9 + stackit/testdata/provider-all-attributes.tf | 1 + stackit/testdata/provider-credentials.tf | 1 + .../testdata/provider-invalid-attribute.tf | 1 + tools/copy.go | 120 + tools/formats.go | 53 + tools/main.go | 720 + tools/templates/data_source_scaffold.gotmpl | 51 + tools/templates/provider_scaffold.gotmpl | 39 + tools/templates/resource_scaffold.gotmpl | 208 + 1283 files changed, 273211 insertions(+), 4614 deletions(-) delete mode 100644 .copywrite.hcl create mode 100644 .github/workflows/publish.yaml create mode 100644 cmd/cmd/buildCmd.go create mode 100644 cmd/cmd/publishCmd.go create mode 100644 cmd/cmd/rootCmd.go create mode 100644 cmd/main.go create mode 100644 docs/data-sources/postgresflexalpha_flavors.md create mode 100644 docs/data-sources/sqlserverflexalpha_database.md create mode 100644 docs/data-sources/sqlserverflexalpha_version.md create mode 100644 docs/resources/sqlserverflexalpha_database.md delete mode 100644 golang-ci.bck.yaml create mode 100644 pkg/albbeta/.openapi-generator/VERSION create mode 100644 pkg/albbeta/api_default.go create mode 100644 pkg/albbeta/api_default_test.go create mode 100644 pkg/albbeta/client.go create mode 100644 pkg/albbeta/configuration.go create mode 100644 pkg/albbeta/model_active_health_check.go create mode 100644 pkg/albbeta/model_active_health_check_test.go create mode 100644 pkg/albbeta/model_certificate_config.go create mode 100644 pkg/albbeta/model_certificate_config_test.go create mode 100644 pkg/albbeta/model_cookie_persistence.go create mode 100644 pkg/albbeta/model_cookie_persistence_test.go create mode 100644 pkg/albbeta/model_create_credentials_payload.go create mode 100644 pkg/albbeta/model_create_credentials_payload_test.go create mode 100644 pkg/albbeta/model_create_credentials_response.go create mode 100644 pkg/albbeta/model_create_credentials_response_test.go create mode 100644 pkg/albbeta/model_create_load_balancer_payload.go create mode 100644 pkg/albbeta/model_create_load_balancer_payload_load_balancer_security_group.go create mode 100644 pkg/albbeta/model_create_load_balancer_payload_load_balancer_security_group_test.go create mode 100644 pkg/albbeta/model_create_load_balancer_payload_target_security_group.go create mode 100644 pkg/albbeta/model_create_load_balancer_payload_target_security_group_test.go create mode 100644 pkg/albbeta/model_create_load_balancer_payload_test.go create mode 100644 pkg/albbeta/model_credentials_response.go create mode 100644 pkg/albbeta/model_credentials_response_test.go create mode 100644 pkg/albbeta/model_get_credentials_response.go create mode 100644 pkg/albbeta/model_get_credentials_response_test.go create mode 100644 pkg/albbeta/model_get_quota_response.go create mode 100644 pkg/albbeta/model_get_quota_response_test.go create mode 100644 pkg/albbeta/model_google_protobuf_any.go create mode 100644 pkg/albbeta/model_google_protobuf_any_test.go create mode 100644 pkg/albbeta/model_host_config.go create mode 100644 pkg/albbeta/model_host_config_test.go create mode 100644 pkg/albbeta/model_http_header.go create mode 100644 pkg/albbeta/model_http_header_test.go create mode 100644 pkg/albbeta/model_http_health_checks.go create mode 100644 pkg/albbeta/model_http_health_checks_test.go create mode 100644 pkg/albbeta/model_list_credentials_response.go create mode 100644 pkg/albbeta/model_list_credentials_response_test.go create mode 100644 pkg/albbeta/model_list_load_balancers_response.go create mode 100644 pkg/albbeta/model_list_load_balancers_response_test.go create mode 100644 pkg/albbeta/model_list_plans_response.go create mode 100644 pkg/albbeta/model_list_plans_response_test.go create mode 100644 pkg/albbeta/model_listener.go create mode 100644 pkg/albbeta/model_listener_test.go create mode 100644 pkg/albbeta/model_load_balancer.go create mode 100644 pkg/albbeta/model_load_balancer_error.go create mode 100644 pkg/albbeta/model_load_balancer_error_test.go create mode 100644 pkg/albbeta/model_load_balancer_options.go create mode 100644 pkg/albbeta/model_load_balancer_options_test.go create mode 100644 pkg/albbeta/model_load_balancer_test.go create mode 100644 pkg/albbeta/model_loadbalancer_option_access_control.go create mode 100644 pkg/albbeta/model_loadbalancer_option_access_control_test.go create mode 100644 pkg/albbeta/model_loadbalancer_option_logs.go create mode 100644 pkg/albbeta/model_loadbalancer_option_logs_test.go create mode 100644 pkg/albbeta/model_loadbalancer_option_metrics.go create mode 100644 pkg/albbeta/model_loadbalancer_option_metrics_test.go create mode 100644 pkg/albbeta/model_loadbalancer_option_observability.go create mode 100644 pkg/albbeta/model_loadbalancer_option_observability_test.go create mode 100644 pkg/albbeta/model_network.go create mode 100644 pkg/albbeta/model_network_test.go create mode 100644 pkg/albbeta/model_path.go create mode 100644 pkg/albbeta/model_path_test.go create mode 100644 pkg/albbeta/model_plan_details.go create mode 100644 pkg/albbeta/model_plan_details_test.go create mode 100644 pkg/albbeta/model_protocol_options_http.go create mode 100644 pkg/albbeta/model_protocol_options_http_test.go create mode 100644 pkg/albbeta/model_protocol_options_https.go create mode 100644 pkg/albbeta/model_protocol_options_https_test.go create mode 100644 pkg/albbeta/model_query_parameter.go create mode 100644 pkg/albbeta/model_query_parameter_test.go create mode 100644 pkg/albbeta/model_rule.go create mode 100644 pkg/albbeta/model_rule_test.go create mode 100644 pkg/albbeta/model_security_group.go create mode 100644 pkg/albbeta/model_security_group_test.go create mode 100644 pkg/albbeta/model_status.go create mode 100644 pkg/albbeta/model_status_test.go create mode 100644 pkg/albbeta/model_target.go create mode 100644 pkg/albbeta/model_target_pool.go create mode 100644 pkg/albbeta/model_target_pool_test.go create mode 100644 pkg/albbeta/model_target_pool_tls_config.go create mode 100644 pkg/albbeta/model_target_pool_tls_config_test.go create mode 100644 pkg/albbeta/model_target_test.go create mode 100644 pkg/albbeta/model_update_credentials_payload.go create mode 100644 pkg/albbeta/model_update_credentials_payload_test.go create mode 100644 pkg/albbeta/model_update_credentials_response.go create mode 100644 pkg/albbeta/model_update_credentials_response_test.go create mode 100644 pkg/albbeta/model_update_load_balancer_payload.go create mode 100644 pkg/albbeta/model_update_load_balancer_payload_test.go create mode 100644 pkg/albbeta/model_update_target_pool_payload.go create mode 100644 pkg/albbeta/model_update_target_pool_payload_test.go create mode 100644 pkg/albbeta/utils.go create mode 100644 pkg/albwafalpha/.openapi-generator/VERSION create mode 100644 pkg/albwafalpha/api_default.go create mode 100644 pkg/albwafalpha/api_default_test.go create mode 100644 pkg/albwafalpha/client.go create mode 100644 pkg/albwafalpha/configuration.go create mode 100644 pkg/albwafalpha/model_create_core_rule_set_payload.go create mode 100644 pkg/albwafalpha/model_create_core_rule_set_payload_test.go create mode 100644 pkg/albwafalpha/model_create_core_rule_set_response.go create mode 100644 pkg/albwafalpha/model_create_core_rule_set_response_test.go create mode 100644 pkg/albwafalpha/model_create_rules_payload.go create mode 100644 pkg/albwafalpha/model_create_rules_payload_test.go create mode 100644 pkg/albwafalpha/model_create_rules_response.go create mode 100644 pkg/albwafalpha/model_create_rules_response_test.go create mode 100644 pkg/albwafalpha/model_create_waf_payload.go create mode 100644 pkg/albwafalpha/model_create_waf_payload_test.go create mode 100644 pkg/albwafalpha/model_create_waf_response.go create mode 100644 pkg/albwafalpha/model_create_waf_response_test.go create mode 100644 pkg/albwafalpha/model_get_core_rule_set_response.go create mode 100644 pkg/albwafalpha/model_get_core_rule_set_response_test.go create mode 100644 pkg/albwafalpha/model_get_rules_response.go create mode 100644 pkg/albwafalpha/model_get_rules_response_test.go create mode 100644 pkg/albwafalpha/model_get_waf_response.go create mode 100644 pkg/albwafalpha/model_get_waf_response_test.go create mode 100644 pkg/albwafalpha/model_google_protobuf_any.go create mode 100644 pkg/albwafalpha/model_google_protobuf_any_test.go create mode 100644 pkg/albwafalpha/model_list_core_rule_set_response.go create mode 100644 pkg/albwafalpha/model_list_core_rule_set_response_test.go create mode 100644 pkg/albwafalpha/model_list_rules_response.go create mode 100644 pkg/albwafalpha/model_list_rules_response_test.go create mode 100644 pkg/albwafalpha/model_list_waf_response.go create mode 100644 pkg/albwafalpha/model_list_waf_response_test.go create mode 100644 pkg/albwafalpha/model_status.go create mode 100644 pkg/albwafalpha/model_status_test.go create mode 100644 pkg/albwafalpha/model_update_core_rule_set_payload.go create mode 100644 pkg/albwafalpha/model_update_core_rule_set_payload_test.go create mode 100644 pkg/albwafalpha/model_update_core_rule_set_response.go create mode 100644 pkg/albwafalpha/model_update_core_rule_set_response_test.go create mode 100644 pkg/albwafalpha/model_update_rules_payload.go create mode 100644 pkg/albwafalpha/model_update_rules_payload_test.go create mode 100644 pkg/albwafalpha/model_update_rules_response.go create mode 100644 pkg/albwafalpha/model_update_rules_response_test.go create mode 100644 pkg/albwafalpha/model_update_waf_payload.go create mode 100644 pkg/albwafalpha/model_update_waf_payload_test.go create mode 100644 pkg/albwafalpha/model_update_waf_response.go create mode 100644 pkg/albwafalpha/model_update_waf_response_test.go create mode 100644 pkg/albwafalpha/utils.go create mode 100644 pkg/cdnbeta/.openapi-generator/VERSION create mode 100644 pkg/cdnbeta/api_default.go create mode 100644 pkg/cdnbeta/api_default_test.go create mode 100644 pkg/cdnbeta/client.go create mode 100644 pkg/cdnbeta/configuration.go create mode 100644 pkg/cdnbeta/model_bucket_backend.go create mode 100644 pkg/cdnbeta/model_bucket_backend_create.go create mode 100644 pkg/cdnbeta/model_bucket_backend_create_test.go create mode 100644 pkg/cdnbeta/model_bucket_backend_patch.go create mode 100644 pkg/cdnbeta/model_bucket_backend_patch_test.go create mode 100644 pkg/cdnbeta/model_bucket_backend_test.go create mode 100644 pkg/cdnbeta/model_bucket_credentials.go create mode 100644 pkg/cdnbeta/model_bucket_credentials_test.go create mode 100644 pkg/cdnbeta/model_config.go create mode 100644 pkg/cdnbeta/model_config_backend.go create mode 100644 pkg/cdnbeta/model_config_backend_test.go create mode 100644 pkg/cdnbeta/model_config_log_sink.go create mode 100644 pkg/cdnbeta/model_config_log_sink_test.go create mode 100644 pkg/cdnbeta/model_config_patch.go create mode 100644 pkg/cdnbeta/model_config_patch_backend.go create mode 100644 pkg/cdnbeta/model_config_patch_backend_test.go create mode 100644 pkg/cdnbeta/model_config_patch_log_sink.go create mode 100644 pkg/cdnbeta/model_config_patch_log_sink_test.go create mode 100644 pkg/cdnbeta/model_config_patch_test.go create mode 100644 pkg/cdnbeta/model_config_test.go create mode 100644 pkg/cdnbeta/model_create_distribution_payload.go create mode 100644 pkg/cdnbeta/model_create_distribution_payload_backend.go create mode 100644 pkg/cdnbeta/model_create_distribution_payload_backend_test.go create mode 100644 pkg/cdnbeta/model_create_distribution_payload_log_sink.go create mode 100644 pkg/cdnbeta/model_create_distribution_payload_log_sink_test.go create mode 100644 pkg/cdnbeta/model_create_distribution_payload_test.go create mode 100644 pkg/cdnbeta/model_create_distribution_response.go create mode 100644 pkg/cdnbeta/model_create_distribution_response_test.go create mode 100644 pkg/cdnbeta/model_custom_domain.go create mode 100644 pkg/cdnbeta/model_custom_domain_test.go create mode 100644 pkg/cdnbeta/model_delete_custom_domain_response.go create mode 100644 pkg/cdnbeta/model_delete_custom_domain_response_test.go create mode 100644 pkg/cdnbeta/model_delete_distribution_response.go create mode 100644 pkg/cdnbeta/model_delete_distribution_response_test.go create mode 100644 pkg/cdnbeta/model_distribution.go create mode 100644 pkg/cdnbeta/model_distribution_logs_record.go create mode 100644 pkg/cdnbeta/model_distribution_logs_record_test.go create mode 100644 pkg/cdnbeta/model_distribution_statistics_record.go create mode 100644 pkg/cdnbeta/model_distribution_statistics_record_all_of.go create mode 100644 pkg/cdnbeta/model_distribution_statistics_record_all_of_test.go create mode 100644 pkg/cdnbeta/model_distribution_statistics_record_entry.go create mode 100644 pkg/cdnbeta/model_distribution_statistics_record_entry_test.go create mode 100644 pkg/cdnbeta/model_distribution_statistics_record_regions.go create mode 100644 pkg/cdnbeta/model_distribution_statistics_record_regions_test.go create mode 100644 pkg/cdnbeta/model_distribution_statistics_record_test.go create mode 100644 pkg/cdnbeta/model_distribution_test.go create mode 100644 pkg/cdnbeta/model_distribution_waf.go create mode 100644 pkg/cdnbeta/model_distribution_waf_test.go create mode 100644 pkg/cdnbeta/model_domain.go create mode 100644 pkg/cdnbeta/model_domain_status.go create mode 100644 pkg/cdnbeta/model_domain_status_test.go create mode 100644 pkg/cdnbeta/model_domain_test.go create mode 100644 pkg/cdnbeta/model_error_details.go create mode 100644 pkg/cdnbeta/model_error_details_test.go create mode 100644 pkg/cdnbeta/model_find_cache_paths_response.go create mode 100644 pkg/cdnbeta/model_find_cache_paths_response_entry.go create mode 100644 pkg/cdnbeta/model_find_cache_paths_response_entry_test.go create mode 100644 pkg/cdnbeta/model_find_cache_paths_response_test.go create mode 100644 pkg/cdnbeta/model_generic_json_response.go create mode 100644 pkg/cdnbeta/model_generic_json_response_test.go create mode 100644 pkg/cdnbeta/model_get_cache_info_response.go create mode 100644 pkg/cdnbeta/model_get_cache_info_response_history_entry.go create mode 100644 pkg/cdnbeta/model_get_cache_info_response_history_entry_test.go create mode 100644 pkg/cdnbeta/model_get_cache_info_response_test.go create mode 100644 pkg/cdnbeta/model_get_custom_domain_custom_certificate.go create mode 100644 pkg/cdnbeta/model_get_custom_domain_custom_certificate_test.go create mode 100644 pkg/cdnbeta/model_get_custom_domain_managed_certificate.go create mode 100644 pkg/cdnbeta/model_get_custom_domain_managed_certificate_test.go create mode 100644 pkg/cdnbeta/model_get_custom_domain_response.go create mode 100644 pkg/cdnbeta/model_get_custom_domain_response_certificate.go create mode 100644 pkg/cdnbeta/model_get_custom_domain_response_certificate_test.go create mode 100644 pkg/cdnbeta/model_get_custom_domain_response_test.go create mode 100644 pkg/cdnbeta/model_get_distribution_response.go create mode 100644 pkg/cdnbeta/model_get_distribution_response_test.go create mode 100644 pkg/cdnbeta/model_get_logs_response.go create mode 100644 pkg/cdnbeta/model_get_logs_response_test.go create mode 100644 pkg/cdnbeta/model_get_statistics_response.go create mode 100644 pkg/cdnbeta/model_get_statistics_response_test.go create mode 100644 pkg/cdnbeta/model_http_backend.go create mode 100644 pkg/cdnbeta/model_http_backend_create.go create mode 100644 pkg/cdnbeta/model_http_backend_create_test.go create mode 100644 pkg/cdnbeta/model_http_backend_patch.go create mode 100644 pkg/cdnbeta/model_http_backend_patch_test.go create mode 100644 pkg/cdnbeta/model_http_backend_test.go create mode 100644 pkg/cdnbeta/model_list_distributions_response.go create mode 100644 pkg/cdnbeta/model_list_distributions_response_test.go create mode 100644 pkg/cdnbeta/model_list_waf_collections_response.go create mode 100644 pkg/cdnbeta/model_list_waf_collections_response_test.go create mode 100644 pkg/cdnbeta/model_loki_log_sink.go create mode 100644 pkg/cdnbeta/model_loki_log_sink_create.go create mode 100644 pkg/cdnbeta/model_loki_log_sink_create_test.go create mode 100644 pkg/cdnbeta/model_loki_log_sink_credentials.go create mode 100644 pkg/cdnbeta/model_loki_log_sink_credentials_test.go create mode 100644 pkg/cdnbeta/model_loki_log_sink_patch.go create mode 100644 pkg/cdnbeta/model_loki_log_sink_patch_test.go create mode 100644 pkg/cdnbeta/model_loki_log_sink_test.go create mode 100644 pkg/cdnbeta/model_optimizer.go create mode 100644 pkg/cdnbeta/model_optimizer_patch.go create mode 100644 pkg/cdnbeta/model_optimizer_patch_test.go create mode 100644 pkg/cdnbeta/model_optimizer_test.go create mode 100644 pkg/cdnbeta/model_patch_distribution_payload.go create mode 100644 pkg/cdnbeta/model_patch_distribution_payload_test.go create mode 100644 pkg/cdnbeta/model_patch_distribution_response.go create mode 100644 pkg/cdnbeta/model_patch_distribution_response_test.go create mode 100644 pkg/cdnbeta/model_purge_cache_payload.go create mode 100644 pkg/cdnbeta/model_purge_cache_payload_test.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_custom_certificate.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_custom_certificate_test.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_managed_certificate.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_managed_certificate_test.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_payload.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_payload_certificate.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_payload_certificate_test.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_payload_test.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_response.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_response_certificate.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_response_certificate_test.go create mode 100644 pkg/cdnbeta/model_put_custom_domain_response_test.go create mode 100644 pkg/cdnbeta/model_region.go create mode 100644 pkg/cdnbeta/model_region_test.go create mode 100644 pkg/cdnbeta/model_status_error.go create mode 100644 pkg/cdnbeta/model_status_error_test.go create mode 100644 pkg/cdnbeta/model_waf_config.go create mode 100644 pkg/cdnbeta/model_waf_config_patch.go create mode 100644 pkg/cdnbeta/model_waf_config_patch_test.go create mode 100644 pkg/cdnbeta/model_waf_config_test.go create mode 100644 pkg/cdnbeta/model_waf_mode.go create mode 100644 pkg/cdnbeta/model_waf_mode_test.go create mode 100644 pkg/cdnbeta/model_waf_rule.go create mode 100644 pkg/cdnbeta/model_waf_rule_collection.go create mode 100644 pkg/cdnbeta/model_waf_rule_collection_test.go create mode 100644 pkg/cdnbeta/model_waf_rule_group.go create mode 100644 pkg/cdnbeta/model_waf_rule_group_test.go create mode 100644 pkg/cdnbeta/model_waf_rule_test.go create mode 100644 pkg/cdnbeta/model_waf_status_rule_block.go create mode 100644 pkg/cdnbeta/model_waf_status_rule_block_test.go create mode 100644 pkg/cdnbeta/model_waf_type.go create mode 100644 pkg/cdnbeta/model_waf_type_test.go create mode 100644 pkg/cdnbeta/utils.go create mode 100644 pkg/certificatesbeta/.openapi-generator/VERSION create mode 100644 pkg/certificatesbeta/api_default.go create mode 100644 pkg/certificatesbeta/api_default_test.go create mode 100644 pkg/certificatesbeta/client.go create mode 100644 pkg/certificatesbeta/configuration.go create mode 100644 pkg/certificatesbeta/model_create_certificate_payload.go create mode 100644 pkg/certificatesbeta/model_create_certificate_payload_test.go create mode 100644 pkg/certificatesbeta/model_create_certificate_response.go create mode 100644 pkg/certificatesbeta/model_create_certificate_response_test.go create mode 100644 pkg/certificatesbeta/model_get_certificate_response.go create mode 100644 pkg/certificatesbeta/model_get_certificate_response_test.go create mode 100644 pkg/certificatesbeta/model_google_protobuf_any.go create mode 100644 pkg/certificatesbeta/model_google_protobuf_any_test.go create mode 100644 pkg/certificatesbeta/model_list_certificates_response.go create mode 100644 pkg/certificatesbeta/model_list_certificates_response_test.go create mode 100644 pkg/certificatesbeta/model_status.go create mode 100644 pkg/certificatesbeta/model_status_test.go create mode 100644 pkg/certificatesbeta/utils.go create mode 100644 pkg/edgebeta/.openapi-generator/VERSION create mode 100644 pkg/edgebeta/api_default.go create mode 100644 pkg/edgebeta/api_default_test.go create mode 100644 pkg/edgebeta/client.go create mode 100644 pkg/edgebeta/configuration.go create mode 100644 pkg/edgebeta/model_bad_request.go create mode 100644 pkg/edgebeta/model_bad_request_test.go create mode 100644 pkg/edgebeta/model_create_instance_payload.go create mode 100644 pkg/edgebeta/model_create_instance_payload_test.go create mode 100644 pkg/edgebeta/model_instance.go create mode 100644 pkg/edgebeta/model_instance_list.go create mode 100644 pkg/edgebeta/model_instance_list_test.go create mode 100644 pkg/edgebeta/model_instance_test.go create mode 100644 pkg/edgebeta/model_kubeconfig.go create mode 100644 pkg/edgebeta/model_kubeconfig_test.go create mode 100644 pkg/edgebeta/model_plan.go create mode 100644 pkg/edgebeta/model_plan_list.go create mode 100644 pkg/edgebeta/model_plan_list_test.go create mode 100644 pkg/edgebeta/model_plan_test.go create mode 100644 pkg/edgebeta/model_token.go create mode 100644 pkg/edgebeta/model_token_test.go create mode 100644 pkg/edgebeta/model_unauthorized_request.go create mode 100644 pkg/edgebeta/model_unauthorized_request_test.go create mode 100644 pkg/edgebeta/model_update_instance_by_name_payload.go create mode 100644 pkg/edgebeta/model_update_instance_by_name_payload_test.go create mode 100644 pkg/edgebeta/model_update_instance_payload.go create mode 100644 pkg/edgebeta/model_update_instance_payload_test.go create mode 100644 pkg/edgebeta/model_user.go create mode 100644 pkg/edgebeta/model_user_test.go create mode 100644 pkg/edgebeta/utils.go create mode 100644 pkg/gitbeta/.openapi-generator/VERSION create mode 100644 pkg/gitbeta/api_default.go create mode 100644 pkg/gitbeta/api_default_test.go create mode 100644 pkg/gitbeta/client.go create mode 100644 pkg/gitbeta/configuration.go create mode 100644 pkg/gitbeta/model_authentication.go create mode 100644 pkg/gitbeta/model_authentication_list.go create mode 100644 pkg/gitbeta/model_authentication_list_test.go create mode 100644 pkg/gitbeta/model_authentication_test.go create mode 100644 pkg/gitbeta/model_create_authentication_payload.go create mode 100644 pkg/gitbeta/model_create_authentication_payload_test.go create mode 100644 pkg/gitbeta/model_create_instance_payload.go create mode 100644 pkg/gitbeta/model_create_instance_payload_test.go create mode 100644 pkg/gitbeta/model_create_runner_payload.go create mode 100644 pkg/gitbeta/model_create_runner_payload_test.go create mode 100644 pkg/gitbeta/model_feature_toggle.go create mode 100644 pkg/gitbeta/model_feature_toggle_test.go create mode 100644 pkg/gitbeta/model_flavor.go create mode 100644 pkg/gitbeta/model_flavor_test.go create mode 100644 pkg/gitbeta/model_flavors_list.go create mode 100644 pkg/gitbeta/model_flavors_list_test.go create mode 100644 pkg/gitbeta/model_generic_error_response.go create mode 100644 pkg/gitbeta/model_generic_error_response_test.go create mode 100644 pkg/gitbeta/model_instance.go create mode 100644 pkg/gitbeta/model_instance_list.go create mode 100644 pkg/gitbeta/model_instance_list_test.go create mode 100644 pkg/gitbeta/model_instance_test.go create mode 100644 pkg/gitbeta/model_internal_server_error_response.go create mode 100644 pkg/gitbeta/model_internal_server_error_response_test.go create mode 100644 pkg/gitbeta/model_patch_authentication_payload.go create mode 100644 pkg/gitbeta/model_patch_authentication_payload_test.go create mode 100644 pkg/gitbeta/model_patch_instance_payload.go create mode 100644 pkg/gitbeta/model_patch_instance_payload_test.go create mode 100644 pkg/gitbeta/model_patch_operation.go create mode 100644 pkg/gitbeta/model_patch_operation_test.go create mode 100644 pkg/gitbeta/model_runner.go create mode 100644 pkg/gitbeta/model_runner_runtime.go create mode 100644 pkg/gitbeta/model_runner_runtime_list.go create mode 100644 pkg/gitbeta/model_runner_runtime_list_test.go create mode 100644 pkg/gitbeta/model_runner_runtime_test.go create mode 100644 pkg/gitbeta/model_runner_test.go create mode 100644 pkg/gitbeta/utils.go create mode 100644 pkg/iaasalpha/.openapi-generator/VERSION create mode 100644 pkg/iaasalpha/api_default.go create mode 100644 pkg/iaasalpha/api_default_test.go create mode 100644 pkg/iaasalpha/client.go create mode 100644 pkg/iaasalpha/configuration.go create mode 100644 pkg/iaasalpha/model_add_routes_to_routing_table_payload.go create mode 100644 pkg/iaasalpha/model_add_routes_to_routing_table_payload_test.go create mode 100644 pkg/iaasalpha/model_add_routing_table_to_area_payload.go create mode 100644 pkg/iaasalpha/model_add_routing_table_to_area_payload_test.go create mode 100644 pkg/iaasalpha/model_create_network_ipv4.go create mode 100644 pkg/iaasalpha/model_create_network_ipv4_test.go create mode 100644 pkg/iaasalpha/model_create_network_ipv4_with_prefix.go create mode 100644 pkg/iaasalpha/model_create_network_ipv4_with_prefix_length.go create mode 100644 pkg/iaasalpha/model_create_network_ipv4_with_prefix_length_test.go create mode 100644 pkg/iaasalpha/model_create_network_ipv4_with_prefix_test.go create mode 100644 pkg/iaasalpha/model_create_network_ipv6.go create mode 100644 pkg/iaasalpha/model_create_network_ipv6_test.go create mode 100644 pkg/iaasalpha/model_create_network_ipv6_with_prefix.go create mode 100644 pkg/iaasalpha/model_create_network_ipv6_with_prefix_length.go create mode 100644 pkg/iaasalpha/model_create_network_ipv6_with_prefix_length_test.go create mode 100644 pkg/iaasalpha/model_create_network_ipv6_with_prefix_test.go create mode 100644 pkg/iaasalpha/model_create_network_payload.go create mode 100644 pkg/iaasalpha/model_create_network_payload_test.go create mode 100644 pkg/iaasalpha/model_destination_cidrv4.go create mode 100644 pkg/iaasalpha/model_destination_cidrv4_test.go create mode 100644 pkg/iaasalpha/model_destination_cidrv6.go create mode 100644 pkg/iaasalpha/model_destination_cidrv6_test.go create mode 100644 pkg/iaasalpha/model_error.go create mode 100644 pkg/iaasalpha/model_error_test.go create mode 100644 pkg/iaasalpha/model_network.go create mode 100644 pkg/iaasalpha/model_network_ipv4.go create mode 100644 pkg/iaasalpha/model_network_ipv4_test.go create mode 100644 pkg/iaasalpha/model_network_ipv6.go create mode 100644 pkg/iaasalpha/model_network_ipv6_test.go create mode 100644 pkg/iaasalpha/model_network_list_response.go create mode 100644 pkg/iaasalpha/model_network_list_response_test.go create mode 100644 pkg/iaasalpha/model_network_test.go create mode 100644 pkg/iaasalpha/model_nexthop_blackhole.go create mode 100644 pkg/iaasalpha/model_nexthop_blackhole_test.go create mode 100644 pkg/iaasalpha/model_nexthop_internet.go create mode 100644 pkg/iaasalpha/model_nexthop_internet_test.go create mode 100644 pkg/iaasalpha/model_nexthop_ipv4.go create mode 100644 pkg/iaasalpha/model_nexthop_ipv4_test.go create mode 100644 pkg/iaasalpha/model_nexthop_ipv6.go create mode 100644 pkg/iaasalpha/model_nexthop_ipv6_test.go create mode 100644 pkg/iaasalpha/model_partial_update_network_payload.go create mode 100644 pkg/iaasalpha/model_partial_update_network_payload_test.go create mode 100644 pkg/iaasalpha/model_route.go create mode 100644 pkg/iaasalpha/model_route_destination.go create mode 100644 pkg/iaasalpha/model_route_destination_test.go create mode 100644 pkg/iaasalpha/model_route_list_response.go create mode 100644 pkg/iaasalpha/model_route_list_response_test.go create mode 100644 pkg/iaasalpha/model_route_nexthop.go create mode 100644 pkg/iaasalpha/model_route_nexthop_test.go create mode 100644 pkg/iaasalpha/model_route_test.go create mode 100644 pkg/iaasalpha/model_routing_table.go create mode 100644 pkg/iaasalpha/model_routing_table_list_response.go create mode 100644 pkg/iaasalpha/model_routing_table_list_response_test.go create mode 100644 pkg/iaasalpha/model_routing_table_test.go create mode 100644 pkg/iaasalpha/model_update_network_ipv4_body.go create mode 100644 pkg/iaasalpha/model_update_network_ipv4_body_test.go create mode 100644 pkg/iaasalpha/model_update_network_ipv6_body.go create mode 100644 pkg/iaasalpha/model_update_network_ipv6_body_test.go create mode 100644 pkg/iaasalpha/model_update_route_of_routing_table_payload.go create mode 100644 pkg/iaasalpha/model_update_route_of_routing_table_payload_test.go create mode 100644 pkg/iaasalpha/model_update_routing_table_of_area_payload.go create mode 100644 pkg/iaasalpha/model_update_routing_table_of_area_payload_test.go create mode 100644 pkg/iaasalpha/utils.go create mode 100644 pkg/iaasalpha/wait/wait.go create mode 100644 pkg/iaasalpha/wait/wait_test.go create mode 100644 pkg/iaasbeta/.openapi-generator/VERSION create mode 100644 pkg/iaasbeta/api_default.go create mode 100644 pkg/iaasbeta/api_default_test.go create mode 100644 pkg/iaasbeta/client.go create mode 100644 pkg/iaasbeta/configuration.go create mode 100644 pkg/iaasbeta/model_add_routes_to_routing_table_payload.go create mode 100644 pkg/iaasbeta/model_add_routes_to_routing_table_payload_test.go create mode 100644 pkg/iaasbeta/model_add_routing_table_to_area_payload.go create mode 100644 pkg/iaasbeta/model_add_routing_table_to_area_payload_test.go create mode 100644 pkg/iaasbeta/model_add_volume_to_server_payload.go create mode 100644 pkg/iaasbeta/model_add_volume_to_server_payload_test.go create mode 100644 pkg/iaasbeta/model_affinity_group.go create mode 100644 pkg/iaasbeta/model_affinity_group_list_response.go create mode 100644 pkg/iaasbeta/model_affinity_group_list_response_test.go create mode 100644 pkg/iaasbeta/model_affinity_group_test.go create mode 100644 pkg/iaasbeta/model_allowed_addresses_inner.go create mode 100644 pkg/iaasbeta/model_allowed_addresses_inner_test.go create mode 100644 pkg/iaasbeta/model_area_id.go create mode 100644 pkg/iaasbeta/model_area_id_test.go create mode 100644 pkg/iaasbeta/model_availability_zone_list_response.go create mode 100644 pkg/iaasbeta/model_availability_zone_list_response_test.go create mode 100644 pkg/iaasbeta/model_backup.go create mode 100644 pkg/iaasbeta/model_backup_list_response.go create mode 100644 pkg/iaasbeta/model_backup_list_response_test.go create mode 100644 pkg/iaasbeta/model_backup_source.go create mode 100644 pkg/iaasbeta/model_backup_source_test.go create mode 100644 pkg/iaasbeta/model_backup_test.go create mode 100644 pkg/iaasbeta/model_base_security_group_rule.go create mode 100644 pkg/iaasbeta/model_base_security_group_rule_test.go create mode 100644 pkg/iaasbeta/model_boot_volume.go create mode 100644 pkg/iaasbeta/model_boot_volume_source.go create mode 100644 pkg/iaasbeta/model_boot_volume_source_test.go create mode 100644 pkg/iaasbeta/model_boot_volume_test.go create mode 100644 pkg/iaasbeta/model_create_affinity_group_payload.go create mode 100644 pkg/iaasbeta/model_create_affinity_group_payload_test.go create mode 100644 pkg/iaasbeta/model_create_backup_payload.go create mode 100644 pkg/iaasbeta/model_create_backup_payload_test.go create mode 100644 pkg/iaasbeta/model_create_image_payload.go create mode 100644 pkg/iaasbeta/model_create_image_payload_test.go create mode 100644 pkg/iaasbeta/model_create_isolated_network_payload.go create mode 100644 pkg/iaasbeta/model_create_isolated_network_payload_test.go create mode 100644 pkg/iaasbeta/model_create_key_pair_payload.go create mode 100644 pkg/iaasbeta/model_create_key_pair_payload_test.go create mode 100644 pkg/iaasbeta/model_create_network_area_payload.go create mode 100644 pkg/iaasbeta/model_create_network_area_payload_test.go create mode 100644 pkg/iaasbeta/model_create_network_area_range_payload.go create mode 100644 pkg/iaasbeta/model_create_network_area_range_payload_test.go create mode 100644 pkg/iaasbeta/model_create_network_area_route_payload.go create mode 100644 pkg/iaasbeta/model_create_network_area_route_payload_test.go create mode 100644 pkg/iaasbeta/model_create_network_ipv4.go create mode 100644 pkg/iaasbeta/model_create_network_ipv4_test.go create mode 100644 pkg/iaasbeta/model_create_network_ipv4_with_prefix.go create mode 100644 pkg/iaasbeta/model_create_network_ipv4_with_prefix_length.go create mode 100644 pkg/iaasbeta/model_create_network_ipv4_with_prefix_length_test.go create mode 100644 pkg/iaasbeta/model_create_network_ipv4_with_prefix_test.go create mode 100644 pkg/iaasbeta/model_create_network_ipv6.go create mode 100644 pkg/iaasbeta/model_create_network_ipv6_test.go create mode 100644 pkg/iaasbeta/model_create_network_ipv6_with_prefix.go create mode 100644 pkg/iaasbeta/model_create_network_ipv6_with_prefix_length.go create mode 100644 pkg/iaasbeta/model_create_network_ipv6_with_prefix_length_test.go create mode 100644 pkg/iaasbeta/model_create_network_ipv6_with_prefix_test.go create mode 100644 pkg/iaasbeta/model_create_network_payload.go create mode 100644 pkg/iaasbeta/model_create_network_payload_test.go create mode 100644 pkg/iaasbeta/model_create_nic_payload.go create mode 100644 pkg/iaasbeta/model_create_nic_payload_test.go create mode 100644 pkg/iaasbeta/model_create_protocol.go create mode 100644 pkg/iaasbeta/model_create_protocol_test.go create mode 100644 pkg/iaasbeta/model_create_public_ip_payload.go create mode 100644 pkg/iaasbeta/model_create_public_ip_payload_test.go create mode 100644 pkg/iaasbeta/model_create_security_group_payload.go create mode 100644 pkg/iaasbeta/model_create_security_group_payload_test.go create mode 100644 pkg/iaasbeta/model_create_security_group_rule_payload.go create mode 100644 pkg/iaasbeta/model_create_security_group_rule_payload_test.go create mode 100644 pkg/iaasbeta/model_create_security_group_rule_protocol.go create mode 100644 pkg/iaasbeta/model_create_security_group_rule_protocol_test.go create mode 100644 pkg/iaasbeta/model_create_server_networking.go create mode 100644 pkg/iaasbeta/model_create_server_networking_test.go create mode 100644 pkg/iaasbeta/model_create_server_networking_with_nics.go create mode 100644 pkg/iaasbeta/model_create_server_networking_with_nics_test.go create mode 100644 pkg/iaasbeta/model_create_server_payload.go create mode 100644 pkg/iaasbeta/model_create_server_payload_all_of.go create mode 100644 pkg/iaasbeta/model_create_server_payload_all_of_networking.go create mode 100644 pkg/iaasbeta/model_create_server_payload_all_of_networking_test.go create mode 100644 pkg/iaasbeta/model_create_server_payload_all_of_test.go create mode 100644 pkg/iaasbeta/model_create_server_payload_test.go create mode 100644 pkg/iaasbeta/model_create_volume_payload.go create mode 100644 pkg/iaasbeta/model_create_volume_payload_test.go create mode 100644 pkg/iaasbeta/model_destination_cidrv4.go create mode 100644 pkg/iaasbeta/model_destination_cidrv4_test.go create mode 100644 pkg/iaasbeta/model_destination_cidrv6.go create mode 100644 pkg/iaasbeta/model_destination_cidrv6_test.go create mode 100644 pkg/iaasbeta/model_error.go create mode 100644 pkg/iaasbeta/model_error_test.go create mode 100644 pkg/iaasbeta/model_get_server_log_200_response.go create mode 100644 pkg/iaasbeta/model_get_server_log_200_response_test.go create mode 100644 pkg/iaasbeta/model_icmp_parameters.go create mode 100644 pkg/iaasbeta/model_icmp_parameters_test.go create mode 100644 pkg/iaasbeta/model_image.go create mode 100644 pkg/iaasbeta/model_image_agent.go create mode 100644 pkg/iaasbeta/model_image_agent_test.go create mode 100644 pkg/iaasbeta/model_image_checksum.go create mode 100644 pkg/iaasbeta/model_image_checksum_test.go create mode 100644 pkg/iaasbeta/model_image_config.go create mode 100644 pkg/iaasbeta/model_image_config_test.go create mode 100644 pkg/iaasbeta/model_image_create_response.go create mode 100644 pkg/iaasbeta/model_image_create_response_test.go create mode 100644 pkg/iaasbeta/model_image_list_response.go create mode 100644 pkg/iaasbeta/model_image_list_response_test.go create mode 100644 pkg/iaasbeta/model_image_share.go create mode 100644 pkg/iaasbeta/model_image_share_consumer.go create mode 100644 pkg/iaasbeta/model_image_share_consumer_test.go create mode 100644 pkg/iaasbeta/model_image_share_test.go create mode 100644 pkg/iaasbeta/model_image_test.go create mode 100644 pkg/iaasbeta/model_key_pair_list_response.go create mode 100644 pkg/iaasbeta/model_key_pair_list_response_test.go create mode 100644 pkg/iaasbeta/model_keypair.go create mode 100644 pkg/iaasbeta/model_keypair_test.go create mode 100644 pkg/iaasbeta/model_machine_type.go create mode 100644 pkg/iaasbeta/model_machine_type_list_response.go create mode 100644 pkg/iaasbeta/model_machine_type_list_response_test.go create mode 100644 pkg/iaasbeta/model_machine_type_test.go create mode 100644 pkg/iaasbeta/model_network.go create mode 100644 pkg/iaasbeta/model_network_area.go create mode 100644 pkg/iaasbeta/model_network_area_list_response.go create mode 100644 pkg/iaasbeta/model_network_area_list_response_test.go create mode 100644 pkg/iaasbeta/model_network_area_test.go create mode 100644 pkg/iaasbeta/model_network_ipv4.go create mode 100644 pkg/iaasbeta/model_network_ipv4_test.go create mode 100644 pkg/iaasbeta/model_network_ipv6.go create mode 100644 pkg/iaasbeta/model_network_ipv6_test.go create mode 100644 pkg/iaasbeta/model_network_list_response.go create mode 100644 pkg/iaasbeta/model_network_list_response_test.go create mode 100644 pkg/iaasbeta/model_network_range.go create mode 100644 pkg/iaasbeta/model_network_range_list_response.go create mode 100644 pkg/iaasbeta/model_network_range_list_response_test.go create mode 100644 pkg/iaasbeta/model_network_range_test.go create mode 100644 pkg/iaasbeta/model_network_test.go create mode 100644 pkg/iaasbeta/model_nexthop_blackhole.go create mode 100644 pkg/iaasbeta/model_nexthop_blackhole_test.go create mode 100644 pkg/iaasbeta/model_nexthop_internet.go create mode 100644 pkg/iaasbeta/model_nexthop_internet_test.go create mode 100644 pkg/iaasbeta/model_nexthop_ipv4.go create mode 100644 pkg/iaasbeta/model_nexthop_ipv4_test.go create mode 100644 pkg/iaasbeta/model_nexthop_ipv6.go create mode 100644 pkg/iaasbeta/model_nexthop_ipv6_test.go create mode 100644 pkg/iaasbeta/model_nic.go create mode 100644 pkg/iaasbeta/model_nic_list_response.go create mode 100644 pkg/iaasbeta/model_nic_list_response_test.go create mode 100644 pkg/iaasbeta/model_nic_test.go create mode 100644 pkg/iaasbeta/model_partial_update_network_area_payload.go create mode 100644 pkg/iaasbeta/model_partial_update_network_area_payload_test.go create mode 100644 pkg/iaasbeta/model_partial_update_network_payload.go create mode 100644 pkg/iaasbeta/model_partial_update_network_payload_test.go create mode 100644 pkg/iaasbeta/model_port_range.go create mode 100644 pkg/iaasbeta/model_port_range_test.go create mode 100644 pkg/iaasbeta/model_project.go create mode 100644 pkg/iaasbeta/model_project_list_response.go create mode 100644 pkg/iaasbeta/model_project_list_response_test.go create mode 100644 pkg/iaasbeta/model_project_test.go create mode 100644 pkg/iaasbeta/model_protocol.go create mode 100644 pkg/iaasbeta/model_protocol_test.go create mode 100644 pkg/iaasbeta/model_public_ip.go create mode 100644 pkg/iaasbeta/model_public_ip_list_response.go create mode 100644 pkg/iaasbeta/model_public_ip_list_response_test.go create mode 100644 pkg/iaasbeta/model_public_ip_test.go create mode 100644 pkg/iaasbeta/model_public_network.go create mode 100644 pkg/iaasbeta/model_public_network_list_response.go create mode 100644 pkg/iaasbeta/model_public_network_list_response_test.go create mode 100644 pkg/iaasbeta/model_public_network_test.go create mode 100644 pkg/iaasbeta/model_quota.go create mode 100644 pkg/iaasbeta/model_quota_list.go create mode 100644 pkg/iaasbeta/model_quota_list_backup_gigabytes.go create mode 100644 pkg/iaasbeta/model_quota_list_backup_gigabytes_test.go create mode 100644 pkg/iaasbeta/model_quota_list_backups.go create mode 100644 pkg/iaasbeta/model_quota_list_backups_test.go create mode 100644 pkg/iaasbeta/model_quota_list_gigabytes.go create mode 100644 pkg/iaasbeta/model_quota_list_gigabytes_test.go create mode 100644 pkg/iaasbeta/model_quota_list_networks.go create mode 100644 pkg/iaasbeta/model_quota_list_networks_test.go create mode 100644 pkg/iaasbeta/model_quota_list_nics.go create mode 100644 pkg/iaasbeta/model_quota_list_nics_test.go create mode 100644 pkg/iaasbeta/model_quota_list_public_ips.go create mode 100644 pkg/iaasbeta/model_quota_list_public_ips_test.go create mode 100644 pkg/iaasbeta/model_quota_list_ram.go create mode 100644 pkg/iaasbeta/model_quota_list_ram_test.go create mode 100644 pkg/iaasbeta/model_quota_list_response.go create mode 100644 pkg/iaasbeta/model_quota_list_response_test.go create mode 100644 pkg/iaasbeta/model_quota_list_security_group_rules.go create mode 100644 pkg/iaasbeta/model_quota_list_security_group_rules_test.go create mode 100644 pkg/iaasbeta/model_quota_list_security_groups.go create mode 100644 pkg/iaasbeta/model_quota_list_security_groups_test.go create mode 100644 pkg/iaasbeta/model_quota_list_snapshots.go create mode 100644 pkg/iaasbeta/model_quota_list_snapshots_test.go create mode 100644 pkg/iaasbeta/model_quota_list_test.go create mode 100644 pkg/iaasbeta/model_quota_list_vcpu.go create mode 100644 pkg/iaasbeta/model_quota_list_vcpu_test.go create mode 100644 pkg/iaasbeta/model_quota_list_volumes.go create mode 100644 pkg/iaasbeta/model_quota_list_volumes_test.go create mode 100644 pkg/iaasbeta/model_quota_test.go create mode 100644 pkg/iaasbeta/model_regional_area.go create mode 100644 pkg/iaasbeta/model_regional_area_ipv4.go create mode 100644 pkg/iaasbeta/model_regional_area_ipv4_test.go create mode 100644 pkg/iaasbeta/model_regional_area_list_response.go create mode 100644 pkg/iaasbeta/model_regional_area_list_response_test.go create mode 100644 pkg/iaasbeta/model_regional_area_test.go create mode 100644 pkg/iaasbeta/model_request.go create mode 100644 pkg/iaasbeta/model_request_resource.go create mode 100644 pkg/iaasbeta/model_request_resource_test.go create mode 100644 pkg/iaasbeta/model_request_test.go create mode 100644 pkg/iaasbeta/model_rescue_server_payload.go create mode 100644 pkg/iaasbeta/model_rescue_server_payload_test.go create mode 100644 pkg/iaasbeta/model_resize_server_payload.go create mode 100644 pkg/iaasbeta/model_resize_server_payload_test.go create mode 100644 pkg/iaasbeta/model_resize_volume_payload.go create mode 100644 pkg/iaasbeta/model_resize_volume_payload_test.go create mode 100644 pkg/iaasbeta/model_route.go create mode 100644 pkg/iaasbeta/model_route_destination.go create mode 100644 pkg/iaasbeta/model_route_destination_test.go create mode 100644 pkg/iaasbeta/model_route_list_response.go create mode 100644 pkg/iaasbeta/model_route_list_response_test.go create mode 100644 pkg/iaasbeta/model_route_nexthop.go create mode 100644 pkg/iaasbeta/model_route_nexthop_test.go create mode 100644 pkg/iaasbeta/model_route_test.go create mode 100644 pkg/iaasbeta/model_routing_table.go create mode 100644 pkg/iaasbeta/model_routing_table_list_response.go create mode 100644 pkg/iaasbeta/model_routing_table_list_response_test.go create mode 100644 pkg/iaasbeta/model_routing_table_test.go create mode 100644 pkg/iaasbeta/model_security_group.go create mode 100644 pkg/iaasbeta/model_security_group_list_response.go create mode 100644 pkg/iaasbeta/model_security_group_list_response_test.go create mode 100644 pkg/iaasbeta/model_security_group_rule.go create mode 100644 pkg/iaasbeta/model_security_group_rule_list_response.go create mode 100644 pkg/iaasbeta/model_security_group_rule_list_response_test.go create mode 100644 pkg/iaasbeta/model_security_group_rule_protocol.go create mode 100644 pkg/iaasbeta/model_security_group_rule_protocol_test.go create mode 100644 pkg/iaasbeta/model_security_group_rule_test.go create mode 100644 pkg/iaasbeta/model_security_group_test.go create mode 100644 pkg/iaasbeta/model_server.go create mode 100644 pkg/iaasbeta/model_server_agent.go create mode 100644 pkg/iaasbeta/model_server_agent_test.go create mode 100644 pkg/iaasbeta/model_server_boot_volume.go create mode 100644 pkg/iaasbeta/model_server_boot_volume_test.go create mode 100644 pkg/iaasbeta/model_server_console_url.go create mode 100644 pkg/iaasbeta/model_server_console_url_test.go create mode 100644 pkg/iaasbeta/model_server_list_response.go create mode 100644 pkg/iaasbeta/model_server_list_response_test.go create mode 100644 pkg/iaasbeta/model_server_maintenance.go create mode 100644 pkg/iaasbeta/model_server_maintenance_test.go create mode 100644 pkg/iaasbeta/model_server_network.go create mode 100644 pkg/iaasbeta/model_server_network_test.go create mode 100644 pkg/iaasbeta/model_server_networking.go create mode 100644 pkg/iaasbeta/model_server_networking_test.go create mode 100644 pkg/iaasbeta/model_server_test.go create mode 100644 pkg/iaasbeta/model_service_account_mail_list_response.go create mode 100644 pkg/iaasbeta/model_service_account_mail_list_response_test.go create mode 100644 pkg/iaasbeta/model_set_image_share_payload.go create mode 100644 pkg/iaasbeta/model_set_image_share_payload_test.go create mode 100644 pkg/iaasbeta/model_snapshot.go create mode 100644 pkg/iaasbeta/model_snapshot_list_response.go create mode 100644 pkg/iaasbeta/model_snapshot_list_response_test.go create mode 100644 pkg/iaasbeta/model_snapshot_test.go create mode 100644 pkg/iaasbeta/model_static_area_id.go create mode 100644 pkg/iaasbeta/model_static_area_id_test.go create mode 100644 pkg/iaasbeta/model_update_attached_volume_payload.go create mode 100644 pkg/iaasbeta/model_update_attached_volume_payload_test.go create mode 100644 pkg/iaasbeta/model_update_image_payload.go create mode 100644 pkg/iaasbeta/model_update_image_payload_test.go create mode 100644 pkg/iaasbeta/model_update_image_share_payload.go create mode 100644 pkg/iaasbeta/model_update_image_share_payload_test.go create mode 100644 pkg/iaasbeta/model_update_key_pair_payload.go create mode 100644 pkg/iaasbeta/model_update_key_pair_payload_test.go create mode 100644 pkg/iaasbeta/model_update_network_ipv4_body.go create mode 100644 pkg/iaasbeta/model_update_network_ipv4_body_test.go create mode 100644 pkg/iaasbeta/model_update_network_ipv6_body.go create mode 100644 pkg/iaasbeta/model_update_network_ipv6_body_test.go create mode 100644 pkg/iaasbeta/model_update_nic_payload.go create mode 100644 pkg/iaasbeta/model_update_nic_payload_test.go create mode 100644 pkg/iaasbeta/model_update_public_ip_payload.go create mode 100644 pkg/iaasbeta/model_update_public_ip_payload_test.go create mode 100644 pkg/iaasbeta/model_update_regional_area_ipv4.go create mode 100644 pkg/iaasbeta/model_update_regional_area_ipv4_test.go create mode 100644 pkg/iaasbeta/model_update_route_of_routing_table_payload.go create mode 100644 pkg/iaasbeta/model_update_route_of_routing_table_payload_test.go create mode 100644 pkg/iaasbeta/model_update_routing_table_of_area_payload.go create mode 100644 pkg/iaasbeta/model_update_routing_table_of_area_payload_test.go create mode 100644 pkg/iaasbeta/model_update_server_payload.go create mode 100644 pkg/iaasbeta/model_update_server_payload_test.go create mode 100644 pkg/iaasbeta/model_update_volume_payload.go create mode 100644 pkg/iaasbeta/model_update_volume_payload_test.go create mode 100644 pkg/iaasbeta/model_v2beta1_configure_network_area_region_payload.go create mode 100644 pkg/iaasbeta/model_v2beta1_configure_network_area_region_payload_test.go create mode 100644 pkg/iaasbeta/model_v2beta1_create_snapshot_payload.go create mode 100644 pkg/iaasbeta/model_v2beta1_create_snapshot_payload_test.go create mode 100644 pkg/iaasbeta/model_v2beta1_update_backup_payload.go create mode 100644 pkg/iaasbeta/model_v2beta1_update_backup_payload_test.go create mode 100644 pkg/iaasbeta/model_v2beta1_update_network_area_region_payload.go create mode 100644 pkg/iaasbeta/model_v2beta1_update_network_area_region_payload_test.go create mode 100644 pkg/iaasbeta/model_v2beta1_update_route_of_area_payload.go create mode 100644 pkg/iaasbeta/model_v2beta1_update_route_of_area_payload_test.go create mode 100644 pkg/iaasbeta/model_v2beta1_update_security_group_payload.go create mode 100644 pkg/iaasbeta/model_v2beta1_update_security_group_payload_test.go create mode 100644 pkg/iaasbeta/model_v2beta1_update_snapshot_payload.go create mode 100644 pkg/iaasbeta/model_v2beta1_update_snapshot_payload_test.go create mode 100644 pkg/iaasbeta/model_volume.go create mode 100644 pkg/iaasbeta/model_volume_attachment.go create mode 100644 pkg/iaasbeta/model_volume_attachment_list_response.go create mode 100644 pkg/iaasbeta/model_volume_attachment_list_response_test.go create mode 100644 pkg/iaasbeta/model_volume_attachment_test.go create mode 100644 pkg/iaasbeta/model_volume_encryption_parameter.go create mode 100644 pkg/iaasbeta/model_volume_encryption_parameter_test.go create mode 100644 pkg/iaasbeta/model_volume_list_response.go create mode 100644 pkg/iaasbeta/model_volume_list_response_test.go create mode 100644 pkg/iaasbeta/model_volume_performance_class.go create mode 100644 pkg/iaasbeta/model_volume_performance_class_list_response.go create mode 100644 pkg/iaasbeta/model_volume_performance_class_list_response_test.go create mode 100644 pkg/iaasbeta/model_volume_performance_class_test.go create mode 100644 pkg/iaasbeta/model_volume_source.go create mode 100644 pkg/iaasbeta/model_volume_source_test.go create mode 100644 pkg/iaasbeta/model_volume_test.go create mode 100644 pkg/iaasbeta/utils.go create mode 100644 pkg/intakebeta/.openapi-generator/VERSION create mode 100644 pkg/intakebeta/api_default.go create mode 100644 pkg/intakebeta/api_default_test.go create mode 100644 pkg/intakebeta/client.go create mode 100644 pkg/intakebeta/configuration.go create mode 100644 pkg/intakebeta/model_catalog_auth.go create mode 100644 pkg/intakebeta/model_catalog_auth_patch.go create mode 100644 pkg/intakebeta/model_catalog_auth_patch_test.go create mode 100644 pkg/intakebeta/model_catalog_auth_test.go create mode 100644 pkg/intakebeta/model_catalog_auth_type.go create mode 100644 pkg/intakebeta/model_catalog_auth_type_test.go create mode 100644 pkg/intakebeta/model_client_config.go create mode 100644 pkg/intakebeta/model_client_config_test.go create mode 100644 pkg/intakebeta/model_create_intake_payload.go create mode 100644 pkg/intakebeta/model_create_intake_payload_test.go create mode 100644 pkg/intakebeta/model_create_intake_runner_payload.go create mode 100644 pkg/intakebeta/model_create_intake_runner_payload_test.go create mode 100644 pkg/intakebeta/model_create_intake_user_payload.go create mode 100644 pkg/intakebeta/model_create_intake_user_payload_test.go create mode 100644 pkg/intakebeta/model_dremio_auth.go create mode 100644 pkg/intakebeta/model_dremio_auth_patch.go create mode 100644 pkg/intakebeta/model_dremio_auth_patch_test.go create mode 100644 pkg/intakebeta/model_dremio_auth_test.go create mode 100644 pkg/intakebeta/model_intake_catalog.go create mode 100644 pkg/intakebeta/model_intake_catalog_patch.go create mode 100644 pkg/intakebeta/model_intake_catalog_patch_test.go create mode 100644 pkg/intakebeta/model_intake_catalog_test.go create mode 100644 pkg/intakebeta/model_intake_response.go create mode 100644 pkg/intakebeta/model_intake_response_test.go create mode 100644 pkg/intakebeta/model_intake_runner_response.go create mode 100644 pkg/intakebeta/model_intake_runner_response_test.go create mode 100644 pkg/intakebeta/model_intake_user_response.go create mode 100644 pkg/intakebeta/model_intake_user_response_test.go create mode 100644 pkg/intakebeta/model_list_intake_runners_response.go create mode 100644 pkg/intakebeta/model_list_intake_runners_response_test.go create mode 100644 pkg/intakebeta/model_list_intake_users_response.go create mode 100644 pkg/intakebeta/model_list_intake_users_response_test.go create mode 100644 pkg/intakebeta/model_list_intakes_response.go create mode 100644 pkg/intakebeta/model_list_intakes_response_test.go create mode 100644 pkg/intakebeta/model_partitioning_type.go create mode 100644 pkg/intakebeta/model_partitioning_type_test.go create mode 100644 pkg/intakebeta/model_partitioning_update_type.go create mode 100644 pkg/intakebeta/model_partitioning_update_type_test.go create mode 100644 pkg/intakebeta/model_update_intake_payload.go create mode 100644 pkg/intakebeta/model_update_intake_payload_test.go create mode 100644 pkg/intakebeta/model_update_intake_runner_payload.go create mode 100644 pkg/intakebeta/model_update_intake_runner_payload_test.go create mode 100644 pkg/intakebeta/model_update_intake_user_payload.go create mode 100644 pkg/intakebeta/model_update_intake_user_payload_test.go create mode 100644 pkg/intakebeta/model_user_type.go create mode 100644 pkg/intakebeta/model_user_type_test.go create mode 100644 pkg/intakebeta/utils.go create mode 100644 pkg/kmsbeta/.openapi-generator/VERSION create mode 100644 pkg/kmsbeta/api_default.go create mode 100644 pkg/kmsbeta/api_default_test.go create mode 100644 pkg/kmsbeta/client.go create mode 100644 pkg/kmsbeta/configuration.go create mode 100644 pkg/kmsbeta/model_access_scope.go create mode 100644 pkg/kmsbeta/model_access_scope_test.go create mode 100644 pkg/kmsbeta/model_algorithm.go create mode 100644 pkg/kmsbeta/model_algorithm_test.go create mode 100644 pkg/kmsbeta/model_backend.go create mode 100644 pkg/kmsbeta/model_backend_test.go create mode 100644 pkg/kmsbeta/model_create_key_payload.go create mode 100644 pkg/kmsbeta/model_create_key_payload_test.go create mode 100644 pkg/kmsbeta/model_create_key_ring_payload.go create mode 100644 pkg/kmsbeta/model_create_key_ring_payload_test.go create mode 100644 pkg/kmsbeta/model_create_wrapping_key_payload.go create mode 100644 pkg/kmsbeta/model_create_wrapping_key_payload_test.go create mode 100644 pkg/kmsbeta/model_decrypt_payload.go create mode 100644 pkg/kmsbeta/model_decrypt_payload_test.go create mode 100644 pkg/kmsbeta/model_decrypted_data.go create mode 100644 pkg/kmsbeta/model_decrypted_data_test.go create mode 100644 pkg/kmsbeta/model_encrypt_payload.go create mode 100644 pkg/kmsbeta/model_encrypt_payload_test.go create mode 100644 pkg/kmsbeta/model_encrypted_data.go create mode 100644 pkg/kmsbeta/model_encrypted_data_test.go create mode 100644 pkg/kmsbeta/model_http_error.go create mode 100644 pkg/kmsbeta/model_http_error_test.go create mode 100644 pkg/kmsbeta/model_import_key_payload.go create mode 100644 pkg/kmsbeta/model_import_key_payload_test.go create mode 100644 pkg/kmsbeta/model_key.go create mode 100644 pkg/kmsbeta/model_key_list.go create mode 100644 pkg/kmsbeta/model_key_list_test.go create mode 100644 pkg/kmsbeta/model_key_ring.go create mode 100644 pkg/kmsbeta/model_key_ring_list.go create mode 100644 pkg/kmsbeta/model_key_ring_list_test.go create mode 100644 pkg/kmsbeta/model_key_ring_test.go create mode 100644 pkg/kmsbeta/model_key_test.go create mode 100644 pkg/kmsbeta/model_protection.go create mode 100644 pkg/kmsbeta/model_protection_test.go create mode 100644 pkg/kmsbeta/model_purpose.go create mode 100644 pkg/kmsbeta/model_purpose_test.go create mode 100644 pkg/kmsbeta/model_sign_payload.go create mode 100644 pkg/kmsbeta/model_sign_payload_test.go create mode 100644 pkg/kmsbeta/model_signed_data.go create mode 100644 pkg/kmsbeta/model_signed_data_test.go create mode 100644 pkg/kmsbeta/model_verified_data.go create mode 100644 pkg/kmsbeta/model_verified_data_test.go create mode 100644 pkg/kmsbeta/model_verify_payload.go create mode 100644 pkg/kmsbeta/model_verify_payload_test.go create mode 100644 pkg/kmsbeta/model_version.go create mode 100644 pkg/kmsbeta/model_version_list.go create mode 100644 pkg/kmsbeta/model_version_list_test.go create mode 100644 pkg/kmsbeta/model_version_test.go create mode 100644 pkg/kmsbeta/model_wrapping_algorithm.go create mode 100644 pkg/kmsbeta/model_wrapping_algorithm_test.go create mode 100644 pkg/kmsbeta/model_wrapping_key.go create mode 100644 pkg/kmsbeta/model_wrapping_key_list.go create mode 100644 pkg/kmsbeta/model_wrapping_key_list_test.go create mode 100644 pkg/kmsbeta/model_wrapping_key_test.go create mode 100644 pkg/kmsbeta/model_wrapping_purpose.go create mode 100644 pkg/kmsbeta/model_wrapping_purpose_test.go create mode 100644 pkg/kmsbeta/utils.go create mode 100644 pkg/logsalpha/.openapi-generator/VERSION create mode 100644 pkg/logsalpha/api_default.go create mode 100644 pkg/logsalpha/api_default_test.go create mode 100644 pkg/logsalpha/client.go create mode 100644 pkg/logsalpha/configuration.go create mode 100644 pkg/logsalpha/model_access_token.go create mode 100644 pkg/logsalpha/model_access_token_list.go create mode 100644 pkg/logsalpha/model_access_token_list_test.go create mode 100644 pkg/logsalpha/model_access_token_test.go create mode 100644 pkg/logsalpha/model_create_access_token_payload.go create mode 100644 pkg/logsalpha/model_create_access_token_payload_test.go create mode 100644 pkg/logsalpha/model_create_logs_instance_payload.go create mode 100644 pkg/logsalpha/model_create_logs_instance_payload_test.go create mode 100644 pkg/logsalpha/model_logs_instance.go create mode 100644 pkg/logsalpha/model_logs_instance_test.go create mode 100644 pkg/logsalpha/model_logs_instances_list.go create mode 100644 pkg/logsalpha/model_logs_instances_list_test.go create mode 100644 pkg/logsalpha/model_update_access_token_payload.go create mode 100644 pkg/logsalpha/model_update_access_token_payload_test.go create mode 100644 pkg/logsalpha/model_update_logs_instance_payload.go create mode 100644 pkg/logsalpha/model_update_logs_instance_payload_test.go create mode 100644 pkg/logsalpha/utils.go create mode 100644 pkg/logsbeta/.openapi-generator/VERSION create mode 100644 pkg/logsbeta/api_default.go create mode 100644 pkg/logsbeta/api_default_test.go create mode 100644 pkg/logsbeta/client.go create mode 100644 pkg/logsbeta/configuration.go create mode 100644 pkg/logsbeta/model_access_token.go create mode 100644 pkg/logsbeta/model_access_token_list.go create mode 100644 pkg/logsbeta/model_access_token_list_test.go create mode 100644 pkg/logsbeta/model_access_token_test.go create mode 100644 pkg/logsbeta/model_create_access_token_payload.go create mode 100644 pkg/logsbeta/model_create_access_token_payload_test.go create mode 100644 pkg/logsbeta/model_create_logs_instance_payload.go create mode 100644 pkg/logsbeta/model_create_logs_instance_payload_test.go create mode 100644 pkg/logsbeta/model_logs_instance.go create mode 100644 pkg/logsbeta/model_logs_instance_test.go create mode 100644 pkg/logsbeta/model_logs_instances_list.go create mode 100644 pkg/logsbeta/model_logs_instances_list_test.go create mode 100644 pkg/logsbeta/model_update_access_token_payload.go create mode 100644 pkg/logsbeta/model_update_access_token_payload_test.go create mode 100644 pkg/logsbeta/model_update_logs_instance_payload.go create mode 100644 pkg/logsbeta/model_update_logs_instance_payload_test.go create mode 100644 pkg/logsbeta/utils.go create mode 100644 pkg/postgresflexalpha/model_instance_connection_info.go create mode 100644 pkg/postgresflexalpha/model_instance_connection_info_test.go create mode 100644 pkg/runcommandbeta/.openapi-generator/VERSION create mode 100644 pkg/runcommandbeta/api_default.go create mode 100644 pkg/runcommandbeta/api_default_test.go create mode 100644 pkg/runcommandbeta/client.go create mode 100644 pkg/runcommandbeta/configuration.go create mode 100644 pkg/runcommandbeta/model_command_details.go create mode 100644 pkg/runcommandbeta/model_command_details_test.go create mode 100644 pkg/runcommandbeta/model_command_template.go create mode 100644 pkg/runcommandbeta/model_command_template_response.go create mode 100644 pkg/runcommandbeta/model_command_template_response_test.go create mode 100644 pkg/runcommandbeta/model_command_template_schema.go create mode 100644 pkg/runcommandbeta/model_command_template_schema_test.go create mode 100644 pkg/runcommandbeta/model_command_template_test.go create mode 100644 pkg/runcommandbeta/model_commands.go create mode 100644 pkg/runcommandbeta/model_commands_test.go create mode 100644 pkg/runcommandbeta/model_create_command_payload.go create mode 100644 pkg/runcommandbeta/model_create_command_payload_test.go create mode 100644 pkg/runcommandbeta/model_error_response.go create mode 100644 pkg/runcommandbeta/model_error_response_test.go create mode 100644 pkg/runcommandbeta/model_field.go create mode 100644 pkg/runcommandbeta/model_field_test.go create mode 100644 pkg/runcommandbeta/model_get_commands_response.go create mode 100644 pkg/runcommandbeta/model_get_commands_response_test.go create mode 100644 pkg/runcommandbeta/model_new_command_response.go create mode 100644 pkg/runcommandbeta/model_new_command_response_test.go create mode 100644 pkg/runcommandbeta/model_parameters_schema.go create mode 100644 pkg/runcommandbeta/model_parameters_schema_test.go create mode 100644 pkg/runcommandbeta/model_properties.go create mode 100644 pkg/runcommandbeta/model_properties_test.go create mode 100644 pkg/runcommandbeta/utils.go create mode 100644 pkg/sfsbeta/.openapi-generator/VERSION create mode 100644 pkg/sfsbeta/api_default.go create mode 100644 pkg/sfsbeta/api_default_test.go create mode 100644 pkg/sfsbeta/client.go create mode 100644 pkg/sfsbeta/configuration.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_payload.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_payload_test.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_response.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_response_resource_pool.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_response_resource_pool_test.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_response_test.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_snapshot_payload.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_snapshot_payload_test.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_snapshot_response.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_snapshot_response_resource_pool_snapshot.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_snapshot_response_resource_pool_snapshot_test.go create mode 100644 pkg/sfsbeta/model_create_resource_pool_snapshot_response_test.go create mode 100644 pkg/sfsbeta/model_create_share_export_policy_payload.go create mode 100644 pkg/sfsbeta/model_create_share_export_policy_payload_test.go create mode 100644 pkg/sfsbeta/model_create_share_export_policy_request_rule.go create mode 100644 pkg/sfsbeta/model_create_share_export_policy_request_rule_test.go create mode 100644 pkg/sfsbeta/model_create_share_export_policy_response.go create mode 100644 pkg/sfsbeta/model_create_share_export_policy_response_share_export_policy.go create mode 100644 pkg/sfsbeta/model_create_share_export_policy_response_share_export_policy_test.go create mode 100644 pkg/sfsbeta/model_create_share_export_policy_response_test.go create mode 100644 pkg/sfsbeta/model_create_share_payload.go create mode 100644 pkg/sfsbeta/model_create_share_payload_test.go create mode 100644 pkg/sfsbeta/model_create_share_response.go create mode 100644 pkg/sfsbeta/model_create_share_response_share.go create mode 100644 pkg/sfsbeta/model_create_share_response_share_test.go create mode 100644 pkg/sfsbeta/model_create_share_response_test.go create mode 100644 pkg/sfsbeta/model_error.go create mode 100644 pkg/sfsbeta/model_error_test.go create mode 100644 pkg/sfsbeta/model_get_resource_pool_response.go create mode 100644 pkg/sfsbeta/model_get_resource_pool_response_resource_pool.go create mode 100644 pkg/sfsbeta/model_get_resource_pool_response_resource_pool_test.go create mode 100644 pkg/sfsbeta/model_get_resource_pool_response_test.go create mode 100644 pkg/sfsbeta/model_get_resource_pool_snapshot_response.go create mode 100644 pkg/sfsbeta/model_get_resource_pool_snapshot_response_resource_pool_snapshot.go create mode 100644 pkg/sfsbeta/model_get_resource_pool_snapshot_response_resource_pool_snapshot_test.go create mode 100644 pkg/sfsbeta/model_get_resource_pool_snapshot_response_test.go create mode 100644 pkg/sfsbeta/model_get_share_export_policy_response.go create mode 100644 pkg/sfsbeta/model_get_share_export_policy_response_share_export_policy.go create mode 100644 pkg/sfsbeta/model_get_share_export_policy_response_share_export_policy_test.go create mode 100644 pkg/sfsbeta/model_get_share_export_policy_response_test.go create mode 100644 pkg/sfsbeta/model_get_share_response.go create mode 100644 pkg/sfsbeta/model_get_share_response_share.go create mode 100644 pkg/sfsbeta/model_get_share_response_share_test.go create mode 100644 pkg/sfsbeta/model_get_share_response_test.go create mode 100644 pkg/sfsbeta/model_google_protobuf_any.go create mode 100644 pkg/sfsbeta/model_google_protobuf_any_test.go create mode 100644 pkg/sfsbeta/model_list_performance_classes_response.go create mode 100644 pkg/sfsbeta/model_list_performance_classes_response_test.go create mode 100644 pkg/sfsbeta/model_list_resource_pool_snapshots_response.go create mode 100644 pkg/sfsbeta/model_list_resource_pool_snapshots_response_test.go create mode 100644 pkg/sfsbeta/model_list_resource_pools_response.go create mode 100644 pkg/sfsbeta/model_list_resource_pools_response_test.go create mode 100644 pkg/sfsbeta/model_list_share_export_policies_response.go create mode 100644 pkg/sfsbeta/model_list_share_export_policies_response_test.go create mode 100644 pkg/sfsbeta/model_list_shares_response.go create mode 100644 pkg/sfsbeta/model_list_shares_response_test.go create mode 100644 pkg/sfsbeta/model_list_snapshot_schedules_response.go create mode 100644 pkg/sfsbeta/model_list_snapshot_schedules_response_test.go create mode 100644 pkg/sfsbeta/model_performance_class.go create mode 100644 pkg/sfsbeta/model_performance_class_test.go create mode 100644 pkg/sfsbeta/model_resource_pool.go create mode 100644 pkg/sfsbeta/model_resource_pool_performance_class.go create mode 100644 pkg/sfsbeta/model_resource_pool_performance_class_test.go create mode 100644 pkg/sfsbeta/model_resource_pool_snapshot.go create mode 100644 pkg/sfsbeta/model_resource_pool_snapshot_test.go create mode 100644 pkg/sfsbeta/model_resource_pool_space.go create mode 100644 pkg/sfsbeta/model_resource_pool_space_test.go create mode 100644 pkg/sfsbeta/model_resource_pool_test.go create mode 100644 pkg/sfsbeta/model_share.go create mode 100644 pkg/sfsbeta/model_share_export_policy.go create mode 100644 pkg/sfsbeta/model_share_export_policy_rule.go create mode 100644 pkg/sfsbeta/model_share_export_policy_rule_test.go create mode 100644 pkg/sfsbeta/model_share_export_policy_test.go create mode 100644 pkg/sfsbeta/model_share_test.go create mode 100644 pkg/sfsbeta/model_snapshot_schedule.go create mode 100644 pkg/sfsbeta/model_snapshot_schedule_test.go create mode 100644 pkg/sfsbeta/model_status.go create mode 100644 pkg/sfsbeta/model_status_test.go create mode 100644 pkg/sfsbeta/model_update_resource_pool_payload.go create mode 100644 pkg/sfsbeta/model_update_resource_pool_payload_test.go create mode 100644 pkg/sfsbeta/model_update_resource_pool_response.go create mode 100644 pkg/sfsbeta/model_update_resource_pool_response_resource_pool.go create mode 100644 pkg/sfsbeta/model_update_resource_pool_response_resource_pool_test.go create mode 100644 pkg/sfsbeta/model_update_resource_pool_response_test.go create mode 100644 pkg/sfsbeta/model_update_share_export_policy_body_rule.go create mode 100644 pkg/sfsbeta/model_update_share_export_policy_body_rule_test.go create mode 100644 pkg/sfsbeta/model_update_share_export_policy_payload.go create mode 100644 pkg/sfsbeta/model_update_share_export_policy_payload_test.go create mode 100644 pkg/sfsbeta/model_update_share_export_policy_response.go create mode 100644 pkg/sfsbeta/model_update_share_export_policy_response_test.go create mode 100644 pkg/sfsbeta/model_update_share_payload.go create mode 100644 pkg/sfsbeta/model_update_share_payload_test.go create mode 100644 pkg/sfsbeta/model_update_share_response.go create mode 100644 pkg/sfsbeta/model_update_share_response_share.go create mode 100644 pkg/sfsbeta/model_update_share_response_share_test.go create mode 100644 pkg/sfsbeta/model_update_share_response_test.go create mode 100644 pkg/sfsbeta/model_validation_error.go create mode 100644 pkg/sfsbeta/model_validation_error_all_of.go create mode 100644 pkg/sfsbeta/model_validation_error_all_of_test.go create mode 100644 pkg/sfsbeta/model_validation_error_field.go create mode 100644 pkg/sfsbeta/model_validation_error_field_test.go create mode 100644 pkg/sfsbeta/model_validation_error_test.go create mode 100644 pkg/sfsbeta/utils.go create mode 100644 pkg/sqlserverflexalpha/model_external_s3.go create mode 100644 pkg/sqlserverflexalpha/model_external_s3_test.go create mode 100644 pkg/sqlserverflexalpha/model_restore_database_from_backup_payload.go create mode 100644 pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_source.go create mode 100644 pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_source_test.go create mode 100644 pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_test.go create mode 100644 pkg/sqlserverflexalpha/model_s3file_info.go create mode 100644 pkg/sqlserverflexalpha/model_s3file_info_test.go create mode 100644 pkg/sqlserverflexalpha/model_source_backup.go create mode 100644 pkg/sqlserverflexalpha/model_source_backup_test.go create mode 100644 pkg/sqlserverflexalpha/model_source_external_s3.go create mode 100644 pkg/sqlserverflexalpha/model_source_external_s3_test.go create mode 100644 pkg/vpnalpha/.openapi-generator/VERSION create mode 100644 pkg/vpnalpha/api_default.go create mode 100644 pkg/vpnalpha/api_default_test.go create mode 100644 pkg/vpnalpha/client.go create mode 100644 pkg/vpnalpha/configuration.go create mode 100644 pkg/vpnalpha/model_api_error.go create mode 100644 pkg/vpnalpha/model_api_error_detail.go create mode 100644 pkg/vpnalpha/model_api_error_detail_test.go create mode 100644 pkg/vpnalpha/model_api_error_response.go create mode 100644 pkg/vpnalpha/model_api_error_response_test.go create mode 100644 pkg/vpnalpha/model_api_error_test.go create mode 100644 pkg/vpnalpha/model_bgp_gateway_config.go create mode 100644 pkg/vpnalpha/model_bgp_gateway_config_test.go create mode 100644 pkg/vpnalpha/model_bgp_status.go create mode 100644 pkg/vpnalpha/model_bgp_status_peers.go create mode 100644 pkg/vpnalpha/model_bgp_status_peers_test.go create mode 100644 pkg/vpnalpha/model_bgp_status_routes.go create mode 100644 pkg/vpnalpha/model_bgp_status_routes_test.go create mode 100644 pkg/vpnalpha/model_bgp_status_test.go create mode 100644 pkg/vpnalpha/model_bgp_tunnel_config.go create mode 100644 pkg/vpnalpha/model_bgp_tunnel_config_test.go create mode 100644 pkg/vpnalpha/model_connection.go create mode 100644 pkg/vpnalpha/model_connection_list.go create mode 100644 pkg/vpnalpha/model_connection_list_test.go create mode 100644 pkg/vpnalpha/model_connection_request.go create mode 100644 pkg/vpnalpha/model_connection_request_test.go create mode 100644 pkg/vpnalpha/model_connection_request_tunnel1.go create mode 100644 pkg/vpnalpha/model_connection_request_tunnel1_test.go create mode 100644 pkg/vpnalpha/model_connection_status_response.go create mode 100644 pkg/vpnalpha/model_connection_status_response_test.go create mode 100644 pkg/vpnalpha/model_connection_test.go create mode 100644 pkg/vpnalpha/model_create_gateway_connection_payload.go create mode 100644 pkg/vpnalpha/model_create_gateway_connection_payload_test.go create mode 100644 pkg/vpnalpha/model_create_vpn_gateway_payload.go create mode 100644 pkg/vpnalpha/model_create_vpn_gateway_payload_availability_zones.go create mode 100644 pkg/vpnalpha/model_create_vpn_gateway_payload_availability_zones_test.go create mode 100644 pkg/vpnalpha/model_create_vpn_gateway_payload_test.go create mode 100644 pkg/vpnalpha/model_gateway.go create mode 100644 pkg/vpnalpha/model_gateway_list.go create mode 100644 pkg/vpnalpha/model_gateway_list_test.go create mode 100644 pkg/vpnalpha/model_gateway_request.go create mode 100644 pkg/vpnalpha/model_gateway_request_test.go create mode 100644 pkg/vpnalpha/model_gateway_status.go create mode 100644 pkg/vpnalpha/model_gateway_status_response.go create mode 100644 pkg/vpnalpha/model_gateway_status_response_test.go create mode 100644 pkg/vpnalpha/model_gateway_status_test.go create mode 100644 pkg/vpnalpha/model_gateway_test.go create mode 100644 pkg/vpnalpha/model_gateway_with_status.go create mode 100644 pkg/vpnalpha/model_gateway_with_status_test.go create mode 100644 pkg/vpnalpha/model_gateways_response.go create mode 100644 pkg/vpnalpha/model_gateways_response_test.go create mode 100644 pkg/vpnalpha/model_phase.go create mode 100644 pkg/vpnalpha/model_phase1_status.go create mode 100644 pkg/vpnalpha/model_phase1_status_test.go create mode 100644 pkg/vpnalpha/model_phase2_status.go create mode 100644 pkg/vpnalpha/model_phase2_status_test.go create mode 100644 pkg/vpnalpha/model_phase_test.go create mode 100644 pkg/vpnalpha/model_plan.go create mode 100644 pkg/vpnalpha/model_plan_list.go create mode 100644 pkg/vpnalpha/model_plan_list_test.go create mode 100644 pkg/vpnalpha/model_plan_test.go create mode 100644 pkg/vpnalpha/model_quota.go create mode 100644 pkg/vpnalpha/model_quota_list.go create mode 100644 pkg/vpnalpha/model_quota_list_gateways.go create mode 100644 pkg/vpnalpha/model_quota_list_gateways_test.go create mode 100644 pkg/vpnalpha/model_quota_list_response.go create mode 100644 pkg/vpnalpha/model_quota_list_response_test.go create mode 100644 pkg/vpnalpha/model_quota_list_test.go create mode 100644 pkg/vpnalpha/model_quota_test.go create mode 100644 pkg/vpnalpha/model_region.go create mode 100644 pkg/vpnalpha/model_region_test.go create mode 100644 pkg/vpnalpha/model_tunnel_configuration.go create mode 100644 pkg/vpnalpha/model_tunnel_configuration_phase1.go create mode 100644 pkg/vpnalpha/model_tunnel_configuration_phase1_all_of.go create mode 100644 pkg/vpnalpha/model_tunnel_configuration_phase1_all_of_test.go create mode 100644 pkg/vpnalpha/model_tunnel_configuration_phase1_test.go create mode 100644 pkg/vpnalpha/model_tunnel_configuration_phase2.go create mode 100644 pkg/vpnalpha/model_tunnel_configuration_phase2_all_of.go create mode 100644 pkg/vpnalpha/model_tunnel_configuration_phase2_all_of_test.go create mode 100644 pkg/vpnalpha/model_tunnel_configuration_phase2_test.go create mode 100644 pkg/vpnalpha/model_tunnel_configuration_test.go create mode 100644 pkg/vpnalpha/model_tunnel_status.go create mode 100644 pkg/vpnalpha/model_tunnel_status_test.go create mode 100644 pkg/vpnalpha/model_update_gateway_connection_payload.go create mode 100644 pkg/vpnalpha/model_update_gateway_connection_payload_test.go create mode 100644 pkg/vpnalpha/model_update_vpn_gateway_payload.go create mode 100644 pkg/vpnalpha/model_update_vpn_gateway_payload_test.go create mode 100644 pkg/vpnalpha/model_vpn_tunnel_plan.go create mode 100644 pkg/vpnalpha/model_vpn_tunnel_plan_test.go create mode 100644 pkg/vpnalpha/model_vpn_tunnels.go create mode 100644 pkg/vpnalpha/model_vpn_tunnels_test.go create mode 100644 pkg/vpnalpha/utils.go create mode 100644 service_specs/postgres-flex_database_config.yml create mode 100644 service_specs/postgres-flex_flavors_config.yml create mode 100644 service_specs/postgres-flex_instance_config.yml create mode 100644 service_specs/postgres-flex_role_config.yml create mode 100644 service_specs/postgres-flex_user_config.yml create mode 100644 service_specs/postgres-flex_version_config.yml create mode 100644 service_specs/sqlserverflex_backup_config.yml.disabled create mode 100644 service_specs/sqlserverflex_collation_config.yml.disabled create mode 100644 service_specs/sqlserverflex_database_config.yml create mode 100644 service_specs/sqlserverflex_flavors_config.yml create mode 100644 service_specs/sqlserverflex_instance_config.yml create mode 100644 service_specs/sqlserverflex_user_config.yml create mode 100644 service_specs/sqlserverflex_version_config.yml create mode 100644 stackit/internal/services/postgresflexalpha/database/datasources_gen/databases_data_source_gen.go create mode 100644 stackit/internal/services/postgresflexalpha/database/resources_gen/database_resource_gen.go rename stackit/internal/services/postgresflexalpha/{flavor_data_source_gen.go => flavor/datasources_gen/flavors_data_source_gen.go} (97%) create mode 100644 stackit/internal/services/postgresflexalpha/flavors/datasource.go rename stackit/internal/services/{sqlserverflexalpha/flavor_data_source_gen.go => postgresflexalpha/flavors/datasources_gen/flavors_data_source_gen.go} (97%) create mode 100644 stackit/internal/services/postgresflexalpha/instance/datasources_gen/instance_data_source_gen.go create mode 100644 stackit/internal/services/postgresflexalpha/instance/datasources_gen/instances_data_source_gen.go delete mode 100644 stackit/internal/services/postgresflexalpha/instance/models.go create mode 100644 stackit/internal/services/postgresflexalpha/instance/planModifiers.yaml create mode 100644 stackit/internal/services/postgresflexalpha/instance/resources_gen/instance_resource_gen.go create mode 100644 stackit/internal/services/postgresflexalpha/instance/schema_test.go create mode 100644 stackit/internal/services/postgresflexalpha/main.go create mode 100644 stackit/internal/services/postgresflexalpha/role/datasources_gen/roles_data_source_gen.go create mode 100644 stackit/internal/services/postgresflexalpha/testdata/resource-complete.tf create mode 100644 stackit/internal/services/postgresflexalpha/user/datasources_gen/user_data_source_gen.go create mode 100644 stackit/internal/services/postgresflexalpha/user/datasources_gen/users_data_source_gen.go create mode 100644 stackit/internal/services/postgresflexalpha/user/resources_gen/user_resource_gen.go create mode 100644 stackit/internal/services/postgresflexalpha/utils/planModifiers.go create mode 100644 stackit/internal/services/postgresflexalpha/version/datasources_gen/versions_data_source_gen.go create mode 100644 stackit/internal/services/sqlserverflexalpha/database/datasource.go create mode 100644 stackit/internal/services/sqlserverflexalpha/database/datasources_gen/database_data_source_gen.go create mode 100644 stackit/internal/services/sqlserverflexalpha/database/datasources_gen/databases_data_source_gen.go create mode 100644 stackit/internal/services/sqlserverflexalpha/database/resource.go create mode 100644 stackit/internal/services/sqlserverflexalpha/database/resources_gen/database_resource_gen.go create mode 100644 stackit/internal/services/sqlserverflexalpha/flavor/datasources_gen/flavor_data_source_gen.go create mode 100644 stackit/internal/services/sqlserverflexalpha/flavor/functions_test.go delete mode 100644 stackit/internal/services/sqlserverflexalpha/flavor/list_datasource.go.bak create mode 100644 stackit/internal/services/sqlserverflexalpha/flavors/datasource.go create mode 100644 stackit/internal/services/sqlserverflexalpha/flavors/datasources_gen/flavors_data_source_gen.go create mode 100644 stackit/internal/services/sqlserverflexalpha/instance/planModifiers.yaml create mode 100644 stackit/internal/services/sqlserverflexalpha/instance/resources_gen/instance_resource_gen.go create mode 100644 stackit/internal/services/sqlserverflexalpha/main.go create mode 100644 stackit/internal/services/sqlserverflexalpha/user/datasources_gen/user_data_source_gen.go create mode 100644 stackit/internal/services/sqlserverflexalpha/user/resources_gen/user_resource_gen.go create mode 100644 stackit/internal/services/sqlserverflexalpha/version/datasource.go create mode 100644 stackit/internal/services/sqlserverflexalpha/version/datasources_gen/version_data_source_gen.go rename {pkg/postgresflexalpha/wait => stackit/internal/wait/postgresflexalpha}/wait.go (76%) rename {pkg/postgresflexalpha/wait => stackit/internal/wait/postgresflexalpha}/wait_test.go (99%) rename {pkg/sqlserverflexalpha/wait => stackit/internal/wait/sqlserverflexalpha}/wait.go (90%) rename {pkg/sqlserverflexalpha/wait => stackit/internal/wait/sqlserverflexalpha}/wait_test.go (99%) create mode 100644 tools/copy.go create mode 100644 tools/formats.go create mode 100644 tools/main.go create mode 100644 tools/templates/data_source_scaffold.gotmpl create mode 100644 tools/templates/provider_scaffold.gotmpl create mode 100644 tools/templates/resource_scaffold.gotmpl diff --git a/.copywrite.hcl b/.copywrite.hcl deleted file mode 100644 index b26d46f2..00000000 --- a/.copywrite.hcl +++ /dev/null @@ -1,24 +0,0 @@ -# NOTE: This file is for HashiCorp specific licensing automation and can be deleted after creating a new repo with this template. -schema_version = 1 - -project { - license = "Apache-2.0" - copyright_year = 2025 - - header_ignore = [ - # internal catalog metadata (prose) - "META.d/**/*.yaml", - - # examples used within documentation (prose) - "examples/**", - - # GitHub issue template configuration - ".github/ISSUE_TEMPLATE/*.yml", - - # golangci-lint tooling configuration - ".golangci.yml", - - # GoReleaser tooling configuration - ".goreleaser.yml", - ] -} diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml index 3601b23f..9da06b1a 100644 --- a/.github/actions/build/action.yaml +++ b/.github/actions/build/action.yaml @@ -1,16 +1,34 @@ + name: Build description: "Build pipeline" inputs: go-version: description: "Go version to install" + default: '1.25' required: true + golang-cilint-version: + description: "Golangci-lint version to install" + default: "2.7.2" + required: true + runs: using: "composite" steps: - name: Install Go ${{ inputs.go-version }} - uses: actions/setup-go@v5 + uses: actions/setup-go@v6 with: go-version: ${{ inputs.go-version }} - - name: Install project tools and dependencies + check-latest: true + go-version-file: 'go.mod' + + # - name: Run golangci-lint + # uses: golangci/golangci-lint-action@v9 + # with: + # version: ${{ inputs.golang-cilint-version }} + + - name: Install needed tools shell: bash - run: make project-tools \ No newline at end of file + run: | + set -e + go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${{ inputs.golang-cilint-version }} + go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@v0.24.0 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..e5181587 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,114 @@ +name: Publish + +on: + pull_request: + workflow_dispatch: + push: + tags: + - 'v0.*' + +env: + GO_VERSION: "1.25" + CODE_COVERAGE_FILE_NAME: "coverage.out" # must be the same as in Makefile + CODE_COVERAGE_ARTIFACT_NAME: "code-coverage" + +jobs: + config: + name: Check GoReleaser config + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Check GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + args: check + + publish: + name: "Publish provider" + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + needs: config + runs-on: ubuntu-latest + permissions: + actions: read # Required to identify workflow run. + checks: write # Required to add status summary. + contents: read # Required to checkout repository. + pull-requests: write # Required to add PR comment. + steps: + - name: Install needed tools + run: | + apt-get -y -qq update + apt-get -y -qq install jq python3 python3-pip python-is-python3 s3cmd git make wget + + - name: Checkout + uses: actions/checkout@v6 + + - name: Install Go ${{ env.GO_VERSION }} + uses: actions/setup-go@v6 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install go tools + run: | + go install golang.org/x/tools/cmd/goimports@latest + go install github.com/hashicorp/terraform-plugin-codegen-framework/cmd/tfplugingen-framework@latest + go install github.com/hashicorp/terraform-plugin-codegen-openapi/cmd/tfplugingen-openapi@latest + + - uses: actions/setup-java@v5 + with: + distribution: 'temurin' # See 'Supported distributions' for available options + java-version: '21' + + - name: Run build pkg directory + run: | + go run cmd/main.go build + + - name: Set up s3cfg + run: | + cat <<'EOF' >> ~/.s3cfg + [default] + host_base = https://object.storage.eu01.onstackit.cloud + host_bucket = https://%(bucket).object.storage.eu01.onstackit.cloud + check_ssl_certificate = False + access_key = ${{ secrets.S3_ACCESS_KEY }} + secret_key = ${{ secrets.S3_SECRET_KEY }} + EOF + + - name: Import GPG key + run: | + gpg --import private.key + + - name: Run GoReleaser + id: goreleaser + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }} + uses: goreleaser/goreleaser-action@v6 + with: + args: release --skip publish --clean --snapshot + + - name: Prepare key file + run: | + echo $(echo ${{ secrets.KEY_FILE_B64 }} | base64 -d) >public_key.pem + + - name: Prepare provider directory structure + run: | + VERSION=$(jq -r .version < dist/metadata.json) + go run cmd/main.go \ + publish \ + --namespace=mhenselin \ + --providerName=stackitprivatepreview \ + --repoName=terraform-provider-stackitprivatepreview \ + --domain=tfregistry.sysops.stackit.rocks \ + --gpgFingerprint=${{ secrets.GPG_FINGERPRINT }} \ + --gpgPubKeyFile=public_key.pem \ + --version=${VERSION} + + - name: Publish provider to S3 + run: | + set -e + cd release/ + s3cmd put --recursive v1 s3://terraform-provider-privatepreview/ + s3cmd put --recursive .well-known s3://terraform-provider-privatepreview/ diff --git a/.gitignore b/.gitignore index 8ac36960..d47a0ae2 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,8 @@ stackit/internal/services/iaas/test-512k.img # Test coverage reports coverage.out coverage.html +generated +stackit-sdk-generator +dist + +.secrets diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 55baab60..e0aafe37 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -5,6 +5,8 @@ # behavior. version: 2 +project_name: terraform-provider-stackitprivatepreview + builds: - env: # goreleaser does not work with CGO, it could also complicate @@ -29,14 +31,16 @@ builds: ignore: - goos: darwin goarch: '386' + - goos: windows + goarch: arm binary: '{{ .ProjectName }}_v{{ .Version }}' archives: - formats: [ 'zip' ] name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' checksum: - extra_files: - - glob: 'terraform-registry-manifest.json' - name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' +# extra_files: +# - glob: 'terraform-registry-manifest.json' +# name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' algorithm: sha256 signs: diff --git a/Makefile b/Makefile index 8dbc5957..c6b3f9ac 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ ROOT_DIR ?= $(shell git rev-parse --show-toplevel) SCRIPTS_BASE ?= $(ROOT_DIR)/scripts +VERSION ?= ${VER} # SETUP AND TOOL INITIALIZATION TASKS project-help: @@ -57,3 +58,11 @@ test-acceptance-tf: TF_ACC_REGION=$(TF_ACC_REGION) \ go test ./... -count=1 -timeout=30m && \ cd $(ROOT_DIR) + +publish: build +ifeq ($(strip $(VERSION)),) + @echo "please call like this: VER=0.1.0 make publish" +else + @echo "version: $(VERSION)" +endif + diff --git a/cmd/cmd/buildCmd.go b/cmd/cmd/buildCmd.go new file mode 100644 index 00000000..78ab41de --- /dev/null +++ b/cmd/cmd/buildCmd.go @@ -0,0 +1,17 @@ +package cmd + +import ( + "github.com/mhenselin/terraform-provider-stackitprivatepreview/tools" + "github.com/spf13/cobra" +) + +func NewBuildCmd() *cobra.Command { + return &cobra.Command{ + Use: "build", + Short: "Build the necessary boilerplate", + Long: `...`, + RunE: func(cmd *cobra.Command, args []string) error { + return tools.Build() + }, + } +} diff --git a/cmd/cmd/publishCmd.go b/cmd/cmd/publishCmd.go new file mode 100644 index 00000000..05e9106f --- /dev/null +++ b/cmd/cmd/publishCmd.go @@ -0,0 +1,498 @@ +package cmd + +import ( + "bufio" + "errors" + "fmt" + "io" + "io/fs" + "log" + "os" + "path" + "path/filepath" + "strings" + + "github.com/spf13/cobra" +) + +var ( + namespace string + domain string + providerName string + distPath string + repoName string + version string + gpgFingerprint string + gpgPubKeyFile string +) + +var rootCmd = &cobra.Command{ + Use: "publish", + Short: "Publish terraform provider", + Long: `...`, + RunE: func(cmd *cobra.Command, args []string) error { + return publish() + }, +} + +func init() { // nolint: gochecknoinits + rootCmd.Flags().StringVarP(&namespace, "namespace", "n", "", "Namespace for the Terraform registry.") + rootCmd.Flags().StringVarP(&domain, "domain", "d", "", "Domain for the Terraform registry.") + rootCmd.Flags().StringVarP(&providerName, "providerName", "p", "", "ProviderName for the Terraform registry.") + rootCmd.Flags().StringVarP(&distPath, "distPath", "x", "dist", "Dist Path for the Terraform registry.") + rootCmd.Flags().StringVarP(&repoName, "repoName", "r", "", "RepoName for the Terraform registry.") + rootCmd.Flags().StringVarP(&version, "version", "v", "", "Version for the Terraform registry.") + rootCmd.Flags().StringVarP(&gpgFingerprint, "gpgFingerprint", "f", "", "GPG Fingerprint for the Terraform registry.") + rootCmd.Flags().StringVarP(&gpgPubKeyFile, "gpgPubKeyFile", "k", "", "GPG PubKey file name for the Terraform registry.") + + err := rootCmd.MarkFlagRequired("namespace") + if err != nil { + return + } + err = rootCmd.MarkFlagRequired("domain") + if err != nil { + return + } + err = rootCmd.MarkFlagRequired("providerName") + if err != nil { + return + } + err = rootCmd.MarkFlagRequired("gpgFingerprint") + if err != nil { + return + } + err = rootCmd.MarkFlagRequired("gpgPubKeyFile") + if err != nil { + return + } + err = rootCmd.MarkFlagRequired("repoName") + if err != nil { + return + } + err = rootCmd.MarkFlagRequired("version") + if err != nil { + return + } + err = rootCmd.MarkFlagRequired("gpgFingerprint") + if err != nil { + return + } + err = rootCmd.MarkFlagRequired("gpgPubKeyFile") + if err != nil { + return + } +} + +func NewPublishCmd() *cobra.Command { + return rootCmd +} + +func publish() error { + log.Println("📦 Packaging Terraform Provider for private registry...") + + distPath = filepath.Clean(distPath) + "/" + + // Create release dir - only the contents of this need to be uploaded to S3 + err := createDir("release") + if err != nil { + return fmt.Errorf("error creating 'release' dir: %s", err) + } + + // Create .wellKnown directory and terraform.json file + err = wellKnown() + if err != nil { + return fmt.Errorf("error creating '.wellKnown' dir: %s", err) + } + + // Create v1 directory + err = provider(namespace, providerName, distPath, repoName, version, gpgFingerprint, gpgPubKeyFile, domain) + if err != nil { + return fmt.Errorf("error creating 'v1' dir: %s", err) + } + + log.Println("📦 Packaged Terraform Provider for private registry.") + return nil +} + +// This establishes the "API" as a TF provider by responding with the correct JSON payload, by using static files +func wellKnown() error { + log.Println("* Creating .well-known directory") + + err := createDir("release/.well-known") + if err != nil { + return err + } + + terraformJson := []byte(`{"providers.v1": "/v1/providers/"}`) + + log.Println(" - Writing to .well-known/terraform.json file") + err = writeFile("release/.well-known/terraform.json", terraformJson) + if err != nil { + return err + } + + return nil +} + +// provider is the Terraform name +// repoName is the Repository name +func provider(namespace, provider, distPath, repoName, version, gpgFingerprint, gpgPubKeyFile, domain string) error { + // Path to semantic version dir + versionPath := providerDirs(namespace, provider, version) + + // Files to create under v1/providers/[namespace]/[provider_name] + err := createVersionsFile(namespace, provider, distPath, repoName, version) + if err != nil { + return err + } // Creates version file one above download, which is why downloadPath isn't used + + // Files/Directories to create under v1/providers/[namespace]/[provider_name]/[version] + copyShaFiles(versionPath, distPath, repoName, version) + downloadPath, err := createDownloadsDir(versionPath) + if err != nil { + return err + } + + // Create darwin, freebsd, linux, windows dirs + err = createTargetDirs(*downloadPath) + if err != nil { + return err + } + + // Copy all zips + err = copyBuildZips(*downloadPath, distPath, repoName, version) + if err != nil { + return err + } + + // Create all individual files for build targets and each architecture for the build targets + err = createArchitectureFiles(namespace, provider, distPath, repoName, version, gpgFingerprint, gpgPubKeyFile, domain) + if err != nil { + return err + } + + return nil +} + +// Create the directories with a path format v1/providers/[namespace]/[provider_name]/[version] +func providerDirs(namespace, repoName, version string) string { + log.Println("* Creating release/v1/providers/[namespace]/[repo]/[version] directories") + + providerPathArr := [6]string{"release", "v1", "providers", namespace, repoName, version} + + var currentPath string + for _, v := range providerPathArr { + currentPath = currentPath + v + "/" + err := createDir(currentPath) + if err != nil { + return "" + } + } + + return currentPath +} + +// Create the versions file under v1/providers/[namespace]/[provider_name] +func createVersionsFile(namespace, provider, distPath, repoName, version string) error { + log.Println("* Writing to release/v1/providers/[namespace]/[repo]/versions file") + + versionPath := fmt.Sprintf("release/v1/providers/%s/%s/versions", namespace, provider) + + shaSumContents, err := getShaSumContents(distPath, repoName, version) + if err != nil { + return err + } + + // Build the versions file... + platforms := "" + for _, line := range shaSumContents { + fileName := line[1] // zip file name + + // get os and arch from filename + removeFileExtension := strings.Split(fileName, ".zip") + fileNameSplit := strings.Split(removeFileExtension[0], "_") + + // Get build target and architecture from the zip file name + target := fileNameSplit[2] + arch := fileNameSplit[3] + + platforms += "{" + platforms += fmt.Sprintf(`"os": "%s",`, target) + platforms += fmt.Sprintf(`"arch": "%s"`, arch) + platforms += "}" + platforms += "," + } + platforms = strings.TrimRight(platforms, ",") // remove trailing comma, json does not allow + + var versions = []byte(fmt.Sprintf(` +{ + "versions": [ + { + "version": "%s", + "protocols": [ + "4.0", + "5.1", + "6.0" + ], + "platform": [ + %s + ] + } + ] +} +`, version, platforms)) + + err = writeFile(versionPath, versions) + if err != nil { + return err + } + + return nil +} + +func copyShaFiles(destPath, srcPath, repoName, version string) { + log.Printf("* Copying SHA files in %s directory", srcPath) + + // Copy files from srcPath + shaSum := repoName + "_" + version + "_SHA256SUMS" + shaSumPath := srcPath + "/" + shaSum + + // _SHA256SUMS file + _, err := copyFile(shaSumPath, destPath+shaSum) + if err != nil { + log.Println(err) + } + + // _SHA256SUMS.sig file + _, err = copyFile(shaSumPath+".sig", destPath+shaSum+".sig") + if err != nil { + log.Println(err) + } +} + +func createDownloadsDir(destPath string) (*string, error) { + log.Printf("* Creating download/ in %s directory", destPath) + + downloadPath := path.Join(destPath, "download") + + err := createDir(downloadPath) + if err != nil { + return nil, err + } + + return &downloadPath, nil +} + +func createTargetDirs(destPath string) error { + log.Printf("* Creating target dirs in %s directory", destPath) + + targets := [4]string{"darwin", "freebsd", "linux", "windows"} + + for _, v := range targets { + err := createDir(destPath + v) + if err != nil { + return err + } + } + + return nil +} + +func copyBuildZips(destPath, distPath, repoName, version string) error { + log.Println("* Copying build zips") + + shaSumContents, err := getShaSumContents(distPath, repoName, version) + if err != nil { + return err + } + + // Loop through and copy each + for _, v := range shaSumContents { + zipName := v[1] + zipSrcPath := distPath + zipName + zipDestPath := destPath + zipName + + log.Printf(" - Zip Source: %s", zipSrcPath) + log.Printf(" - Zip Dest: %s", zipDestPath) + + // Copy the zip + _, err := copyFile(zipSrcPath, zipDestPath) + if err != nil { + return err + } + } + + return nil +} + +func getShaSumContents(distPath, repoName, version string) ([][]string, error) { + shaSumFileName := repoName + "_" + version + "_SHA256SUMS" + shaSumPath := distPath + "/" + shaSumFileName + + shaSumLine, err := readFile(shaSumPath) + if err != nil { + return nil, err + } + + buildsAndShaSums := [][]string{} + + for _, line := range shaSumLine { + lineSplit := strings.Split(line, " ") + + row := []string{lineSplit[0], lineSplit[1]} + buildsAndShaSums = append(buildsAndShaSums, row) + } + + // log.Println(buildsAndShaSums) + + return buildsAndShaSums, nil +} + +// Create architecture files for each build target +func createArchitectureFiles(namespace, provider, distPath, repoName, version, gpgFingerprint, gpgPubKeyFile, domain string) error { + log.Println("* Creating architecture files in target directories") + + // filename = terraform-provider-[provider]_0.0.1_darwin_amd64.zip - provider_name + version + target + architecture + .zip + prefix := fmt.Sprintf("v1/providers/%s/%s/%s/", namespace, provider, version) + pathPrefix := fmt.Sprintf("release/%s", prefix) + urlPrefix := fmt.Sprintf("https://%s/%s", domain, prefix) + + // download url = https://example.com/v1/providers/namespace/provider/0.0.1/download/terraform-provider_0.0.1_darwin_amd64.zip + downloadUrlPrefix := urlPrefix + "download/" + downloadPathPrefix := pathPrefix + "download/" + + // shasums url = https://example.com/v1/providers/namespace/provider/0.0.1/terraform-provider_0.0.1_SHA256SUMS + shasumsUrl := urlPrefix + fmt.Sprintf("%s_%s_SHA256SUMS", repoName, version) + // shasums_signature_url = https://example.com/v1/providers/namespace/provider/0.0.1/terraform-provider_0.0.1_SHA256SUMS.sig + shasumsSigUrl := shasumsUrl + ".sig" + + shaSumContents, err := getShaSumContents(distPath, repoName, version) + if err != nil { + return err + } + + // Get contents of GPG key + gpgFile, err := readFile(gpgPubKeyFile) + if err != nil { + log.Printf("Error reading '%s' file: %s", gpgPubKeyFile, err) + } + + // loop through every line and stick with \\n + gpgAsciiPub := "" + for _, line := range gpgFile { + gpgAsciiPub = gpgAsciiPub + line + "\\n" + } + // log.Println(gpgAsciiPub) + + for _, line := range shaSumContents { + shasum := line[0] // shasum of the zip + fileName := line[1] // zip file name + + downloadUrl := downloadUrlPrefix + fileName + + // get os and arch from filename + removeFileExtension := strings.Split(fileName, ".zip") + fileNameSplit := strings.Split(removeFileExtension[0], "_") + + // Get build target and architecture from the zip file name + target := fileNameSplit[2] + arch := fileNameSplit[3] + + // build filepath + archFileName := downloadPathPrefix + target + "/" + arch + + var architectureTemplate = []byte(fmt.Sprintf(` +{ + "protocols": [ + "4.0", + "5.1" + ], + "os": "%s", + "arch": "%s", + "filename": "%s", + "download_url": "%s", + "shasums_url": "%s", + "shasums_signature_url": "%s", + "shasum": "%s", + "signing_keys": { + "gpg_public_keys": [ + { + "key_id": "%s", + "ascii_armor": "%s", + "trust_signature": "", + "source": "", + "source_url": "" + } + ] + } +} +`, target, arch, fileName, downloadUrl, shasumsUrl, shasumsSigUrl, shasum, gpgFingerprint, gpgAsciiPub)) + + log.Printf(" - Arch file: %s", archFileName) + + err := writeFile(archFileName, architectureTemplate) + if err != nil { + return err + } + } + + return nil +} + +func createDir(path string) error { + log.Printf("* Creating %s directory", path) + err := os.Mkdir(path, os.ModePerm) + if errors.Is(err, fs.ErrExist) { + return nil + } + return err +} + +func copyFile(src, dst string) (int64, error) { + sourceFileStat, err := os.Stat(src) + if err != nil { + return 0, err + } + + if !sourceFileStat.Mode().IsRegular() { + return 0, fmt.Errorf("%s is not a regular file", src) + } + + source, err := os.Open(src) + if err != nil { + return 0, err + } + defer source.Close() + + destination, err := os.Create(dst) + if err != nil { + return 0, err + } + defer destination.Close() + nBytes, err := io.Copy(destination, source) + return nBytes, err +} + +func readFile(filePath string) ([]string, error) { + rFile, err := os.Open(filePath) + + if err != nil { + return nil, err + } + fileScanner := bufio.NewScanner(rFile) + fileScanner.Split(bufio.ScanLines) + var fileLines []string + + for fileScanner.Scan() { + fileLines = append(fileLines, fileScanner.Text()) + } + + rFile.Close() + + return fileLines, nil +} + +func writeFile(fileName string, fileContents []byte) error { + err := os.WriteFile(fileName, fileContents, 0644) + return err +} diff --git a/cmd/cmd/rootCmd.go b/cmd/cmd/rootCmd.go new file mode 100644 index 00000000..924d8794 --- /dev/null +++ b/cmd/cmd/rootCmd.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/spf13/cobra" +) + +func NewRootCmd() *cobra.Command { + return &cobra.Command{ + Use: "build-tools", + Short: "...", + Long: "...", + SilenceErrors: true, // Error is beautified in a custom way before being printed + SilenceUsage: true, + DisableAutoGenTag: true, + RunE: func(cmd *cobra.Command, _ []string) error { + err := cmd.Help() + if err != nil { + return err + } + return nil + }, + } +} diff --git a/cmd/main.go b/cmd/main.go new file mode 100644 index 00000000..40fbbfef --- /dev/null +++ b/cmd/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "log" + "os" + + "github.com/mhenselin/terraform-provider-stackitprivatepreview/cmd/cmd" +) + +func main() { + rootCmd := cmd.NewRootCmd() + //rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)") + //rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "author name for copyright attribution") + //rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "name of license for the project") + + rootCmd.SetOut(os.Stdout) + + rootCmd.AddCommand( + cmd.NewBuildCmd(), + cmd.NewPublishCmd(), + ) + + err := rootCmd.Execute() + if err != nil { + log.Fatal(err) + } +} diff --git a/docs/data-sources/postgresflexalpha_database.md b/docs/data-sources/postgresflexalpha_database.md index f7d0bf2a..834d030c 100644 --- a/docs/data-sources/postgresflexalpha_database.md +++ b/docs/data-sources/postgresflexalpha_database.md @@ -25,16 +25,16 @@ data "stackitprivatepreview_postgresflexalpha_database" "example" { ### Required -- `database_id` (String) Database ID. - `instance_id` (String) ID of the Postgres Flex instance. - `project_id` (String) STACKIT project ID to which the instance is associated. ### Optional +- `database_id` (Number) Database ID. +- `name` (String) Database name. - `region` (String) The resource region. If not defined, the provider region is used. ### Read-Only - `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`region`,`instance_id`,`database_id`". -- `name` (String) Database name. - `owner` (String) Username of the database owner. diff --git a/docs/data-sources/postgresflexalpha_flavors.md b/docs/data-sources/postgresflexalpha_flavors.md new file mode 100644 index 00000000..f90ae257 --- /dev/null +++ b/docs/data-sources/postgresflexalpha_flavors.md @@ -0,0 +1,68 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "stackitprivatepreview_postgresflexalpha_flavors Data Source - stackitprivatepreview" +subcategory: "" +description: |- + +--- + +# stackitprivatepreview_postgresflexalpha_flavors (Data Source) + + + + + + +## Schema + +### Required + +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed + +### Optional + +- `page` (Number) Number of the page of items list to be returned. +- `size` (Number) Number of items to be returned on each page. +- `sort` (String) Sorting of the flavors to be returned on each page. + +### Read-Only + +- `flavors` (Attributes List) List of flavors available for the project. (see [below for nested schema](#nestedatt--flavors)) +- `pagination` (Attributes) (see [below for nested schema](#nestedatt--pagination)) + + +### Nested Schema for `flavors` + +Read-Only: + +- `cpu` (Number) The cpu count of the instance. +- `description` (String) The flavor description. +- `id` (String) The id of the instance flavor. +- `max_gb` (Number) maximum storage which can be ordered for the flavor in Gigabyte. +- `memory` (Number) The memory of the instance in Gibibyte. +- `min_gb` (Number) minimum storage which is required to order in Gigabyte. +- `node_type` (String) defines the nodeType it can be either single or replica +- `storage_classes` (Attributes List) maximum storage which can be ordered for the flavor in Gigabyte. (see [below for nested schema](#nestedatt--flavors--storage_classes)) + + +### Nested Schema for `flavors.storage_classes` + +Read-Only: + +- `class` (String) +- `max_io_per_sec` (Number) +- `max_through_in_mb` (Number) + + + + +### Nested Schema for `pagination` + +Read-Only: + +- `page` (Number) +- `size` (Number) +- `sort` (String) +- `total_pages` (Number) +- `total_rows` (Number) diff --git a/docs/data-sources/postgresflexalpha_instance.md b/docs/data-sources/postgresflexalpha_instance.md index c5c4785d..b7756a9b 100644 --- a/docs/data-sources/postgresflexalpha_instance.md +++ b/docs/data-sources/postgresflexalpha_instance.md @@ -3,12 +3,12 @@ page_title: "stackitprivatepreview_postgresflexalpha_instance Data Source - stackitprivatepreview" subcategory: "" description: |- - Postgres Flex instance data source schema. Must have a region specified in the provider configuration. + --- # stackitprivatepreview_postgresflexalpha_instance (Data Source) -Postgres Flex instance data source schema. Must have a `region` specified in the provider configuration. + ## Example Usage @@ -24,44 +24,31 @@ data "stackitprivatepreview_postgresflexalpha_instance" "example" { ### Required -- `instance_id` (String) ID of the PostgresFlex instance. -- `project_id` (String) STACKIT project ID to which the instance is associated. - -### Optional - -- `region` (String) The resource region. If not defined, the provider region is used. +- `instance_id` (String) The ID of the instance. +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed ### Read-Only -- `backup_schedule` (String) -- `encryption` (Attributes) (see [below for nested schema](#nestedatt--encryption)) -- `flavor_id` (String) -- `id` (String) Terraform's internal data source. ID. It is structured as "`project_id`,`region`,`instance_id`". -- `name` (String) Instance name. -- `network` (Attributes) (see [below for nested schema](#nestedatt--network)) -- `replicas` (Number) -- `retention_days` (Number) -- `storage` (Attributes) (see [below for nested schema](#nestedatt--storage)) -- `version` (String) - - -### Nested Schema for `encryption` - -Read-Only: - -- `key_id` (String) -- `key_version` (String) -- `keyring_id` (String) -- `service_account` (String) - +- `backup_schedule` (String) The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule. +- `flavor_id` (String) The id of the instance flavor. +- `id` (String) The ID of the instance. +- `is_deletable` (Boolean) Whether the instance can be deleted or not. +- `name` (String) The name of the instance. +- `network` (Attributes) The access configuration of the instance (see [below for nested schema](#nestedatt--network)) +- `replicas` (Number) How many replicas the instance should have. +- `retention_days` (Number) How long backups are retained. The value can only be between 32 and 365 days. +- `status` (String) The current status of the instance. +- `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage)) +- `version` (String) The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3alpha1#tag/Version) for supported version parameters. ### Nested Schema for `network` Read-Only: -- `access_scope` (String) -- `acl` (List of String) The Access Control List (ACL) for the PostgresFlex instance. +- `access_scope` (String) The access scope of the instance. It defines if the instance is public or airgapped. +- `acl` (List of String) List of IPV4 cidr. - `instance_address` (String) - `router_address` (String) @@ -71,5 +58,5 @@ Read-Only: Read-Only: -- `class` (String) -- `size` (Number) +- `performance_class` (String) The storage class for the storage. +- `size` (Number) The storage size in Gigabytes. diff --git a/docs/data-sources/postgresflexalpha_user.md b/docs/data-sources/postgresflexalpha_user.md index 7e664ea5..1cda4f62 100644 --- a/docs/data-sources/postgresflexalpha_user.md +++ b/docs/data-sources/postgresflexalpha_user.md @@ -35,10 +35,10 @@ data "stackitprivatepreview_postgresflexalpha_user" "example" { ### Read-Only -- `connection_string` (String) -- `host` (String) +- `connection_string` (String) The connection string for the user to the instance. +- `host` (String) The host address for the user to connect to the instance. - `id` (String) Terraform's internal data source. ID. It is structured as "`project_id`,`region`,`instance_id`,`user_id`". -- `port` (Number) -- `roles` (Set of String) -- `status` (String) -- `username` (String) +- `port` (Number) The port number for the user to connect to the instance. +- `roles` (Set of String) The roles assigned to the user. +- `status` (String) The current status of the user. +- `username` (String) The name of the user. diff --git a/docs/data-sources/sqlserverflexalpha_database.md b/docs/data-sources/sqlserverflexalpha_database.md new file mode 100644 index 00000000..4aab99cc --- /dev/null +++ b/docs/data-sources/sqlserverflexalpha_database.md @@ -0,0 +1,31 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "stackitprivatepreview_sqlserverflexalpha_database Data Source - stackitprivatepreview" +subcategory: "" +description: |- + +--- + +# stackitprivatepreview_sqlserverflexalpha_database (Data Source) + + + + + + +## Schema + +### Required + +- `database_name` (String) The name of the database. +- `instance_id` (String) The ID of the instance. +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed + +### Read-Only + +- `collation_name` (String) The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint. +- `compatibility_level` (Number) CompatibilityLevel of the Database. +- `id` (Number) The id of the database. +- `name` (String) The name of the database. +- `owner` (String) The owner of the database. diff --git a/docs/data-sources/sqlserverflexalpha_version.md b/docs/data-sources/sqlserverflexalpha_version.md new file mode 100644 index 00000000..c9c61732 --- /dev/null +++ b/docs/data-sources/sqlserverflexalpha_version.md @@ -0,0 +1,35 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "stackitprivatepreview_sqlserverflexalpha_version Data Source - stackitprivatepreview" +subcategory: "" +description: |- + +--- + +# stackitprivatepreview_sqlserverflexalpha_version (Data Source) + + + + + + +## Schema + +### Required + +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed + +### Read-Only + +- `versions` (Attributes List) A list containing available sqlserver versions. (see [below for nested schema](#nestedatt--versions)) + + +### Nested Schema for `versions` + +Read-Only: + +- `beta` (Boolean) Flag if the version is a beta version. If set the version may contain bugs and is not fully tested. +- `deprecated` (String) Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT. +- `recommend` (Boolean) Flag if the version is recommend by the STACKIT Team. +- `version` (String) The sqlserver version used for the instance. diff --git a/docs/resources/postgresflexalpha_instance.md b/docs/resources/postgresflexalpha_instance.md index ec20a30e..af2d0d7b 100644 --- a/docs/resources/postgresflexalpha_instance.md +++ b/docs/resources/postgresflexalpha_instance.md @@ -3,12 +3,12 @@ page_title: "stackitprivatepreview_postgresflexalpha_instance Resource - stackitprivatepreview" subcategory: "" description: |- - Postgres Flex instance resource schema. Must have a region specified in the provider configuration. + --- # stackitprivatepreview_postgresflexalpha_instance (Resource) -Postgres Flex instance resource schema. Must have a `region` specified in the provider configuration. + ## Example Usage @@ -42,49 +42,42 @@ import { ### Required -- `backup_schedule` (String) -- `encryption` (Attributes) The encryption block. (see [below for nested schema](#nestedatt--encryption)) -- `flavor_id` (String) -- `name` (String) Instance name. -- `network` (Attributes) The network block configuration. (see [below for nested schema](#nestedatt--network)) -- `project_id` (String) STACKIT project ID to which the instance is associated. -- `replicas` (Number) -- `retention_days` (Number) The days of the retention period. -- `storage` (Attributes) (see [below for nested schema](#nestedatt--storage)) -- `version` (String) The database version used. +- `backup_schedule` (String) The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule. +- `flavor_id` (String) The id of the instance flavor. +- `name` (String) The name of the instance. +- `network` (Attributes) The access configuration of the instance (see [below for nested schema](#nestedatt--network)) +- `replicas` (Number) How many replicas the instance should have. +- `retention_days` (Number) How long backups are retained. The value can only be between 32 and 365 days. +- `storage` (Attributes) The object containing information about the storage size and class. (see [below for nested schema](#nestedatt--storage)) +- `version` (String) The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3alpha1#tag/Version) for supported version parameters. ### Optional -- `region` (String) The resource region. If not defined, the provider region is used. +- `encryption` (Attributes) The configuration for instance's volume and backup storage encryption. + +⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. (see [below for nested schema](#nestedatt--encryption)) +- `instance_id` (String) The ID of the instance. +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed ### Read-Only -- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`region`,`instance_id`". -- `instance_id` (String) ID of the PostgresFlex instance. - - -### Nested Schema for `encryption` - -Required: - -- `key_id` (String) Key ID of the encryption key. -- `key_version` (String) Key version of the encryption key. -- `keyring_id` (String) KeyRing ID of the encryption key. -- `service_account` (String) The service account ID of the service account. - +- `id` (String) The ID of the instance. +- `is_deletable` (Boolean) Whether the instance can be deleted or not. +- `status` (String) The current status of the instance. ### Nested Schema for `network` Required: -- `acl` (List of String) The Access Control List (ACL) for the PostgresFlex instance. +- `acl` (List of String) List of IPV4 cidr. Optional: -- `access_scope` (String) The access scope. (Either SNA or PUBLIC) -- `instance_address` (String) The returned instance address. -- `router_address` (String) The returned router address. +- `access_scope` (String) The access scope of the instance. It defines if the instance is public or airgapped. +- `instance_address` (String) +- `router_address` (String) @@ -92,5 +85,16 @@ Optional: Required: -- `class` (String) The storage class used. -- `size` (Number) The disk size of the storage. +- `performance_class` (String) The storage class for the storage. +- `size` (Number) The storage size in Gigabytes. + + + +### Nested Schema for `encryption` + +Required: + +- `kek_key_id` (String) The encryption-key key identifier +- `kek_key_ring_id` (String) The encryption-key keyring identifier +- `kek_key_version` (String) The encryption-key version +- `service_account` (String) diff --git a/docs/resources/postgresflexalpha_user.md b/docs/resources/postgresflexalpha_user.md index 771671a8..d3b12f9d 100644 --- a/docs/resources/postgresflexalpha_user.md +++ b/docs/resources/postgresflexalpha_user.md @@ -34,8 +34,8 @@ import { - `instance_id` (String) ID of the PostgresFlex instance. - `project_id` (String) STACKIT project ID to which the instance is associated. -- `roles` (Set of String) Database access levels for the user. Possible values are: `login`, `createdb`. -- `username` (String) +- `roles` (Set of String) Database access levels for the user. Possible values are: `login`, `createdb`, `createrole`. +- `username` (String) The name of the user. ### Optional @@ -43,8 +43,10 @@ import { ### Read-Only -- `connection_string` (String) +- `connection_string` (String) The connection string for the user to the instance. +- `host` (String) The host of the Postgres Flex instance. - `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`region`,`instance_id`,`user_id`". -- `password` (String, Sensitive) -- `status` (String) +- `password` (String, Sensitive) The password for the user. This is only set upon creation. +- `port` (Number) The port of the Postgres Flex instance. +- `status` (String) The current status of the user. - `user_id` (Number) User ID. diff --git a/docs/resources/sqlserverflexalpha_database.md b/docs/resources/sqlserverflexalpha_database.md new file mode 100644 index 00000000..fd6ba0fd --- /dev/null +++ b/docs/resources/sqlserverflexalpha_database.md @@ -0,0 +1,36 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "stackitprivatepreview_sqlserverflexalpha_database Resource - stackitprivatepreview" +subcategory: "" +description: |- + +--- + +# stackitprivatepreview_sqlserverflexalpha_database (Resource) + + + + + + +## Schema + +### Required + +- `name` (String) The name of the database. +- `owner` (String) The owner of the database. + +### Optional + +- `collation` (String) The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint. +- `compatibility` (Number) CompatibilityLevel of the Database. +- `database_name` (String) The name of the database. +- `instance_id` (String) The ID of the instance. +- `project_id` (String) The STACKIT project ID. +- `region` (String) The region which should be addressed + +### Read-Only + +- `collation_name` (String) The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint. +- `compatibility_level` (Number) CompatibilityLevel of the Database. +- `id` (Number) The id of the database. diff --git a/docs/resources/sqlserverflexalpha_instance.md b/docs/resources/sqlserverflexalpha_instance.md index 28dcbeca..d5926387 100644 --- a/docs/resources/sqlserverflexalpha_instance.md +++ b/docs/resources/sqlserverflexalpha_instance.md @@ -41,7 +41,6 @@ import { ### Required -- `encryption` (Attributes) The encryption block. (see [below for nested schema](#nestedatt--encryption)) - `flavor_id` (String) - `name` (String) Instance name. - `network` (Attributes) The network block. (see [below for nested schema](#nestedatt--network)) @@ -50,6 +49,7 @@ import { ### Optional - `backup_schedule` (String) The backup schedule. Should follow the cron scheduling system format (e.g. "0 0 * * *") +- `encryption` (Attributes) The encryption block. (see [below for nested schema](#nestedatt--encryption)) - `is_deletable` (Boolean) - `region` (String) The resource region. If not defined, the provider region is used. - `retention_days` (Number) @@ -64,17 +64,6 @@ import { - `instance_id` (String) ID of the SQLServer Flex instance. - `replicas` (Number) - -### Nested Schema for `encryption` - -Required: - -- `key_id` (String) STACKIT KMS - Key ID of the encryption key to use. -- `key_version` (String) STACKIT KMS - Key version to use in the encryption key. -- `keyring_id` (String) STACKIT KMS - KeyRing ID of the encryption key to use. -- `service_account` (String) - - ### Nested Schema for `network` @@ -89,6 +78,17 @@ Read-Only: - `router_address` (String) The returned router IP address of the SQLServer Flex instance. + +### Nested Schema for `encryption` + +Required: + +- `key_id` (String) STACKIT KMS - Key ID of the encryption key to use. +- `key_version` (String) STACKIT KMS - Key version to use in the encryption key. +- `keyring_id` (String) STACKIT KMS - KeyRing ID of the encryption key to use. +- `service_account` (String) + + ### Nested Schema for `storage` diff --git a/go.mod b/go.mod index 5e6b8d1a..9f891564 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/mhenselin/terraform-provider-stackitprivatepreview -go 1.25.5 +go 1.25.6 require ( github.com/google/go-cmp v0.7.0 @@ -10,18 +10,23 @@ require ( github.com/hashicorp/terraform-plugin-go v0.29.0 github.com/hashicorp/terraform-plugin-log v0.10.0 github.com/hashicorp/terraform-plugin-testing v1.14.0 - github.com/stackitcloud/stackit-sdk-go/core v0.20.1 - github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.4.0 + github.com/iancoleman/strcase v0.3.0 + github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1 + github.com/spf13/cobra v1.10.2 + github.com/stackitcloud/stackit-sdk-go/core v0.21.0 + github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.23-alpha + github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.4.1 github.com/teambition/rrule-go v1.8.2 + gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/hashicorp/go-retryablehttp v0.7.8 // indirect - github.com/kr/text v0.2.0 // indirect - golang.org/x/telemetry v0.0.0-20260109210033-bd525da824e2 // indirect + golang.org/x/telemetry v0.0.0-20260116145544-c6413dc483f5 // indirect ) require ( + dario.cat/mergo v1.0.1 // indirect github.com/ProtonMail/go-crypto v1.3.0 // indirect github.com/agext/levenshtein v1.2.3 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect @@ -45,8 +50,10 @@ require ( github.com/hashicorp/terraform-json v0.27.2 // indirect github.com/hashicorp/terraform-plugin-sdk/v2 v2.38.1 // indirect github.com/hashicorp/terraform-registry-address v0.4.0 // indirect - github.com/hashicorp/terraform-svchost v0.1.1 // indirect + github.com/hashicorp/terraform-svchost v0.2.0 // indirect github.com/hashicorp/yamux v0.1.2 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/kr/text v0.2.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect @@ -55,19 +62,21 @@ require ( github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/oklog/run v1.2.0 // indirect + github.com/spf13/pflag v1.0.10 // indirect + github.com/stretchr/testify v1.11.1 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect github.com/zclconf/go-cty v1.17.0 // indirect - golang.org/x/crypto v0.46.0 // indirect + golang.org/x/crypto v0.47.0 // indirect golang.org/x/mod v0.32.0 // indirect - golang.org/x/net v0.48.0 // indirect + golang.org/x/net v0.49.0 // indirect golang.org/x/sync v0.19.0 // indirect golang.org/x/sys v0.40.0 // indirect golang.org/x/text v0.33.0 // indirect - golang.org/x/tools v0.40.0 // indirect + golang.org/x/tools v0.41.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 // indirect google.golang.org/grpc v1.78.0 // indirect google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/go.sum b/go.sum index 2ea27291..cd787442 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= -dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= +dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw= @@ -13,6 +13,7 @@ github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/ github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= github.com/cloudflare/circl v1.6.2 h1:hL7VBpHHKzrV5WTfHCaBsgx/HGbBYlgrwvNXEVDYYsQ= github.com/cloudflare/circl v1.6.2/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s= github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= @@ -99,10 +100,14 @@ github.com/hashicorp/terraform-plugin-testing v1.14.0 h1:5t4VKrjOJ0rg0sVuSJ86dz5 github.com/hashicorp/terraform-plugin-testing v1.14.0/go.mod h1:1qfWkecyYe1Do2EEOK/5/WnTyvC8wQucUkkhiGLg5nk= github.com/hashicorp/terraform-registry-address v0.4.0 h1:S1yCGomj30Sao4l5BMPjTGZmCNzuv7/GDTDX99E9gTk= github.com/hashicorp/terraform-registry-address v0.4.0/go.mod h1:LRS1Ay0+mAiRkUyltGT+UHWkIqTFvigGn/LbMshfflE= -github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= -github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= +github.com/hashicorp/terraform-svchost v0.2.0 h1:wVc2vMiodOHvNZcQw/3y9af1XSomgjGSv+rv3BMCk7I= +github.com/hashicorp/terraform-svchost v0.2.0/go.mod h1:/98rrS2yZsbppi4VGVCjwYmh8dqsKzISqK7Hli+0rcQ= github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8= github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 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.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= @@ -116,6 +121,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1 h1:QJRB9Gs5i/h6TVJI6yl09Qm6rNooznRiKwIw+VIxd90= +github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1/go.mod h1:0eUeas7XtKDPKQbB0KijfaMPbuQ/cIprtoTRiwaUoFg= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= @@ -143,18 +150,26 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8= github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= -github.com/stackitcloud/stackit-sdk-go/core v0.20.1 h1:odiuhhRXmxvEvnVTeZSN9u98edvw2Cd3DcnkepncP3M= -github.com/stackitcloud/stackit-sdk-go/core v0.20.1/go.mod h1:fqto7M82ynGhEnpZU6VkQKYWYoFG5goC076JWXTUPRQ= -github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.4.0 h1:KgIRTw4gpxx8qoiaLGLbXPVDcBgCxPl60gigw+tizYc= -github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.4.0/go.mod h1:fd13ANCU/Pye8uDd/6E0I605+6PYfHuVIQpPEK2Ph6c= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stackitcloud/stackit-sdk-go/core v0.21.0 h1:QXZqiaO7U/4IpTkJfzt4dt6QxJzG2uUS12mBnHpYNik= +github.com/stackitcloud/stackit-sdk-go/core v0.21.0/go.mod h1:fqto7M82ynGhEnpZU6VkQKYWYoFG5goC076JWXTUPRQ= +github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.23-alpha h1:ugpMOMUZGB0yXsWcfe97F7GCdjlexbjFuGD8ZeyMSts= +github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.23-alpha/go.mod h1:v5VGvTxLcCdJJmblbhqYalt/MFHcElDfYoy15CMhaWs= +github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.4.1 h1:6MJdy1xmdE+uOo/F8mR5HSldjPSHpdhwuqS3u9m2EWQ= +github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.4.1/go.mod h1:XLr3ZfrT1g8ZZMm7A6RXOPBuhBkikdUN2o/+/Y+Hu+g= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/teambition/rrule-go v1.8.2 h1:lIjpjvWTj9fFUZCmuoVDrKVOtdiyzbzc93qTmRVe/J8= github.com/teambition/rrule-go v1.8.2/go.mod h1:Ieq5AbrKGciP1V//Wq8ktsTXwSwJHDD5mD/wLBGl3p4= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -183,10 +198,11 @@ go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6 go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= -golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= +golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8= +golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= @@ -194,8 +210,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= -golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= +golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -214,12 +230,12 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/telemetry v0.0.0-20260109210033-bd525da824e2 h1:O1cMQHRfwNpDfDJerqRoE2oD+AFlyid87D40L/OkkJo= -golang.org/x/telemetry v0.0.0-20260109210033-bd525da824e2/go.mod h1:b7fPSJ0pKZ3ccUh8gnTONJxhn3c/PS6tyzQvyqw4iA8= +golang.org/x/telemetry v0.0.0-20260116145544-c6413dc483f5 h1:i0p03B68+xC1kD2QUO8JzDTPXCzhN56OLJ+IhHY8U3A= +golang.org/x/telemetry v0.0.0-20260116145544-c6413dc483f5/go.mod h1:b7fPSJ0pKZ3ccUh8gnTONJxhn3c/PS6tyzQvyqw4iA8= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q= -golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= +golang.org/x/term v0.39.0 h1:RclSuaJf32jOqZz74CkPA9qFuVTX7vhLlpfj/IGWlqY= +golang.org/x/term v0.39.0/go.mod h1:yxzUCTP/U+FzoxfdKmLaA0RV1WgE0VY7hXBwKtY/4ww= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -229,8 +245,8 @@ golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA= -golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc= +golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= +golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= @@ -238,8 +254,8 @@ gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b h1:Mv8VFug0MP9e5vUxfBcE3vUkV6CImK3cMNMIDFjmzxU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251222181119-0a764e51fe1b/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516 h1:sNrWoksmOyF5bvJUcnmbeAmQi8baNhqg5IWaI3llQqU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260120221211-b8f7ae30c516/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc= google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= diff --git a/golang-ci.bck.yaml b/golang-ci.bck.yaml deleted file mode 100644 index 36ace61d..00000000 --- a/golang-ci.bck.yaml +++ /dev/null @@ -1,95 +0,0 @@ -# This file contains all available configuration options -# with their default values. - -# options for analysis running -run: - # default concurrency is a available CPU number - concurrency: 4 - - # timeout for analysis, e.g. 30s, 5m, default is 1m - timeout: 5m -linters-settings: - goimports: - # put imports beginning with prefix after 3rd-party packages; - # it's a comma-separated list of prefixes - local-prefixes: github.com/freiheit-com/nmww - depguard: - rules: - main: - list-mode: lax # Everything is allowed unless it is denied - deny: - - pkg: "github.com/stretchr/testify" - desc: Do not use a testing framework - misspell: - # Correct spellings using locale preferences for US or UK. - # Default is to use a neutral variety of English. - # Setting locale to US will correct the British spelling of 'colour' to 'color'. - locale: US -# golint: -# min-confidence: 0.8 - gosec: - excludes: - # Suppressions: (see https://github.com/securego/gosec#available-rules for details) - - G104 # "Audit errors not checked" -> which we don't need and is a badly implemented version of errcheck - - G102 # "Bind to all interfaces" -> since this is normal in k8s - - G304 # "File path provided as taint input" -> too many false positives - - G307 # "Deferring unsafe method "Close" on type "io.ReadCloser" -> false positive when calling defer resp.Body.Close() - nakedret: - max-func-lines: 0 - revive: - ignore-generated-header: true - severity: error - # https://github.com/mgechev/revive - rules: - - name: errorf - - name: context-as-argument - - name: error-return - - name: increment-decrement - - name: indent-error-flow - - name: superfluous-else - - name: unused-parameter - - name: unreachable-code - - name: atomic - - name: empty-lines - - name: early-return - gocritic: - enabled-tags: - - performance - - style - - experimental - disabled-checks: - - wrapperFunc - - typeDefFirst - - ifElseChain - - dupImport # https://github.com/go-critic/go-critic/issues/845 -linters: - enable: - # https://golangci-lint.run/usage/linters/ - # default linters - - gosimple - - govet - - ineffassign - - staticcheck - - typecheck - - unused - # additional linters - - errorlint - - gochecknoinits - - gocritic - - gofmt - - goimports - - gosec - - misspell - - nakedret - - revive - - depguard - - bodyclose - - sqlclosecheck - - wastedassign - - forcetypeassert - - errcheck - disable: - - noctx # false positive: finds errors with http.NewRequest that dont make sense - - unparam # false positives -issues: - exclude-use-default: false diff --git a/golang-ci.yaml b/golang-ci.yaml index 4b50846f..b3f00eb7 100644 --- a/golang-ci.yaml +++ b/golang-ci.yaml @@ -1,3 +1,4 @@ + version: "2" run: concurrency: 4 @@ -67,6 +68,8 @@ linters: - third_party$ - builtin$ - examples$ + - tools/copy.go + - tools/main.go formatters: enable: - gofmt diff --git a/main.go b/main.go index 97559f18..9adda418 100644 --- a/main.go +++ b/main.go @@ -21,7 +21,7 @@ func main() { flag.BoolVar(&debug, "debug", false, "allows debugging the provider") flag.Parse() err := providerserver.Serve(context.Background(), stackit.New(version), providerserver.ServeOpts{ - Address: "registry.terraform.io/mhenselin/stackitprivatepreview", + Address: "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview", Debug: debug, }) if err != nil { diff --git a/pkg/albbeta/.openapi-generator/VERSION b/pkg/albbeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/albbeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/albbeta/api_default.go b/pkg/albbeta/api_default.go new file mode 100644 index 00000000..bbbbad37 --- /dev/null +++ b/pkg/albbeta/api_default.go @@ -0,0 +1,2409 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateCredentials Create credentials for observability of the application load balancer + Created credentials can be stored and used for the load balancer observability. For example, when using STACKIT + Observability, credentials first must be created for that STACKIT Observability instance (by using their API or the + STACKIT Portal) and then can be provided to the load balancer by storing them with this endpoint. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateCredentialsRequest + */ + CreateCredentials(ctx context.Context, projectId string, region string) ApiCreateCredentialsRequest + /* + CreateCredentialsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return CreateCredentialsResponse + + */ + CreateCredentialsExecute(ctx context.Context, projectId string, region string) (*CreateCredentialsResponse, error) + /* + CreateLoadBalancer Create an application load balancer in a project + Creates an Application Load Balancer. + The default load balancing algorithm is Maglev, and selecting a different algorithm is currently not supported. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateLoadBalancerRequest + */ + CreateLoadBalancer(ctx context.Context, projectId string, region string) ApiCreateLoadBalancerRequest + /* + CreateLoadBalancerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return LoadBalancer + + */ + CreateLoadBalancerExecute(ctx context.Context, projectId string, region string) (*LoadBalancer, error) + /* + DeleteCredentials Delete a single credential in a project. + Deletes the stored Observability credentials. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param credentialsRef + @return ApiDeleteCredentialsRequest + */ + DeleteCredentials(ctx context.Context, projectId string, region string, credentialsRef string) ApiDeleteCredentialsRequest + /* + DeleteCredentialsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param credentialsRef + @return map[string]interface{} + + */ + DeleteCredentialsExecute(ctx context.Context, projectId string, region string, credentialsRef string) (map[string]interface{}, error) + /* + DeleteLoadBalancer Delete a given load balancer in a project. + Deletes the specified Application Load Balancer. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiDeleteLoadBalancerRequest + */ + DeleteLoadBalancer(ctx context.Context, projectId string, region string, name string) ApiDeleteLoadBalancerRequest + /* + DeleteLoadBalancerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return map[string]interface{} + + */ + DeleteLoadBalancerExecute(ctx context.Context, projectId string, region string, name string) (map[string]interface{}, error) + /* + GetCredentials Get a single credential reference in a project. + Gets the stored Observability credentials. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param credentialsRef + @return ApiGetCredentialsRequest + */ + GetCredentials(ctx context.Context, projectId string, region string, credentialsRef string) ApiGetCredentialsRequest + /* + GetCredentialsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param credentialsRef + @return GetCredentialsResponse + + */ + GetCredentialsExecute(ctx context.Context, projectId string, region string, credentialsRef string) (*GetCredentialsResponse, error) + /* + GetLoadBalancer Get a single application load balancer in a project. + Retrieves details of a specific Application Load Balancer in a project. + Includes creation and update information, current status, and any error descriptions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiGetLoadBalancerRequest + */ + GetLoadBalancer(ctx context.Context, projectId string, region string, name string) ApiGetLoadBalancerRequest + /* + GetLoadBalancerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return LoadBalancer + + */ + GetLoadBalancerExecute(ctx context.Context, projectId string, region string, name string) (*LoadBalancer, error) + /* + GetQuota Get the quota of Application Load Balancers in a project. + Retrieves the configured Application Load Balancer quota for the project. Limit can be changed via service request. + There can be 3 times as many TLS certificates and observability credentials as Load Balancers. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiGetQuotaRequest + */ + GetQuota(ctx context.Context, projectId string, region string) ApiGetQuotaRequest + /* + GetQuotaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return GetQuotaResponse + + */ + GetQuotaExecute(ctx context.Context, projectId string, region string) (*GetQuotaResponse, error) + /* + ListCredentials List all credentials in a project. + Lists the stored Observability credentials. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListCredentialsRequest + */ + ListCredentials(ctx context.Context, projectId string, region string) ApiListCredentialsRequest + /* + ListCredentialsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ListCredentialsResponse + + */ + ListCredentialsExecute(ctx context.Context, projectId string, region string) (*ListCredentialsResponse, error) + /* + ListLoadBalancers List load balancers in a project. + Lists all Application Load Balancers in a project. + Includes details from creation or updates, along with their status and any error descriptions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListLoadBalancersRequest + */ + ListLoadBalancers(ctx context.Context, projectId string, region string) ApiListLoadBalancersRequest + /* + ListLoadBalancersExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ListLoadBalancersResponse + + */ + ListLoadBalancersExecute(ctx context.Context, projectId string, region string) (*ListLoadBalancersResponse, error) + /* + ListPlans List available service plans. + Lists the configured service plans for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return ApiListPlansRequest + */ + ListPlans(ctx context.Context, region string) ApiListPlansRequest + /* + ListPlansExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return ListPlansResponse + + */ + ListPlansExecute(ctx context.Context, region string) (*ListPlansResponse, error) + /* + UpdateCredentials Update credentials for observability in a project. + Updates the stored Observability credentials. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param credentialsRef + @return ApiUpdateCredentialsRequest + */ + UpdateCredentials(ctx context.Context, projectId string, region string, credentialsRef string) ApiUpdateCredentialsRequest + /* + UpdateCredentialsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param credentialsRef + @return UpdateCredentialsResponse + + */ + UpdateCredentialsExecute(ctx context.Context, projectId string, region string, credentialsRef string) (*UpdateCredentialsResponse, error) + /* + UpdateLoadBalancer Update a load balancer in a project. + Updates an existing Application Load Balancer by modifying its listeners and target pools. + Ensure the resource version is current to maintain concurrency safety. + The default load balancing algorithm is Maglev, and selecting a different algorithm is currently not supported. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiUpdateLoadBalancerRequest + */ + UpdateLoadBalancer(ctx context.Context, projectId string, region string, name string) ApiUpdateLoadBalancerRequest + /* + UpdateLoadBalancerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return LoadBalancer + + */ + UpdateLoadBalancerExecute(ctx context.Context, projectId string, region string, name string) (*LoadBalancer, error) + /* + UpdateTargetPool Update a single target pool of a load balancer in a project. + Replaces the content of a specific target pool in the Application Load Balancer (useful for adding or removing target servers). + Only updates the specified target pool, leaving others unchanged. + Cannot be used to create or rename target pools. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @param targetPoolName + @return ApiUpdateTargetPoolRequest + */ + UpdateTargetPool(ctx context.Context, projectId string, region string, name string, targetPoolName string) ApiUpdateTargetPoolRequest + /* + UpdateTargetPoolExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @param targetPoolName + @return TargetPool + + */ + UpdateTargetPoolExecute(ctx context.Context, projectId string, region string, name string, targetPoolName string) (*TargetPool, error) +} + +type ApiCreateCredentialsRequest interface { + CreateCredentialsPayload(createCredentialsPayload CreateCredentialsPayload) ApiCreateCredentialsRequest + XRequestID(xRequestID string) ApiCreateCredentialsRequest + Execute() (*CreateCredentialsResponse, error) +} + +type ApiCreateLoadBalancerRequest interface { + CreateLoadBalancerPayload(createLoadBalancerPayload CreateLoadBalancerPayload) ApiCreateLoadBalancerRequest + XRequestID(xRequestID string) ApiCreateLoadBalancerRequest + Execute() (*LoadBalancer, error) +} + +type ApiDeleteCredentialsRequest interface { + Execute() (map[string]interface{}, error) +} + +type ApiDeleteLoadBalancerRequest interface { + Execute() (map[string]interface{}, error) +} + +type ApiGetCredentialsRequest interface { + Execute() (*GetCredentialsResponse, error) +} + +type ApiGetLoadBalancerRequest interface { + Execute() (*LoadBalancer, error) +} + +type ApiGetQuotaRequest interface { + Execute() (*GetQuotaResponse, error) +} + +type ApiListCredentialsRequest interface { + Execute() (*ListCredentialsResponse, error) +} + +type ApiListLoadBalancersRequest interface { + // page_size specifies how many load balancers should be returned on this page. Must be a positive number <= 1000 + PageSize(pageSize string) ApiListLoadBalancersRequest + // page_id is a page identifier returned by the previous response and is used to request the next page + PageId(pageId string) ApiListLoadBalancersRequest + Execute() (*ListLoadBalancersResponse, error) +} + +type ApiListPlansRequest interface { + Execute() (*ListPlansResponse, error) +} + +type ApiUpdateCredentialsRequest interface { + UpdateCredentialsPayload(updateCredentialsPayload UpdateCredentialsPayload) ApiUpdateCredentialsRequest + Execute() (*UpdateCredentialsResponse, error) +} + +type ApiUpdateLoadBalancerRequest interface { + UpdateLoadBalancerPayload(updateLoadBalancerPayload UpdateLoadBalancerPayload) ApiUpdateLoadBalancerRequest + Execute() (*LoadBalancer, error) +} + +type ApiUpdateTargetPoolRequest interface { + UpdateTargetPoolPayload(updateTargetPoolPayload UpdateTargetPoolPayload) ApiUpdateTargetPoolRequest + Execute() (*TargetPool, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateCredentialsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createCredentialsPayload *CreateCredentialsPayload + xRequestID *string +} + +func (r CreateCredentialsRequest) CreateCredentialsPayload(createCredentialsPayload CreateCredentialsPayload) ApiCreateCredentialsRequest { + r.createCredentialsPayload = &createCredentialsPayload + return r +} + +func (r CreateCredentialsRequest) XRequestID(xRequestID string) ApiCreateCredentialsRequest { + r.xRequestID = &xRequestID + return r +} + +func (r CreateCredentialsRequest) Execute() (*CreateCredentialsResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateCredentialsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateCredentials") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/credentials" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createCredentialsPayload == nil { + return localVarReturnValue, fmt.Errorf("createCredentialsPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xRequestID != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Request-ID", r.xRequestID, "") + } + // body params + localVarPostBody = r.createCredentialsPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateCredentials: Create credentials for observability of the application load balancer + +Created credentials can be stored and used for the load balancer observability. For example, when using STACKIT + + Observability, credentials first must be created for that STACKIT Observability instance (by using their API or the + STACKIT Portal) and then can be provided to the load balancer by storing them with this endpoint. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateCredentialsRequest +*/ +func (a *APIClient) CreateCredentials(ctx context.Context, projectId string, region string) ApiCreateCredentialsRequest { + return CreateCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateCredentialsExecute(ctx context.Context, projectId string, region string) (*CreateCredentialsResponse, error) { + r := CreateCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateLoadBalancerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createLoadBalancerPayload *CreateLoadBalancerPayload + xRequestID *string +} + +func (r CreateLoadBalancerRequest) CreateLoadBalancerPayload(createLoadBalancerPayload CreateLoadBalancerPayload) ApiCreateLoadBalancerRequest { + r.createLoadBalancerPayload = &createLoadBalancerPayload + return r +} + +func (r CreateLoadBalancerRequest) XRequestID(xRequestID string) ApiCreateLoadBalancerRequest { + r.xRequestID = &xRequestID + return r +} + +func (r CreateLoadBalancerRequest) Execute() (*LoadBalancer, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoadBalancer + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateLoadBalancer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/load-balancers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createLoadBalancerPayload == nil { + return localVarReturnValue, fmt.Errorf("createLoadBalancerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.xRequestID != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Request-ID", r.xRequestID, "") + } + // body params + localVarPostBody = r.createLoadBalancerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateLoadBalancer: Create an application load balancer in a project + +Creates an Application Load Balancer. + + The default load balancing algorithm is Maglev, and selecting a different algorithm is currently not supported. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateLoadBalancerRequest +*/ +func (a *APIClient) CreateLoadBalancer(ctx context.Context, projectId string, region string) ApiCreateLoadBalancerRequest { + return CreateLoadBalancerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateLoadBalancerExecute(ctx context.Context, projectId string, region string) (*LoadBalancer, error) { + r := CreateLoadBalancerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type DeleteCredentialsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + credentialsRef string +} + +func (r DeleteCredentialsRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteCredentials") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/credentials/{credentialsRef}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(r.credentialsRef, "credentialsRef")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteCredentials: Delete a single credential in a project. + +Deletes the stored Observability credentials. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param credentialsRef + @return ApiDeleteCredentialsRequest +*/ +func (a *APIClient) DeleteCredentials(ctx context.Context, projectId string, region string, credentialsRef string) ApiDeleteCredentialsRequest { + return DeleteCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + credentialsRef: credentialsRef, + } +} + +func (a *APIClient) DeleteCredentialsExecute(ctx context.Context, projectId string, region string, credentialsRef string) (map[string]interface{}, error) { + r := DeleteCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + credentialsRef: credentialsRef, + } + return r.Execute() +} + +type DeleteLoadBalancerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string +} + +func (r DeleteLoadBalancerRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteLoadBalancer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/load-balancers/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteLoadBalancer: Delete a given load balancer in a project. + +Deletes the specified Application Load Balancer. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiDeleteLoadBalancerRequest +*/ +func (a *APIClient) DeleteLoadBalancer(ctx context.Context, projectId string, region string, name string) ApiDeleteLoadBalancerRequest { + return DeleteLoadBalancerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) DeleteLoadBalancerExecute(ctx context.Context, projectId string, region string, name string) (map[string]interface{}, error) { + r := DeleteLoadBalancerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type GetCredentialsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + credentialsRef string +} + +func (r GetCredentialsRequest) Execute() (*GetCredentialsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCredentialsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCredentials") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/credentials/{credentialsRef}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(r.credentialsRef, "credentialsRef")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCredentials: Get a single credential reference in a project. + +Gets the stored Observability credentials. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param credentialsRef + @return ApiGetCredentialsRequest +*/ +func (a *APIClient) GetCredentials(ctx context.Context, projectId string, region string, credentialsRef string) ApiGetCredentialsRequest { + return GetCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + credentialsRef: credentialsRef, + } +} + +func (a *APIClient) GetCredentialsExecute(ctx context.Context, projectId string, region string, credentialsRef string) (*GetCredentialsResponse, error) { + r := GetCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + credentialsRef: credentialsRef, + } + return r.Execute() +} + +type GetLoadBalancerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string +} + +func (r GetLoadBalancerRequest) Execute() (*LoadBalancer, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoadBalancer + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetLoadBalancer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/load-balancers/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetLoadBalancer: Get a single application load balancer in a project. + +Retrieves details of a specific Application Load Balancer in a project. + + Includes creation and update information, current status, and any error descriptions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiGetLoadBalancerRequest +*/ +func (a *APIClient) GetLoadBalancer(ctx context.Context, projectId string, region string, name string) ApiGetLoadBalancerRequest { + return GetLoadBalancerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) GetLoadBalancerExecute(ctx context.Context, projectId string, region string, name string) (*LoadBalancer, error) { + r := GetLoadBalancerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type GetQuotaRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string +} + +func (r GetQuotaRequest) Execute() (*GetQuotaResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetQuotaResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetQuota") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/quota" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetQuota: Get the quota of Application Load Balancers in a project. + +Retrieves the configured Application Load Balancer quota for the project. Limit can be changed via service request. + + There can be 3 times as many TLS certificates and observability credentials as Load Balancers. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiGetQuotaRequest +*/ +func (a *APIClient) GetQuota(ctx context.Context, projectId string, region string) ApiGetQuotaRequest { + return GetQuotaRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) GetQuotaExecute(ctx context.Context, projectId string, region string) (*GetQuotaResponse, error) { + r := GetQuotaRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListCredentialsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string +} + +func (r ListCredentialsRequest) Execute() (*ListCredentialsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListCredentialsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListCredentials") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/credentials" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListCredentials: List all credentials in a project. + +Lists the stored Observability credentials. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListCredentialsRequest +*/ +func (a *APIClient) ListCredentials(ctx context.Context, projectId string, region string) ApiListCredentialsRequest { + return ListCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListCredentialsExecute(ctx context.Context, projectId string, region string) (*ListCredentialsResponse, error) { + r := ListCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListLoadBalancersRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + pageSize *string + pageId *string +} + +// page_size specifies how many load balancers should be returned on this page. Must be a positive number <= 1000 + +func (r ListLoadBalancersRequest) PageSize(pageSize string) ApiListLoadBalancersRequest { + r.pageSize = &pageSize + return r +} + +// page_id is a page identifier returned by the previous response and is used to request the next page + +func (r ListLoadBalancersRequest) PageId(pageId string) ApiListLoadBalancersRequest { + r.pageId = &pageId + return r +} + +func (r ListLoadBalancersRequest) Execute() (*ListLoadBalancersResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListLoadBalancersResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListLoadBalancers") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/load-balancers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.pageId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageId", r.pageId, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListLoadBalancers: List load balancers in a project. + +Lists all Application Load Balancers in a project. + + Includes details from creation or updates, along with their status and any error descriptions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListLoadBalancersRequest +*/ +func (a *APIClient) ListLoadBalancers(ctx context.Context, projectId string, region string) ApiListLoadBalancersRequest { + return ListLoadBalancersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListLoadBalancersExecute(ctx context.Context, projectId string, region string) (*ListLoadBalancersResponse, error) { + r := ListLoadBalancersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListPlansRequest struct { + ctx context.Context + apiService *DefaultApiService + region string +} + +func (r ListPlansRequest) Execute() (*ListPlansResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListPlansResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPlans") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/regions/{region}/plans" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListPlans: List available service plans. + +Lists the configured service plans for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return ApiListPlansRequest +*/ +func (a *APIClient) ListPlans(ctx context.Context, region string) ApiListPlansRequest { + return ListPlansRequest{ + apiService: a.defaultApi, + ctx: ctx, + region: region, + } +} + +func (a *APIClient) ListPlansExecute(ctx context.Context, region string) (*ListPlansResponse, error) { + r := ListPlansRequest{ + apiService: a.defaultApi, + ctx: ctx, + region: region, + } + return r.Execute() +} + +type UpdateCredentialsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + credentialsRef string + updateCredentialsPayload *UpdateCredentialsPayload +} + +func (r UpdateCredentialsRequest) UpdateCredentialsPayload(updateCredentialsPayload UpdateCredentialsPayload) ApiUpdateCredentialsRequest { + r.updateCredentialsPayload = &updateCredentialsPayload + return r +} + +func (r UpdateCredentialsRequest) Execute() (*UpdateCredentialsResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UpdateCredentialsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateCredentials") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/credentials/{credentialsRef}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(r.credentialsRef, "credentialsRef")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateCredentialsPayload == nil { + return localVarReturnValue, fmt.Errorf("updateCredentialsPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateCredentialsPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateCredentials: Update credentials for observability in a project. + +Updates the stored Observability credentials. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param credentialsRef + @return ApiUpdateCredentialsRequest +*/ +func (a *APIClient) UpdateCredentials(ctx context.Context, projectId string, region string, credentialsRef string) ApiUpdateCredentialsRequest { + return UpdateCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + credentialsRef: credentialsRef, + } +} + +func (a *APIClient) UpdateCredentialsExecute(ctx context.Context, projectId string, region string, credentialsRef string) (*UpdateCredentialsResponse, error) { + r := UpdateCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + credentialsRef: credentialsRef, + } + return r.Execute() +} + +type UpdateLoadBalancerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string + updateLoadBalancerPayload *UpdateLoadBalancerPayload +} + +func (r UpdateLoadBalancerRequest) UpdateLoadBalancerPayload(updateLoadBalancerPayload UpdateLoadBalancerPayload) ApiUpdateLoadBalancerRequest { + r.updateLoadBalancerPayload = &updateLoadBalancerPayload + return r +} + +func (r UpdateLoadBalancerRequest) Execute() (*LoadBalancer, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoadBalancer + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateLoadBalancer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/load-balancers/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateLoadBalancerPayload == nil { + return localVarReturnValue, fmt.Errorf("updateLoadBalancerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateLoadBalancerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateLoadBalancer: Update a load balancer in a project. + +Updates an existing Application Load Balancer by modifying its listeners and target pools. + + Ensure the resource version is current to maintain concurrency safety. + The default load balancing algorithm is Maglev, and selecting a different algorithm is currently not supported. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiUpdateLoadBalancerRequest +*/ +func (a *APIClient) UpdateLoadBalancer(ctx context.Context, projectId string, region string, name string) ApiUpdateLoadBalancerRequest { + return UpdateLoadBalancerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) UpdateLoadBalancerExecute(ctx context.Context, projectId string, region string, name string) (*LoadBalancer, error) { + r := UpdateLoadBalancerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type UpdateTargetPoolRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string + targetPoolName string + updateTargetPoolPayload *UpdateTargetPoolPayload +} + +func (r UpdateTargetPoolRequest) UpdateTargetPoolPayload(updateTargetPoolPayload UpdateTargetPoolPayload) ApiUpdateTargetPoolRequest { + r.updateTargetPoolPayload = &updateTargetPoolPayload + return r +} + +func (r UpdateTargetPoolRequest) Execute() (*TargetPool, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TargetPool + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateTargetPool") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta2/projects/{projectId}/regions/{region}/load-balancers/{name}/target-pools/{targetPoolName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"targetPoolName"+"}", url.PathEscape(ParameterValueToString(r.targetPoolName, "targetPoolName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateTargetPoolPayload == nil { + return localVarReturnValue, fmt.Errorf("updateTargetPoolPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateTargetPoolPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateTargetPool: Update a single target pool of a load balancer in a project. + +Replaces the content of a specific target pool in the Application Load Balancer (useful for adding or removing target servers). + + Only updates the specified target pool, leaving others unchanged. + Cannot be used to create or rename target pools. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @param targetPoolName + @return ApiUpdateTargetPoolRequest +*/ +func (a *APIClient) UpdateTargetPool(ctx context.Context, projectId string, region string, name string, targetPoolName string) ApiUpdateTargetPoolRequest { + return UpdateTargetPoolRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + targetPoolName: targetPoolName, + } +} + +func (a *APIClient) UpdateTargetPoolExecute(ctx context.Context, projectId string, region string, name string, targetPoolName string) (*TargetPool, error) { + r := UpdateTargetPoolRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + targetPoolName: targetPoolName, + } + return r.Execute() +} diff --git a/pkg/albbeta/api_default_test.go b/pkg/albbeta/api_default_test.go new file mode 100644 index 00000000..6afff118 --- /dev/null +++ b/pkg/albbeta/api_default_test.go @@ -0,0 +1,767 @@ +/* +STACKIT Application Load Balancer API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package albbeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_albbeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateCredentials", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/credentials" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateCredentialsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createCredentialsPayload := CreateCredentialsPayload{} + + resp, reqErr := apiClient.CreateCredentials(context.Background(), projectId, region).CreateCredentialsPayload(createCredentialsPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateLoadBalancer", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/load-balancers" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LoadBalancer{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createLoadBalancerPayload := CreateLoadBalancerPayload{} + + resp, reqErr := apiClient.CreateLoadBalancer(context.Background(), projectId, region).CreateLoadBalancerPayload(createLoadBalancerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/credentials/{credentialsRef}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + credentialsRefValue := "credentialsRef-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(credentialsRefValue, "credentialsRef")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + credentialsRef := credentialsRefValue + + resp, reqErr := apiClient.DeleteCredentials(context.Background(), projectId, region, credentialsRef).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteLoadBalancer", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/load-balancers/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + + resp, reqErr := apiClient.DeleteLoadBalancer(context.Background(), projectId, region, name).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/credentials/{credentialsRef}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + credentialsRefValue := "credentialsRef-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(credentialsRefValue, "credentialsRef")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetCredentialsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + credentialsRef := credentialsRefValue + + resp, reqErr := apiClient.GetCredentials(context.Background(), projectId, region, credentialsRef).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetLoadBalancer", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/load-balancers/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LoadBalancer{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + + resp, reqErr := apiClient.GetLoadBalancer(context.Background(), projectId, region, name).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetQuota", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/quota" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetQuotaResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.GetQuota(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/credentials" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListCredentialsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListCredentials(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListLoadBalancers", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/load-balancers" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListLoadBalancersResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListLoadBalancers(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListPlans", func(t *testing.T) { + _apiUrlPath := "/v2beta2/regions/{region}/plans" + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListPlansResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + region := regionValue + + resp, reqErr := apiClient.ListPlans(context.Background(), region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateCredentials", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/credentials/{credentialsRef}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + credentialsRefValue := "credentialsRef-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"credentialsRef"+"}", url.PathEscape(ParameterValueToString(credentialsRefValue, "credentialsRef")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := UpdateCredentialsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + credentialsRef := credentialsRefValue + updateCredentialsPayload := UpdateCredentialsPayload{} + + resp, reqErr := apiClient.UpdateCredentials(context.Background(), projectId, region, credentialsRef).UpdateCredentialsPayload(updateCredentialsPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateLoadBalancer", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/load-balancers/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LoadBalancer{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + updateLoadBalancerPayload := UpdateLoadBalancerPayload{} + + resp, reqErr := apiClient.UpdateLoadBalancer(context.Background(), projectId, region, name).UpdateLoadBalancerPayload(updateLoadBalancerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateTargetPool", func(t *testing.T) { + _apiUrlPath := "/v2beta2/projects/{projectId}/regions/{region}/load-balancers/{name}/target-pools/{targetPoolName}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + targetPoolNameValue := "targetPoolName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"targetPoolName"+"}", url.PathEscape(ParameterValueToString(targetPoolNameValue, "targetPoolName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := TargetPool{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + targetPoolName := targetPoolNameValue + updateTargetPoolPayload := UpdateTargetPoolPayload{} + + resp, reqErr := apiClient.UpdateTargetPool(context.Background(), projectId, region, name, targetPoolName).UpdateTargetPoolPayload(updateTargetPoolPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/albbeta/client.go b/pkg/albbeta/client.go new file mode 100644 index 00000000..1059e022 --- /dev/null +++ b/pkg/albbeta/client.go @@ -0,0 +1,628 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Application Load Balancer API API v2beta2.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/albbeta/configuration.go b/pkg/albbeta/configuration.go new file mode 100644 index 00000000..664a02a7 --- /dev/null +++ b/pkg/albbeta/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/albbeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://alb.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/albbeta/model_active_health_check.go b/pkg/albbeta/model_active_health_check.go new file mode 100644 index 00000000..4c1a019c --- /dev/null +++ b/pkg/albbeta/model_active_health_check.go @@ -0,0 +1,372 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the ActiveHealthCheck type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ActiveHealthCheck{} + +/* + types and functions for healthyThreshold +*/ + +// isInteger +type ActiveHealthCheckGetHealthyThresholdAttributeType = *int64 +type ActiveHealthCheckGetHealthyThresholdArgType = int64 +type ActiveHealthCheckGetHealthyThresholdRetType = int64 + +func getActiveHealthCheckGetHealthyThresholdAttributeTypeOk(arg ActiveHealthCheckGetHealthyThresholdAttributeType) (ret ActiveHealthCheckGetHealthyThresholdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setActiveHealthCheckGetHealthyThresholdAttributeType(arg *ActiveHealthCheckGetHealthyThresholdAttributeType, val ActiveHealthCheckGetHealthyThresholdRetType) { + *arg = &val +} + +/* + types and functions for httpHealthChecks +*/ + +// isModel +type ActiveHealthCheckGetHttpHealthChecksAttributeType = *HttpHealthChecks +type ActiveHealthCheckGetHttpHealthChecksArgType = HttpHealthChecks +type ActiveHealthCheckGetHttpHealthChecksRetType = HttpHealthChecks + +func getActiveHealthCheckGetHttpHealthChecksAttributeTypeOk(arg ActiveHealthCheckGetHttpHealthChecksAttributeType) (ret ActiveHealthCheckGetHttpHealthChecksRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setActiveHealthCheckGetHttpHealthChecksAttributeType(arg *ActiveHealthCheckGetHttpHealthChecksAttributeType, val ActiveHealthCheckGetHttpHealthChecksRetType) { + *arg = &val +} + +/* + types and functions for interval +*/ + +// isNotNullableString +type ActiveHealthCheckGetIntervalAttributeType = *string + +func getActiveHealthCheckGetIntervalAttributeTypeOk(arg ActiveHealthCheckGetIntervalAttributeType) (ret ActiveHealthCheckGetIntervalRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setActiveHealthCheckGetIntervalAttributeType(arg *ActiveHealthCheckGetIntervalAttributeType, val ActiveHealthCheckGetIntervalRetType) { + *arg = &val +} + +type ActiveHealthCheckGetIntervalArgType = string +type ActiveHealthCheckGetIntervalRetType = string + +/* + types and functions for intervalJitter +*/ + +// isNotNullableString +type ActiveHealthCheckGetIntervalJitterAttributeType = *string + +func getActiveHealthCheckGetIntervalJitterAttributeTypeOk(arg ActiveHealthCheckGetIntervalJitterAttributeType) (ret ActiveHealthCheckGetIntervalJitterRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setActiveHealthCheckGetIntervalJitterAttributeType(arg *ActiveHealthCheckGetIntervalJitterAttributeType, val ActiveHealthCheckGetIntervalJitterRetType) { + *arg = &val +} + +type ActiveHealthCheckGetIntervalJitterArgType = string +type ActiveHealthCheckGetIntervalJitterRetType = string + +/* + types and functions for timeout +*/ + +// isNotNullableString +type ActiveHealthCheckGetTimeoutAttributeType = *string + +func getActiveHealthCheckGetTimeoutAttributeTypeOk(arg ActiveHealthCheckGetTimeoutAttributeType) (ret ActiveHealthCheckGetTimeoutRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setActiveHealthCheckGetTimeoutAttributeType(arg *ActiveHealthCheckGetTimeoutAttributeType, val ActiveHealthCheckGetTimeoutRetType) { + *arg = &val +} + +type ActiveHealthCheckGetTimeoutArgType = string +type ActiveHealthCheckGetTimeoutRetType = string + +/* + types and functions for unhealthyThreshold +*/ + +// isInteger +type ActiveHealthCheckGetUnhealthyThresholdAttributeType = *int64 +type ActiveHealthCheckGetUnhealthyThresholdArgType = int64 +type ActiveHealthCheckGetUnhealthyThresholdRetType = int64 + +func getActiveHealthCheckGetUnhealthyThresholdAttributeTypeOk(arg ActiveHealthCheckGetUnhealthyThresholdAttributeType) (ret ActiveHealthCheckGetUnhealthyThresholdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setActiveHealthCheckGetUnhealthyThresholdAttributeType(arg *ActiveHealthCheckGetUnhealthyThresholdAttributeType, val ActiveHealthCheckGetUnhealthyThresholdRetType) { + *arg = &val +} + +// ActiveHealthCheck struct for ActiveHealthCheck +type ActiveHealthCheck struct { + // Healthy threshold of the health checking + // Can be cast to int32 without loss of precision. + HealthyThreshold ActiveHealthCheckGetHealthyThresholdAttributeType `json:"healthyThreshold,omitempty"` + HttpHealthChecks ActiveHealthCheckGetHttpHealthChecksAttributeType `json:"httpHealthChecks,omitempty"` + // Interval duration of health checking in seconds + Interval ActiveHealthCheckGetIntervalAttributeType `json:"interval,omitempty"` + // Interval duration threshold of the health checking in seconds + IntervalJitter ActiveHealthCheckGetIntervalJitterAttributeType `json:"intervalJitter,omitempty"` + // Active health checking timeout duration in seconds + Timeout ActiveHealthCheckGetTimeoutAttributeType `json:"timeout,omitempty"` + // Unhealthy threshold of the health checking + // Can be cast to int32 without loss of precision. + UnhealthyThreshold ActiveHealthCheckGetUnhealthyThresholdAttributeType `json:"unhealthyThreshold,omitempty"` +} + +// NewActiveHealthCheck instantiates a new ActiveHealthCheck 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 NewActiveHealthCheck() *ActiveHealthCheck { + this := ActiveHealthCheck{} + return &this +} + +// NewActiveHealthCheckWithDefaults instantiates a new ActiveHealthCheck 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 NewActiveHealthCheckWithDefaults() *ActiveHealthCheck { + this := ActiveHealthCheck{} + return &this +} + +// GetHealthyThreshold returns the HealthyThreshold field value if set, zero value otherwise. +func (o *ActiveHealthCheck) GetHealthyThreshold() (res ActiveHealthCheckGetHealthyThresholdRetType) { + res, _ = o.GetHealthyThresholdOk() + return +} + +// GetHealthyThresholdOk returns a tuple with the HealthyThreshold field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActiveHealthCheck) GetHealthyThresholdOk() (ret ActiveHealthCheckGetHealthyThresholdRetType, ok bool) { + return getActiveHealthCheckGetHealthyThresholdAttributeTypeOk(o.HealthyThreshold) +} + +// HasHealthyThreshold returns a boolean if a field has been set. +func (o *ActiveHealthCheck) HasHealthyThreshold() bool { + _, ok := o.GetHealthyThresholdOk() + return ok +} + +// SetHealthyThreshold gets a reference to the given int64 and assigns it to the HealthyThreshold field. +func (o *ActiveHealthCheck) SetHealthyThreshold(v ActiveHealthCheckGetHealthyThresholdRetType) { + setActiveHealthCheckGetHealthyThresholdAttributeType(&o.HealthyThreshold, v) +} + +// GetHttpHealthChecks returns the HttpHealthChecks field value if set, zero value otherwise. +func (o *ActiveHealthCheck) GetHttpHealthChecks() (res ActiveHealthCheckGetHttpHealthChecksRetType) { + res, _ = o.GetHttpHealthChecksOk() + return +} + +// GetHttpHealthChecksOk returns a tuple with the HttpHealthChecks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActiveHealthCheck) GetHttpHealthChecksOk() (ret ActiveHealthCheckGetHttpHealthChecksRetType, ok bool) { + return getActiveHealthCheckGetHttpHealthChecksAttributeTypeOk(o.HttpHealthChecks) +} + +// HasHttpHealthChecks returns a boolean if a field has been set. +func (o *ActiveHealthCheck) HasHttpHealthChecks() bool { + _, ok := o.GetHttpHealthChecksOk() + return ok +} + +// SetHttpHealthChecks gets a reference to the given HttpHealthChecks and assigns it to the HttpHealthChecks field. +func (o *ActiveHealthCheck) SetHttpHealthChecks(v ActiveHealthCheckGetHttpHealthChecksRetType) { + setActiveHealthCheckGetHttpHealthChecksAttributeType(&o.HttpHealthChecks, v) +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *ActiveHealthCheck) GetInterval() (res ActiveHealthCheckGetIntervalRetType) { + res, _ = o.GetIntervalOk() + return +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActiveHealthCheck) GetIntervalOk() (ret ActiveHealthCheckGetIntervalRetType, ok bool) { + return getActiveHealthCheckGetIntervalAttributeTypeOk(o.Interval) +} + +// HasInterval returns a boolean if a field has been set. +func (o *ActiveHealthCheck) HasInterval() bool { + _, ok := o.GetIntervalOk() + return ok +} + +// SetInterval gets a reference to the given string and assigns it to the Interval field. +func (o *ActiveHealthCheck) SetInterval(v ActiveHealthCheckGetIntervalRetType) { + setActiveHealthCheckGetIntervalAttributeType(&o.Interval, v) +} + +// GetIntervalJitter returns the IntervalJitter field value if set, zero value otherwise. +func (o *ActiveHealthCheck) GetIntervalJitter() (res ActiveHealthCheckGetIntervalJitterRetType) { + res, _ = o.GetIntervalJitterOk() + return +} + +// GetIntervalJitterOk returns a tuple with the IntervalJitter field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActiveHealthCheck) GetIntervalJitterOk() (ret ActiveHealthCheckGetIntervalJitterRetType, ok bool) { + return getActiveHealthCheckGetIntervalJitterAttributeTypeOk(o.IntervalJitter) +} + +// HasIntervalJitter returns a boolean if a field has been set. +func (o *ActiveHealthCheck) HasIntervalJitter() bool { + _, ok := o.GetIntervalJitterOk() + return ok +} + +// SetIntervalJitter gets a reference to the given string and assigns it to the IntervalJitter field. +func (o *ActiveHealthCheck) SetIntervalJitter(v ActiveHealthCheckGetIntervalJitterRetType) { + setActiveHealthCheckGetIntervalJitterAttributeType(&o.IntervalJitter, v) +} + +// GetTimeout returns the Timeout field value if set, zero value otherwise. +func (o *ActiveHealthCheck) GetTimeout() (res ActiveHealthCheckGetTimeoutRetType) { + res, _ = o.GetTimeoutOk() + return +} + +// GetTimeoutOk returns a tuple with the Timeout field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActiveHealthCheck) GetTimeoutOk() (ret ActiveHealthCheckGetTimeoutRetType, ok bool) { + return getActiveHealthCheckGetTimeoutAttributeTypeOk(o.Timeout) +} + +// HasTimeout returns a boolean if a field has been set. +func (o *ActiveHealthCheck) HasTimeout() bool { + _, ok := o.GetTimeoutOk() + return ok +} + +// SetTimeout gets a reference to the given string and assigns it to the Timeout field. +func (o *ActiveHealthCheck) SetTimeout(v ActiveHealthCheckGetTimeoutRetType) { + setActiveHealthCheckGetTimeoutAttributeType(&o.Timeout, v) +} + +// GetUnhealthyThreshold returns the UnhealthyThreshold field value if set, zero value otherwise. +func (o *ActiveHealthCheck) GetUnhealthyThreshold() (res ActiveHealthCheckGetUnhealthyThresholdRetType) { + res, _ = o.GetUnhealthyThresholdOk() + return +} + +// GetUnhealthyThresholdOk returns a tuple with the UnhealthyThreshold field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ActiveHealthCheck) GetUnhealthyThresholdOk() (ret ActiveHealthCheckGetUnhealthyThresholdRetType, ok bool) { + return getActiveHealthCheckGetUnhealthyThresholdAttributeTypeOk(o.UnhealthyThreshold) +} + +// HasUnhealthyThreshold returns a boolean if a field has been set. +func (o *ActiveHealthCheck) HasUnhealthyThreshold() bool { + _, ok := o.GetUnhealthyThresholdOk() + return ok +} + +// SetUnhealthyThreshold gets a reference to the given int64 and assigns it to the UnhealthyThreshold field. +func (o *ActiveHealthCheck) SetUnhealthyThreshold(v ActiveHealthCheckGetUnhealthyThresholdRetType) { + setActiveHealthCheckGetUnhealthyThresholdAttributeType(&o.UnhealthyThreshold, v) +} + +func (o ActiveHealthCheck) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getActiveHealthCheckGetHealthyThresholdAttributeTypeOk(o.HealthyThreshold); ok { + toSerialize["HealthyThreshold"] = val + } + if val, ok := getActiveHealthCheckGetHttpHealthChecksAttributeTypeOk(o.HttpHealthChecks); ok { + toSerialize["HttpHealthChecks"] = val + } + if val, ok := getActiveHealthCheckGetIntervalAttributeTypeOk(o.Interval); ok { + toSerialize["Interval"] = val + } + if val, ok := getActiveHealthCheckGetIntervalJitterAttributeTypeOk(o.IntervalJitter); ok { + toSerialize["IntervalJitter"] = val + } + if val, ok := getActiveHealthCheckGetTimeoutAttributeTypeOk(o.Timeout); ok { + toSerialize["Timeout"] = val + } + if val, ok := getActiveHealthCheckGetUnhealthyThresholdAttributeTypeOk(o.UnhealthyThreshold); ok { + toSerialize["UnhealthyThreshold"] = val + } + return toSerialize, nil +} + +type NullableActiveHealthCheck struct { + value *ActiveHealthCheck + isSet bool +} + +func (v NullableActiveHealthCheck) Get() *ActiveHealthCheck { + return v.value +} + +func (v *NullableActiveHealthCheck) Set(val *ActiveHealthCheck) { + v.value = val + v.isSet = true +} + +func (v NullableActiveHealthCheck) IsSet() bool { + return v.isSet +} + +func (v *NullableActiveHealthCheck) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableActiveHealthCheck(val *ActiveHealthCheck) *NullableActiveHealthCheck { + return &NullableActiveHealthCheck{value: val, isSet: true} +} + +func (v NullableActiveHealthCheck) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableActiveHealthCheck) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_active_health_check_test.go b/pkg/albbeta/model_active_health_check_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_active_health_check_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_certificate_config.go b/pkg/albbeta/model_certificate_config.go new file mode 100644 index 00000000..3546eaba --- /dev/null +++ b/pkg/albbeta/model_certificate_config.go @@ -0,0 +1,128 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the CertificateConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CertificateConfig{} + +/* + types and functions for certificateIds +*/ + +// isArray +type CertificateConfigGetCertificateIdsAttributeType = *[]string +type CertificateConfigGetCertificateIdsArgType = []string +type CertificateConfigGetCertificateIdsRetType = []string + +func getCertificateConfigGetCertificateIdsAttributeTypeOk(arg CertificateConfigGetCertificateIdsAttributeType) (ret CertificateConfigGetCertificateIdsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCertificateConfigGetCertificateIdsAttributeType(arg *CertificateConfigGetCertificateIdsAttributeType, val CertificateConfigGetCertificateIdsRetType) { + *arg = &val +} + +// CertificateConfig TLS termination certificate configuration. +type CertificateConfig struct { + // Certificate IDs for TLS termination. + CertificateIds CertificateConfigGetCertificateIdsAttributeType `json:"certificateIds,omitempty"` +} + +// NewCertificateConfig instantiates a new CertificateConfig 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 NewCertificateConfig() *CertificateConfig { + this := CertificateConfig{} + return &this +} + +// NewCertificateConfigWithDefaults instantiates a new CertificateConfig 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 NewCertificateConfigWithDefaults() *CertificateConfig { + this := CertificateConfig{} + return &this +} + +// GetCertificateIds returns the CertificateIds field value if set, zero value otherwise. +func (o *CertificateConfig) GetCertificateIds() (res CertificateConfigGetCertificateIdsRetType) { + res, _ = o.GetCertificateIdsOk() + return +} + +// GetCertificateIdsOk returns a tuple with the CertificateIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CertificateConfig) GetCertificateIdsOk() (ret CertificateConfigGetCertificateIdsRetType, ok bool) { + return getCertificateConfigGetCertificateIdsAttributeTypeOk(o.CertificateIds) +} + +// HasCertificateIds returns a boolean if a field has been set. +func (o *CertificateConfig) HasCertificateIds() bool { + _, ok := o.GetCertificateIdsOk() + return ok +} + +// SetCertificateIds gets a reference to the given []string and assigns it to the CertificateIds field. +func (o *CertificateConfig) SetCertificateIds(v CertificateConfigGetCertificateIdsRetType) { + setCertificateConfigGetCertificateIdsAttributeType(&o.CertificateIds, v) +} + +func (o CertificateConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCertificateConfigGetCertificateIdsAttributeTypeOk(o.CertificateIds); ok { + toSerialize["CertificateIds"] = val + } + return toSerialize, nil +} + +type NullableCertificateConfig struct { + value *CertificateConfig + isSet bool +} + +func (v NullableCertificateConfig) Get() *CertificateConfig { + return v.value +} + +func (v *NullableCertificateConfig) Set(val *CertificateConfig) { + v.value = val + v.isSet = true +} + +func (v NullableCertificateConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableCertificateConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCertificateConfig(val *CertificateConfig) *NullableCertificateConfig { + return &NullableCertificateConfig{value: val, isSet: true} +} + +func (v NullableCertificateConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCertificateConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_certificate_config_test.go b/pkg/albbeta/model_certificate_config_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_certificate_config_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_cookie_persistence.go b/pkg/albbeta/model_cookie_persistence.go new file mode 100644 index 00000000..b1c7ac49 --- /dev/null +++ b/pkg/albbeta/model_cookie_persistence.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the CookiePersistence type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CookiePersistence{} + +/* + types and functions for name +*/ + +// isNotNullableString +type CookiePersistenceGetNameAttributeType = *string + +func getCookiePersistenceGetNameAttributeTypeOk(arg CookiePersistenceGetNameAttributeType) (ret CookiePersistenceGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCookiePersistenceGetNameAttributeType(arg *CookiePersistenceGetNameAttributeType, val CookiePersistenceGetNameRetType) { + *arg = &val +} + +type CookiePersistenceGetNameArgType = string +type CookiePersistenceGetNameRetType = string + +/* + types and functions for ttl +*/ + +// isNotNullableString +type CookiePersistenceGetTtlAttributeType = *string + +func getCookiePersistenceGetTtlAttributeTypeOk(arg CookiePersistenceGetTtlAttributeType) (ret CookiePersistenceGetTtlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCookiePersistenceGetTtlAttributeType(arg *CookiePersistenceGetTtlAttributeType, val CookiePersistenceGetTtlRetType) { + *arg = &val +} + +type CookiePersistenceGetTtlArgType = string +type CookiePersistenceGetTtlRetType = string + +// CookiePersistence struct for CookiePersistence +type CookiePersistence struct { + // Cookie is the name of the cookie to use. + Name CookiePersistenceGetNameAttributeType `json:"name,omitempty"` + // TTL specifies the time-to-live for the cookie. The default value is 0s, and it acts as a session cookie, expiring when the client session ends. + Ttl CookiePersistenceGetTtlAttributeType `json:"ttl,omitempty"` +} + +// NewCookiePersistence instantiates a new CookiePersistence 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 NewCookiePersistence() *CookiePersistence { + this := CookiePersistence{} + return &this +} + +// NewCookiePersistenceWithDefaults instantiates a new CookiePersistence 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 NewCookiePersistenceWithDefaults() *CookiePersistence { + this := CookiePersistence{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CookiePersistence) GetName() (res CookiePersistenceGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CookiePersistence) GetNameOk() (ret CookiePersistenceGetNameRetType, ok bool) { + return getCookiePersistenceGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CookiePersistence) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CookiePersistence) SetName(v CookiePersistenceGetNameRetType) { + setCookiePersistenceGetNameAttributeType(&o.Name, v) +} + +// GetTtl returns the Ttl field value if set, zero value otherwise. +func (o *CookiePersistence) GetTtl() (res CookiePersistenceGetTtlRetType) { + res, _ = o.GetTtlOk() + return +} + +// GetTtlOk returns a tuple with the Ttl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CookiePersistence) GetTtlOk() (ret CookiePersistenceGetTtlRetType, ok bool) { + return getCookiePersistenceGetTtlAttributeTypeOk(o.Ttl) +} + +// HasTtl returns a boolean if a field has been set. +func (o *CookiePersistence) HasTtl() bool { + _, ok := o.GetTtlOk() + return ok +} + +// SetTtl gets a reference to the given string and assigns it to the Ttl field. +func (o *CookiePersistence) SetTtl(v CookiePersistenceGetTtlRetType) { + setCookiePersistenceGetTtlAttributeType(&o.Ttl, v) +} + +func (o CookiePersistence) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCookiePersistenceGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCookiePersistenceGetTtlAttributeTypeOk(o.Ttl); ok { + toSerialize["Ttl"] = val + } + return toSerialize, nil +} + +type NullableCookiePersistence struct { + value *CookiePersistence + isSet bool +} + +func (v NullableCookiePersistence) Get() *CookiePersistence { + return v.value +} + +func (v *NullableCookiePersistence) Set(val *CookiePersistence) { + v.value = val + v.isSet = true +} + +func (v NullableCookiePersistence) IsSet() bool { + return v.isSet +} + +func (v *NullableCookiePersistence) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCookiePersistence(val *CookiePersistence) *NullableCookiePersistence { + return &NullableCookiePersistence{value: val, isSet: true} +} + +func (v NullableCookiePersistence) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCookiePersistence) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_cookie_persistence_test.go b/pkg/albbeta/model_cookie_persistence_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_cookie_persistence_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_create_credentials_payload.go b/pkg/albbeta/model_create_credentials_payload.go new file mode 100644 index 00000000..a49f705c --- /dev/null +++ b/pkg/albbeta/model_create_credentials_payload.go @@ -0,0 +1,227 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the CreateCredentialsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCredentialsPayload{} + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateCredentialsPayloadGetDisplayNameAttributeType = *string + +func getCreateCredentialsPayloadGetDisplayNameAttributeTypeOk(arg CreateCredentialsPayloadGetDisplayNameAttributeType) (ret CreateCredentialsPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCredentialsPayloadGetDisplayNameAttributeType(arg *CreateCredentialsPayloadGetDisplayNameAttributeType, val CreateCredentialsPayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateCredentialsPayloadGetDisplayNameArgType = string +type CreateCredentialsPayloadGetDisplayNameRetType = string + +/* + types and functions for password +*/ + +// isNotNullableString +type CreateCredentialsPayloadGetPasswordAttributeType = *string + +func getCreateCredentialsPayloadGetPasswordAttributeTypeOk(arg CreateCredentialsPayloadGetPasswordAttributeType) (ret CreateCredentialsPayloadGetPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCredentialsPayloadGetPasswordAttributeType(arg *CreateCredentialsPayloadGetPasswordAttributeType, val CreateCredentialsPayloadGetPasswordRetType) { + *arg = &val +} + +type CreateCredentialsPayloadGetPasswordArgType = string +type CreateCredentialsPayloadGetPasswordRetType = string + +/* + types and functions for username +*/ + +// isNotNullableString +type CreateCredentialsPayloadGetUsernameAttributeType = *string + +func getCreateCredentialsPayloadGetUsernameAttributeTypeOk(arg CreateCredentialsPayloadGetUsernameAttributeType) (ret CreateCredentialsPayloadGetUsernameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCredentialsPayloadGetUsernameAttributeType(arg *CreateCredentialsPayloadGetUsernameAttributeType, val CreateCredentialsPayloadGetUsernameRetType) { + *arg = &val +} + +type CreateCredentialsPayloadGetUsernameArgType = string +type CreateCredentialsPayloadGetUsernameRetType = string + +// CreateCredentialsPayload struct for CreateCredentialsPayload +type CreateCredentialsPayload struct { + // Credential name + DisplayName CreateCredentialsPayloadGetDisplayNameAttributeType `json:"displayName,omitempty"` + // A valid password used for an existing STACKIT Observability instance, which is used during basic auth. + Password CreateCredentialsPayloadGetPasswordAttributeType `json:"password,omitempty"` + // A valid username used for an existing STACKIT Observability instance, which is used during basic auth. + Username CreateCredentialsPayloadGetUsernameAttributeType `json:"username,omitempty"` +} + +// NewCreateCredentialsPayload instantiates a new CreateCredentialsPayload 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 NewCreateCredentialsPayload() *CreateCredentialsPayload { + this := CreateCredentialsPayload{} + return &this +} + +// NewCreateCredentialsPayloadWithDefaults instantiates a new CreateCredentialsPayload 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 NewCreateCredentialsPayloadWithDefaults() *CreateCredentialsPayload { + this := CreateCredentialsPayload{} + return &this +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *CreateCredentialsPayload) GetDisplayName() (res CreateCredentialsPayloadGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCredentialsPayload) GetDisplayNameOk() (ret CreateCredentialsPayloadGetDisplayNameRetType, ok bool) { + return getCreateCredentialsPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *CreateCredentialsPayload) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *CreateCredentialsPayload) SetDisplayName(v CreateCredentialsPayloadGetDisplayNameRetType) { + setCreateCredentialsPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *CreateCredentialsPayload) GetPassword() (res CreateCredentialsPayloadGetPasswordRetType) { + res, _ = o.GetPasswordOk() + return +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCredentialsPayload) GetPasswordOk() (ret CreateCredentialsPayloadGetPasswordRetType, ok bool) { + return getCreateCredentialsPayloadGetPasswordAttributeTypeOk(o.Password) +} + +// HasPassword returns a boolean if a field has been set. +func (o *CreateCredentialsPayload) HasPassword() bool { + _, ok := o.GetPasswordOk() + return ok +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *CreateCredentialsPayload) SetPassword(v CreateCredentialsPayloadGetPasswordRetType) { + setCreateCredentialsPayloadGetPasswordAttributeType(&o.Password, v) +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *CreateCredentialsPayload) GetUsername() (res CreateCredentialsPayloadGetUsernameRetType) { + res, _ = o.GetUsernameOk() + return +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCredentialsPayload) GetUsernameOk() (ret CreateCredentialsPayloadGetUsernameRetType, ok bool) { + return getCreateCredentialsPayloadGetUsernameAttributeTypeOk(o.Username) +} + +// HasUsername returns a boolean if a field has been set. +func (o *CreateCredentialsPayload) HasUsername() bool { + _, ok := o.GetUsernameOk() + return ok +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *CreateCredentialsPayload) SetUsername(v CreateCredentialsPayloadGetUsernameRetType) { + setCreateCredentialsPayloadGetUsernameAttributeType(&o.Username, v) +} + +func (o CreateCredentialsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateCredentialsPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateCredentialsPayloadGetPasswordAttributeTypeOk(o.Password); ok { + toSerialize["Password"] = val + } + if val, ok := getCreateCredentialsPayloadGetUsernameAttributeTypeOk(o.Username); ok { + toSerialize["Username"] = val + } + return toSerialize, nil +} + +type NullableCreateCredentialsPayload struct { + value *CreateCredentialsPayload + isSet bool +} + +func (v NullableCreateCredentialsPayload) Get() *CreateCredentialsPayload { + return v.value +} + +func (v *NullableCreateCredentialsPayload) Set(val *CreateCredentialsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateCredentialsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateCredentialsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateCredentialsPayload(val *CreateCredentialsPayload) *NullableCreateCredentialsPayload { + return &NullableCreateCredentialsPayload{value: val, isSet: true} +} + +func (v NullableCreateCredentialsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateCredentialsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_create_credentials_payload_test.go b/pkg/albbeta/model_create_credentials_payload_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_create_credentials_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_create_credentials_response.go b/pkg/albbeta/model_create_credentials_response.go new file mode 100644 index 00000000..8d27cd84 --- /dev/null +++ b/pkg/albbeta/model_create_credentials_response.go @@ -0,0 +1,127 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the CreateCredentialsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCredentialsResponse{} + +/* + types and functions for credential +*/ + +// isModel +type CreateCredentialsResponseGetCredentialAttributeType = *CredentialsResponse +type CreateCredentialsResponseGetCredentialArgType = CredentialsResponse +type CreateCredentialsResponseGetCredentialRetType = CredentialsResponse + +func getCreateCredentialsResponseGetCredentialAttributeTypeOk(arg CreateCredentialsResponseGetCredentialAttributeType) (ret CreateCredentialsResponseGetCredentialRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCredentialsResponseGetCredentialAttributeType(arg *CreateCredentialsResponseGetCredentialAttributeType, val CreateCredentialsResponseGetCredentialRetType) { + *arg = &val +} + +// CreateCredentialsResponse struct for CreateCredentialsResponse +type CreateCredentialsResponse struct { + Credential CreateCredentialsResponseGetCredentialAttributeType `json:"credential,omitempty"` +} + +// NewCreateCredentialsResponse instantiates a new CreateCredentialsResponse 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 NewCreateCredentialsResponse() *CreateCredentialsResponse { + this := CreateCredentialsResponse{} + return &this +} + +// NewCreateCredentialsResponseWithDefaults instantiates a new CreateCredentialsResponse 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 NewCreateCredentialsResponseWithDefaults() *CreateCredentialsResponse { + this := CreateCredentialsResponse{} + return &this +} + +// GetCredential returns the Credential field value if set, zero value otherwise. +func (o *CreateCredentialsResponse) GetCredential() (res CreateCredentialsResponseGetCredentialRetType) { + res, _ = o.GetCredentialOk() + return +} + +// GetCredentialOk returns a tuple with the Credential field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCredentialsResponse) GetCredentialOk() (ret CreateCredentialsResponseGetCredentialRetType, ok bool) { + return getCreateCredentialsResponseGetCredentialAttributeTypeOk(o.Credential) +} + +// HasCredential returns a boolean if a field has been set. +func (o *CreateCredentialsResponse) HasCredential() bool { + _, ok := o.GetCredentialOk() + return ok +} + +// SetCredential gets a reference to the given CredentialsResponse and assigns it to the Credential field. +func (o *CreateCredentialsResponse) SetCredential(v CreateCredentialsResponseGetCredentialRetType) { + setCreateCredentialsResponseGetCredentialAttributeType(&o.Credential, v) +} + +func (o CreateCredentialsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateCredentialsResponseGetCredentialAttributeTypeOk(o.Credential); ok { + toSerialize["Credential"] = val + } + return toSerialize, nil +} + +type NullableCreateCredentialsResponse struct { + value *CreateCredentialsResponse + isSet bool +} + +func (v NullableCreateCredentialsResponse) Get() *CreateCredentialsResponse { + return v.value +} + +func (v *NullableCreateCredentialsResponse) Set(val *CreateCredentialsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateCredentialsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateCredentialsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateCredentialsResponse(val *CreateCredentialsResponse) *NullableCreateCredentialsResponse { + return &NullableCreateCredentialsResponse{value: val, isSet: true} +} + +func (v NullableCreateCredentialsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateCredentialsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_create_credentials_response_test.go b/pkg/albbeta/model_create_credentials_response_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_create_credentials_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_create_load_balancer_payload.go b/pkg/albbeta/model_create_load_balancer_payload.go new file mode 100644 index 00000000..2460d525 --- /dev/null +++ b/pkg/albbeta/model_create_load_balancer_payload.go @@ -0,0 +1,961 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateLoadBalancerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateLoadBalancerPayload{} + +/* + types and functions for disableTargetSecurityGroupAssignment +*/ + +// isBoolean +type CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType = *bool +type CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentArgType = bool +type CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType = bool + +func getCreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeTypeOk(arg CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType) (ret CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType(arg *CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType, val CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType) { + *arg = &val +} + +/* + types and functions for errors +*/ + +// isArray +type CreateLoadBalancerPayloadGetErrorsAttributeType = *[]LoadBalancerError +type CreateLoadBalancerPayloadGetErrorsArgType = []LoadBalancerError +type CreateLoadBalancerPayloadGetErrorsRetType = []LoadBalancerError + +func getCreateLoadBalancerPayloadGetErrorsAttributeTypeOk(arg CreateLoadBalancerPayloadGetErrorsAttributeType) (ret CreateLoadBalancerPayloadGetErrorsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetErrorsAttributeType(arg *CreateLoadBalancerPayloadGetErrorsAttributeType, val CreateLoadBalancerPayloadGetErrorsRetType) { + *arg = &val +} + +/* + types and functions for externalAddress +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadGetExternalAddressAttributeType = *string + +func getCreateLoadBalancerPayloadGetExternalAddressAttributeTypeOk(arg CreateLoadBalancerPayloadGetExternalAddressAttributeType) (ret CreateLoadBalancerPayloadGetExternalAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetExternalAddressAttributeType(arg *CreateLoadBalancerPayloadGetExternalAddressAttributeType, val CreateLoadBalancerPayloadGetExternalAddressRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadGetExternalAddressArgType = string +type CreateLoadBalancerPayloadGetExternalAddressRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type CreateLoadBalancerPayloadGetLabelsAttributeType = *map[string]string +type CreateLoadBalancerPayloadGetLabelsArgType = map[string]string +type CreateLoadBalancerPayloadGetLabelsRetType = map[string]string + +func getCreateLoadBalancerPayloadGetLabelsAttributeTypeOk(arg CreateLoadBalancerPayloadGetLabelsAttributeType) (ret CreateLoadBalancerPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetLabelsAttributeType(arg *CreateLoadBalancerPayloadGetLabelsAttributeType, val CreateLoadBalancerPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for listeners +*/ + +// isArray +type CreateLoadBalancerPayloadGetListenersAttributeType = *[]Listener +type CreateLoadBalancerPayloadGetListenersArgType = []Listener +type CreateLoadBalancerPayloadGetListenersRetType = []Listener + +func getCreateLoadBalancerPayloadGetListenersAttributeTypeOk(arg CreateLoadBalancerPayloadGetListenersAttributeType) (ret CreateLoadBalancerPayloadGetListenersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetListenersAttributeType(arg *CreateLoadBalancerPayloadGetListenersAttributeType, val CreateLoadBalancerPayloadGetListenersRetType) { + *arg = &val +} + +/* + types and functions for loadBalancerSecurityGroup +*/ + +// isModel +type CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType = *CreateLoadBalancerPayloadLoadBalancerSecurityGroup +type CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupArgType = CreateLoadBalancerPayloadLoadBalancerSecurityGroup +type CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType = CreateLoadBalancerPayloadLoadBalancerSecurityGroup + +func getCreateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeTypeOk(arg CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType) (ret CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType(arg *CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType, val CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadGetNameAttributeType = *string + +func getCreateLoadBalancerPayloadGetNameAttributeTypeOk(arg CreateLoadBalancerPayloadGetNameAttributeType) (ret CreateLoadBalancerPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetNameAttributeType(arg *CreateLoadBalancerPayloadGetNameAttributeType, val CreateLoadBalancerPayloadGetNameRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadGetNameArgType = string +type CreateLoadBalancerPayloadGetNameRetType = string + +/* + types and functions for networks +*/ + +// isArray +type CreateLoadBalancerPayloadGetNetworksAttributeType = *[]Network +type CreateLoadBalancerPayloadGetNetworksArgType = []Network +type CreateLoadBalancerPayloadGetNetworksRetType = []Network + +func getCreateLoadBalancerPayloadGetNetworksAttributeTypeOk(arg CreateLoadBalancerPayloadGetNetworksAttributeType) (ret CreateLoadBalancerPayloadGetNetworksRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetNetworksAttributeType(arg *CreateLoadBalancerPayloadGetNetworksAttributeType, val CreateLoadBalancerPayloadGetNetworksRetType) { + *arg = &val +} + +/* + types and functions for options +*/ + +// isModel +type CreateLoadBalancerPayloadGetOptionsAttributeType = *LoadBalancerOptions +type CreateLoadBalancerPayloadGetOptionsArgType = LoadBalancerOptions +type CreateLoadBalancerPayloadGetOptionsRetType = LoadBalancerOptions + +func getCreateLoadBalancerPayloadGetOptionsAttributeTypeOk(arg CreateLoadBalancerPayloadGetOptionsAttributeType) (ret CreateLoadBalancerPayloadGetOptionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetOptionsAttributeType(arg *CreateLoadBalancerPayloadGetOptionsAttributeType, val CreateLoadBalancerPayloadGetOptionsRetType) { + *arg = &val +} + +/* + types and functions for planId +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadGetPlanIdAttributeType = *string + +func getCreateLoadBalancerPayloadGetPlanIdAttributeTypeOk(arg CreateLoadBalancerPayloadGetPlanIdAttributeType) (ret CreateLoadBalancerPayloadGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetPlanIdAttributeType(arg *CreateLoadBalancerPayloadGetPlanIdAttributeType, val CreateLoadBalancerPayloadGetPlanIdRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadGetPlanIdArgType = string +type CreateLoadBalancerPayloadGetPlanIdRetType = string + +/* + types and functions for privateAddress +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadGetPrivateAddressAttributeType = *string + +func getCreateLoadBalancerPayloadGetPrivateAddressAttributeTypeOk(arg CreateLoadBalancerPayloadGetPrivateAddressAttributeType) (ret CreateLoadBalancerPayloadGetPrivateAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetPrivateAddressAttributeType(arg *CreateLoadBalancerPayloadGetPrivateAddressAttributeType, val CreateLoadBalancerPayloadGetPrivateAddressRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadGetPrivateAddressArgType = string +type CreateLoadBalancerPayloadGetPrivateAddressRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadGetRegionAttributeType = *string + +func getCreateLoadBalancerPayloadGetRegionAttributeTypeOk(arg CreateLoadBalancerPayloadGetRegionAttributeType) (ret CreateLoadBalancerPayloadGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetRegionAttributeType(arg *CreateLoadBalancerPayloadGetRegionAttributeType, val CreateLoadBalancerPayloadGetRegionRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadGetRegionArgType = string +type CreateLoadBalancerPayloadGetRegionRetType = string + +/* + types and functions for status +*/ + +// isEnum + +// CreateLoadBalancerPayloadStatus the model 'CreateLoadBalancerPayload' +// value type for enums +type CreateLoadBalancerPayloadStatus string + +// List of Status +const ( + CREATELOADBALANCERPAYLOADSTATUS_UNSPECIFIED CreateLoadBalancerPayloadStatus = "STATUS_UNSPECIFIED" + CREATELOADBALANCERPAYLOADSTATUS_PENDING CreateLoadBalancerPayloadStatus = "STATUS_PENDING" + CREATELOADBALANCERPAYLOADSTATUS_READY CreateLoadBalancerPayloadStatus = "STATUS_READY" + CREATELOADBALANCERPAYLOADSTATUS_ERROR CreateLoadBalancerPayloadStatus = "STATUS_ERROR" + CREATELOADBALANCERPAYLOADSTATUS_TERMINATING CreateLoadBalancerPayloadStatus = "STATUS_TERMINATING" +) + +// All allowed values of CreateLoadBalancerPayload enum +var AllowedCreateLoadBalancerPayloadStatusEnumValues = []CreateLoadBalancerPayloadStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *CreateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson CreateLoadBalancerPayloadStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := CreateLoadBalancerPayloadStatus(value) + for _, existing := range AllowedCreateLoadBalancerPayloadStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateLoadBalancerPayload", value) +} + +// NewCreateLoadBalancerPayloadStatusFromValue returns a pointer to a valid CreateLoadBalancerPayloadStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateLoadBalancerPayloadStatusFromValue(v CreateLoadBalancerPayloadStatus) (*CreateLoadBalancerPayloadStatus, error) { + ev := CreateLoadBalancerPayloadStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateLoadBalancerPayloadStatus: valid values are %v", v, AllowedCreateLoadBalancerPayloadStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateLoadBalancerPayloadStatus) IsValid() bool { + for _, existing := range AllowedCreateLoadBalancerPayloadStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v CreateLoadBalancerPayloadStatus) Ptr() *CreateLoadBalancerPayloadStatus { + return &v +} + +type NullableCreateLoadBalancerPayloadStatus struct { + value *CreateLoadBalancerPayloadStatus + isSet bool +} + +func (v NullableCreateLoadBalancerPayloadStatus) Get() *CreateLoadBalancerPayloadStatus { + return v.value +} + +func (v *NullableCreateLoadBalancerPayloadStatus) Set(val *CreateLoadBalancerPayloadStatus) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLoadBalancerPayloadStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLoadBalancerPayloadStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLoadBalancerPayloadStatus(val *CreateLoadBalancerPayloadStatus) *NullableCreateLoadBalancerPayloadStatus { + return &NullableCreateLoadBalancerPayloadStatus{value: val, isSet: true} +} + +func (v NullableCreateLoadBalancerPayloadStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateLoadBalancerPayloadGetStatusAttributeType = *CreateLoadBalancerPayloadStatus +type CreateLoadBalancerPayloadGetStatusArgType = CreateLoadBalancerPayloadStatus +type CreateLoadBalancerPayloadGetStatusRetType = CreateLoadBalancerPayloadStatus + +func getCreateLoadBalancerPayloadGetStatusAttributeTypeOk(arg CreateLoadBalancerPayloadGetStatusAttributeType) (ret CreateLoadBalancerPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetStatusAttributeType(arg *CreateLoadBalancerPayloadGetStatusAttributeType, val CreateLoadBalancerPayloadGetStatusRetType) { + *arg = &val +} + +/* + types and functions for targetPools +*/ + +// isArray +type CreateLoadBalancerPayloadGetTargetPoolsAttributeType = *[]TargetPool +type CreateLoadBalancerPayloadGetTargetPoolsArgType = []TargetPool +type CreateLoadBalancerPayloadGetTargetPoolsRetType = []TargetPool + +func getCreateLoadBalancerPayloadGetTargetPoolsAttributeTypeOk(arg CreateLoadBalancerPayloadGetTargetPoolsAttributeType) (ret CreateLoadBalancerPayloadGetTargetPoolsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetTargetPoolsAttributeType(arg *CreateLoadBalancerPayloadGetTargetPoolsAttributeType, val CreateLoadBalancerPayloadGetTargetPoolsRetType) { + *arg = &val +} + +/* + types and functions for targetSecurityGroup +*/ + +// isModel +type CreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType = *CreateLoadBalancerPayloadTargetSecurityGroup +type CreateLoadBalancerPayloadGetTargetSecurityGroupArgType = CreateLoadBalancerPayloadTargetSecurityGroup +type CreateLoadBalancerPayloadGetTargetSecurityGroupRetType = CreateLoadBalancerPayloadTargetSecurityGroup + +func getCreateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(arg CreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType) (ret CreateLoadBalancerPayloadGetTargetSecurityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType(arg *CreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType, val CreateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + *arg = &val +} + +/* + types and functions for version +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadGetVersionAttributeType = *string + +func getCreateLoadBalancerPayloadGetVersionAttributeTypeOk(arg CreateLoadBalancerPayloadGetVersionAttributeType) (ret CreateLoadBalancerPayloadGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadGetVersionAttributeType(arg *CreateLoadBalancerPayloadGetVersionAttributeType, val CreateLoadBalancerPayloadGetVersionRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadGetVersionArgType = string +type CreateLoadBalancerPayloadGetVersionRetType = string + +// CreateLoadBalancerPayload struct for CreateLoadBalancerPayload +type CreateLoadBalancerPayload struct { + // Disable target security group assignemt to allow targets outside of the given network. Connectivity to targets need to be ensured by the customer, including routing and Security Groups (targetSecurityGroup can be assigned). Not changeable after creation. + DisableTargetSecurityGroupAssignment CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType `json:"disableTargetSecurityGroupAssignment,omitempty"` + // Reports all errors a application load balancer has. + Errors CreateLoadBalancerPayloadGetErrorsAttributeType `json:"errors,omitempty"` + // External application load balancer IP address where this application load balancer is exposed. Not changeable after creation. + ExternalAddress CreateLoadBalancerPayloadGetExternalAddressAttributeType `json:"externalAddress,omitempty"` + // Labels represent user-defined metadata as key-value pairs. Label count should not exceed 64 per ALB. **Key Formatting Rules:** Length: 1-63 characters. Characters: Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. Keys starting with 'stackit-' are system-reserved; users MUST NOT manage them. **Value Formatting Rules:** Length: 0-63 characters (empty string explicitly allowed). Characters (for non-empty values): Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. + Labels CreateLoadBalancerPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // There is a maximum listener count of 20. + Listeners CreateLoadBalancerPayloadGetListenersAttributeType `json:"listeners,omitempty"` + LoadBalancerSecurityGroup CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType `json:"loadBalancerSecurityGroup,omitempty"` + // Application Load Balancer name. Not changeable after creation. + Name CreateLoadBalancerPayloadGetNameAttributeType `json:"name,omitempty"` + // List of networks that listeners and targets reside in. Currently limited to one. Not changeable after creation. + Networks CreateLoadBalancerPayloadGetNetworksAttributeType `json:"networks,omitempty"` + Options CreateLoadBalancerPayloadGetOptionsAttributeType `json:"options,omitempty"` + // Service Plan configures the size of the Application Load Balancer. Currently supported plans are p10, p50, p250 and p750. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + PlanId CreateLoadBalancerPayloadGetPlanIdAttributeType `json:"planId,omitempty"` + // Transient private application load balancer IP address that can change any time. + PrivateAddress CreateLoadBalancerPayloadGetPrivateAddressAttributeType `json:"privateAddress,omitempty"` + // Region of the LoadBalancer. + Region CreateLoadBalancerPayloadGetRegionAttributeType `json:"region,omitempty"` + Status CreateLoadBalancerPayloadGetStatusAttributeType `json:"status,omitempty"` + // List of all target pools which will be used in the application load balancer. Limited to 20. + TargetPools CreateLoadBalancerPayloadGetTargetPoolsAttributeType `json:"targetPools,omitempty"` + TargetSecurityGroup CreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType `json:"targetSecurityGroup,omitempty"` + // Application Load Balancer resource version. Must be empty or unset for creating load balancers, non-empty for updating load balancers. Semantics: While retrieving load balancers, this is the current version of this application load balancer resource that changes during updates of the load balancers. On updates this field specified the application load balancer version you calculated your update for instead of the future version to enable concurrency safe updates. Update calls will then report the new version in their result as you would see with a application load balancer retrieval call later. There exist no total order of the version, so you can only compare it for equality, but not for less/greater than another version. Since the creation of application load balancer is always intended to create the first version of it, there should be no existing version. That's why this field must by empty of not present in that case. + Version CreateLoadBalancerPayloadGetVersionAttributeType `json:"version,omitempty"` +} + +// NewCreateLoadBalancerPayload instantiates a new CreateLoadBalancerPayload 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 NewCreateLoadBalancerPayload() *CreateLoadBalancerPayload { + this := CreateLoadBalancerPayload{} + return &this +} + +// NewCreateLoadBalancerPayloadWithDefaults instantiates a new CreateLoadBalancerPayload 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 NewCreateLoadBalancerPayloadWithDefaults() *CreateLoadBalancerPayload { + this := CreateLoadBalancerPayload{} + return &this +} + +// GetDisableTargetSecurityGroupAssignment returns the DisableTargetSecurityGroupAssignment field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetDisableTargetSecurityGroupAssignment() (res CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType) { + res, _ = o.GetDisableTargetSecurityGroupAssignmentOk() + return +} + +// GetDisableTargetSecurityGroupAssignmentOk returns a tuple with the DisableTargetSecurityGroupAssignment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetDisableTargetSecurityGroupAssignmentOk() (ret CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType, ok bool) { + return getCreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeTypeOk(o.DisableTargetSecurityGroupAssignment) +} + +// HasDisableTargetSecurityGroupAssignment returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasDisableTargetSecurityGroupAssignment() bool { + _, ok := o.GetDisableTargetSecurityGroupAssignmentOk() + return ok +} + +// SetDisableTargetSecurityGroupAssignment gets a reference to the given bool and assigns it to the DisableTargetSecurityGroupAssignment field. +func (o *CreateLoadBalancerPayload) SetDisableTargetSecurityGroupAssignment(v CreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType) { + setCreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType(&o.DisableTargetSecurityGroupAssignment, v) +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetErrors() (res CreateLoadBalancerPayloadGetErrorsRetType) { + res, _ = o.GetErrorsOk() + return +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetErrorsOk() (ret CreateLoadBalancerPayloadGetErrorsRetType, ok bool) { + return getCreateLoadBalancerPayloadGetErrorsAttributeTypeOk(o.Errors) +} + +// HasErrors returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasErrors() bool { + _, ok := o.GetErrorsOk() + return ok +} + +// SetErrors gets a reference to the given []LoadBalancerError and assigns it to the Errors field. +func (o *CreateLoadBalancerPayload) SetErrors(v CreateLoadBalancerPayloadGetErrorsRetType) { + setCreateLoadBalancerPayloadGetErrorsAttributeType(&o.Errors, v) +} + +// GetExternalAddress returns the ExternalAddress field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetExternalAddress() (res CreateLoadBalancerPayloadGetExternalAddressRetType) { + res, _ = o.GetExternalAddressOk() + return +} + +// GetExternalAddressOk returns a tuple with the ExternalAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetExternalAddressOk() (ret CreateLoadBalancerPayloadGetExternalAddressRetType, ok bool) { + return getCreateLoadBalancerPayloadGetExternalAddressAttributeTypeOk(o.ExternalAddress) +} + +// HasExternalAddress returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasExternalAddress() bool { + _, ok := o.GetExternalAddressOk() + return ok +} + +// SetExternalAddress gets a reference to the given string and assigns it to the ExternalAddress field. +func (o *CreateLoadBalancerPayload) SetExternalAddress(v CreateLoadBalancerPayloadGetExternalAddressRetType) { + setCreateLoadBalancerPayloadGetExternalAddressAttributeType(&o.ExternalAddress, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetLabels() (res CreateLoadBalancerPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetLabelsOk() (ret CreateLoadBalancerPayloadGetLabelsRetType, ok bool) { + return getCreateLoadBalancerPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateLoadBalancerPayload) SetLabels(v CreateLoadBalancerPayloadGetLabelsRetType) { + setCreateLoadBalancerPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetListeners returns the Listeners field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetListeners() (res CreateLoadBalancerPayloadGetListenersRetType) { + res, _ = o.GetListenersOk() + return +} + +// GetListenersOk returns a tuple with the Listeners field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetListenersOk() (ret CreateLoadBalancerPayloadGetListenersRetType, ok bool) { + return getCreateLoadBalancerPayloadGetListenersAttributeTypeOk(o.Listeners) +} + +// HasListeners returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasListeners() bool { + _, ok := o.GetListenersOk() + return ok +} + +// SetListeners gets a reference to the given []Listener and assigns it to the Listeners field. +func (o *CreateLoadBalancerPayload) SetListeners(v CreateLoadBalancerPayloadGetListenersRetType) { + setCreateLoadBalancerPayloadGetListenersAttributeType(&o.Listeners, v) +} + +// GetLoadBalancerSecurityGroup returns the LoadBalancerSecurityGroup field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetLoadBalancerSecurityGroup() (res CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType) { + res, _ = o.GetLoadBalancerSecurityGroupOk() + return +} + +// GetLoadBalancerSecurityGroupOk returns a tuple with the LoadBalancerSecurityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetLoadBalancerSecurityGroupOk() (ret CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType, ok bool) { + return getCreateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeTypeOk(o.LoadBalancerSecurityGroup) +} + +// HasLoadBalancerSecurityGroup returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasLoadBalancerSecurityGroup() bool { + _, ok := o.GetLoadBalancerSecurityGroupOk() + return ok +} + +// SetLoadBalancerSecurityGroup gets a reference to the given CreateLoadBalancerPayloadLoadBalancerSecurityGroup and assigns it to the LoadBalancerSecurityGroup field. +func (o *CreateLoadBalancerPayload) SetLoadBalancerSecurityGroup(v CreateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType) { + setCreateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType(&o.LoadBalancerSecurityGroup, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetName() (res CreateLoadBalancerPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetNameOk() (ret CreateLoadBalancerPayloadGetNameRetType, ok bool) { + return getCreateLoadBalancerPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateLoadBalancerPayload) SetName(v CreateLoadBalancerPayloadGetNameRetType) { + setCreateLoadBalancerPayloadGetNameAttributeType(&o.Name, v) +} + +// GetNetworks returns the Networks field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetNetworks() (res CreateLoadBalancerPayloadGetNetworksRetType) { + res, _ = o.GetNetworksOk() + return +} + +// GetNetworksOk returns a tuple with the Networks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetNetworksOk() (ret CreateLoadBalancerPayloadGetNetworksRetType, ok bool) { + return getCreateLoadBalancerPayloadGetNetworksAttributeTypeOk(o.Networks) +} + +// HasNetworks returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasNetworks() bool { + _, ok := o.GetNetworksOk() + return ok +} + +// SetNetworks gets a reference to the given []Network and assigns it to the Networks field. +func (o *CreateLoadBalancerPayload) SetNetworks(v CreateLoadBalancerPayloadGetNetworksRetType) { + setCreateLoadBalancerPayloadGetNetworksAttributeType(&o.Networks, v) +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetOptions() (res CreateLoadBalancerPayloadGetOptionsRetType) { + res, _ = o.GetOptionsOk() + return +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetOptionsOk() (ret CreateLoadBalancerPayloadGetOptionsRetType, ok bool) { + return getCreateLoadBalancerPayloadGetOptionsAttributeTypeOk(o.Options) +} + +// HasOptions returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasOptions() bool { + _, ok := o.GetOptionsOk() + return ok +} + +// SetOptions gets a reference to the given LoadBalancerOptions and assigns it to the Options field. +func (o *CreateLoadBalancerPayload) SetOptions(v CreateLoadBalancerPayloadGetOptionsRetType) { + setCreateLoadBalancerPayloadGetOptionsAttributeType(&o.Options, v) +} + +// GetPlanId returns the PlanId field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetPlanId() (res CreateLoadBalancerPayloadGetPlanIdRetType) { + res, _ = o.GetPlanIdOk() + return +} + +// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetPlanIdOk() (ret CreateLoadBalancerPayloadGetPlanIdRetType, ok bool) { + return getCreateLoadBalancerPayloadGetPlanIdAttributeTypeOk(o.PlanId) +} + +// HasPlanId returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasPlanId() bool { + _, ok := o.GetPlanIdOk() + return ok +} + +// SetPlanId gets a reference to the given string and assigns it to the PlanId field. +func (o *CreateLoadBalancerPayload) SetPlanId(v CreateLoadBalancerPayloadGetPlanIdRetType) { + setCreateLoadBalancerPayloadGetPlanIdAttributeType(&o.PlanId, v) +} + +// GetPrivateAddress returns the PrivateAddress field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetPrivateAddress() (res CreateLoadBalancerPayloadGetPrivateAddressRetType) { + res, _ = o.GetPrivateAddressOk() + return +} + +// GetPrivateAddressOk returns a tuple with the PrivateAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetPrivateAddressOk() (ret CreateLoadBalancerPayloadGetPrivateAddressRetType, ok bool) { + return getCreateLoadBalancerPayloadGetPrivateAddressAttributeTypeOk(o.PrivateAddress) +} + +// HasPrivateAddress returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasPrivateAddress() bool { + _, ok := o.GetPrivateAddressOk() + return ok +} + +// SetPrivateAddress gets a reference to the given string and assigns it to the PrivateAddress field. +func (o *CreateLoadBalancerPayload) SetPrivateAddress(v CreateLoadBalancerPayloadGetPrivateAddressRetType) { + setCreateLoadBalancerPayloadGetPrivateAddressAttributeType(&o.PrivateAddress, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetRegion() (res CreateLoadBalancerPayloadGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetRegionOk() (ret CreateLoadBalancerPayloadGetRegionRetType, ok bool) { + return getCreateLoadBalancerPayloadGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *CreateLoadBalancerPayload) SetRegion(v CreateLoadBalancerPayloadGetRegionRetType) { + setCreateLoadBalancerPayloadGetRegionAttributeType(&o.Region, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetStatus() (res CreateLoadBalancerPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetStatusOk() (ret CreateLoadBalancerPayloadGetStatusRetType, ok bool) { + return getCreateLoadBalancerPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateLoadBalancerPayload) SetStatus(v CreateLoadBalancerPayloadGetStatusRetType) { + setCreateLoadBalancerPayloadGetStatusAttributeType(&o.Status, v) +} + +// GetTargetPools returns the TargetPools field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetTargetPools() (res CreateLoadBalancerPayloadGetTargetPoolsRetType) { + res, _ = o.GetTargetPoolsOk() + return +} + +// GetTargetPoolsOk returns a tuple with the TargetPools field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetTargetPoolsOk() (ret CreateLoadBalancerPayloadGetTargetPoolsRetType, ok bool) { + return getCreateLoadBalancerPayloadGetTargetPoolsAttributeTypeOk(o.TargetPools) +} + +// HasTargetPools returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasTargetPools() bool { + _, ok := o.GetTargetPoolsOk() + return ok +} + +// SetTargetPools gets a reference to the given []TargetPool and assigns it to the TargetPools field. +func (o *CreateLoadBalancerPayload) SetTargetPools(v CreateLoadBalancerPayloadGetTargetPoolsRetType) { + setCreateLoadBalancerPayloadGetTargetPoolsAttributeType(&o.TargetPools, v) +} + +// GetTargetSecurityGroup returns the TargetSecurityGroup field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetTargetSecurityGroup() (res CreateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + res, _ = o.GetTargetSecurityGroupOk() + return +} + +// GetTargetSecurityGroupOk returns a tuple with the TargetSecurityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetTargetSecurityGroupOk() (ret CreateLoadBalancerPayloadGetTargetSecurityGroupRetType, ok bool) { + return getCreateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup) +} + +// HasTargetSecurityGroup returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasTargetSecurityGroup() bool { + _, ok := o.GetTargetSecurityGroupOk() + return ok +} + +// SetTargetSecurityGroup gets a reference to the given CreateLoadBalancerPayloadTargetSecurityGroup and assigns it to the TargetSecurityGroup field. +func (o *CreateLoadBalancerPayload) SetTargetSecurityGroup(v CreateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + setCreateLoadBalancerPayloadGetTargetSecurityGroupAttributeType(&o.TargetSecurityGroup, v) +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayload) GetVersion() (res CreateLoadBalancerPayloadGetVersionRetType) { + res, _ = o.GetVersionOk() + return +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayload) GetVersionOk() (ret CreateLoadBalancerPayloadGetVersionRetType, ok bool) { + return getCreateLoadBalancerPayloadGetVersionAttributeTypeOk(o.Version) +} + +// HasVersion returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayload) HasVersion() bool { + _, ok := o.GetVersionOk() + return ok +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *CreateLoadBalancerPayload) SetVersion(v CreateLoadBalancerPayloadGetVersionRetType) { + setCreateLoadBalancerPayloadGetVersionAttributeType(&o.Version, v) +} + +func (o CreateLoadBalancerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeTypeOk(o.DisableTargetSecurityGroupAssignment); ok { + toSerialize["DisableTargetSecurityGroupAssignment"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetErrorsAttributeTypeOk(o.Errors); ok { + toSerialize["Errors"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetExternalAddressAttributeTypeOk(o.ExternalAddress); ok { + toSerialize["ExternalAddress"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetListenersAttributeTypeOk(o.Listeners); ok { + toSerialize["Listeners"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeTypeOk(o.LoadBalancerSecurityGroup); ok { + toSerialize["LoadBalancerSecurityGroup"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetNetworksAttributeTypeOk(o.Networks); ok { + toSerialize["Networks"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetOptionsAttributeTypeOk(o.Options); ok { + toSerialize["Options"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetPrivateAddressAttributeTypeOk(o.PrivateAddress); ok { + toSerialize["PrivateAddress"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetTargetPoolsAttributeTypeOk(o.TargetPools); ok { + toSerialize["TargetPools"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup); ok { + toSerialize["TargetSecurityGroup"] = val + } + if val, ok := getCreateLoadBalancerPayloadGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +type NullableCreateLoadBalancerPayload struct { + value *CreateLoadBalancerPayload + isSet bool +} + +func (v NullableCreateLoadBalancerPayload) Get() *CreateLoadBalancerPayload { + return v.value +} + +func (v *NullableCreateLoadBalancerPayload) Set(val *CreateLoadBalancerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLoadBalancerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLoadBalancerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLoadBalancerPayload(val *CreateLoadBalancerPayload) *NullableCreateLoadBalancerPayload { + return &NullableCreateLoadBalancerPayload{value: val, isSet: true} +} + +func (v NullableCreateLoadBalancerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLoadBalancerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_create_load_balancer_payload_load_balancer_security_group.go b/pkg/albbeta/model_create_load_balancer_payload_load_balancer_security_group.go new file mode 100644 index 00000000..9a6315e7 --- /dev/null +++ b/pkg/albbeta/model_create_load_balancer_payload_load_balancer_security_group.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the CreateLoadBalancerPayloadLoadBalancerSecurityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateLoadBalancerPayloadLoadBalancerSecurityGroup{} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdAttributeType = *string + +func getCreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdAttributeTypeOk(arg CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdAttributeType) (ret CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdAttributeType(arg *CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdAttributeType, val CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdArgType = string +type CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameAttributeType = *string + +func getCreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameAttributeTypeOk(arg CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameAttributeType) (ret CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameAttributeType(arg *CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameAttributeType, val CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameArgType = string +type CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameRetType = string + +// CreateLoadBalancerPayloadLoadBalancerSecurityGroup Security Group permitting network traffic from the LoadBalancer to the targets. Useful when disableTargetSecurityGroupAssignment=true to manually assign target security groups to targets. +type CreateLoadBalancerPayloadLoadBalancerSecurityGroup struct { + // ID of the security Group + Id CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdAttributeType `json:"id,omitempty"` + // Name of the security Group + Name CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameAttributeType `json:"name,omitempty"` +} + +// NewCreateLoadBalancerPayloadLoadBalancerSecurityGroup instantiates a new CreateLoadBalancerPayloadLoadBalancerSecurityGroup 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 NewCreateLoadBalancerPayloadLoadBalancerSecurityGroup() *CreateLoadBalancerPayloadLoadBalancerSecurityGroup { + this := CreateLoadBalancerPayloadLoadBalancerSecurityGroup{} + return &this +} + +// NewCreateLoadBalancerPayloadLoadBalancerSecurityGroupWithDefaults instantiates a new CreateLoadBalancerPayloadLoadBalancerSecurityGroup 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 NewCreateLoadBalancerPayloadLoadBalancerSecurityGroupWithDefaults() *CreateLoadBalancerPayloadLoadBalancerSecurityGroup { + this := CreateLoadBalancerPayloadLoadBalancerSecurityGroup{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayloadLoadBalancerSecurityGroup) GetId() (res CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayloadLoadBalancerSecurityGroup) GetIdOk() (ret CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdRetType, ok bool) { + return getCreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayloadLoadBalancerSecurityGroup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateLoadBalancerPayloadLoadBalancerSecurityGroup) SetId(v CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdRetType) { + setCreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayloadLoadBalancerSecurityGroup) GetName() (res CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayloadLoadBalancerSecurityGroup) GetNameOk() (ret CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameRetType, ok bool) { + return getCreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayloadLoadBalancerSecurityGroup) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateLoadBalancerPayloadLoadBalancerSecurityGroup) SetName(v CreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameRetType) { + setCreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameAttributeType(&o.Name, v) +} + +func (o CreateLoadBalancerPayloadLoadBalancerSecurityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateLoadBalancerPayloadLoadBalancerSecurityGroupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateLoadBalancerPayloadLoadBalancerSecurityGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableCreateLoadBalancerPayloadLoadBalancerSecurityGroup struct { + value *CreateLoadBalancerPayloadLoadBalancerSecurityGroup + isSet bool +} + +func (v NullableCreateLoadBalancerPayloadLoadBalancerSecurityGroup) Get() *CreateLoadBalancerPayloadLoadBalancerSecurityGroup { + return v.value +} + +func (v *NullableCreateLoadBalancerPayloadLoadBalancerSecurityGroup) Set(val *CreateLoadBalancerPayloadLoadBalancerSecurityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLoadBalancerPayloadLoadBalancerSecurityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLoadBalancerPayloadLoadBalancerSecurityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLoadBalancerPayloadLoadBalancerSecurityGroup(val *CreateLoadBalancerPayloadLoadBalancerSecurityGroup) *NullableCreateLoadBalancerPayloadLoadBalancerSecurityGroup { + return &NullableCreateLoadBalancerPayloadLoadBalancerSecurityGroup{value: val, isSet: true} +} + +func (v NullableCreateLoadBalancerPayloadLoadBalancerSecurityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLoadBalancerPayloadLoadBalancerSecurityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_create_load_balancer_payload_load_balancer_security_group_test.go b/pkg/albbeta/model_create_load_balancer_payload_load_balancer_security_group_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_create_load_balancer_payload_load_balancer_security_group_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_create_load_balancer_payload_target_security_group.go b/pkg/albbeta/model_create_load_balancer_payload_target_security_group.go new file mode 100644 index 00000000..e02ebc47 --- /dev/null +++ b/pkg/albbeta/model_create_load_balancer_payload_target_security_group.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the CreateLoadBalancerPayloadTargetSecurityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateLoadBalancerPayloadTargetSecurityGroup{} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType = *string + +func getCreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeTypeOk(arg CreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType) (ret CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType(arg *CreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType, val CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadTargetSecurityGroupGetIdArgType = string +type CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType = *string + +func getCreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeTypeOk(arg CreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType) (ret CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType(arg *CreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType, val CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType) { + *arg = &val +} + +type CreateLoadBalancerPayloadTargetSecurityGroupGetNameArgType = string +type CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType = string + +// CreateLoadBalancerPayloadTargetSecurityGroup Security Group that allows the targets to receive traffic from the LoadBalancer. Useful when disableTargetSecurityGroupAssignment=true to manually assign target security groups to targets. +type CreateLoadBalancerPayloadTargetSecurityGroup struct { + // ID of the security Group + Id CreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType `json:"id,omitempty"` + // Name of the security Group + Name CreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType `json:"name,omitempty"` +} + +// NewCreateLoadBalancerPayloadTargetSecurityGroup instantiates a new CreateLoadBalancerPayloadTargetSecurityGroup 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 NewCreateLoadBalancerPayloadTargetSecurityGroup() *CreateLoadBalancerPayloadTargetSecurityGroup { + this := CreateLoadBalancerPayloadTargetSecurityGroup{} + return &this +} + +// NewCreateLoadBalancerPayloadTargetSecurityGroupWithDefaults instantiates a new CreateLoadBalancerPayloadTargetSecurityGroup 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 NewCreateLoadBalancerPayloadTargetSecurityGroupWithDefaults() *CreateLoadBalancerPayloadTargetSecurityGroup { + this := CreateLoadBalancerPayloadTargetSecurityGroup{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) GetId() (res CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) GetIdOk() (ret CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType, ok bool) { + return getCreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) SetId(v CreateLoadBalancerPayloadTargetSecurityGroupGetIdRetType) { + setCreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) GetName() (res CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) GetNameOk() (ret CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType, ok bool) { + return getCreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateLoadBalancerPayloadTargetSecurityGroup) SetName(v CreateLoadBalancerPayloadTargetSecurityGroupGetNameRetType) { + setCreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeType(&o.Name, v) +} + +func (o CreateLoadBalancerPayloadTargetSecurityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateLoadBalancerPayloadTargetSecurityGroupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateLoadBalancerPayloadTargetSecurityGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableCreateLoadBalancerPayloadTargetSecurityGroup struct { + value *CreateLoadBalancerPayloadTargetSecurityGroup + isSet bool +} + +func (v NullableCreateLoadBalancerPayloadTargetSecurityGroup) Get() *CreateLoadBalancerPayloadTargetSecurityGroup { + return v.value +} + +func (v *NullableCreateLoadBalancerPayloadTargetSecurityGroup) Set(val *CreateLoadBalancerPayloadTargetSecurityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLoadBalancerPayloadTargetSecurityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLoadBalancerPayloadTargetSecurityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLoadBalancerPayloadTargetSecurityGroup(val *CreateLoadBalancerPayloadTargetSecurityGroup) *NullableCreateLoadBalancerPayloadTargetSecurityGroup { + return &NullableCreateLoadBalancerPayloadTargetSecurityGroup{value: val, isSet: true} +} + +func (v NullableCreateLoadBalancerPayloadTargetSecurityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLoadBalancerPayloadTargetSecurityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_create_load_balancer_payload_target_security_group_test.go b/pkg/albbeta/model_create_load_balancer_payload_target_security_group_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_create_load_balancer_payload_target_security_group_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_create_load_balancer_payload_test.go b/pkg/albbeta/model_create_load_balancer_payload_test.go new file mode 100644 index 00000000..869e5762 --- /dev/null +++ b/pkg/albbeta/model_create_load_balancer_payload_test.go @@ -0,0 +1,79 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "testing" +) + +// isEnum + +func TestCreateLoadBalancerPayloadStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"STATUS_UNSPECIFIED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"STATUS_PENDING"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"STATUS_READY"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"STATUS_ERROR"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 5`, + args: args{ + src: []byte(`"STATUS_TERMINATING"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := CreateLoadBalancerPayloadStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/albbeta/model_credentials_response.go b/pkg/albbeta/model_credentials_response.go new file mode 100644 index 00000000..12c26727 --- /dev/null +++ b/pkg/albbeta/model_credentials_response.go @@ -0,0 +1,276 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the CredentialsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CredentialsResponse{} + +/* + types and functions for credentialsRef +*/ + +// isNotNullableString +type CredentialsResponseGetCredentialsRefAttributeType = *string + +func getCredentialsResponseGetCredentialsRefAttributeTypeOk(arg CredentialsResponseGetCredentialsRefAttributeType) (ret CredentialsResponseGetCredentialsRefRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCredentialsResponseGetCredentialsRefAttributeType(arg *CredentialsResponseGetCredentialsRefAttributeType, val CredentialsResponseGetCredentialsRefRetType) { + *arg = &val +} + +type CredentialsResponseGetCredentialsRefArgType = string +type CredentialsResponseGetCredentialsRefRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CredentialsResponseGetDisplayNameAttributeType = *string + +func getCredentialsResponseGetDisplayNameAttributeTypeOk(arg CredentialsResponseGetDisplayNameAttributeType) (ret CredentialsResponseGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCredentialsResponseGetDisplayNameAttributeType(arg *CredentialsResponseGetDisplayNameAttributeType, val CredentialsResponseGetDisplayNameRetType) { + *arg = &val +} + +type CredentialsResponseGetDisplayNameArgType = string +type CredentialsResponseGetDisplayNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type CredentialsResponseGetRegionAttributeType = *string + +func getCredentialsResponseGetRegionAttributeTypeOk(arg CredentialsResponseGetRegionAttributeType) (ret CredentialsResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCredentialsResponseGetRegionAttributeType(arg *CredentialsResponseGetRegionAttributeType, val CredentialsResponseGetRegionRetType) { + *arg = &val +} + +type CredentialsResponseGetRegionArgType = string +type CredentialsResponseGetRegionRetType = string + +/* + types and functions for username +*/ + +// isNotNullableString +type CredentialsResponseGetUsernameAttributeType = *string + +func getCredentialsResponseGetUsernameAttributeTypeOk(arg CredentialsResponseGetUsernameAttributeType) (ret CredentialsResponseGetUsernameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCredentialsResponseGetUsernameAttributeType(arg *CredentialsResponseGetUsernameAttributeType, val CredentialsResponseGetUsernameRetType) { + *arg = &val +} + +type CredentialsResponseGetUsernameArgType = string +type CredentialsResponseGetUsernameRetType = string + +// CredentialsResponse struct for CredentialsResponse +type CredentialsResponse struct { + // The credentials reference can be used for observability of the Application Load Balancer. + CredentialsRef CredentialsResponseGetCredentialsRefAttributeType `json:"credentialsRef,omitempty"` + // Credential name + DisplayName CredentialsResponseGetDisplayNameAttributeType `json:"displayName,omitempty"` + // Region of the Credential + Region CredentialsResponseGetRegionAttributeType `json:"region,omitempty"` + // The username used for the STACKIT Observability instance + Username CredentialsResponseGetUsernameAttributeType `json:"username,omitempty"` +} + +// NewCredentialsResponse instantiates a new CredentialsResponse 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 NewCredentialsResponse() *CredentialsResponse { + this := CredentialsResponse{} + return &this +} + +// NewCredentialsResponseWithDefaults instantiates a new CredentialsResponse 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 NewCredentialsResponseWithDefaults() *CredentialsResponse { + this := CredentialsResponse{} + return &this +} + +// GetCredentialsRef returns the CredentialsRef field value if set, zero value otherwise. +func (o *CredentialsResponse) GetCredentialsRef() (res CredentialsResponseGetCredentialsRefRetType) { + res, _ = o.GetCredentialsRefOk() + return +} + +// GetCredentialsRefOk returns a tuple with the CredentialsRef field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialsResponse) GetCredentialsRefOk() (ret CredentialsResponseGetCredentialsRefRetType, ok bool) { + return getCredentialsResponseGetCredentialsRefAttributeTypeOk(o.CredentialsRef) +} + +// HasCredentialsRef returns a boolean if a field has been set. +func (o *CredentialsResponse) HasCredentialsRef() bool { + _, ok := o.GetCredentialsRefOk() + return ok +} + +// SetCredentialsRef gets a reference to the given string and assigns it to the CredentialsRef field. +func (o *CredentialsResponse) SetCredentialsRef(v CredentialsResponseGetCredentialsRefRetType) { + setCredentialsResponseGetCredentialsRefAttributeType(&o.CredentialsRef, v) +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *CredentialsResponse) GetDisplayName() (res CredentialsResponseGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialsResponse) GetDisplayNameOk() (ret CredentialsResponseGetDisplayNameRetType, ok bool) { + return getCredentialsResponseGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *CredentialsResponse) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *CredentialsResponse) SetDisplayName(v CredentialsResponseGetDisplayNameRetType) { + setCredentialsResponseGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *CredentialsResponse) GetRegion() (res CredentialsResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialsResponse) GetRegionOk() (ret CredentialsResponseGetRegionRetType, ok bool) { + return getCredentialsResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *CredentialsResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *CredentialsResponse) SetRegion(v CredentialsResponseGetRegionRetType) { + setCredentialsResponseGetRegionAttributeType(&o.Region, v) +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *CredentialsResponse) GetUsername() (res CredentialsResponseGetUsernameRetType) { + res, _ = o.GetUsernameOk() + return +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CredentialsResponse) GetUsernameOk() (ret CredentialsResponseGetUsernameRetType, ok bool) { + return getCredentialsResponseGetUsernameAttributeTypeOk(o.Username) +} + +// HasUsername returns a boolean if a field has been set. +func (o *CredentialsResponse) HasUsername() bool { + _, ok := o.GetUsernameOk() + return ok +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *CredentialsResponse) SetUsername(v CredentialsResponseGetUsernameRetType) { + setCredentialsResponseGetUsernameAttributeType(&o.Username, v) +} + +func (o CredentialsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCredentialsResponseGetCredentialsRefAttributeTypeOk(o.CredentialsRef); ok { + toSerialize["CredentialsRef"] = val + } + if val, ok := getCredentialsResponseGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCredentialsResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getCredentialsResponseGetUsernameAttributeTypeOk(o.Username); ok { + toSerialize["Username"] = val + } + return toSerialize, nil +} + +type NullableCredentialsResponse struct { + value *CredentialsResponse + isSet bool +} + +func (v NullableCredentialsResponse) Get() *CredentialsResponse { + return v.value +} + +func (v *NullableCredentialsResponse) Set(val *CredentialsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCredentialsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCredentialsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCredentialsResponse(val *CredentialsResponse) *NullableCredentialsResponse { + return &NullableCredentialsResponse{value: val, isSet: true} +} + +func (v NullableCredentialsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCredentialsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_credentials_response_test.go b/pkg/albbeta/model_credentials_response_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_credentials_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_get_credentials_response.go b/pkg/albbeta/model_get_credentials_response.go new file mode 100644 index 00000000..67219231 --- /dev/null +++ b/pkg/albbeta/model_get_credentials_response.go @@ -0,0 +1,127 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the GetCredentialsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCredentialsResponse{} + +/* + types and functions for credential +*/ + +// isModel +type GetCredentialsResponseGetCredentialAttributeType = *CredentialsResponse +type GetCredentialsResponseGetCredentialArgType = CredentialsResponse +type GetCredentialsResponseGetCredentialRetType = CredentialsResponse + +func getGetCredentialsResponseGetCredentialAttributeTypeOk(arg GetCredentialsResponseGetCredentialAttributeType) (ret GetCredentialsResponseGetCredentialRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCredentialsResponseGetCredentialAttributeType(arg *GetCredentialsResponseGetCredentialAttributeType, val GetCredentialsResponseGetCredentialRetType) { + *arg = &val +} + +// GetCredentialsResponse struct for GetCredentialsResponse +type GetCredentialsResponse struct { + Credential GetCredentialsResponseGetCredentialAttributeType `json:"credential,omitempty"` +} + +// NewGetCredentialsResponse instantiates a new GetCredentialsResponse 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 NewGetCredentialsResponse() *GetCredentialsResponse { + this := GetCredentialsResponse{} + return &this +} + +// NewGetCredentialsResponseWithDefaults instantiates a new GetCredentialsResponse 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 NewGetCredentialsResponseWithDefaults() *GetCredentialsResponse { + this := GetCredentialsResponse{} + return &this +} + +// GetCredential returns the Credential field value if set, zero value otherwise. +func (o *GetCredentialsResponse) GetCredential() (res GetCredentialsResponseGetCredentialRetType) { + res, _ = o.GetCredentialOk() + return +} + +// GetCredentialOk returns a tuple with the Credential field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCredentialsResponse) GetCredentialOk() (ret GetCredentialsResponseGetCredentialRetType, ok bool) { + return getGetCredentialsResponseGetCredentialAttributeTypeOk(o.Credential) +} + +// HasCredential returns a boolean if a field has been set. +func (o *GetCredentialsResponse) HasCredential() bool { + _, ok := o.GetCredentialOk() + return ok +} + +// SetCredential gets a reference to the given CredentialsResponse and assigns it to the Credential field. +func (o *GetCredentialsResponse) SetCredential(v GetCredentialsResponseGetCredentialRetType) { + setGetCredentialsResponseGetCredentialAttributeType(&o.Credential, v) +} + +func (o GetCredentialsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCredentialsResponseGetCredentialAttributeTypeOk(o.Credential); ok { + toSerialize["Credential"] = val + } + return toSerialize, nil +} + +type NullableGetCredentialsResponse struct { + value *GetCredentialsResponse + isSet bool +} + +func (v NullableGetCredentialsResponse) Get() *GetCredentialsResponse { + return v.value +} + +func (v *NullableGetCredentialsResponse) Set(val *GetCredentialsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetCredentialsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCredentialsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCredentialsResponse(val *GetCredentialsResponse) *NullableGetCredentialsResponse { + return &NullableGetCredentialsResponse{value: val, isSet: true} +} + +func (v NullableGetCredentialsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCredentialsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_get_credentials_response_test.go b/pkg/albbeta/model_get_credentials_response_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_get_credentials_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_get_quota_response.go b/pkg/albbeta/model_get_quota_response.go new file mode 100644 index 00000000..8f60bc4c --- /dev/null +++ b/pkg/albbeta/model_get_quota_response.go @@ -0,0 +1,227 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the GetQuotaResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetQuotaResponse{} + +/* + types and functions for maxLoadBalancers +*/ + +// isInteger +type GetQuotaResponseGetMaxLoadBalancersAttributeType = *int64 +type GetQuotaResponseGetMaxLoadBalancersArgType = int64 +type GetQuotaResponseGetMaxLoadBalancersRetType = int64 + +func getGetQuotaResponseGetMaxLoadBalancersAttributeTypeOk(arg GetQuotaResponseGetMaxLoadBalancersAttributeType) (ret GetQuotaResponseGetMaxLoadBalancersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetQuotaResponseGetMaxLoadBalancersAttributeType(arg *GetQuotaResponseGetMaxLoadBalancersAttributeType, val GetQuotaResponseGetMaxLoadBalancersRetType) { + *arg = &val +} + +/* + types and functions for projectId +*/ + +// isNotNullableString +type GetQuotaResponseGetProjectIdAttributeType = *string + +func getGetQuotaResponseGetProjectIdAttributeTypeOk(arg GetQuotaResponseGetProjectIdAttributeType) (ret GetQuotaResponseGetProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetQuotaResponseGetProjectIdAttributeType(arg *GetQuotaResponseGetProjectIdAttributeType, val GetQuotaResponseGetProjectIdRetType) { + *arg = &val +} + +type GetQuotaResponseGetProjectIdArgType = string +type GetQuotaResponseGetProjectIdRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type GetQuotaResponseGetRegionAttributeType = *string + +func getGetQuotaResponseGetRegionAttributeTypeOk(arg GetQuotaResponseGetRegionAttributeType) (ret GetQuotaResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetQuotaResponseGetRegionAttributeType(arg *GetQuotaResponseGetRegionAttributeType, val GetQuotaResponseGetRegionRetType) { + *arg = &val +} + +type GetQuotaResponseGetRegionArgType = string +type GetQuotaResponseGetRegionRetType = string + +// GetQuotaResponse struct for GetQuotaResponse +type GetQuotaResponse struct { + // The maximum number of load balancing servers in this project. Unlimited if set to -1. + // Can be cast to int32 without loss of precision. + MaxLoadBalancers GetQuotaResponseGetMaxLoadBalancersAttributeType `json:"maxLoadBalancers,omitempty"` + // Project identifier + ProjectId GetQuotaResponseGetProjectIdAttributeType `json:"projectId,omitempty"` + // Region + Region GetQuotaResponseGetRegionAttributeType `json:"region,omitempty"` +} + +// NewGetQuotaResponse instantiates a new GetQuotaResponse 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 NewGetQuotaResponse() *GetQuotaResponse { + this := GetQuotaResponse{} + return &this +} + +// NewGetQuotaResponseWithDefaults instantiates a new GetQuotaResponse 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 NewGetQuotaResponseWithDefaults() *GetQuotaResponse { + this := GetQuotaResponse{} + return &this +} + +// GetMaxLoadBalancers returns the MaxLoadBalancers field value if set, zero value otherwise. +func (o *GetQuotaResponse) GetMaxLoadBalancers() (res GetQuotaResponseGetMaxLoadBalancersRetType) { + res, _ = o.GetMaxLoadBalancersOk() + return +} + +// GetMaxLoadBalancersOk returns a tuple with the MaxLoadBalancers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetQuotaResponse) GetMaxLoadBalancersOk() (ret GetQuotaResponseGetMaxLoadBalancersRetType, ok bool) { + return getGetQuotaResponseGetMaxLoadBalancersAttributeTypeOk(o.MaxLoadBalancers) +} + +// HasMaxLoadBalancers returns a boolean if a field has been set. +func (o *GetQuotaResponse) HasMaxLoadBalancers() bool { + _, ok := o.GetMaxLoadBalancersOk() + return ok +} + +// SetMaxLoadBalancers gets a reference to the given int64 and assigns it to the MaxLoadBalancers field. +func (o *GetQuotaResponse) SetMaxLoadBalancers(v GetQuotaResponseGetMaxLoadBalancersRetType) { + setGetQuotaResponseGetMaxLoadBalancersAttributeType(&o.MaxLoadBalancers, v) +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *GetQuotaResponse) GetProjectId() (res GetQuotaResponseGetProjectIdRetType) { + res, _ = o.GetProjectIdOk() + return +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetQuotaResponse) GetProjectIdOk() (ret GetQuotaResponseGetProjectIdRetType, ok bool) { + return getGetQuotaResponseGetProjectIdAttributeTypeOk(o.ProjectId) +} + +// HasProjectId returns a boolean if a field has been set. +func (o *GetQuotaResponse) HasProjectId() bool { + _, ok := o.GetProjectIdOk() + return ok +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *GetQuotaResponse) SetProjectId(v GetQuotaResponseGetProjectIdRetType) { + setGetQuotaResponseGetProjectIdAttributeType(&o.ProjectId, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *GetQuotaResponse) GetRegion() (res GetQuotaResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetQuotaResponse) GetRegionOk() (ret GetQuotaResponseGetRegionRetType, ok bool) { + return getGetQuotaResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *GetQuotaResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *GetQuotaResponse) SetRegion(v GetQuotaResponseGetRegionRetType) { + setGetQuotaResponseGetRegionAttributeType(&o.Region, v) +} + +func (o GetQuotaResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetQuotaResponseGetMaxLoadBalancersAttributeTypeOk(o.MaxLoadBalancers); ok { + toSerialize["MaxLoadBalancers"] = val + } + if val, ok := getGetQuotaResponseGetProjectIdAttributeTypeOk(o.ProjectId); ok { + toSerialize["ProjectId"] = val + } + if val, ok := getGetQuotaResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullableGetQuotaResponse struct { + value *GetQuotaResponse + isSet bool +} + +func (v NullableGetQuotaResponse) Get() *GetQuotaResponse { + return v.value +} + +func (v *NullableGetQuotaResponse) Set(val *GetQuotaResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetQuotaResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetQuotaResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetQuotaResponse(val *GetQuotaResponse) *NullableGetQuotaResponse { + return &NullableGetQuotaResponse{value: val, isSet: true} +} + +func (v NullableGetQuotaResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetQuotaResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_get_quota_response_test.go b/pkg/albbeta/model_get_quota_response_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_get_quota_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_google_protobuf_any.go b/pkg/albbeta/model_google_protobuf_any.go new file mode 100644 index 00000000..1d176e0d --- /dev/null +++ b/pkg/albbeta/model_google_protobuf_any.go @@ -0,0 +1,137 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the GoogleProtobufAny type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GoogleProtobufAny{} + +/* + types and functions for @type +*/ + +// isNotNullableString +type GoogleProtobufAnyGetTypeAttributeType = *string + +func getGoogleProtobufAnyGetTypeAttributeTypeOk(arg GoogleProtobufAnyGetTypeAttributeType) (ret GoogleProtobufAnyGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGoogleProtobufAnyGetTypeAttributeType(arg *GoogleProtobufAnyGetTypeAttributeType, val GoogleProtobufAnyGetTypeRetType) { + *arg = &val +} + +type GoogleProtobufAnyGetTypeArgType = string +type GoogleProtobufAnyGetTypeRetType = string + +// GoogleProtobufAny Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. +type GoogleProtobufAny struct { + // The type of the serialized message. + Type GoogleProtobufAnyGetTypeAttributeType `json:"@type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GoogleProtobufAny GoogleProtobufAny + +// NewGoogleProtobufAny instantiates a new GoogleProtobufAny 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 NewGoogleProtobufAny() *GoogleProtobufAny { + this := GoogleProtobufAny{} + return &this +} + +// NewGoogleProtobufAnyWithDefaults instantiates a new GoogleProtobufAny 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 NewGoogleProtobufAnyWithDefaults() *GoogleProtobufAny { + this := GoogleProtobufAny{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *GoogleProtobufAny) GetType() (res GoogleProtobufAnyGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GoogleProtobufAny) GetTypeOk() (ret GoogleProtobufAnyGetTypeRetType, ok bool) { + return getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *GoogleProtobufAny) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *GoogleProtobufAny) SetType(v GoogleProtobufAnyGetTypeRetType) { + setGoogleProtobufAnyGetTypeAttributeType(&o.Type, v) +} + +func (o GoogleProtobufAny) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +type NullableGoogleProtobufAny struct { + value *GoogleProtobufAny + isSet bool +} + +func (v NullableGoogleProtobufAny) Get() *GoogleProtobufAny { + return v.value +} + +func (v *NullableGoogleProtobufAny) Set(val *GoogleProtobufAny) { + v.value = val + v.isSet = true +} + +func (v NullableGoogleProtobufAny) IsSet() bool { + return v.isSet +} + +func (v *NullableGoogleProtobufAny) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGoogleProtobufAny(val *GoogleProtobufAny) *NullableGoogleProtobufAny { + return &NullableGoogleProtobufAny{value: val, isSet: true} +} + +func (v NullableGoogleProtobufAny) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGoogleProtobufAny) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_google_protobuf_any_test.go b/pkg/albbeta/model_google_protobuf_any_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_google_protobuf_any_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_host_config.go b/pkg/albbeta/model_host_config.go new file mode 100644 index 00000000..f98dfb99 --- /dev/null +++ b/pkg/albbeta/model_host_config.go @@ -0,0 +1,177 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the HostConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HostConfig{} + +/* + types and functions for host +*/ + +// isNotNullableString +type HostConfigGetHostAttributeType = *string + +func getHostConfigGetHostAttributeTypeOk(arg HostConfigGetHostAttributeType) (ret HostConfigGetHostRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHostConfigGetHostAttributeType(arg *HostConfigGetHostAttributeType, val HostConfigGetHostRetType) { + *arg = &val +} + +type HostConfigGetHostArgType = string +type HostConfigGetHostRetType = string + +/* + types and functions for rules +*/ + +// isArray +type HostConfigGetRulesAttributeType = *[]Rule +type HostConfigGetRulesArgType = []Rule +type HostConfigGetRulesRetType = []Rule + +func getHostConfigGetRulesAttributeTypeOk(arg HostConfigGetRulesAttributeType) (ret HostConfigGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHostConfigGetRulesAttributeType(arg *HostConfigGetRulesAttributeType, val HostConfigGetRulesRetType) { + *arg = &val +} + +// HostConfig struct for HostConfig +type HostConfig struct { + // Hostname to match. Supports wildcards (e.g. *.example.com). + Host HostConfigGetHostAttributeType `json:"host,omitempty"` + // Routing rules under the specified host, matched by path prefix. + Rules HostConfigGetRulesAttributeType `json:"rules,omitempty"` +} + +// NewHostConfig instantiates a new HostConfig 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 NewHostConfig() *HostConfig { + this := HostConfig{} + return &this +} + +// NewHostConfigWithDefaults instantiates a new HostConfig 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 NewHostConfigWithDefaults() *HostConfig { + this := HostConfig{} + return &this +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *HostConfig) GetHost() (res HostConfigGetHostRetType) { + res, _ = o.GetHostOk() + return +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostConfig) GetHostOk() (ret HostConfigGetHostRetType, ok bool) { + return getHostConfigGetHostAttributeTypeOk(o.Host) +} + +// HasHost returns a boolean if a field has been set. +func (o *HostConfig) HasHost() bool { + _, ok := o.GetHostOk() + return ok +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *HostConfig) SetHost(v HostConfigGetHostRetType) { + setHostConfigGetHostAttributeType(&o.Host, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *HostConfig) GetRules() (res HostConfigGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HostConfig) GetRulesOk() (ret HostConfigGetRulesRetType, ok bool) { + return getHostConfigGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *HostConfig) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given []Rule and assigns it to the Rules field. +func (o *HostConfig) SetRules(v HostConfigGetRulesRetType) { + setHostConfigGetRulesAttributeType(&o.Rules, v) +} + +func (o HostConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getHostConfigGetHostAttributeTypeOk(o.Host); ok { + toSerialize["Host"] = val + } + if val, ok := getHostConfigGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableHostConfig struct { + value *HostConfig + isSet bool +} + +func (v NullableHostConfig) Get() *HostConfig { + return v.value +} + +func (v *NullableHostConfig) Set(val *HostConfig) { + v.value = val + v.isSet = true +} + +func (v NullableHostConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableHostConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHostConfig(val *HostConfig) *NullableHostConfig { + return &NullableHostConfig{value: val, isSet: true} +} + +func (v NullableHostConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHostConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_host_config_test.go b/pkg/albbeta/model_host_config_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_host_config_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_http_header.go b/pkg/albbeta/model_http_header.go new file mode 100644 index 00000000..ad0a41d7 --- /dev/null +++ b/pkg/albbeta/model_http_header.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the HttpHeader type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HttpHeader{} + +/* + types and functions for exactMatch +*/ + +// isNotNullableString +type HttpHeaderGetExactMatchAttributeType = *string + +func getHttpHeaderGetExactMatchAttributeTypeOk(arg HttpHeaderGetExactMatchAttributeType) (ret HttpHeaderGetExactMatchRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpHeaderGetExactMatchAttributeType(arg *HttpHeaderGetExactMatchAttributeType, val HttpHeaderGetExactMatchRetType) { + *arg = &val +} + +type HttpHeaderGetExactMatchArgType = string +type HttpHeaderGetExactMatchRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type HttpHeaderGetNameAttributeType = *string + +func getHttpHeaderGetNameAttributeTypeOk(arg HttpHeaderGetNameAttributeType) (ret HttpHeaderGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpHeaderGetNameAttributeType(arg *HttpHeaderGetNameAttributeType, val HttpHeaderGetNameRetType) { + *arg = &val +} + +type HttpHeaderGetNameArgType = string +type HttpHeaderGetNameRetType = string + +// HttpHeader struct for HttpHeader +type HttpHeader struct { + // Exact match for the header value. + ExactMatch HttpHeaderGetExactMatchAttributeType `json:"exactMatch,omitempty"` + // Header name. + Name HttpHeaderGetNameAttributeType `json:"name,omitempty"` +} + +// NewHttpHeader instantiates a new HttpHeader 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 NewHttpHeader() *HttpHeader { + this := HttpHeader{} + return &this +} + +// NewHttpHeaderWithDefaults instantiates a new HttpHeader 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 NewHttpHeaderWithDefaults() *HttpHeader { + this := HttpHeader{} + return &this +} + +// GetExactMatch returns the ExactMatch field value if set, zero value otherwise. +func (o *HttpHeader) GetExactMatch() (res HttpHeaderGetExactMatchRetType) { + res, _ = o.GetExactMatchOk() + return +} + +// GetExactMatchOk returns a tuple with the ExactMatch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpHeader) GetExactMatchOk() (ret HttpHeaderGetExactMatchRetType, ok bool) { + return getHttpHeaderGetExactMatchAttributeTypeOk(o.ExactMatch) +} + +// HasExactMatch returns a boolean if a field has been set. +func (o *HttpHeader) HasExactMatch() bool { + _, ok := o.GetExactMatchOk() + return ok +} + +// SetExactMatch gets a reference to the given string and assigns it to the ExactMatch field. +func (o *HttpHeader) SetExactMatch(v HttpHeaderGetExactMatchRetType) { + setHttpHeaderGetExactMatchAttributeType(&o.ExactMatch, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *HttpHeader) GetName() (res HttpHeaderGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpHeader) GetNameOk() (ret HttpHeaderGetNameRetType, ok bool) { + return getHttpHeaderGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *HttpHeader) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *HttpHeader) SetName(v HttpHeaderGetNameRetType) { + setHttpHeaderGetNameAttributeType(&o.Name, v) +} + +func (o HttpHeader) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getHttpHeaderGetExactMatchAttributeTypeOk(o.ExactMatch); ok { + toSerialize["ExactMatch"] = val + } + if val, ok := getHttpHeaderGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableHttpHeader struct { + value *HttpHeader + isSet bool +} + +func (v NullableHttpHeader) Get() *HttpHeader { + return v.value +} + +func (v *NullableHttpHeader) Set(val *HttpHeader) { + v.value = val + v.isSet = true +} + +func (v NullableHttpHeader) IsSet() bool { + return v.isSet +} + +func (v *NullableHttpHeader) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHttpHeader(val *HttpHeader) *NullableHttpHeader { + return &NullableHttpHeader{value: val, isSet: true} +} + +func (v NullableHttpHeader) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHttpHeader) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_http_header_test.go b/pkg/albbeta/model_http_header_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_http_header_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_http_health_checks.go b/pkg/albbeta/model_http_health_checks.go new file mode 100644 index 00000000..5d15564a --- /dev/null +++ b/pkg/albbeta/model_http_health_checks.go @@ -0,0 +1,177 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the HttpHealthChecks type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HttpHealthChecks{} + +/* + types and functions for okStatuses +*/ + +// isArray +type HttpHealthChecksGetOkStatusesAttributeType = *[]string +type HttpHealthChecksGetOkStatusesArgType = []string +type HttpHealthChecksGetOkStatusesRetType = []string + +func getHttpHealthChecksGetOkStatusesAttributeTypeOk(arg HttpHealthChecksGetOkStatusesAttributeType) (ret HttpHealthChecksGetOkStatusesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpHealthChecksGetOkStatusesAttributeType(arg *HttpHealthChecksGetOkStatusesAttributeType, val HttpHealthChecksGetOkStatusesRetType) { + *arg = &val +} + +/* + types and functions for path +*/ + +// isNotNullableString +type HttpHealthChecksGetPathAttributeType = *string + +func getHttpHealthChecksGetPathAttributeTypeOk(arg HttpHealthChecksGetPathAttributeType) (ret HttpHealthChecksGetPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpHealthChecksGetPathAttributeType(arg *HttpHealthChecksGetPathAttributeType, val HttpHealthChecksGetPathRetType) { + *arg = &val +} + +type HttpHealthChecksGetPathArgType = string +type HttpHealthChecksGetPathRetType = string + +// HttpHealthChecks struct for HttpHealthChecks +type HttpHealthChecks struct { + // List of HTTP status codes that indicate a healthy response + OkStatuses HttpHealthChecksGetOkStatusesAttributeType `json:"okStatuses,omitempty"` + // Path to send the health check request to + Path HttpHealthChecksGetPathAttributeType `json:"path,omitempty"` +} + +// NewHttpHealthChecks instantiates a new HttpHealthChecks 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 NewHttpHealthChecks() *HttpHealthChecks { + this := HttpHealthChecks{} + return &this +} + +// NewHttpHealthChecksWithDefaults instantiates a new HttpHealthChecks 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 NewHttpHealthChecksWithDefaults() *HttpHealthChecks { + this := HttpHealthChecks{} + return &this +} + +// GetOkStatuses returns the OkStatuses field value if set, zero value otherwise. +func (o *HttpHealthChecks) GetOkStatuses() (res HttpHealthChecksGetOkStatusesRetType) { + res, _ = o.GetOkStatusesOk() + return +} + +// GetOkStatusesOk returns a tuple with the OkStatuses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpHealthChecks) GetOkStatusesOk() (ret HttpHealthChecksGetOkStatusesRetType, ok bool) { + return getHttpHealthChecksGetOkStatusesAttributeTypeOk(o.OkStatuses) +} + +// HasOkStatuses returns a boolean if a field has been set. +func (o *HttpHealthChecks) HasOkStatuses() bool { + _, ok := o.GetOkStatusesOk() + return ok +} + +// SetOkStatuses gets a reference to the given []string and assigns it to the OkStatuses field. +func (o *HttpHealthChecks) SetOkStatuses(v HttpHealthChecksGetOkStatusesRetType) { + setHttpHealthChecksGetOkStatusesAttributeType(&o.OkStatuses, v) +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *HttpHealthChecks) GetPath() (res HttpHealthChecksGetPathRetType) { + res, _ = o.GetPathOk() + return +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpHealthChecks) GetPathOk() (ret HttpHealthChecksGetPathRetType, ok bool) { + return getHttpHealthChecksGetPathAttributeTypeOk(o.Path) +} + +// HasPath returns a boolean if a field has been set. +func (o *HttpHealthChecks) HasPath() bool { + _, ok := o.GetPathOk() + return ok +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *HttpHealthChecks) SetPath(v HttpHealthChecksGetPathRetType) { + setHttpHealthChecksGetPathAttributeType(&o.Path, v) +} + +func (o HttpHealthChecks) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getHttpHealthChecksGetOkStatusesAttributeTypeOk(o.OkStatuses); ok { + toSerialize["OkStatuses"] = val + } + if val, ok := getHttpHealthChecksGetPathAttributeTypeOk(o.Path); ok { + toSerialize["Path"] = val + } + return toSerialize, nil +} + +type NullableHttpHealthChecks struct { + value *HttpHealthChecks + isSet bool +} + +func (v NullableHttpHealthChecks) Get() *HttpHealthChecks { + return v.value +} + +func (v *NullableHttpHealthChecks) Set(val *HttpHealthChecks) { + v.value = val + v.isSet = true +} + +func (v NullableHttpHealthChecks) IsSet() bool { + return v.isSet +} + +func (v *NullableHttpHealthChecks) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHttpHealthChecks(val *HttpHealthChecks) *NullableHttpHealthChecks { + return &NullableHttpHealthChecks{value: val, isSet: true} +} + +func (v NullableHttpHealthChecks) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHttpHealthChecks) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_http_health_checks_test.go b/pkg/albbeta/model_http_health_checks_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_http_health_checks_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_list_credentials_response.go b/pkg/albbeta/model_list_credentials_response.go new file mode 100644 index 00000000..c3488a0d --- /dev/null +++ b/pkg/albbeta/model_list_credentials_response.go @@ -0,0 +1,127 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the ListCredentialsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListCredentialsResponse{} + +/* + types and functions for credentials +*/ + +// isArray +type ListCredentialsResponseGetCredentialsAttributeType = *[]CredentialsResponse +type ListCredentialsResponseGetCredentialsArgType = []CredentialsResponse +type ListCredentialsResponseGetCredentialsRetType = []CredentialsResponse + +func getListCredentialsResponseGetCredentialsAttributeTypeOk(arg ListCredentialsResponseGetCredentialsAttributeType) (ret ListCredentialsResponseGetCredentialsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListCredentialsResponseGetCredentialsAttributeType(arg *ListCredentialsResponseGetCredentialsAttributeType, val ListCredentialsResponseGetCredentialsRetType) { + *arg = &val +} + +// ListCredentialsResponse struct for ListCredentialsResponse +type ListCredentialsResponse struct { + Credentials ListCredentialsResponseGetCredentialsAttributeType `json:"credentials,omitempty"` +} + +// NewListCredentialsResponse instantiates a new ListCredentialsResponse 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 NewListCredentialsResponse() *ListCredentialsResponse { + this := ListCredentialsResponse{} + return &this +} + +// NewListCredentialsResponseWithDefaults instantiates a new ListCredentialsResponse 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 NewListCredentialsResponseWithDefaults() *ListCredentialsResponse { + this := ListCredentialsResponse{} + return &this +} + +// GetCredentials returns the Credentials field value if set, zero value otherwise. +func (o *ListCredentialsResponse) GetCredentials() (res ListCredentialsResponseGetCredentialsRetType) { + res, _ = o.GetCredentialsOk() + return +} + +// GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListCredentialsResponse) GetCredentialsOk() (ret ListCredentialsResponseGetCredentialsRetType, ok bool) { + return getListCredentialsResponseGetCredentialsAttributeTypeOk(o.Credentials) +} + +// HasCredentials returns a boolean if a field has been set. +func (o *ListCredentialsResponse) HasCredentials() bool { + _, ok := o.GetCredentialsOk() + return ok +} + +// SetCredentials gets a reference to the given []CredentialsResponse and assigns it to the Credentials field. +func (o *ListCredentialsResponse) SetCredentials(v ListCredentialsResponseGetCredentialsRetType) { + setListCredentialsResponseGetCredentialsAttributeType(&o.Credentials, v) +} + +func (o ListCredentialsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListCredentialsResponseGetCredentialsAttributeTypeOk(o.Credentials); ok { + toSerialize["Credentials"] = val + } + return toSerialize, nil +} + +type NullableListCredentialsResponse struct { + value *ListCredentialsResponse + isSet bool +} + +func (v NullableListCredentialsResponse) Get() *ListCredentialsResponse { + return v.value +} + +func (v *NullableListCredentialsResponse) Set(val *ListCredentialsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListCredentialsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListCredentialsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListCredentialsResponse(val *ListCredentialsResponse) *NullableListCredentialsResponse { + return &NullableListCredentialsResponse{value: val, isSet: true} +} + +func (v NullableListCredentialsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListCredentialsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_list_credentials_response_test.go b/pkg/albbeta/model_list_credentials_response_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_list_credentials_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_list_load_balancers_response.go b/pkg/albbeta/model_list_load_balancers_response.go new file mode 100644 index 00000000..da506a37 --- /dev/null +++ b/pkg/albbeta/model_list_load_balancers_response.go @@ -0,0 +1,176 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the ListLoadBalancersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListLoadBalancersResponse{} + +/* + types and functions for loadBalancers +*/ + +// isArray +type ListLoadBalancersResponseGetLoadBalancersAttributeType = *[]LoadBalancer +type ListLoadBalancersResponseGetLoadBalancersArgType = []LoadBalancer +type ListLoadBalancersResponseGetLoadBalancersRetType = []LoadBalancer + +func getListLoadBalancersResponseGetLoadBalancersAttributeTypeOk(arg ListLoadBalancersResponseGetLoadBalancersAttributeType) (ret ListLoadBalancersResponseGetLoadBalancersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListLoadBalancersResponseGetLoadBalancersAttributeType(arg *ListLoadBalancersResponseGetLoadBalancersAttributeType, val ListLoadBalancersResponseGetLoadBalancersRetType) { + *arg = &val +} + +/* + types and functions for nextPageId +*/ + +// isNotNullableString +type ListLoadBalancersResponseGetNextPageIdAttributeType = *string + +func getListLoadBalancersResponseGetNextPageIdAttributeTypeOk(arg ListLoadBalancersResponseGetNextPageIdAttributeType) (ret ListLoadBalancersResponseGetNextPageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListLoadBalancersResponseGetNextPageIdAttributeType(arg *ListLoadBalancersResponseGetNextPageIdAttributeType, val ListLoadBalancersResponseGetNextPageIdRetType) { + *arg = &val +} + +type ListLoadBalancersResponseGetNextPageIdArgType = string +type ListLoadBalancersResponseGetNextPageIdRetType = string + +// ListLoadBalancersResponse struct for ListLoadBalancersResponse +type ListLoadBalancersResponse struct { + LoadBalancers ListLoadBalancersResponseGetLoadBalancersAttributeType `json:"loadBalancers,omitempty"` + // Continue token from the ListLoadBalancerResponse with Limit option + NextPageId ListLoadBalancersResponseGetNextPageIdAttributeType `json:"nextPageId,omitempty"` +} + +// NewListLoadBalancersResponse instantiates a new ListLoadBalancersResponse 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 NewListLoadBalancersResponse() *ListLoadBalancersResponse { + this := ListLoadBalancersResponse{} + return &this +} + +// NewListLoadBalancersResponseWithDefaults instantiates a new ListLoadBalancersResponse 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 NewListLoadBalancersResponseWithDefaults() *ListLoadBalancersResponse { + this := ListLoadBalancersResponse{} + return &this +} + +// GetLoadBalancers returns the LoadBalancers field value if set, zero value otherwise. +func (o *ListLoadBalancersResponse) GetLoadBalancers() (res ListLoadBalancersResponseGetLoadBalancersRetType) { + res, _ = o.GetLoadBalancersOk() + return +} + +// 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 *ListLoadBalancersResponse) GetLoadBalancersOk() (ret ListLoadBalancersResponseGetLoadBalancersRetType, ok bool) { + return getListLoadBalancersResponseGetLoadBalancersAttributeTypeOk(o.LoadBalancers) +} + +// HasLoadBalancers returns a boolean if a field has been set. +func (o *ListLoadBalancersResponse) HasLoadBalancers() bool { + _, ok := o.GetLoadBalancersOk() + return ok +} + +// SetLoadBalancers gets a reference to the given []LoadBalancer and assigns it to the LoadBalancers field. +func (o *ListLoadBalancersResponse) SetLoadBalancers(v ListLoadBalancersResponseGetLoadBalancersRetType) { + setListLoadBalancersResponseGetLoadBalancersAttributeType(&o.LoadBalancers, v) +} + +// GetNextPageId returns the NextPageId field value if set, zero value otherwise. +func (o *ListLoadBalancersResponse) GetNextPageId() (res ListLoadBalancersResponseGetNextPageIdRetType) { + res, _ = o.GetNextPageIdOk() + return +} + +// GetNextPageIdOk returns a tuple with the NextPageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListLoadBalancersResponse) GetNextPageIdOk() (ret ListLoadBalancersResponseGetNextPageIdRetType, ok bool) { + return getListLoadBalancersResponseGetNextPageIdAttributeTypeOk(o.NextPageId) +} + +// HasNextPageId returns a boolean if a field has been set. +func (o *ListLoadBalancersResponse) HasNextPageId() bool { + _, ok := o.GetNextPageIdOk() + return ok +} + +// SetNextPageId gets a reference to the given string and assigns it to the NextPageId field. +func (o *ListLoadBalancersResponse) SetNextPageId(v ListLoadBalancersResponseGetNextPageIdRetType) { + setListLoadBalancersResponseGetNextPageIdAttributeType(&o.NextPageId, v) +} + +func (o ListLoadBalancersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListLoadBalancersResponseGetLoadBalancersAttributeTypeOk(o.LoadBalancers); ok { + toSerialize["LoadBalancers"] = val + } + if val, ok := getListLoadBalancersResponseGetNextPageIdAttributeTypeOk(o.NextPageId); ok { + toSerialize["NextPageId"] = val + } + return toSerialize, nil +} + +type NullableListLoadBalancersResponse struct { + value *ListLoadBalancersResponse + isSet bool +} + +func (v NullableListLoadBalancersResponse) Get() *ListLoadBalancersResponse { + return v.value +} + +func (v *NullableListLoadBalancersResponse) Set(val *ListLoadBalancersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListLoadBalancersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListLoadBalancersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListLoadBalancersResponse(val *ListLoadBalancersResponse) *NullableListLoadBalancersResponse { + return &NullableListLoadBalancersResponse{value: val, isSet: true} +} + +func (v NullableListLoadBalancersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListLoadBalancersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_list_load_balancers_response_test.go b/pkg/albbeta/model_list_load_balancers_response_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_list_load_balancers_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_list_plans_response.go b/pkg/albbeta/model_list_plans_response.go new file mode 100644 index 00000000..909c35e1 --- /dev/null +++ b/pkg/albbeta/model_list_plans_response.go @@ -0,0 +1,127 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the ListPlansResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListPlansResponse{} + +/* + types and functions for validPlans +*/ + +// isArray +type ListPlansResponseGetValidPlansAttributeType = *[]PlanDetails +type ListPlansResponseGetValidPlansArgType = []PlanDetails +type ListPlansResponseGetValidPlansRetType = []PlanDetails + +func getListPlansResponseGetValidPlansAttributeTypeOk(arg ListPlansResponseGetValidPlansAttributeType) (ret ListPlansResponseGetValidPlansRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListPlansResponseGetValidPlansAttributeType(arg *ListPlansResponseGetValidPlansAttributeType, val ListPlansResponseGetValidPlansRetType) { + *arg = &val +} + +// ListPlansResponse struct for ListPlansResponse +type ListPlansResponse struct { + ValidPlans ListPlansResponseGetValidPlansAttributeType `json:"validPlans,omitempty"` +} + +// NewListPlansResponse instantiates a new ListPlansResponse 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 NewListPlansResponse() *ListPlansResponse { + this := ListPlansResponse{} + return &this +} + +// NewListPlansResponseWithDefaults instantiates a new ListPlansResponse 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 NewListPlansResponseWithDefaults() *ListPlansResponse { + this := ListPlansResponse{} + return &this +} + +// GetValidPlans returns the ValidPlans field value if set, zero value otherwise. +func (o *ListPlansResponse) GetValidPlans() (res ListPlansResponseGetValidPlansRetType) { + res, _ = o.GetValidPlansOk() + return +} + +// GetValidPlansOk returns a tuple with the ValidPlans field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListPlansResponse) GetValidPlansOk() (ret ListPlansResponseGetValidPlansRetType, ok bool) { + return getListPlansResponseGetValidPlansAttributeTypeOk(o.ValidPlans) +} + +// HasValidPlans returns a boolean if a field has been set. +func (o *ListPlansResponse) HasValidPlans() bool { + _, ok := o.GetValidPlansOk() + return ok +} + +// SetValidPlans gets a reference to the given []PlanDetails and assigns it to the ValidPlans field. +func (o *ListPlansResponse) SetValidPlans(v ListPlansResponseGetValidPlansRetType) { + setListPlansResponseGetValidPlansAttributeType(&o.ValidPlans, v) +} + +func (o ListPlansResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListPlansResponseGetValidPlansAttributeTypeOk(o.ValidPlans); ok { + toSerialize["ValidPlans"] = val + } + return toSerialize, nil +} + +type NullableListPlansResponse struct { + value *ListPlansResponse + isSet bool +} + +func (v NullableListPlansResponse) Get() *ListPlansResponse { + return v.value +} + +func (v *NullableListPlansResponse) Set(val *ListPlansResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListPlansResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListPlansResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListPlansResponse(val *ListPlansResponse) *NullableListPlansResponse { + return &NullableListPlansResponse{value: val, isSet: true} +} + +func (v NullableListPlansResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListPlansResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_list_plans_response_test.go b/pkg/albbeta/model_list_plans_response_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_list_plans_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_listener.go b/pkg/albbeta/model_listener.go new file mode 100644 index 00000000..3a7f83fd --- /dev/null +++ b/pkg/albbeta/model_listener.go @@ -0,0 +1,476 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the Listener type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Listener{} + +/* + types and functions for http +*/ + +// isModel +type ListenerGetHttpAttributeType = *ProtocolOptionsHTTP +type ListenerGetHttpArgType = ProtocolOptionsHTTP +type ListenerGetHttpRetType = ProtocolOptionsHTTP + +func getListenerGetHttpAttributeTypeOk(arg ListenerGetHttpAttributeType) (ret ListenerGetHttpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListenerGetHttpAttributeType(arg *ListenerGetHttpAttributeType, val ListenerGetHttpRetType) { + *arg = &val +} + +/* + types and functions for https +*/ + +// isModel +type ListenerGetHttpsAttributeType = *ProtocolOptionsHTTPS +type ListenerGetHttpsArgType = ProtocolOptionsHTTPS +type ListenerGetHttpsRetType = ProtocolOptionsHTTPS + +func getListenerGetHttpsAttributeTypeOk(arg ListenerGetHttpsAttributeType) (ret ListenerGetHttpsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListenerGetHttpsAttributeType(arg *ListenerGetHttpsAttributeType, val ListenerGetHttpsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type ListenerGetNameAttributeType = *string + +func getListenerGetNameAttributeTypeOk(arg ListenerGetNameAttributeType) (ret ListenerGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListenerGetNameAttributeType(arg *ListenerGetNameAttributeType, val ListenerGetNameRetType) { + *arg = &val +} + +type ListenerGetNameArgType = string +type ListenerGetNameRetType = string + +/* + types and functions for port +*/ + +// isInteger +type ListenerGetPortAttributeType = *int64 +type ListenerGetPortArgType = int64 +type ListenerGetPortRetType = int64 + +func getListenerGetPortAttributeTypeOk(arg ListenerGetPortAttributeType) (ret ListenerGetPortRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListenerGetPortAttributeType(arg *ListenerGetPortAttributeType, val ListenerGetPortRetType) { + *arg = &val +} + +/* + types and functions for protocol +*/ + +// isEnum + +// ListenerProtocol Protocol is the highest network protocol we understand to load balance. Currently PROTOCOL_HTTP and PROTOCOL_HTTPS are supported. +// value type for enums +type ListenerProtocol string + +// List of Protocol +const ( + LISTENERPROTOCOL_UNSPECIFIED ListenerProtocol = "PROTOCOL_UNSPECIFIED" + LISTENERPROTOCOL_HTTP ListenerProtocol = "PROTOCOL_HTTP" + LISTENERPROTOCOL_HTTPS ListenerProtocol = "PROTOCOL_HTTPS" +) + +// All allowed values of Listener enum +var AllowedListenerProtocolEnumValues = []ListenerProtocol{ + "PROTOCOL_UNSPECIFIED", + "PROTOCOL_HTTP", + "PROTOCOL_HTTPS", +} + +func (v *ListenerProtocol) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson ListenerProtocol + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := ListenerProtocol(value) + for _, existing := range AllowedListenerProtocolEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Listener", value) +} + +// NewListenerProtocolFromValue returns a pointer to a valid ListenerProtocol +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewListenerProtocolFromValue(v ListenerProtocol) (*ListenerProtocol, error) { + ev := ListenerProtocol(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ListenerProtocol: valid values are %v", v, AllowedListenerProtocolEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ListenerProtocol) IsValid() bool { + for _, existing := range AllowedListenerProtocolEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ProtocolProtocol value +func (v ListenerProtocol) Ptr() *ListenerProtocol { + return &v +} + +type NullableListenerProtocol struct { + value *ListenerProtocol + isSet bool +} + +func (v NullableListenerProtocol) Get() *ListenerProtocol { + return v.value +} + +func (v *NullableListenerProtocol) Set(val *ListenerProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableListenerProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableListenerProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListenerProtocol(val *ListenerProtocol) *NullableListenerProtocol { + return &NullableListenerProtocol{value: val, isSet: true} +} + +func (v NullableListenerProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListenerProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ListenerGetProtocolAttributeType = *ListenerProtocol +type ListenerGetProtocolArgType = ListenerProtocol +type ListenerGetProtocolRetType = ListenerProtocol + +func getListenerGetProtocolAttributeTypeOk(arg ListenerGetProtocolAttributeType) (ret ListenerGetProtocolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListenerGetProtocolAttributeType(arg *ListenerGetProtocolAttributeType, val ListenerGetProtocolRetType) { + *arg = &val +} + +/* + types and functions for wafConfigName +*/ + +// isNotNullableString +type ListenerGetWafConfigNameAttributeType = *string + +func getListenerGetWafConfigNameAttributeTypeOk(arg ListenerGetWafConfigNameAttributeType) (ret ListenerGetWafConfigNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListenerGetWafConfigNameAttributeType(arg *ListenerGetWafConfigNameAttributeType, val ListenerGetWafConfigNameRetType) { + *arg = &val +} + +type ListenerGetWafConfigNameArgType = string +type ListenerGetWafConfigNameRetType = string + +// Listener struct for Listener +type Listener struct { + Http ListenerGetHttpAttributeType `json:"http,omitempty"` + Https ListenerGetHttpsAttributeType `json:"https,omitempty"` + // Unique, system-generated identifier for the listener. It is derived from the protocol and port. + Name ListenerGetNameAttributeType `json:"name,omitempty"` + // Port number on which the listener receives incoming traffic. + // Can be cast to int32 without loss of precision. + Port ListenerGetPortAttributeType `json:"port,omitempty"` + // Protocol is the highest network protocol we understand to load balance. Currently PROTOCOL_HTTP and PROTOCOL_HTTPS are supported. + Protocol ListenerGetProtocolAttributeType `json:"protocol,omitempty"` + // Enable Web Application Firewall (WAF), referenced by name. See \"Application Load Balancer - Web Application Firewall API\" for more information. + WafConfigName ListenerGetWafConfigNameAttributeType `json:"wafConfigName,omitempty"` +} + +// NewListener instantiates a new Listener 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 NewListener() *Listener { + this := Listener{} + return &this +} + +// NewListenerWithDefaults instantiates a new Listener 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 NewListenerWithDefaults() *Listener { + this := Listener{} + return &this +} + +// GetHttp returns the Http field value if set, zero value otherwise. +func (o *Listener) GetHttp() (res ListenerGetHttpRetType) { + res, _ = o.GetHttpOk() + return +} + +// GetHttpOk returns a tuple with the Http field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Listener) GetHttpOk() (ret ListenerGetHttpRetType, ok bool) { + return getListenerGetHttpAttributeTypeOk(o.Http) +} + +// HasHttp returns a boolean if a field has been set. +func (o *Listener) HasHttp() bool { + _, ok := o.GetHttpOk() + return ok +} + +// SetHttp gets a reference to the given ProtocolOptionsHTTP and assigns it to the Http field. +func (o *Listener) SetHttp(v ListenerGetHttpRetType) { + setListenerGetHttpAttributeType(&o.Http, v) +} + +// GetHttps returns the Https field value if set, zero value otherwise. +func (o *Listener) GetHttps() (res ListenerGetHttpsRetType) { + res, _ = o.GetHttpsOk() + return +} + +// GetHttpsOk returns a tuple with the Https field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Listener) GetHttpsOk() (ret ListenerGetHttpsRetType, ok bool) { + return getListenerGetHttpsAttributeTypeOk(o.Https) +} + +// HasHttps returns a boolean if a field has been set. +func (o *Listener) HasHttps() bool { + _, ok := o.GetHttpsOk() + return ok +} + +// SetHttps gets a reference to the given ProtocolOptionsHTTPS and assigns it to the Https field. +func (o *Listener) SetHttps(v ListenerGetHttpsRetType) { + setListenerGetHttpsAttributeType(&o.Https, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Listener) GetName() (res ListenerGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Listener) GetNameOk() (ret ListenerGetNameRetType, ok bool) { + return getListenerGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Listener) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Listener) SetName(v ListenerGetNameRetType) { + setListenerGetNameAttributeType(&o.Name, v) +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *Listener) GetPort() (res ListenerGetPortRetType) { + res, _ = o.GetPortOk() + return +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Listener) GetPortOk() (ret ListenerGetPortRetType, ok bool) { + return getListenerGetPortAttributeTypeOk(o.Port) +} + +// HasPort returns a boolean if a field has been set. +func (o *Listener) HasPort() bool { + _, ok := o.GetPortOk() + return ok +} + +// SetPort gets a reference to the given int64 and assigns it to the Port field. +func (o *Listener) SetPort(v ListenerGetPortRetType) { + setListenerGetPortAttributeType(&o.Port, v) +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *Listener) GetProtocol() (res ListenerGetProtocolRetType) { + res, _ = o.GetProtocolOk() + return +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Listener) GetProtocolOk() (ret ListenerGetProtocolRetType, ok bool) { + return getListenerGetProtocolAttributeTypeOk(o.Protocol) +} + +// HasProtocol returns a boolean if a field has been set. +func (o *Listener) HasProtocol() bool { + _, ok := o.GetProtocolOk() + return ok +} + +// SetProtocol gets a reference to the given string and assigns it to the Protocol field. +func (o *Listener) SetProtocol(v ListenerGetProtocolRetType) { + setListenerGetProtocolAttributeType(&o.Protocol, v) +} + +// GetWafConfigName returns the WafConfigName field value if set, zero value otherwise. +func (o *Listener) GetWafConfigName() (res ListenerGetWafConfigNameRetType) { + res, _ = o.GetWafConfigNameOk() + return +} + +// GetWafConfigNameOk returns a tuple with the WafConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Listener) GetWafConfigNameOk() (ret ListenerGetWafConfigNameRetType, ok bool) { + return getListenerGetWafConfigNameAttributeTypeOk(o.WafConfigName) +} + +// HasWafConfigName returns a boolean if a field has been set. +func (o *Listener) HasWafConfigName() bool { + _, ok := o.GetWafConfigNameOk() + return ok +} + +// SetWafConfigName gets a reference to the given string and assigns it to the WafConfigName field. +func (o *Listener) SetWafConfigName(v ListenerGetWafConfigNameRetType) { + setListenerGetWafConfigNameAttributeType(&o.WafConfigName, v) +} + +func (o Listener) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListenerGetHttpAttributeTypeOk(o.Http); ok { + toSerialize["Http"] = val + } + if val, ok := getListenerGetHttpsAttributeTypeOk(o.Https); ok { + toSerialize["Https"] = val + } + if val, ok := getListenerGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getListenerGetPortAttributeTypeOk(o.Port); ok { + toSerialize["Port"] = val + } + if val, ok := getListenerGetProtocolAttributeTypeOk(o.Protocol); ok { + toSerialize["Protocol"] = val + } + if val, ok := getListenerGetWafConfigNameAttributeTypeOk(o.WafConfigName); ok { + toSerialize["WafConfigName"] = val + } + return toSerialize, nil +} + +type NullableListener struct { + value *Listener + isSet bool +} + +func (v NullableListener) Get() *Listener { + return v.value +} + +func (v *NullableListener) Set(val *Listener) { + v.value = val + v.isSet = true +} + +func (v NullableListener) IsSet() bool { + return v.isSet +} + +func (v *NullableListener) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListener(val *Listener) *NullableListener { + return &NullableListener{value: val, isSet: true} +} + +func (v NullableListener) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListener) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_listener_test.go b/pkg/albbeta/model_listener_test.go new file mode 100644 index 00000000..2cb7c052 --- /dev/null +++ b/pkg/albbeta/model_listener_test.go @@ -0,0 +1,65 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "testing" +) + +// isEnum + +func TestListenerProtocol_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"PROTOCOL_UNSPECIFIED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"PROTOCOL_HTTP"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"PROTOCOL_HTTPS"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := ListenerProtocol("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/albbeta/model_load_balancer.go b/pkg/albbeta/model_load_balancer.go new file mode 100644 index 00000000..4f2a8ea7 --- /dev/null +++ b/pkg/albbeta/model_load_balancer.go @@ -0,0 +1,961 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the LoadBalancer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoadBalancer{} + +/* + types and functions for disableTargetSecurityGroupAssignment +*/ + +// isBoolean +type LoadBalancergetDisableTargetSecurityGroupAssignmentAttributeType = *bool +type LoadBalancergetDisableTargetSecurityGroupAssignmentArgType = bool +type LoadBalancergetDisableTargetSecurityGroupAssignmentRetType = bool + +func getLoadBalancergetDisableTargetSecurityGroupAssignmentAttributeTypeOk(arg LoadBalancergetDisableTargetSecurityGroupAssignmentAttributeType) (ret LoadBalancergetDisableTargetSecurityGroupAssignmentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancergetDisableTargetSecurityGroupAssignmentAttributeType(arg *LoadBalancergetDisableTargetSecurityGroupAssignmentAttributeType, val LoadBalancergetDisableTargetSecurityGroupAssignmentRetType) { + *arg = &val +} + +/* + types and functions for errors +*/ + +// isArray +type LoadBalancerGetErrorsAttributeType = *[]LoadBalancerError +type LoadBalancerGetErrorsArgType = []LoadBalancerError +type LoadBalancerGetErrorsRetType = []LoadBalancerError + +func getLoadBalancerGetErrorsAttributeTypeOk(arg LoadBalancerGetErrorsAttributeType) (ret LoadBalancerGetErrorsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetErrorsAttributeType(arg *LoadBalancerGetErrorsAttributeType, val LoadBalancerGetErrorsRetType) { + *arg = &val +} + +/* + types and functions for externalAddress +*/ + +// isNotNullableString +type LoadBalancerGetExternalAddressAttributeType = *string + +func getLoadBalancerGetExternalAddressAttributeTypeOk(arg LoadBalancerGetExternalAddressAttributeType) (ret LoadBalancerGetExternalAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetExternalAddressAttributeType(arg *LoadBalancerGetExternalAddressAttributeType, val LoadBalancerGetExternalAddressRetType) { + *arg = &val +} + +type LoadBalancerGetExternalAddressArgType = string +type LoadBalancerGetExternalAddressRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type LoadBalancerGetLabelsAttributeType = *map[string]string +type LoadBalancerGetLabelsArgType = map[string]string +type LoadBalancerGetLabelsRetType = map[string]string + +func getLoadBalancerGetLabelsAttributeTypeOk(arg LoadBalancerGetLabelsAttributeType) (ret LoadBalancerGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetLabelsAttributeType(arg *LoadBalancerGetLabelsAttributeType, val LoadBalancerGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for listeners +*/ + +// isArray +type LoadBalancerGetListenersAttributeType = *[]Listener +type LoadBalancerGetListenersArgType = []Listener +type LoadBalancerGetListenersRetType = []Listener + +func getLoadBalancerGetListenersAttributeTypeOk(arg LoadBalancerGetListenersAttributeType) (ret LoadBalancerGetListenersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetListenersAttributeType(arg *LoadBalancerGetListenersAttributeType, val LoadBalancerGetListenersRetType) { + *arg = &val +} + +/* + types and functions for loadBalancerSecurityGroup +*/ + +// isModel +type LoadBalancerGetLoadBalancerSecurityGroupAttributeType = *CreateLoadBalancerPayloadLoadBalancerSecurityGroup +type LoadBalancerGetLoadBalancerSecurityGroupArgType = CreateLoadBalancerPayloadLoadBalancerSecurityGroup +type LoadBalancerGetLoadBalancerSecurityGroupRetType = CreateLoadBalancerPayloadLoadBalancerSecurityGroup + +func getLoadBalancerGetLoadBalancerSecurityGroupAttributeTypeOk(arg LoadBalancerGetLoadBalancerSecurityGroupAttributeType) (ret LoadBalancerGetLoadBalancerSecurityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetLoadBalancerSecurityGroupAttributeType(arg *LoadBalancerGetLoadBalancerSecurityGroupAttributeType, val LoadBalancerGetLoadBalancerSecurityGroupRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type LoadBalancerGetNameAttributeType = *string + +func getLoadBalancerGetNameAttributeTypeOk(arg LoadBalancerGetNameAttributeType) (ret LoadBalancerGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetNameAttributeType(arg *LoadBalancerGetNameAttributeType, val LoadBalancerGetNameRetType) { + *arg = &val +} + +type LoadBalancerGetNameArgType = string +type LoadBalancerGetNameRetType = string + +/* + types and functions for networks +*/ + +// isArray +type LoadBalancerGetNetworksAttributeType = *[]Network +type LoadBalancerGetNetworksArgType = []Network +type LoadBalancerGetNetworksRetType = []Network + +func getLoadBalancerGetNetworksAttributeTypeOk(arg LoadBalancerGetNetworksAttributeType) (ret LoadBalancerGetNetworksRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetNetworksAttributeType(arg *LoadBalancerGetNetworksAttributeType, val LoadBalancerGetNetworksRetType) { + *arg = &val +} + +/* + types and functions for options +*/ + +// isModel +type LoadBalancerGetOptionsAttributeType = *LoadBalancerOptions +type LoadBalancerGetOptionsArgType = LoadBalancerOptions +type LoadBalancerGetOptionsRetType = LoadBalancerOptions + +func getLoadBalancerGetOptionsAttributeTypeOk(arg LoadBalancerGetOptionsAttributeType) (ret LoadBalancerGetOptionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetOptionsAttributeType(arg *LoadBalancerGetOptionsAttributeType, val LoadBalancerGetOptionsRetType) { + *arg = &val +} + +/* + types and functions for planId +*/ + +// isNotNullableString +type LoadBalancerGetPlanIdAttributeType = *string + +func getLoadBalancerGetPlanIdAttributeTypeOk(arg LoadBalancerGetPlanIdAttributeType) (ret LoadBalancerGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetPlanIdAttributeType(arg *LoadBalancerGetPlanIdAttributeType, val LoadBalancerGetPlanIdRetType) { + *arg = &val +} + +type LoadBalancerGetPlanIdArgType = string +type LoadBalancerGetPlanIdRetType = string + +/* + types and functions for privateAddress +*/ + +// isNotNullableString +type LoadBalancerGetPrivateAddressAttributeType = *string + +func getLoadBalancerGetPrivateAddressAttributeTypeOk(arg LoadBalancerGetPrivateAddressAttributeType) (ret LoadBalancerGetPrivateAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetPrivateAddressAttributeType(arg *LoadBalancerGetPrivateAddressAttributeType, val LoadBalancerGetPrivateAddressRetType) { + *arg = &val +} + +type LoadBalancerGetPrivateAddressArgType = string +type LoadBalancerGetPrivateAddressRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type LoadBalancerGetRegionAttributeType = *string + +func getLoadBalancerGetRegionAttributeTypeOk(arg LoadBalancerGetRegionAttributeType) (ret LoadBalancerGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetRegionAttributeType(arg *LoadBalancerGetRegionAttributeType, val LoadBalancerGetRegionRetType) { + *arg = &val +} + +type LoadBalancerGetRegionArgType = string +type LoadBalancerGetRegionRetType = string + +/* + types and functions for status +*/ + +// isEnum + +// LoadBalancerStatus the model 'LoadBalancer' +// value type for enums +type LoadBalancerStatus string + +// List of Status +const ( + LOADBALANCERSTATUS_UNSPECIFIED LoadBalancerStatus = "STATUS_UNSPECIFIED" + LOADBALANCERSTATUS_PENDING LoadBalancerStatus = "STATUS_PENDING" + LOADBALANCERSTATUS_READY LoadBalancerStatus = "STATUS_READY" + LOADBALANCERSTATUS_ERROR LoadBalancerStatus = "STATUS_ERROR" + LOADBALANCERSTATUS_TERMINATING LoadBalancerStatus = "STATUS_TERMINATING" +) + +// All allowed values of LoadBalancer enum +var AllowedLoadBalancerStatusEnumValues = []LoadBalancerStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *LoadBalancerStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson LoadBalancerStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := LoadBalancerStatus(value) + for _, existing := range AllowedLoadBalancerStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LoadBalancer", value) +} + +// NewLoadBalancerStatusFromValue returns a pointer to a valid LoadBalancerStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoadBalancerStatusFromValue(v LoadBalancerStatus) (*LoadBalancerStatus, error) { + ev := LoadBalancerStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoadBalancerStatus: valid values are %v", v, AllowedLoadBalancerStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoadBalancerStatus) IsValid() bool { + for _, existing := range AllowedLoadBalancerStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v LoadBalancerStatus) Ptr() *LoadBalancerStatus { + return &v +} + +type NullableLoadBalancerStatus struct { + value *LoadBalancerStatus + isSet bool +} + +func (v NullableLoadBalancerStatus) Get() *LoadBalancerStatus { + return v.value +} + +func (v *NullableLoadBalancerStatus) Set(val *LoadBalancerStatus) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancerStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancerStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancerStatus(val *LoadBalancerStatus) *NullableLoadBalancerStatus { + return &NullableLoadBalancerStatus{value: val, isSet: true} +} + +func (v NullableLoadBalancerStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancerStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type LoadBalancerGetStatusAttributeType = *LoadBalancerStatus +type LoadBalancerGetStatusArgType = LoadBalancerStatus +type LoadBalancerGetStatusRetType = LoadBalancerStatus + +func getLoadBalancerGetStatusAttributeTypeOk(arg LoadBalancerGetStatusAttributeType) (ret LoadBalancerGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetStatusAttributeType(arg *LoadBalancerGetStatusAttributeType, val LoadBalancerGetStatusRetType) { + *arg = &val +} + +/* + types and functions for targetPools +*/ + +// isArray +type LoadBalancerGetTargetPoolsAttributeType = *[]TargetPool +type LoadBalancerGetTargetPoolsArgType = []TargetPool +type LoadBalancerGetTargetPoolsRetType = []TargetPool + +func getLoadBalancerGetTargetPoolsAttributeTypeOk(arg LoadBalancerGetTargetPoolsAttributeType) (ret LoadBalancerGetTargetPoolsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetTargetPoolsAttributeType(arg *LoadBalancerGetTargetPoolsAttributeType, val LoadBalancerGetTargetPoolsRetType) { + *arg = &val +} + +/* + types and functions for targetSecurityGroup +*/ + +// isModel +type LoadBalancerGetTargetSecurityGroupAttributeType = *CreateLoadBalancerPayloadTargetSecurityGroup +type LoadBalancerGetTargetSecurityGroupArgType = CreateLoadBalancerPayloadTargetSecurityGroup +type LoadBalancerGetTargetSecurityGroupRetType = CreateLoadBalancerPayloadTargetSecurityGroup + +func getLoadBalancerGetTargetSecurityGroupAttributeTypeOk(arg LoadBalancerGetTargetSecurityGroupAttributeType) (ret LoadBalancerGetTargetSecurityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetTargetSecurityGroupAttributeType(arg *LoadBalancerGetTargetSecurityGroupAttributeType, val LoadBalancerGetTargetSecurityGroupRetType) { + *arg = &val +} + +/* + types and functions for version +*/ + +// isNotNullableString +type LoadBalancerGetVersionAttributeType = *string + +func getLoadBalancerGetVersionAttributeTypeOk(arg LoadBalancerGetVersionAttributeType) (ret LoadBalancerGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerGetVersionAttributeType(arg *LoadBalancerGetVersionAttributeType, val LoadBalancerGetVersionRetType) { + *arg = &val +} + +type LoadBalancerGetVersionArgType = string +type LoadBalancerGetVersionRetType = string + +// LoadBalancer struct for LoadBalancer +type LoadBalancer struct { + // Disable target security group assignemt to allow targets outside of the given network. Connectivity to targets need to be ensured by the customer, including routing and Security Groups (targetSecurityGroup can be assigned). Not changeable after creation. + DisableTargetSecurityGroupAssignment LoadBalancergetDisableTargetSecurityGroupAssignmentAttributeType `json:"disableTargetSecurityGroupAssignment,omitempty"` + // Reports all errors a application load balancer has. + Errors LoadBalancerGetErrorsAttributeType `json:"errors,omitempty"` + // External application load balancer IP address where this application load balancer is exposed. Not changeable after creation. + ExternalAddress LoadBalancerGetExternalAddressAttributeType `json:"externalAddress,omitempty"` + // Labels represent user-defined metadata as key-value pairs. Label count should not exceed 64 per ALB. **Key Formatting Rules:** Length: 1-63 characters. Characters: Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. Keys starting with 'stackit-' are system-reserved; users MUST NOT manage them. **Value Formatting Rules:** Length: 0-63 characters (empty string explicitly allowed). Characters (for non-empty values): Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. + Labels LoadBalancerGetLabelsAttributeType `json:"labels,omitempty"` + // There is a maximum listener count of 20. + Listeners LoadBalancerGetListenersAttributeType `json:"listeners,omitempty"` + LoadBalancerSecurityGroup LoadBalancerGetLoadBalancerSecurityGroupAttributeType `json:"loadBalancerSecurityGroup,omitempty"` + // Application Load Balancer name. Not changeable after creation. + Name LoadBalancerGetNameAttributeType `json:"name,omitempty"` + // List of networks that listeners and targets reside in. Currently limited to one. Not changeable after creation. + Networks LoadBalancerGetNetworksAttributeType `json:"networks,omitempty"` + Options LoadBalancerGetOptionsAttributeType `json:"options,omitempty"` + // Service Plan configures the size of the Application Load Balancer. Currently supported plans are p10, p50, p250 and p750. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + PlanId LoadBalancerGetPlanIdAttributeType `json:"planId,omitempty"` + // Transient private application load balancer IP address that can change any time. + PrivateAddress LoadBalancerGetPrivateAddressAttributeType `json:"privateAddress,omitempty"` + // Region of the LoadBalancer. + Region LoadBalancerGetRegionAttributeType `json:"region,omitempty"` + Status LoadBalancerGetStatusAttributeType `json:"status,omitempty"` + // List of all target pools which will be used in the application load balancer. Limited to 20. + TargetPools LoadBalancerGetTargetPoolsAttributeType `json:"targetPools,omitempty"` + TargetSecurityGroup LoadBalancerGetTargetSecurityGroupAttributeType `json:"targetSecurityGroup,omitempty"` + // Application Load Balancer resource version. Must be empty or unset for creating load balancers, non-empty for updating load balancers. Semantics: While retrieving load balancers, this is the current version of this application load balancer resource that changes during updates of the load balancers. On updates this field specified the application load balancer version you calculated your update for instead of the future version to enable concurrency safe updates. Update calls will then report the new version in their result as you would see with a application load balancer retrieval call later. There exist no total order of the version, so you can only compare it for equality, but not for less/greater than another version. Since the creation of application load balancer is always intended to create the first version of it, there should be no existing version. That's why this field must by empty of not present in that case. + Version LoadBalancerGetVersionAttributeType `json:"version,omitempty"` +} + +// NewLoadBalancer instantiates a new LoadBalancer 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 NewLoadBalancer() *LoadBalancer { + this := LoadBalancer{} + return &this +} + +// NewLoadBalancerWithDefaults instantiates a new LoadBalancer 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 NewLoadBalancerWithDefaults() *LoadBalancer { + this := LoadBalancer{} + return &this +} + +// GetDisableTargetSecurityGroupAssignment returns the DisableTargetSecurityGroupAssignment field value if set, zero value otherwise. +func (o *LoadBalancer) GetDisableTargetSecurityGroupAssignment() (res LoadBalancergetDisableTargetSecurityGroupAssignmentRetType) { + res, _ = o.GetDisableTargetSecurityGroupAssignmentOk() + return +} + +// GetDisableTargetSecurityGroupAssignmentOk returns a tuple with the DisableTargetSecurityGroupAssignment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetDisableTargetSecurityGroupAssignmentOk() (ret LoadBalancergetDisableTargetSecurityGroupAssignmentRetType, ok bool) { + return getLoadBalancergetDisableTargetSecurityGroupAssignmentAttributeTypeOk(o.DisableTargetSecurityGroupAssignment) +} + +// HasDisableTargetSecurityGroupAssignment returns a boolean if a field has been set. +func (o *LoadBalancer) HasDisableTargetSecurityGroupAssignment() bool { + _, ok := o.GetDisableTargetSecurityGroupAssignmentOk() + return ok +} + +// SetDisableTargetSecurityGroupAssignment gets a reference to the given bool and assigns it to the DisableTargetSecurityGroupAssignment field. +func (o *LoadBalancer) SetDisableTargetSecurityGroupAssignment(v LoadBalancergetDisableTargetSecurityGroupAssignmentRetType) { + setLoadBalancergetDisableTargetSecurityGroupAssignmentAttributeType(&o.DisableTargetSecurityGroupAssignment, v) +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *LoadBalancer) GetErrors() (res LoadBalancerGetErrorsRetType) { + res, _ = o.GetErrorsOk() + return +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetErrorsOk() (ret LoadBalancerGetErrorsRetType, ok bool) { + return getLoadBalancerGetErrorsAttributeTypeOk(o.Errors) +} + +// HasErrors returns a boolean if a field has been set. +func (o *LoadBalancer) HasErrors() bool { + _, ok := o.GetErrorsOk() + return ok +} + +// SetErrors gets a reference to the given []LoadBalancerError and assigns it to the Errors field. +func (o *LoadBalancer) SetErrors(v LoadBalancerGetErrorsRetType) { + setLoadBalancerGetErrorsAttributeType(&o.Errors, v) +} + +// GetExternalAddress returns the ExternalAddress field value if set, zero value otherwise. +func (o *LoadBalancer) GetExternalAddress() (res LoadBalancerGetExternalAddressRetType) { + res, _ = o.GetExternalAddressOk() + return +} + +// GetExternalAddressOk returns a tuple with the ExternalAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetExternalAddressOk() (ret LoadBalancerGetExternalAddressRetType, ok bool) { + return getLoadBalancerGetExternalAddressAttributeTypeOk(o.ExternalAddress) +} + +// HasExternalAddress returns a boolean if a field has been set. +func (o *LoadBalancer) HasExternalAddress() bool { + _, ok := o.GetExternalAddressOk() + return ok +} + +// SetExternalAddress gets a reference to the given string and assigns it to the ExternalAddress field. +func (o *LoadBalancer) SetExternalAddress(v LoadBalancerGetExternalAddressRetType) { + setLoadBalancerGetExternalAddressAttributeType(&o.ExternalAddress, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *LoadBalancer) GetLabels() (res LoadBalancerGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetLabelsOk() (ret LoadBalancerGetLabelsRetType, ok bool) { + return getLoadBalancerGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *LoadBalancer) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *LoadBalancer) SetLabels(v LoadBalancerGetLabelsRetType) { + setLoadBalancerGetLabelsAttributeType(&o.Labels, v) +} + +// GetListeners returns the Listeners field value if set, zero value otherwise. +func (o *LoadBalancer) GetListeners() (res LoadBalancerGetListenersRetType) { + res, _ = o.GetListenersOk() + return +} + +// GetListenersOk returns a tuple with the Listeners field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetListenersOk() (ret LoadBalancerGetListenersRetType, ok bool) { + return getLoadBalancerGetListenersAttributeTypeOk(o.Listeners) +} + +// HasListeners returns a boolean if a field has been set. +func (o *LoadBalancer) HasListeners() bool { + _, ok := o.GetListenersOk() + return ok +} + +// SetListeners gets a reference to the given []Listener and assigns it to the Listeners field. +func (o *LoadBalancer) SetListeners(v LoadBalancerGetListenersRetType) { + setLoadBalancerGetListenersAttributeType(&o.Listeners, v) +} + +// GetLoadBalancerSecurityGroup returns the LoadBalancerSecurityGroup field value if set, zero value otherwise. +func (o *LoadBalancer) GetLoadBalancerSecurityGroup() (res LoadBalancerGetLoadBalancerSecurityGroupRetType) { + res, _ = o.GetLoadBalancerSecurityGroupOk() + return +} + +// GetLoadBalancerSecurityGroupOk returns a tuple with the LoadBalancerSecurityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetLoadBalancerSecurityGroupOk() (ret LoadBalancerGetLoadBalancerSecurityGroupRetType, ok bool) { + return getLoadBalancerGetLoadBalancerSecurityGroupAttributeTypeOk(o.LoadBalancerSecurityGroup) +} + +// HasLoadBalancerSecurityGroup returns a boolean if a field has been set. +func (o *LoadBalancer) HasLoadBalancerSecurityGroup() bool { + _, ok := o.GetLoadBalancerSecurityGroupOk() + return ok +} + +// SetLoadBalancerSecurityGroup gets a reference to the given CreateLoadBalancerPayloadLoadBalancerSecurityGroup and assigns it to the LoadBalancerSecurityGroup field. +func (o *LoadBalancer) SetLoadBalancerSecurityGroup(v LoadBalancerGetLoadBalancerSecurityGroupRetType) { + setLoadBalancerGetLoadBalancerSecurityGroupAttributeType(&o.LoadBalancerSecurityGroup, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *LoadBalancer) GetName() (res LoadBalancerGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetNameOk() (ret LoadBalancerGetNameRetType, ok bool) { + return getLoadBalancerGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *LoadBalancer) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LoadBalancer) SetName(v LoadBalancerGetNameRetType) { + setLoadBalancerGetNameAttributeType(&o.Name, v) +} + +// GetNetworks returns the Networks field value if set, zero value otherwise. +func (o *LoadBalancer) GetNetworks() (res LoadBalancerGetNetworksRetType) { + res, _ = o.GetNetworksOk() + return +} + +// GetNetworksOk returns a tuple with the Networks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetNetworksOk() (ret LoadBalancerGetNetworksRetType, ok bool) { + return getLoadBalancerGetNetworksAttributeTypeOk(o.Networks) +} + +// HasNetworks returns a boolean if a field has been set. +func (o *LoadBalancer) HasNetworks() bool { + _, ok := o.GetNetworksOk() + return ok +} + +// SetNetworks gets a reference to the given []Network and assigns it to the Networks field. +func (o *LoadBalancer) SetNetworks(v LoadBalancerGetNetworksRetType) { + setLoadBalancerGetNetworksAttributeType(&o.Networks, v) +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *LoadBalancer) GetOptions() (res LoadBalancerGetOptionsRetType) { + res, _ = o.GetOptionsOk() + return +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetOptionsOk() (ret LoadBalancerGetOptionsRetType, ok bool) { + return getLoadBalancerGetOptionsAttributeTypeOk(o.Options) +} + +// HasOptions returns a boolean if a field has been set. +func (o *LoadBalancer) HasOptions() bool { + _, ok := o.GetOptionsOk() + return ok +} + +// SetOptions gets a reference to the given LoadBalancerOptions and assigns it to the Options field. +func (o *LoadBalancer) SetOptions(v LoadBalancerGetOptionsRetType) { + setLoadBalancerGetOptionsAttributeType(&o.Options, v) +} + +// GetPlanId returns the PlanId field value if set, zero value otherwise. +func (o *LoadBalancer) GetPlanId() (res LoadBalancerGetPlanIdRetType) { + res, _ = o.GetPlanIdOk() + return +} + +// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetPlanIdOk() (ret LoadBalancerGetPlanIdRetType, ok bool) { + return getLoadBalancerGetPlanIdAttributeTypeOk(o.PlanId) +} + +// HasPlanId returns a boolean if a field has been set. +func (o *LoadBalancer) HasPlanId() bool { + _, ok := o.GetPlanIdOk() + return ok +} + +// SetPlanId gets a reference to the given string and assigns it to the PlanId field. +func (o *LoadBalancer) SetPlanId(v LoadBalancerGetPlanIdRetType) { + setLoadBalancerGetPlanIdAttributeType(&o.PlanId, v) +} + +// GetPrivateAddress returns the PrivateAddress field value if set, zero value otherwise. +func (o *LoadBalancer) GetPrivateAddress() (res LoadBalancerGetPrivateAddressRetType) { + res, _ = o.GetPrivateAddressOk() + return +} + +// GetPrivateAddressOk returns a tuple with the PrivateAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetPrivateAddressOk() (ret LoadBalancerGetPrivateAddressRetType, ok bool) { + return getLoadBalancerGetPrivateAddressAttributeTypeOk(o.PrivateAddress) +} + +// HasPrivateAddress returns a boolean if a field has been set. +func (o *LoadBalancer) HasPrivateAddress() bool { + _, ok := o.GetPrivateAddressOk() + return ok +} + +// SetPrivateAddress gets a reference to the given string and assigns it to the PrivateAddress field. +func (o *LoadBalancer) SetPrivateAddress(v LoadBalancerGetPrivateAddressRetType) { + setLoadBalancerGetPrivateAddressAttributeType(&o.PrivateAddress, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *LoadBalancer) GetRegion() (res LoadBalancerGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetRegionOk() (ret LoadBalancerGetRegionRetType, ok bool) { + return getLoadBalancerGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *LoadBalancer) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *LoadBalancer) SetRegion(v LoadBalancerGetRegionRetType) { + setLoadBalancerGetRegionAttributeType(&o.Region, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *LoadBalancer) GetStatus() (res LoadBalancerGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetStatusOk() (ret LoadBalancerGetStatusRetType, ok bool) { + return getLoadBalancerGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *LoadBalancer) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *LoadBalancer) SetStatus(v LoadBalancerGetStatusRetType) { + setLoadBalancerGetStatusAttributeType(&o.Status, v) +} + +// GetTargetPools returns the TargetPools field value if set, zero value otherwise. +func (o *LoadBalancer) GetTargetPools() (res LoadBalancerGetTargetPoolsRetType) { + res, _ = o.GetTargetPoolsOk() + return +} + +// GetTargetPoolsOk returns a tuple with the TargetPools field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetTargetPoolsOk() (ret LoadBalancerGetTargetPoolsRetType, ok bool) { + return getLoadBalancerGetTargetPoolsAttributeTypeOk(o.TargetPools) +} + +// HasTargetPools returns a boolean if a field has been set. +func (o *LoadBalancer) HasTargetPools() bool { + _, ok := o.GetTargetPoolsOk() + return ok +} + +// SetTargetPools gets a reference to the given []TargetPool and assigns it to the TargetPools field. +func (o *LoadBalancer) SetTargetPools(v LoadBalancerGetTargetPoolsRetType) { + setLoadBalancerGetTargetPoolsAttributeType(&o.TargetPools, v) +} + +// GetTargetSecurityGroup returns the TargetSecurityGroup field value if set, zero value otherwise. +func (o *LoadBalancer) GetTargetSecurityGroup() (res LoadBalancerGetTargetSecurityGroupRetType) { + res, _ = o.GetTargetSecurityGroupOk() + return +} + +// GetTargetSecurityGroupOk returns a tuple with the TargetSecurityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetTargetSecurityGroupOk() (ret LoadBalancerGetTargetSecurityGroupRetType, ok bool) { + return getLoadBalancerGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup) +} + +// HasTargetSecurityGroup returns a boolean if a field has been set. +func (o *LoadBalancer) HasTargetSecurityGroup() bool { + _, ok := o.GetTargetSecurityGroupOk() + return ok +} + +// SetTargetSecurityGroup gets a reference to the given CreateLoadBalancerPayloadTargetSecurityGroup and assigns it to the TargetSecurityGroup field. +func (o *LoadBalancer) SetTargetSecurityGroup(v LoadBalancerGetTargetSecurityGroupRetType) { + setLoadBalancerGetTargetSecurityGroupAttributeType(&o.TargetSecurityGroup, v) +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *LoadBalancer) GetVersion() (res LoadBalancerGetVersionRetType) { + res, _ = o.GetVersionOk() + return +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancer) GetVersionOk() (ret LoadBalancerGetVersionRetType, ok bool) { + return getLoadBalancerGetVersionAttributeTypeOk(o.Version) +} + +// HasVersion returns a boolean if a field has been set. +func (o *LoadBalancer) HasVersion() bool { + _, ok := o.GetVersionOk() + return ok +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *LoadBalancer) SetVersion(v LoadBalancerGetVersionRetType) { + setLoadBalancerGetVersionAttributeType(&o.Version, v) +} + +func (o LoadBalancer) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLoadBalancergetDisableTargetSecurityGroupAssignmentAttributeTypeOk(o.DisableTargetSecurityGroupAssignment); ok { + toSerialize["DisableTargetSecurityGroupAssignment"] = val + } + if val, ok := getLoadBalancerGetErrorsAttributeTypeOk(o.Errors); ok { + toSerialize["Errors"] = val + } + if val, ok := getLoadBalancerGetExternalAddressAttributeTypeOk(o.ExternalAddress); ok { + toSerialize["ExternalAddress"] = val + } + if val, ok := getLoadBalancerGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getLoadBalancerGetListenersAttributeTypeOk(o.Listeners); ok { + toSerialize["Listeners"] = val + } + if val, ok := getLoadBalancerGetLoadBalancerSecurityGroupAttributeTypeOk(o.LoadBalancerSecurityGroup); ok { + toSerialize["LoadBalancerSecurityGroup"] = val + } + if val, ok := getLoadBalancerGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getLoadBalancerGetNetworksAttributeTypeOk(o.Networks); ok { + toSerialize["Networks"] = val + } + if val, ok := getLoadBalancerGetOptionsAttributeTypeOk(o.Options); ok { + toSerialize["Options"] = val + } + if val, ok := getLoadBalancerGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + if val, ok := getLoadBalancerGetPrivateAddressAttributeTypeOk(o.PrivateAddress); ok { + toSerialize["PrivateAddress"] = val + } + if val, ok := getLoadBalancerGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getLoadBalancerGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getLoadBalancerGetTargetPoolsAttributeTypeOk(o.TargetPools); ok { + toSerialize["TargetPools"] = val + } + if val, ok := getLoadBalancerGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup); ok { + toSerialize["TargetSecurityGroup"] = val + } + if val, ok := getLoadBalancerGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +type NullableLoadBalancer struct { + value *LoadBalancer + isSet bool +} + +func (v NullableLoadBalancer) Get() *LoadBalancer { + return v.value +} + +func (v *NullableLoadBalancer) Set(val *LoadBalancer) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancer) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancer(val *LoadBalancer) *NullableLoadBalancer { + return &NullableLoadBalancer{value: val, isSet: true} +} + +func (v NullableLoadBalancer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_load_balancer_error.go b/pkg/albbeta/model_load_balancer_error.go new file mode 100644 index 00000000..1ae4be0f --- /dev/null +++ b/pkg/albbeta/model_load_balancer_error.go @@ -0,0 +1,296 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the LoadBalancerError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoadBalancerError{} + +/* + types and functions for description +*/ + +// isNotNullableString +type LoadBalancerErrorGetDescriptionAttributeType = *string + +func getLoadBalancerErrorGetDescriptionAttributeTypeOk(arg LoadBalancerErrorGetDescriptionAttributeType) (ret LoadBalancerErrorGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerErrorGetDescriptionAttributeType(arg *LoadBalancerErrorGetDescriptionAttributeType, val LoadBalancerErrorGetDescriptionRetType) { + *arg = &val +} + +type LoadBalancerErrorGetDescriptionArgType = string +type LoadBalancerErrorGetDescriptionRetType = string + +/* + types and functions for type +*/ + +// isEnum + +// LoadBalancerErrorTypes The error type specifies which part of the application load balancer encountered the error. I.e. the API will not check if a provided public IP is actually available in the project. Instead the application load balancer with try to use the provided IP and if not available reports TYPE_FIP_NOT_CONFIGURED error. +// value type for enums +type LoadBalancerErrorTypes string + +// List of Type +const ( + LOADBALANCERERRORTYPE_UNSPECIFIED LoadBalancerErrorTypes = "TYPE_UNSPECIFIED" + LOADBALANCERERRORTYPE_INTERNAL LoadBalancerErrorTypes = "TYPE_INTERNAL" + LOADBALANCERERRORTYPE_QUOTA_SECGROUP_EXCEEDED LoadBalancerErrorTypes = "TYPE_QUOTA_SECGROUP_EXCEEDED" + LOADBALANCERERRORTYPE_QUOTA_SECGROUPRULE_EXCEEDED LoadBalancerErrorTypes = "TYPE_QUOTA_SECGROUPRULE_EXCEEDED" + LOADBALANCERERRORTYPE_PORT_NOT_CONFIGURED LoadBalancerErrorTypes = "TYPE_PORT_NOT_CONFIGURED" + LOADBALANCERERRORTYPE_FIP_NOT_CONFIGURED LoadBalancerErrorTypes = "TYPE_FIP_NOT_CONFIGURED" + LOADBALANCERERRORTYPE_TARGET_NOT_ACTIVE LoadBalancerErrorTypes = "TYPE_TARGET_NOT_ACTIVE" + LOADBALANCERERRORTYPE_METRICS_MISCONFIGURED LoadBalancerErrorTypes = "TYPE_METRICS_MISCONFIGURED" + LOADBALANCERERRORTYPE_LOGS_MISCONFIGURED LoadBalancerErrorTypes = "TYPE_LOGS_MISCONFIGURED" +) + +// All allowed values of LoadBalancerError enum +var AllowedLoadBalancerErrorTypesEnumValues = []LoadBalancerErrorTypes{ + "TYPE_UNSPECIFIED", + "TYPE_INTERNAL", + "TYPE_QUOTA_SECGROUP_EXCEEDED", + "TYPE_QUOTA_SECGROUPRULE_EXCEEDED", + "TYPE_PORT_NOT_CONFIGURED", + "TYPE_FIP_NOT_CONFIGURED", + "TYPE_TARGET_NOT_ACTIVE", + "TYPE_METRICS_MISCONFIGURED", + "TYPE_LOGS_MISCONFIGURED", +} + +func (v *LoadBalancerErrorTypes) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson LoadBalancerErrorTypes + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := LoadBalancerErrorTypes(value) + for _, existing := range AllowedLoadBalancerErrorTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LoadBalancerError", value) +} + +// NewLoadBalancerErrorTypesFromValue returns a pointer to a valid LoadBalancerErrorTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLoadBalancerErrorTypesFromValue(v LoadBalancerErrorTypes) (*LoadBalancerErrorTypes, error) { + ev := LoadBalancerErrorTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LoadBalancerErrorTypes: valid values are %v", v, AllowedLoadBalancerErrorTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LoadBalancerErrorTypes) IsValid() bool { + for _, existing := range AllowedLoadBalancerErrorTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v LoadBalancerErrorTypes) Ptr() *LoadBalancerErrorTypes { + return &v +} + +type NullableLoadBalancerErrorTypes struct { + value *LoadBalancerErrorTypes + isSet bool +} + +func (v NullableLoadBalancerErrorTypes) Get() *LoadBalancerErrorTypes { + return v.value +} + +func (v *NullableLoadBalancerErrorTypes) Set(val *LoadBalancerErrorTypes) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancerErrorTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancerErrorTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancerErrorTypes(val *LoadBalancerErrorTypes) *NullableLoadBalancerErrorTypes { + return &NullableLoadBalancerErrorTypes{value: val, isSet: true} +} + +func (v NullableLoadBalancerErrorTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancerErrorTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type LoadBalancerErrorGetTypeAttributeType = *LoadBalancerErrorTypes +type LoadBalancerErrorGetTypeArgType = LoadBalancerErrorTypes +type LoadBalancerErrorGetTypeRetType = LoadBalancerErrorTypes + +func getLoadBalancerErrorGetTypeAttributeTypeOk(arg LoadBalancerErrorGetTypeAttributeType) (ret LoadBalancerErrorGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerErrorGetTypeAttributeType(arg *LoadBalancerErrorGetTypeAttributeType, val LoadBalancerErrorGetTypeRetType) { + *arg = &val +} + +// LoadBalancerError struct for LoadBalancerError +type LoadBalancerError struct { + // The error description contains additional helpful user information to fix the error state of the application load balancer. For example the IP 45.135.247.139 does not exist in the project, then the description will report: Floating IP \"45.135.247.139\" could not be found. + Description LoadBalancerErrorGetDescriptionAttributeType `json:"description,omitempty"` + // The error type specifies which part of the application load balancer encountered the error. I.e. the API will not check if a provided public IP is actually available in the project. Instead the application load balancer with try to use the provided IP and if not available reports TYPE_FIP_NOT_CONFIGURED error. + Type LoadBalancerErrorGetTypeAttributeType `json:"type,omitempty"` +} + +// NewLoadBalancerError instantiates a new LoadBalancerError 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 NewLoadBalancerError() *LoadBalancerError { + this := LoadBalancerError{} + return &this +} + +// NewLoadBalancerErrorWithDefaults instantiates a new LoadBalancerError 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 NewLoadBalancerErrorWithDefaults() *LoadBalancerError { + this := LoadBalancerError{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *LoadBalancerError) GetDescription() (res LoadBalancerErrorGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancerError) GetDescriptionOk() (ret LoadBalancerErrorGetDescriptionRetType, ok bool) { + return getLoadBalancerErrorGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *LoadBalancerError) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *LoadBalancerError) SetDescription(v LoadBalancerErrorGetDescriptionRetType) { + setLoadBalancerErrorGetDescriptionAttributeType(&o.Description, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *LoadBalancerError) GetType() (res LoadBalancerErrorGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancerError) GetTypeOk() (ret LoadBalancerErrorGetTypeRetType, ok bool) { + return getLoadBalancerErrorGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *LoadBalancerError) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *LoadBalancerError) SetType(v LoadBalancerErrorGetTypeRetType) { + setLoadBalancerErrorGetTypeAttributeType(&o.Type, v) +} + +func (o LoadBalancerError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLoadBalancerErrorGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getLoadBalancerErrorGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableLoadBalancerError struct { + value *LoadBalancerError + isSet bool +} + +func (v NullableLoadBalancerError) Get() *LoadBalancerError { + return v.value +} + +func (v *NullableLoadBalancerError) Set(val *LoadBalancerError) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancerError) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancerError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancerError(val *LoadBalancerError) *NullableLoadBalancerError { + return &NullableLoadBalancerError{value: val, isSet: true} +} + +func (v NullableLoadBalancerError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancerError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_load_balancer_error_test.go b/pkg/albbeta/model_load_balancer_error_test.go new file mode 100644 index 00000000..e7fca1d1 --- /dev/null +++ b/pkg/albbeta/model_load_balancer_error_test.go @@ -0,0 +1,107 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "testing" +) + +// isEnum + +func TestLoadBalancerErrorTypes_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"TYPE_UNSPECIFIED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"TYPE_INTERNAL"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"TYPE_QUOTA_SECGROUP_EXCEEDED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"TYPE_QUOTA_SECGROUPRULE_EXCEEDED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 5`, + args: args{ + src: []byte(`"TYPE_PORT_NOT_CONFIGURED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 6`, + args: args{ + src: []byte(`"TYPE_FIP_NOT_CONFIGURED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 7`, + args: args{ + src: []byte(`"TYPE_TARGET_NOT_ACTIVE"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 8`, + args: args{ + src: []byte(`"TYPE_METRICS_MISCONFIGURED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 9`, + args: args{ + src: []byte(`"TYPE_LOGS_MISCONFIGURED"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := LoadBalancerErrorTypes("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/albbeta/model_load_balancer_options.go b/pkg/albbeta/model_load_balancer_options.go new file mode 100644 index 00000000..abc14cf4 --- /dev/null +++ b/pkg/albbeta/model_load_balancer_options.go @@ -0,0 +1,269 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the LoadBalancerOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoadBalancerOptions{} + +/* + types and functions for accessControl +*/ + +// isModel +type LoadBalancerOptionsGetAccessControlAttributeType = *LoadbalancerOptionAccessControl +type LoadBalancerOptionsGetAccessControlArgType = LoadbalancerOptionAccessControl +type LoadBalancerOptionsGetAccessControlRetType = LoadbalancerOptionAccessControl + +func getLoadBalancerOptionsGetAccessControlAttributeTypeOk(arg LoadBalancerOptionsGetAccessControlAttributeType) (ret LoadBalancerOptionsGetAccessControlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerOptionsGetAccessControlAttributeType(arg *LoadBalancerOptionsGetAccessControlAttributeType, val LoadBalancerOptionsGetAccessControlRetType) { + *arg = &val +} + +/* + types and functions for ephemeralAddress +*/ + +// isBoolean +type LoadBalancerOptionsgetEphemeralAddressAttributeType = *bool +type LoadBalancerOptionsgetEphemeralAddressArgType = bool +type LoadBalancerOptionsgetEphemeralAddressRetType = bool + +func getLoadBalancerOptionsgetEphemeralAddressAttributeTypeOk(arg LoadBalancerOptionsgetEphemeralAddressAttributeType) (ret LoadBalancerOptionsgetEphemeralAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerOptionsgetEphemeralAddressAttributeType(arg *LoadBalancerOptionsgetEphemeralAddressAttributeType, val LoadBalancerOptionsgetEphemeralAddressRetType) { + *arg = &val +} + +/* + types and functions for observability +*/ + +// isModel +type LoadBalancerOptionsGetObservabilityAttributeType = *LoadbalancerOptionObservability +type LoadBalancerOptionsGetObservabilityArgType = LoadbalancerOptionObservability +type LoadBalancerOptionsGetObservabilityRetType = LoadbalancerOptionObservability + +func getLoadBalancerOptionsGetObservabilityAttributeTypeOk(arg LoadBalancerOptionsGetObservabilityAttributeType) (ret LoadBalancerOptionsGetObservabilityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerOptionsGetObservabilityAttributeType(arg *LoadBalancerOptionsGetObservabilityAttributeType, val LoadBalancerOptionsGetObservabilityRetType) { + *arg = &val +} + +/* + types and functions for privateNetworkOnly +*/ + +// isBoolean +type LoadBalancerOptionsgetPrivateNetworkOnlyAttributeType = *bool +type LoadBalancerOptionsgetPrivateNetworkOnlyArgType = bool +type LoadBalancerOptionsgetPrivateNetworkOnlyRetType = bool + +func getLoadBalancerOptionsgetPrivateNetworkOnlyAttributeTypeOk(arg LoadBalancerOptionsgetPrivateNetworkOnlyAttributeType) (ret LoadBalancerOptionsgetPrivateNetworkOnlyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadBalancerOptionsgetPrivateNetworkOnlyAttributeType(arg *LoadBalancerOptionsgetPrivateNetworkOnlyAttributeType, val LoadBalancerOptionsgetPrivateNetworkOnlyRetType) { + *arg = &val +} + +// LoadBalancerOptions Defines any optional functionality you want to have enabled on your application load balancer. +type LoadBalancerOptions struct { + AccessControl LoadBalancerOptionsGetAccessControlAttributeType `json:"accessControl,omitempty"` + EphemeralAddress LoadBalancerOptionsgetEphemeralAddressAttributeType `json:"ephemeralAddress,omitempty"` + Observability LoadBalancerOptionsGetObservabilityAttributeType `json:"observability,omitempty"` + // Application Load Balancer is accessible only via a private network ip address. Not changeable after creation. + PrivateNetworkOnly LoadBalancerOptionsgetPrivateNetworkOnlyAttributeType `json:"privateNetworkOnly,omitempty"` +} + +// NewLoadBalancerOptions instantiates a new LoadBalancerOptions 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 NewLoadBalancerOptions() *LoadBalancerOptions { + this := LoadBalancerOptions{} + return &this +} + +// NewLoadBalancerOptionsWithDefaults instantiates a new LoadBalancerOptions 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 NewLoadBalancerOptionsWithDefaults() *LoadBalancerOptions { + this := LoadBalancerOptions{} + return &this +} + +// GetAccessControl returns the AccessControl field value if set, zero value otherwise. +func (o *LoadBalancerOptions) GetAccessControl() (res LoadBalancerOptionsGetAccessControlRetType) { + res, _ = o.GetAccessControlOk() + return +} + +// GetAccessControlOk returns a tuple with the AccessControl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancerOptions) GetAccessControlOk() (ret LoadBalancerOptionsGetAccessControlRetType, ok bool) { + return getLoadBalancerOptionsGetAccessControlAttributeTypeOk(o.AccessControl) +} + +// HasAccessControl returns a boolean if a field has been set. +func (o *LoadBalancerOptions) HasAccessControl() bool { + _, ok := o.GetAccessControlOk() + return ok +} + +// SetAccessControl gets a reference to the given LoadbalancerOptionAccessControl and assigns it to the AccessControl field. +func (o *LoadBalancerOptions) SetAccessControl(v LoadBalancerOptionsGetAccessControlRetType) { + setLoadBalancerOptionsGetAccessControlAttributeType(&o.AccessControl, v) +} + +// GetEphemeralAddress returns the EphemeralAddress field value if set, zero value otherwise. +func (o *LoadBalancerOptions) GetEphemeralAddress() (res LoadBalancerOptionsgetEphemeralAddressRetType) { + res, _ = o.GetEphemeralAddressOk() + return +} + +// GetEphemeralAddressOk returns a tuple with the EphemeralAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancerOptions) GetEphemeralAddressOk() (ret LoadBalancerOptionsgetEphemeralAddressRetType, ok bool) { + return getLoadBalancerOptionsgetEphemeralAddressAttributeTypeOk(o.EphemeralAddress) +} + +// HasEphemeralAddress returns a boolean if a field has been set. +func (o *LoadBalancerOptions) HasEphemeralAddress() bool { + _, ok := o.GetEphemeralAddressOk() + return ok +} + +// SetEphemeralAddress gets a reference to the given bool and assigns it to the EphemeralAddress field. +func (o *LoadBalancerOptions) SetEphemeralAddress(v LoadBalancerOptionsgetEphemeralAddressRetType) { + setLoadBalancerOptionsgetEphemeralAddressAttributeType(&o.EphemeralAddress, v) +} + +// GetObservability returns the Observability field value if set, zero value otherwise. +func (o *LoadBalancerOptions) GetObservability() (res LoadBalancerOptionsGetObservabilityRetType) { + res, _ = o.GetObservabilityOk() + return +} + +// GetObservabilityOk returns a tuple with the Observability field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancerOptions) GetObservabilityOk() (ret LoadBalancerOptionsGetObservabilityRetType, ok bool) { + return getLoadBalancerOptionsGetObservabilityAttributeTypeOk(o.Observability) +} + +// HasObservability returns a boolean if a field has been set. +func (o *LoadBalancerOptions) HasObservability() bool { + _, ok := o.GetObservabilityOk() + return ok +} + +// SetObservability gets a reference to the given LoadbalancerOptionObservability and assigns it to the Observability field. +func (o *LoadBalancerOptions) SetObservability(v LoadBalancerOptionsGetObservabilityRetType) { + setLoadBalancerOptionsGetObservabilityAttributeType(&o.Observability, v) +} + +// GetPrivateNetworkOnly returns the PrivateNetworkOnly field value if set, zero value otherwise. +func (o *LoadBalancerOptions) GetPrivateNetworkOnly() (res LoadBalancerOptionsgetPrivateNetworkOnlyRetType) { + res, _ = o.GetPrivateNetworkOnlyOk() + return +} + +// GetPrivateNetworkOnlyOk returns a tuple with the PrivateNetworkOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadBalancerOptions) GetPrivateNetworkOnlyOk() (ret LoadBalancerOptionsgetPrivateNetworkOnlyRetType, ok bool) { + return getLoadBalancerOptionsgetPrivateNetworkOnlyAttributeTypeOk(o.PrivateNetworkOnly) +} + +// HasPrivateNetworkOnly returns a boolean if a field has been set. +func (o *LoadBalancerOptions) HasPrivateNetworkOnly() bool { + _, ok := o.GetPrivateNetworkOnlyOk() + return ok +} + +// SetPrivateNetworkOnly gets a reference to the given bool and assigns it to the PrivateNetworkOnly field. +func (o *LoadBalancerOptions) SetPrivateNetworkOnly(v LoadBalancerOptionsgetPrivateNetworkOnlyRetType) { + setLoadBalancerOptionsgetPrivateNetworkOnlyAttributeType(&o.PrivateNetworkOnly, v) +} + +func (o LoadBalancerOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLoadBalancerOptionsGetAccessControlAttributeTypeOk(o.AccessControl); ok { + toSerialize["AccessControl"] = val + } + if val, ok := getLoadBalancerOptionsgetEphemeralAddressAttributeTypeOk(o.EphemeralAddress); ok { + toSerialize["EphemeralAddress"] = val + } + if val, ok := getLoadBalancerOptionsGetObservabilityAttributeTypeOk(o.Observability); ok { + toSerialize["Observability"] = val + } + if val, ok := getLoadBalancerOptionsgetPrivateNetworkOnlyAttributeTypeOk(o.PrivateNetworkOnly); ok { + toSerialize["PrivateNetworkOnly"] = val + } + return toSerialize, nil +} + +type NullableLoadBalancerOptions struct { + value *LoadBalancerOptions + isSet bool +} + +func (v NullableLoadBalancerOptions) Get() *LoadBalancerOptions { + return v.value +} + +func (v *NullableLoadBalancerOptions) Set(val *LoadBalancerOptions) { + v.value = val + v.isSet = true +} + +func (v NullableLoadBalancerOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadBalancerOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadBalancerOptions(val *LoadBalancerOptions) *NullableLoadBalancerOptions { + return &NullableLoadBalancerOptions{value: val, isSet: true} +} + +func (v NullableLoadBalancerOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadBalancerOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_load_balancer_options_test.go b/pkg/albbeta/model_load_balancer_options_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_load_balancer_options_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_load_balancer_test.go b/pkg/albbeta/model_load_balancer_test.go new file mode 100644 index 00000000..b57efb30 --- /dev/null +++ b/pkg/albbeta/model_load_balancer_test.go @@ -0,0 +1,79 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "testing" +) + +// isEnum + +func TestLoadBalancerStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"STATUS_UNSPECIFIED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"STATUS_PENDING"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"STATUS_READY"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"STATUS_ERROR"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 5`, + args: args{ + src: []byte(`"STATUS_TERMINATING"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := LoadBalancerStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/albbeta/model_loadbalancer_option_access_control.go b/pkg/albbeta/model_loadbalancer_option_access_control.go new file mode 100644 index 00000000..77318775 --- /dev/null +++ b/pkg/albbeta/model_loadbalancer_option_access_control.go @@ -0,0 +1,128 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the LoadbalancerOptionAccessControl type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoadbalancerOptionAccessControl{} + +/* + types and functions for allowedSourceRanges +*/ + +// isArray +type LoadbalancerOptionAccessControlGetAllowedSourceRangesAttributeType = *[]string +type LoadbalancerOptionAccessControlGetAllowedSourceRangesArgType = []string +type LoadbalancerOptionAccessControlGetAllowedSourceRangesRetType = []string + +func getLoadbalancerOptionAccessControlGetAllowedSourceRangesAttributeTypeOk(arg LoadbalancerOptionAccessControlGetAllowedSourceRangesAttributeType) (ret LoadbalancerOptionAccessControlGetAllowedSourceRangesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadbalancerOptionAccessControlGetAllowedSourceRangesAttributeType(arg *LoadbalancerOptionAccessControlGetAllowedSourceRangesAttributeType, val LoadbalancerOptionAccessControlGetAllowedSourceRangesRetType) { + *arg = &val +} + +// LoadbalancerOptionAccessControl Use this option to limit the IP ranges that can use the application load balancer. +type LoadbalancerOptionAccessControl struct { + // Application Load Balancer is accessible only from an IP address in this range + AllowedSourceRanges LoadbalancerOptionAccessControlGetAllowedSourceRangesAttributeType `json:"allowedSourceRanges,omitempty"` +} + +// NewLoadbalancerOptionAccessControl instantiates a new LoadbalancerOptionAccessControl 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 NewLoadbalancerOptionAccessControl() *LoadbalancerOptionAccessControl { + this := LoadbalancerOptionAccessControl{} + return &this +} + +// NewLoadbalancerOptionAccessControlWithDefaults instantiates a new LoadbalancerOptionAccessControl 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 NewLoadbalancerOptionAccessControlWithDefaults() *LoadbalancerOptionAccessControl { + this := LoadbalancerOptionAccessControl{} + return &this +} + +// GetAllowedSourceRanges returns the AllowedSourceRanges field value if set, zero value otherwise. +func (o *LoadbalancerOptionAccessControl) GetAllowedSourceRanges() (res LoadbalancerOptionAccessControlGetAllowedSourceRangesRetType) { + res, _ = o.GetAllowedSourceRangesOk() + return +} + +// GetAllowedSourceRangesOk returns a tuple with the AllowedSourceRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadbalancerOptionAccessControl) GetAllowedSourceRangesOk() (ret LoadbalancerOptionAccessControlGetAllowedSourceRangesRetType, ok bool) { + return getLoadbalancerOptionAccessControlGetAllowedSourceRangesAttributeTypeOk(o.AllowedSourceRanges) +} + +// HasAllowedSourceRanges returns a boolean if a field has been set. +func (o *LoadbalancerOptionAccessControl) HasAllowedSourceRanges() bool { + _, ok := o.GetAllowedSourceRangesOk() + return ok +} + +// SetAllowedSourceRanges gets a reference to the given []string and assigns it to the AllowedSourceRanges field. +func (o *LoadbalancerOptionAccessControl) SetAllowedSourceRanges(v LoadbalancerOptionAccessControlGetAllowedSourceRangesRetType) { + setLoadbalancerOptionAccessControlGetAllowedSourceRangesAttributeType(&o.AllowedSourceRanges, v) +} + +func (o LoadbalancerOptionAccessControl) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLoadbalancerOptionAccessControlGetAllowedSourceRangesAttributeTypeOk(o.AllowedSourceRanges); ok { + toSerialize["AllowedSourceRanges"] = val + } + return toSerialize, nil +} + +type NullableLoadbalancerOptionAccessControl struct { + value *LoadbalancerOptionAccessControl + isSet bool +} + +func (v NullableLoadbalancerOptionAccessControl) Get() *LoadbalancerOptionAccessControl { + return v.value +} + +func (v *NullableLoadbalancerOptionAccessControl) Set(val *LoadbalancerOptionAccessControl) { + v.value = val + v.isSet = true +} + +func (v NullableLoadbalancerOptionAccessControl) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadbalancerOptionAccessControl) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadbalancerOptionAccessControl(val *LoadbalancerOptionAccessControl) *NullableLoadbalancerOptionAccessControl { + return &NullableLoadbalancerOptionAccessControl{value: val, isSet: true} +} + +func (v NullableLoadbalancerOptionAccessControl) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadbalancerOptionAccessControl) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_loadbalancer_option_access_control_test.go b/pkg/albbeta/model_loadbalancer_option_access_control_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_loadbalancer_option_access_control_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_loadbalancer_option_logs.go b/pkg/albbeta/model_loadbalancer_option_logs.go new file mode 100644 index 00000000..e26053b5 --- /dev/null +++ b/pkg/albbeta/model_loadbalancer_option_logs.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the LoadbalancerOptionLogs type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoadbalancerOptionLogs{} + +/* + types and functions for credentialsRef +*/ + +// isNotNullableString +type LoadbalancerOptionLogsGetCredentialsRefAttributeType = *string + +func getLoadbalancerOptionLogsGetCredentialsRefAttributeTypeOk(arg LoadbalancerOptionLogsGetCredentialsRefAttributeType) (ret LoadbalancerOptionLogsGetCredentialsRefRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadbalancerOptionLogsGetCredentialsRefAttributeType(arg *LoadbalancerOptionLogsGetCredentialsRefAttributeType, val LoadbalancerOptionLogsGetCredentialsRefRetType) { + *arg = &val +} + +type LoadbalancerOptionLogsGetCredentialsRefArgType = string +type LoadbalancerOptionLogsGetCredentialsRefRetType = string + +/* + types and functions for pushUrl +*/ + +// isNotNullableString +type LoadbalancerOptionLogsGetPushUrlAttributeType = *string + +func getLoadbalancerOptionLogsGetPushUrlAttributeTypeOk(arg LoadbalancerOptionLogsGetPushUrlAttributeType) (ret LoadbalancerOptionLogsGetPushUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadbalancerOptionLogsGetPushUrlAttributeType(arg *LoadbalancerOptionLogsGetPushUrlAttributeType, val LoadbalancerOptionLogsGetPushUrlRetType) { + *arg = &val +} + +type LoadbalancerOptionLogsGetPushUrlArgType = string +type LoadbalancerOptionLogsGetPushUrlRetType = string + +// LoadbalancerOptionLogs struct for LoadbalancerOptionLogs +type LoadbalancerOptionLogs struct { + // Credentials reference for logging. This reference is created via the observability create endpoint and the credential needs to contain the basic auth username and password for the logging solution the push URL points to. Then this enables monitoring via remote write for the Application Load Balancer. + CredentialsRef LoadbalancerOptionLogsGetCredentialsRefAttributeType `json:"credentialsRef,omitempty"` + // The Observability(Logs)/Loki remote write Push URL you want the logs to be shipped to. + PushUrl LoadbalancerOptionLogsGetPushUrlAttributeType `json:"pushUrl,omitempty"` +} + +// NewLoadbalancerOptionLogs instantiates a new LoadbalancerOptionLogs 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 NewLoadbalancerOptionLogs() *LoadbalancerOptionLogs { + this := LoadbalancerOptionLogs{} + return &this +} + +// NewLoadbalancerOptionLogsWithDefaults instantiates a new LoadbalancerOptionLogs 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 NewLoadbalancerOptionLogsWithDefaults() *LoadbalancerOptionLogs { + this := LoadbalancerOptionLogs{} + return &this +} + +// GetCredentialsRef returns the CredentialsRef field value if set, zero value otherwise. +func (o *LoadbalancerOptionLogs) GetCredentialsRef() (res LoadbalancerOptionLogsGetCredentialsRefRetType) { + res, _ = o.GetCredentialsRefOk() + return +} + +// GetCredentialsRefOk returns a tuple with the CredentialsRef field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadbalancerOptionLogs) GetCredentialsRefOk() (ret LoadbalancerOptionLogsGetCredentialsRefRetType, ok bool) { + return getLoadbalancerOptionLogsGetCredentialsRefAttributeTypeOk(o.CredentialsRef) +} + +// HasCredentialsRef returns a boolean if a field has been set. +func (o *LoadbalancerOptionLogs) HasCredentialsRef() bool { + _, ok := o.GetCredentialsRefOk() + return ok +} + +// SetCredentialsRef gets a reference to the given string and assigns it to the CredentialsRef field. +func (o *LoadbalancerOptionLogs) SetCredentialsRef(v LoadbalancerOptionLogsGetCredentialsRefRetType) { + setLoadbalancerOptionLogsGetCredentialsRefAttributeType(&o.CredentialsRef, v) +} + +// GetPushUrl returns the PushUrl field value if set, zero value otherwise. +func (o *LoadbalancerOptionLogs) GetPushUrl() (res LoadbalancerOptionLogsGetPushUrlRetType) { + res, _ = o.GetPushUrlOk() + return +} + +// GetPushUrlOk returns a tuple with the PushUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadbalancerOptionLogs) GetPushUrlOk() (ret LoadbalancerOptionLogsGetPushUrlRetType, ok bool) { + return getLoadbalancerOptionLogsGetPushUrlAttributeTypeOk(o.PushUrl) +} + +// HasPushUrl returns a boolean if a field has been set. +func (o *LoadbalancerOptionLogs) HasPushUrl() bool { + _, ok := o.GetPushUrlOk() + return ok +} + +// SetPushUrl gets a reference to the given string and assigns it to the PushUrl field. +func (o *LoadbalancerOptionLogs) SetPushUrl(v LoadbalancerOptionLogsGetPushUrlRetType) { + setLoadbalancerOptionLogsGetPushUrlAttributeType(&o.PushUrl, v) +} + +func (o LoadbalancerOptionLogs) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLoadbalancerOptionLogsGetCredentialsRefAttributeTypeOk(o.CredentialsRef); ok { + toSerialize["CredentialsRef"] = val + } + if val, ok := getLoadbalancerOptionLogsGetPushUrlAttributeTypeOk(o.PushUrl); ok { + toSerialize["PushUrl"] = val + } + return toSerialize, nil +} + +type NullableLoadbalancerOptionLogs struct { + value *LoadbalancerOptionLogs + isSet bool +} + +func (v NullableLoadbalancerOptionLogs) Get() *LoadbalancerOptionLogs { + return v.value +} + +func (v *NullableLoadbalancerOptionLogs) Set(val *LoadbalancerOptionLogs) { + v.value = val + v.isSet = true +} + +func (v NullableLoadbalancerOptionLogs) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadbalancerOptionLogs) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadbalancerOptionLogs(val *LoadbalancerOptionLogs) *NullableLoadbalancerOptionLogs { + return &NullableLoadbalancerOptionLogs{value: val, isSet: true} +} + +func (v NullableLoadbalancerOptionLogs) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadbalancerOptionLogs) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_loadbalancer_option_logs_test.go b/pkg/albbeta/model_loadbalancer_option_logs_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_loadbalancer_option_logs_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_loadbalancer_option_metrics.go b/pkg/albbeta/model_loadbalancer_option_metrics.go new file mode 100644 index 00000000..6e10fcb8 --- /dev/null +++ b/pkg/albbeta/model_loadbalancer_option_metrics.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the LoadbalancerOptionMetrics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoadbalancerOptionMetrics{} + +/* + types and functions for credentialsRef +*/ + +// isNotNullableString +type LoadbalancerOptionMetricsGetCredentialsRefAttributeType = *string + +func getLoadbalancerOptionMetricsGetCredentialsRefAttributeTypeOk(arg LoadbalancerOptionMetricsGetCredentialsRefAttributeType) (ret LoadbalancerOptionMetricsGetCredentialsRefRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadbalancerOptionMetricsGetCredentialsRefAttributeType(arg *LoadbalancerOptionMetricsGetCredentialsRefAttributeType, val LoadbalancerOptionMetricsGetCredentialsRefRetType) { + *arg = &val +} + +type LoadbalancerOptionMetricsGetCredentialsRefArgType = string +type LoadbalancerOptionMetricsGetCredentialsRefRetType = string + +/* + types and functions for pushUrl +*/ + +// isNotNullableString +type LoadbalancerOptionMetricsGetPushUrlAttributeType = *string + +func getLoadbalancerOptionMetricsGetPushUrlAttributeTypeOk(arg LoadbalancerOptionMetricsGetPushUrlAttributeType) (ret LoadbalancerOptionMetricsGetPushUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadbalancerOptionMetricsGetPushUrlAttributeType(arg *LoadbalancerOptionMetricsGetPushUrlAttributeType, val LoadbalancerOptionMetricsGetPushUrlRetType) { + *arg = &val +} + +type LoadbalancerOptionMetricsGetPushUrlArgType = string +type LoadbalancerOptionMetricsGetPushUrlRetType = string + +// LoadbalancerOptionMetrics struct for LoadbalancerOptionMetrics +type LoadbalancerOptionMetrics struct { + // Credentials reference for metrics. This reference is created via the observability create endpoint and the credential needs to contain the basic auth username and password for the metrics solution the push URL points to. Then this enables monitoring via remote write for the Application Load Balancer. + CredentialsRef LoadbalancerOptionMetricsGetCredentialsRefAttributeType `json:"credentialsRef,omitempty"` + // The Observability(Metrics)/Prometheus remote write push URL you want the metrics to be shipped to. + PushUrl LoadbalancerOptionMetricsGetPushUrlAttributeType `json:"pushUrl,omitempty"` +} + +// NewLoadbalancerOptionMetrics instantiates a new LoadbalancerOptionMetrics 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 NewLoadbalancerOptionMetrics() *LoadbalancerOptionMetrics { + this := LoadbalancerOptionMetrics{} + return &this +} + +// NewLoadbalancerOptionMetricsWithDefaults instantiates a new LoadbalancerOptionMetrics 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 NewLoadbalancerOptionMetricsWithDefaults() *LoadbalancerOptionMetrics { + this := LoadbalancerOptionMetrics{} + return &this +} + +// GetCredentialsRef returns the CredentialsRef field value if set, zero value otherwise. +func (o *LoadbalancerOptionMetrics) GetCredentialsRef() (res LoadbalancerOptionMetricsGetCredentialsRefRetType) { + res, _ = o.GetCredentialsRefOk() + return +} + +// GetCredentialsRefOk returns a tuple with the CredentialsRef field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadbalancerOptionMetrics) GetCredentialsRefOk() (ret LoadbalancerOptionMetricsGetCredentialsRefRetType, ok bool) { + return getLoadbalancerOptionMetricsGetCredentialsRefAttributeTypeOk(o.CredentialsRef) +} + +// HasCredentialsRef returns a boolean if a field has been set. +func (o *LoadbalancerOptionMetrics) HasCredentialsRef() bool { + _, ok := o.GetCredentialsRefOk() + return ok +} + +// SetCredentialsRef gets a reference to the given string and assigns it to the CredentialsRef field. +func (o *LoadbalancerOptionMetrics) SetCredentialsRef(v LoadbalancerOptionMetricsGetCredentialsRefRetType) { + setLoadbalancerOptionMetricsGetCredentialsRefAttributeType(&o.CredentialsRef, v) +} + +// GetPushUrl returns the PushUrl field value if set, zero value otherwise. +func (o *LoadbalancerOptionMetrics) GetPushUrl() (res LoadbalancerOptionMetricsGetPushUrlRetType) { + res, _ = o.GetPushUrlOk() + return +} + +// GetPushUrlOk returns a tuple with the PushUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadbalancerOptionMetrics) GetPushUrlOk() (ret LoadbalancerOptionMetricsGetPushUrlRetType, ok bool) { + return getLoadbalancerOptionMetricsGetPushUrlAttributeTypeOk(o.PushUrl) +} + +// HasPushUrl returns a boolean if a field has been set. +func (o *LoadbalancerOptionMetrics) HasPushUrl() bool { + _, ok := o.GetPushUrlOk() + return ok +} + +// SetPushUrl gets a reference to the given string and assigns it to the PushUrl field. +func (o *LoadbalancerOptionMetrics) SetPushUrl(v LoadbalancerOptionMetricsGetPushUrlRetType) { + setLoadbalancerOptionMetricsGetPushUrlAttributeType(&o.PushUrl, v) +} + +func (o LoadbalancerOptionMetrics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLoadbalancerOptionMetricsGetCredentialsRefAttributeTypeOk(o.CredentialsRef); ok { + toSerialize["CredentialsRef"] = val + } + if val, ok := getLoadbalancerOptionMetricsGetPushUrlAttributeTypeOk(o.PushUrl); ok { + toSerialize["PushUrl"] = val + } + return toSerialize, nil +} + +type NullableLoadbalancerOptionMetrics struct { + value *LoadbalancerOptionMetrics + isSet bool +} + +func (v NullableLoadbalancerOptionMetrics) Get() *LoadbalancerOptionMetrics { + return v.value +} + +func (v *NullableLoadbalancerOptionMetrics) Set(val *LoadbalancerOptionMetrics) { + v.value = val + v.isSet = true +} + +func (v NullableLoadbalancerOptionMetrics) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadbalancerOptionMetrics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadbalancerOptionMetrics(val *LoadbalancerOptionMetrics) *NullableLoadbalancerOptionMetrics { + return &NullableLoadbalancerOptionMetrics{value: val, isSet: true} +} + +func (v NullableLoadbalancerOptionMetrics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadbalancerOptionMetrics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_loadbalancer_option_metrics_test.go b/pkg/albbeta/model_loadbalancer_option_metrics_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_loadbalancer_option_metrics_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_loadbalancer_option_observability.go b/pkg/albbeta/model_loadbalancer_option_observability.go new file mode 100644 index 00000000..9ccccfe9 --- /dev/null +++ b/pkg/albbeta/model_loadbalancer_option_observability.go @@ -0,0 +1,174 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the LoadbalancerOptionObservability type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoadbalancerOptionObservability{} + +/* + types and functions for logs +*/ + +// isModel +type LoadbalancerOptionObservabilityGetLogsAttributeType = *LoadbalancerOptionLogs +type LoadbalancerOptionObservabilityGetLogsArgType = LoadbalancerOptionLogs +type LoadbalancerOptionObservabilityGetLogsRetType = LoadbalancerOptionLogs + +func getLoadbalancerOptionObservabilityGetLogsAttributeTypeOk(arg LoadbalancerOptionObservabilityGetLogsAttributeType) (ret LoadbalancerOptionObservabilityGetLogsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadbalancerOptionObservabilityGetLogsAttributeType(arg *LoadbalancerOptionObservabilityGetLogsAttributeType, val LoadbalancerOptionObservabilityGetLogsRetType) { + *arg = &val +} + +/* + types and functions for metrics +*/ + +// isModel +type LoadbalancerOptionObservabilityGetMetricsAttributeType = *LoadbalancerOptionMetrics +type LoadbalancerOptionObservabilityGetMetricsArgType = LoadbalancerOptionMetrics +type LoadbalancerOptionObservabilityGetMetricsRetType = LoadbalancerOptionMetrics + +func getLoadbalancerOptionObservabilityGetMetricsAttributeTypeOk(arg LoadbalancerOptionObservabilityGetMetricsAttributeType) (ret LoadbalancerOptionObservabilityGetMetricsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLoadbalancerOptionObservabilityGetMetricsAttributeType(arg *LoadbalancerOptionObservabilityGetMetricsAttributeType, val LoadbalancerOptionObservabilityGetMetricsRetType) { + *arg = &val +} + +// LoadbalancerOptionObservability We offer Load Balancer observability via STACKIT Observability or external solutions. +type LoadbalancerOptionObservability struct { + Logs LoadbalancerOptionObservabilityGetLogsAttributeType `json:"logs,omitempty"` + Metrics LoadbalancerOptionObservabilityGetMetricsAttributeType `json:"metrics,omitempty"` +} + +// NewLoadbalancerOptionObservability instantiates a new LoadbalancerOptionObservability 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 NewLoadbalancerOptionObservability() *LoadbalancerOptionObservability { + this := LoadbalancerOptionObservability{} + return &this +} + +// NewLoadbalancerOptionObservabilityWithDefaults instantiates a new LoadbalancerOptionObservability 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 NewLoadbalancerOptionObservabilityWithDefaults() *LoadbalancerOptionObservability { + this := LoadbalancerOptionObservability{} + return &this +} + +// GetLogs returns the Logs field value if set, zero value otherwise. +func (o *LoadbalancerOptionObservability) GetLogs() (res LoadbalancerOptionObservabilityGetLogsRetType) { + res, _ = o.GetLogsOk() + return +} + +// GetLogsOk returns a tuple with the Logs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadbalancerOptionObservability) GetLogsOk() (ret LoadbalancerOptionObservabilityGetLogsRetType, ok bool) { + return getLoadbalancerOptionObservabilityGetLogsAttributeTypeOk(o.Logs) +} + +// HasLogs returns a boolean if a field has been set. +func (o *LoadbalancerOptionObservability) HasLogs() bool { + _, ok := o.GetLogsOk() + return ok +} + +// SetLogs gets a reference to the given LoadbalancerOptionLogs and assigns it to the Logs field. +func (o *LoadbalancerOptionObservability) SetLogs(v LoadbalancerOptionObservabilityGetLogsRetType) { + setLoadbalancerOptionObservabilityGetLogsAttributeType(&o.Logs, v) +} + +// GetMetrics returns the Metrics field value if set, zero value otherwise. +func (o *LoadbalancerOptionObservability) GetMetrics() (res LoadbalancerOptionObservabilityGetMetricsRetType) { + res, _ = o.GetMetricsOk() + return +} + +// GetMetricsOk returns a tuple with the Metrics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LoadbalancerOptionObservability) GetMetricsOk() (ret LoadbalancerOptionObservabilityGetMetricsRetType, ok bool) { + return getLoadbalancerOptionObservabilityGetMetricsAttributeTypeOk(o.Metrics) +} + +// HasMetrics returns a boolean if a field has been set. +func (o *LoadbalancerOptionObservability) HasMetrics() bool { + _, ok := o.GetMetricsOk() + return ok +} + +// SetMetrics gets a reference to the given LoadbalancerOptionMetrics and assigns it to the Metrics field. +func (o *LoadbalancerOptionObservability) SetMetrics(v LoadbalancerOptionObservabilityGetMetricsRetType) { + setLoadbalancerOptionObservabilityGetMetricsAttributeType(&o.Metrics, v) +} + +func (o LoadbalancerOptionObservability) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLoadbalancerOptionObservabilityGetLogsAttributeTypeOk(o.Logs); ok { + toSerialize["Logs"] = val + } + if val, ok := getLoadbalancerOptionObservabilityGetMetricsAttributeTypeOk(o.Metrics); ok { + toSerialize["Metrics"] = val + } + return toSerialize, nil +} + +type NullableLoadbalancerOptionObservability struct { + value *LoadbalancerOptionObservability + isSet bool +} + +func (v NullableLoadbalancerOptionObservability) Get() *LoadbalancerOptionObservability { + return v.value +} + +func (v *NullableLoadbalancerOptionObservability) Set(val *LoadbalancerOptionObservability) { + v.value = val + v.isSet = true +} + +func (v NullableLoadbalancerOptionObservability) IsSet() bool { + return v.isSet +} + +func (v *NullableLoadbalancerOptionObservability) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoadbalancerOptionObservability(val *LoadbalancerOptionObservability) *NullableLoadbalancerOptionObservability { + return &NullableLoadbalancerOptionObservability{value: val, isSet: true} +} + +func (v NullableLoadbalancerOptionObservability) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoadbalancerOptionObservability) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_loadbalancer_option_observability_test.go b/pkg/albbeta/model_loadbalancer_option_observability_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_loadbalancer_option_observability_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_network.go b/pkg/albbeta/model_network.go new file mode 100644 index 00000000..436fc40d --- /dev/null +++ b/pkg/albbeta/model_network.go @@ -0,0 +1,286 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the Network type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Network{} + +/* + types and functions for networkId +*/ + +// isNotNullableString +type NetworkGetNetworkIdAttributeType = *string + +func getNetworkGetNetworkIdAttributeTypeOk(arg NetworkGetNetworkIdAttributeType) (ret NetworkGetNetworkIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetNetworkIdAttributeType(arg *NetworkGetNetworkIdAttributeType, val NetworkGetNetworkIdRetType) { + *arg = &val +} + +type NetworkGetNetworkIdArgType = string +type NetworkGetNetworkIdRetType = string + +/* + types and functions for role +*/ + +// isEnum + +// NetworkRole The role defines how the Application Load Balancer is using the network. Currently only ROLE_LISTENERS_AND_TARGETS is supported. +// value type for enums +type NetworkRole string + +// List of Role +const ( + NETWORKROLE_UNSPECIFIED NetworkRole = "ROLE_UNSPECIFIED" + NETWORKROLE_LISTENERS_AND_TARGETS NetworkRole = "ROLE_LISTENERS_AND_TARGETS" + NETWORKROLE_LISTENERS NetworkRole = "ROLE_LISTENERS" + NETWORKROLE_TARGETS NetworkRole = "ROLE_TARGETS" +) + +// All allowed values of Network enum +var AllowedNetworkRoleEnumValues = []NetworkRole{ + "ROLE_UNSPECIFIED", + "ROLE_LISTENERS_AND_TARGETS", + "ROLE_LISTENERS", + "ROLE_TARGETS", +} + +func (v *NetworkRole) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson NetworkRole + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := NetworkRole(value) + for _, existing := range AllowedNetworkRoleEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Network", value) +} + +// NewNetworkRoleFromValue returns a pointer to a valid NetworkRole +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewNetworkRoleFromValue(v NetworkRole) (*NetworkRole, error) { + ev := NetworkRole(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for NetworkRole: valid values are %v", v, AllowedNetworkRoleEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v NetworkRole) IsValid() bool { + for _, existing := range AllowedNetworkRoleEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to RoleRole value +func (v NetworkRole) Ptr() *NetworkRole { + return &v +} + +type NullableNetworkRole struct { + value *NetworkRole + isSet bool +} + +func (v NullableNetworkRole) Get() *NetworkRole { + return v.value +} + +func (v *NullableNetworkRole) Set(val *NetworkRole) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkRole) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkRole) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkRole(val *NetworkRole) *NullableNetworkRole { + return &NullableNetworkRole{value: val, isSet: true} +} + +func (v NullableNetworkRole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkRole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NetworkGetRoleAttributeType = *NetworkRole +type NetworkGetRoleArgType = NetworkRole +type NetworkGetRoleRetType = NetworkRole + +func getNetworkGetRoleAttributeTypeOk(arg NetworkGetRoleAttributeType) (ret NetworkGetRoleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetRoleAttributeType(arg *NetworkGetRoleAttributeType, val NetworkGetRoleRetType) { + *arg = &val +} + +// Network struct for Network +type Network struct { + // Openstack network ID + NetworkId NetworkGetNetworkIdAttributeType `json:"networkId,omitempty"` + // The role defines how the Application Load Balancer is using the network. Currently only ROLE_LISTENERS_AND_TARGETS is supported. + Role NetworkGetRoleAttributeType `json:"role,omitempty"` +} + +// NewNetwork instantiates a new Network 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 NewNetwork() *Network { + this := Network{} + return &this +} + +// NewNetworkWithDefaults instantiates a new Network 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 NewNetworkWithDefaults() *Network { + this := Network{} + return &this +} + +// GetNetworkId returns the NetworkId field value if set, zero value otherwise. +func (o *Network) GetNetworkId() (res NetworkGetNetworkIdRetType) { + res, _ = o.GetNetworkIdOk() + return +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetNetworkIdOk() (ret NetworkGetNetworkIdRetType, ok bool) { + return getNetworkGetNetworkIdAttributeTypeOk(o.NetworkId) +} + +// HasNetworkId returns a boolean if a field has been set. +func (o *Network) HasNetworkId() bool { + _, ok := o.GetNetworkIdOk() + return ok +} + +// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. +func (o *Network) SetNetworkId(v NetworkGetNetworkIdRetType) { + setNetworkGetNetworkIdAttributeType(&o.NetworkId, v) +} + +// GetRole returns the Role field value if set, zero value otherwise. +func (o *Network) GetRole() (res NetworkGetRoleRetType) { + res, _ = o.GetRoleOk() + return +} + +// GetRoleOk returns a tuple with the Role field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetRoleOk() (ret NetworkGetRoleRetType, ok bool) { + return getNetworkGetRoleAttributeTypeOk(o.Role) +} + +// HasRole returns a boolean if a field has been set. +func (o *Network) HasRole() bool { + _, ok := o.GetRoleOk() + return ok +} + +// SetRole gets a reference to the given string and assigns it to the Role field. +func (o *Network) SetRole(v NetworkGetRoleRetType) { + setNetworkGetRoleAttributeType(&o.Role, v) +} + +func (o Network) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkGetNetworkIdAttributeTypeOk(o.NetworkId); ok { + toSerialize["NetworkId"] = val + } + if val, ok := getNetworkGetRoleAttributeTypeOk(o.Role); ok { + toSerialize["Role"] = val + } + return toSerialize, nil +} + +type NullableNetwork struct { + value *Network + isSet bool +} + +func (v NullableNetwork) Get() *Network { + return v.value +} + +func (v *NullableNetwork) Set(val *Network) { + v.value = val + v.isSet = true +} + +func (v NullableNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetwork(val *Network) *NullableNetwork { + return &NullableNetwork{value: val, isSet: true} +} + +func (v NullableNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_network_test.go b/pkg/albbeta/model_network_test.go new file mode 100644 index 00000000..bb6eb87b --- /dev/null +++ b/pkg/albbeta/model_network_test.go @@ -0,0 +1,72 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "testing" +) + +// isEnum + +func TestNetworkRole_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"ROLE_UNSPECIFIED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"ROLE_LISTENERS_AND_TARGETS"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"ROLE_LISTENERS"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"ROLE_TARGETS"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := NetworkRole("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/albbeta/model_path.go b/pkg/albbeta/model_path.go new file mode 100644 index 00000000..cc48152b --- /dev/null +++ b/pkg/albbeta/model_path.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the Path type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Path{} + +/* + types and functions for exact +*/ + +// isNotNullableString +type PathGetExactAttributeType = *string + +func getPathGetExactAttributeTypeOk(arg PathGetExactAttributeType) (ret PathGetExactRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPathGetExactAttributeType(arg *PathGetExactAttributeType, val PathGetExactRetType) { + *arg = &val +} + +type PathGetExactArgType = string +type PathGetExactRetType = string + +/* + types and functions for prefix +*/ + +// isNotNullableString +type PathGetPrefixAttributeType = *string + +func getPathGetPrefixAttributeTypeOk(arg PathGetPrefixAttributeType) (ret PathGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPathGetPrefixAttributeType(arg *PathGetPrefixAttributeType, val PathGetPrefixRetType) { + *arg = &val +} + +type PathGetPrefixArgType = string +type PathGetPrefixRetType = string + +// Path struct for Path +type Path struct { + // Exact path match. Only a request path exactly equal to the value will match, e.g. '/foo' matches only '/foo', not '/foo/bar' or '/foobar'. + Exact PathGetExactAttributeType `json:"exact,omitempty"` + // Prefix path match. Only matches on full segment boundaries, e.g. '/foo' matches '/foo' and '/foo/bar' but NOT '/foobar'. + Prefix PathGetPrefixAttributeType `json:"prefix,omitempty"` +} + +// NewPath instantiates a new Path 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 NewPath() *Path { + this := Path{} + return &this +} + +// NewPathWithDefaults instantiates a new Path 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 NewPathWithDefaults() *Path { + this := Path{} + return &this +} + +// GetExact returns the Exact field value if set, zero value otherwise. +func (o *Path) GetExact() (res PathGetExactRetType) { + res, _ = o.GetExactOk() + return +} + +// GetExactOk returns a tuple with the Exact field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Path) GetExactOk() (ret PathGetExactRetType, ok bool) { + return getPathGetExactAttributeTypeOk(o.Exact) +} + +// HasExact returns a boolean if a field has been set. +func (o *Path) HasExact() bool { + _, ok := o.GetExactOk() + return ok +} + +// SetExact gets a reference to the given string and assigns it to the Exact field. +func (o *Path) SetExact(v PathGetExactRetType) { + setPathGetExactAttributeType(&o.Exact, v) +} + +// GetPrefix returns the Prefix field value if set, zero value otherwise. +func (o *Path) GetPrefix() (res PathGetPrefixRetType) { + res, _ = o.GetPrefixOk() + return +} + +// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Path) GetPrefixOk() (ret PathGetPrefixRetType, ok bool) { + return getPathGetPrefixAttributeTypeOk(o.Prefix) +} + +// HasPrefix returns a boolean if a field has been set. +func (o *Path) HasPrefix() bool { + _, ok := o.GetPrefixOk() + return ok +} + +// SetPrefix gets a reference to the given string and assigns it to the Prefix field. +func (o *Path) SetPrefix(v PathGetPrefixRetType) { + setPathGetPrefixAttributeType(&o.Prefix, v) +} + +func (o Path) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPathGetExactAttributeTypeOk(o.Exact); ok { + toSerialize["Exact"] = val + } + if val, ok := getPathGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + return toSerialize, nil +} + +type NullablePath struct { + value *Path + isSet bool +} + +func (v NullablePath) Get() *Path { + return v.value +} + +func (v *NullablePath) Set(val *Path) { + v.value = val + v.isSet = true +} + +func (v NullablePath) IsSet() bool { + return v.isSet +} + +func (v *NullablePath) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePath(val *Path) *NullablePath { + return &NullablePath{value: val, isSet: true} +} + +func (v NullablePath) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePath) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_path_test.go b/pkg/albbeta/model_path_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_path_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_plan_details.go b/pkg/albbeta/model_plan_details.go new file mode 100644 index 00000000..423a3397 --- /dev/null +++ b/pkg/albbeta/model_plan_details.go @@ -0,0 +1,374 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the PlanDetails type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanDetails{} + +/* + types and functions for description +*/ + +// isNotNullableString +type PlanDetailsGetDescriptionAttributeType = *string + +func getPlanDetailsGetDescriptionAttributeTypeOk(arg PlanDetailsGetDescriptionAttributeType) (ret PlanDetailsGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanDetailsGetDescriptionAttributeType(arg *PlanDetailsGetDescriptionAttributeType, val PlanDetailsGetDescriptionRetType) { + *arg = &val +} + +type PlanDetailsGetDescriptionArgType = string +type PlanDetailsGetDescriptionRetType = string + +/* + types and functions for flavorName +*/ + +// isNotNullableString +type PlanDetailsGetFlavorNameAttributeType = *string + +func getPlanDetailsGetFlavorNameAttributeTypeOk(arg PlanDetailsGetFlavorNameAttributeType) (ret PlanDetailsGetFlavorNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanDetailsGetFlavorNameAttributeType(arg *PlanDetailsGetFlavorNameAttributeType, val PlanDetailsGetFlavorNameRetType) { + *arg = &val +} + +type PlanDetailsGetFlavorNameArgType = string +type PlanDetailsGetFlavorNameRetType = string + +/* + types and functions for maxConnections +*/ + +// isInteger +type PlanDetailsGetMaxConnectionsAttributeType = *int64 +type PlanDetailsGetMaxConnectionsArgType = int64 +type PlanDetailsGetMaxConnectionsRetType = int64 + +func getPlanDetailsGetMaxConnectionsAttributeTypeOk(arg PlanDetailsGetMaxConnectionsAttributeType) (ret PlanDetailsGetMaxConnectionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanDetailsGetMaxConnectionsAttributeType(arg *PlanDetailsGetMaxConnectionsAttributeType, val PlanDetailsGetMaxConnectionsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type PlanDetailsGetNameAttributeType = *string + +func getPlanDetailsGetNameAttributeTypeOk(arg PlanDetailsGetNameAttributeType) (ret PlanDetailsGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanDetailsGetNameAttributeType(arg *PlanDetailsGetNameAttributeType, val PlanDetailsGetNameRetType) { + *arg = &val +} + +type PlanDetailsGetNameArgType = string +type PlanDetailsGetNameRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type PlanDetailsGetPlanIdAttributeType = *string + +func getPlanDetailsGetPlanIdAttributeTypeOk(arg PlanDetailsGetPlanIdAttributeType) (ret PlanDetailsGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanDetailsGetPlanIdAttributeType(arg *PlanDetailsGetPlanIdAttributeType, val PlanDetailsGetPlanIdRetType) { + *arg = &val +} + +type PlanDetailsGetPlanIdArgType = string +type PlanDetailsGetPlanIdRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type PlanDetailsGetRegionAttributeType = *string + +func getPlanDetailsGetRegionAttributeTypeOk(arg PlanDetailsGetRegionAttributeType) (ret PlanDetailsGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanDetailsGetRegionAttributeType(arg *PlanDetailsGetRegionAttributeType, val PlanDetailsGetRegionRetType) { + *arg = &val +} + +type PlanDetailsGetRegionArgType = string +type PlanDetailsGetRegionRetType = string + +// PlanDetails struct for PlanDetails +type PlanDetails struct { + // Description + Description PlanDetailsGetDescriptionAttributeType `json:"description,omitempty"` + // Flavor Name + FlavorName PlanDetailsGetFlavorNameAttributeType `json:"flavorName,omitempty"` + // Maximum number of concurrent connections per application load balancer VM instance. + // Can be cast to int32 without loss of precision. + MaxConnections PlanDetailsGetMaxConnectionsAttributeType `json:"maxConnections,omitempty"` + // Service Plan Name + Name PlanDetailsGetNameAttributeType `json:"name,omitempty"` + // Service Plan Identifier + PlanId PlanDetailsGetPlanIdAttributeType `json:"planId,omitempty"` + // Region this Plan is available in + Region PlanDetailsGetRegionAttributeType `json:"region,omitempty"` +} + +// NewPlanDetails instantiates a new PlanDetails 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 NewPlanDetails() *PlanDetails { + this := PlanDetails{} + return &this +} + +// NewPlanDetailsWithDefaults instantiates a new PlanDetails 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 NewPlanDetailsWithDefaults() *PlanDetails { + this := PlanDetails{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *PlanDetails) GetDescription() (res PlanDetailsGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanDetails) GetDescriptionOk() (ret PlanDetailsGetDescriptionRetType, ok bool) { + return getPlanDetailsGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *PlanDetails) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *PlanDetails) SetDescription(v PlanDetailsGetDescriptionRetType) { + setPlanDetailsGetDescriptionAttributeType(&o.Description, v) +} + +// GetFlavorName returns the FlavorName field value if set, zero value otherwise. +func (o *PlanDetails) GetFlavorName() (res PlanDetailsGetFlavorNameRetType) { + res, _ = o.GetFlavorNameOk() + return +} + +// GetFlavorNameOk returns a tuple with the FlavorName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanDetails) GetFlavorNameOk() (ret PlanDetailsGetFlavorNameRetType, ok bool) { + return getPlanDetailsGetFlavorNameAttributeTypeOk(o.FlavorName) +} + +// HasFlavorName returns a boolean if a field has been set. +func (o *PlanDetails) HasFlavorName() bool { + _, ok := o.GetFlavorNameOk() + return ok +} + +// SetFlavorName gets a reference to the given string and assigns it to the FlavorName field. +func (o *PlanDetails) SetFlavorName(v PlanDetailsGetFlavorNameRetType) { + setPlanDetailsGetFlavorNameAttributeType(&o.FlavorName, v) +} + +// GetMaxConnections returns the MaxConnections field value if set, zero value otherwise. +func (o *PlanDetails) GetMaxConnections() (res PlanDetailsGetMaxConnectionsRetType) { + res, _ = o.GetMaxConnectionsOk() + return +} + +// GetMaxConnectionsOk returns a tuple with the MaxConnections field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanDetails) GetMaxConnectionsOk() (ret PlanDetailsGetMaxConnectionsRetType, ok bool) { + return getPlanDetailsGetMaxConnectionsAttributeTypeOk(o.MaxConnections) +} + +// HasMaxConnections returns a boolean if a field has been set. +func (o *PlanDetails) HasMaxConnections() bool { + _, ok := o.GetMaxConnectionsOk() + return ok +} + +// SetMaxConnections gets a reference to the given int64 and assigns it to the MaxConnections field. +func (o *PlanDetails) SetMaxConnections(v PlanDetailsGetMaxConnectionsRetType) { + setPlanDetailsGetMaxConnectionsAttributeType(&o.MaxConnections, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PlanDetails) GetName() (res PlanDetailsGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanDetails) GetNameOk() (ret PlanDetailsGetNameRetType, ok bool) { + return getPlanDetailsGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *PlanDetails) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PlanDetails) SetName(v PlanDetailsGetNameRetType) { + setPlanDetailsGetNameAttributeType(&o.Name, v) +} + +// GetPlanId returns the PlanId field value if set, zero value otherwise. +func (o *PlanDetails) GetPlanId() (res PlanDetailsGetPlanIdRetType) { + res, _ = o.GetPlanIdOk() + return +} + +// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanDetails) GetPlanIdOk() (ret PlanDetailsGetPlanIdRetType, ok bool) { + return getPlanDetailsGetPlanIdAttributeTypeOk(o.PlanId) +} + +// HasPlanId returns a boolean if a field has been set. +func (o *PlanDetails) HasPlanId() bool { + _, ok := o.GetPlanIdOk() + return ok +} + +// SetPlanId gets a reference to the given string and assigns it to the PlanId field. +func (o *PlanDetails) SetPlanId(v PlanDetailsGetPlanIdRetType) { + setPlanDetailsGetPlanIdAttributeType(&o.PlanId, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *PlanDetails) GetRegion() (res PlanDetailsGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanDetails) GetRegionOk() (ret PlanDetailsGetRegionRetType, ok bool) { + return getPlanDetailsGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *PlanDetails) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *PlanDetails) SetRegion(v PlanDetailsGetRegionRetType) { + setPlanDetailsGetRegionAttributeType(&o.Region, v) +} + +func (o PlanDetails) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPlanDetailsGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getPlanDetailsGetFlavorNameAttributeTypeOk(o.FlavorName); ok { + toSerialize["FlavorName"] = val + } + if val, ok := getPlanDetailsGetMaxConnectionsAttributeTypeOk(o.MaxConnections); ok { + toSerialize["MaxConnections"] = val + } + if val, ok := getPlanDetailsGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getPlanDetailsGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + if val, ok := getPlanDetailsGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullablePlanDetails struct { + value *PlanDetails + isSet bool +} + +func (v NullablePlanDetails) Get() *PlanDetails { + return v.value +} + +func (v *NullablePlanDetails) Set(val *PlanDetails) { + v.value = val + v.isSet = true +} + +func (v NullablePlanDetails) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanDetails) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanDetails(val *PlanDetails) *NullablePlanDetails { + return &NullablePlanDetails{value: val, isSet: true} +} + +func (v NullablePlanDetails) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanDetails) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_plan_details_test.go b/pkg/albbeta/model_plan_details_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_plan_details_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_protocol_options_http.go b/pkg/albbeta/model_protocol_options_http.go new file mode 100644 index 00000000..22421df5 --- /dev/null +++ b/pkg/albbeta/model_protocol_options_http.go @@ -0,0 +1,128 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the ProtocolOptionsHTTP type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProtocolOptionsHTTP{} + +/* + types and functions for hosts +*/ + +// isArray +type ProtocolOptionsHTTPGetHostsAttributeType = *[]HostConfig +type ProtocolOptionsHTTPGetHostsArgType = []HostConfig +type ProtocolOptionsHTTPGetHostsRetType = []HostConfig + +func getProtocolOptionsHTTPGetHostsAttributeTypeOk(arg ProtocolOptionsHTTPGetHostsAttributeType) (ret ProtocolOptionsHTTPGetHostsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProtocolOptionsHTTPGetHostsAttributeType(arg *ProtocolOptionsHTTPGetHostsAttributeType, val ProtocolOptionsHTTPGetHostsRetType) { + *arg = &val +} + +// ProtocolOptionsHTTP Configuration for handling HTTP traffic on this listener. +type ProtocolOptionsHTTP struct { + // Defines routing rules grouped by hostname. + Hosts ProtocolOptionsHTTPGetHostsAttributeType `json:"hosts,omitempty"` +} + +// NewProtocolOptionsHTTP instantiates a new ProtocolOptionsHTTP 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 NewProtocolOptionsHTTP() *ProtocolOptionsHTTP { + this := ProtocolOptionsHTTP{} + return &this +} + +// NewProtocolOptionsHTTPWithDefaults instantiates a new ProtocolOptionsHTTP 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 NewProtocolOptionsHTTPWithDefaults() *ProtocolOptionsHTTP { + this := ProtocolOptionsHTTP{} + return &this +} + +// GetHosts returns the Hosts field value if set, zero value otherwise. +func (o *ProtocolOptionsHTTP) GetHosts() (res ProtocolOptionsHTTPGetHostsRetType) { + res, _ = o.GetHostsOk() + return +} + +// GetHostsOk returns a tuple with the Hosts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProtocolOptionsHTTP) GetHostsOk() (ret ProtocolOptionsHTTPGetHostsRetType, ok bool) { + return getProtocolOptionsHTTPGetHostsAttributeTypeOk(o.Hosts) +} + +// HasHosts returns a boolean if a field has been set. +func (o *ProtocolOptionsHTTP) HasHosts() bool { + _, ok := o.GetHostsOk() + return ok +} + +// SetHosts gets a reference to the given []HostConfig and assigns it to the Hosts field. +func (o *ProtocolOptionsHTTP) SetHosts(v ProtocolOptionsHTTPGetHostsRetType) { + setProtocolOptionsHTTPGetHostsAttributeType(&o.Hosts, v) +} + +func (o ProtocolOptionsHTTP) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getProtocolOptionsHTTPGetHostsAttributeTypeOk(o.Hosts); ok { + toSerialize["Hosts"] = val + } + return toSerialize, nil +} + +type NullableProtocolOptionsHTTP struct { + value *ProtocolOptionsHTTP + isSet bool +} + +func (v NullableProtocolOptionsHTTP) Get() *ProtocolOptionsHTTP { + return v.value +} + +func (v *NullableProtocolOptionsHTTP) Set(val *ProtocolOptionsHTTP) { + v.value = val + v.isSet = true +} + +func (v NullableProtocolOptionsHTTP) IsSet() bool { + return v.isSet +} + +func (v *NullableProtocolOptionsHTTP) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtocolOptionsHTTP(val *ProtocolOptionsHTTP) *NullableProtocolOptionsHTTP { + return &NullableProtocolOptionsHTTP{value: val, isSet: true} +} + +func (v NullableProtocolOptionsHTTP) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtocolOptionsHTTP) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_protocol_options_http_test.go b/pkg/albbeta/model_protocol_options_http_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_protocol_options_http_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_protocol_options_https.go b/pkg/albbeta/model_protocol_options_https.go new file mode 100644 index 00000000..69541267 --- /dev/null +++ b/pkg/albbeta/model_protocol_options_https.go @@ -0,0 +1,127 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the ProtocolOptionsHTTPS type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProtocolOptionsHTTPS{} + +/* + types and functions for certificateConfig +*/ + +// isModel +type ProtocolOptionsHTTPSGetCertificateConfigAttributeType = *CertificateConfig +type ProtocolOptionsHTTPSGetCertificateConfigArgType = CertificateConfig +type ProtocolOptionsHTTPSGetCertificateConfigRetType = CertificateConfig + +func getProtocolOptionsHTTPSGetCertificateConfigAttributeTypeOk(arg ProtocolOptionsHTTPSGetCertificateConfigAttributeType) (ret ProtocolOptionsHTTPSGetCertificateConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProtocolOptionsHTTPSGetCertificateConfigAttributeType(arg *ProtocolOptionsHTTPSGetCertificateConfigAttributeType, val ProtocolOptionsHTTPSGetCertificateConfigRetType) { + *arg = &val +} + +// ProtocolOptionsHTTPS Configuration for handling HTTPS traffic on this listener. +type ProtocolOptionsHTTPS struct { + CertificateConfig ProtocolOptionsHTTPSGetCertificateConfigAttributeType `json:"certificateConfig,omitempty"` +} + +// NewProtocolOptionsHTTPS instantiates a new ProtocolOptionsHTTPS 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 NewProtocolOptionsHTTPS() *ProtocolOptionsHTTPS { + this := ProtocolOptionsHTTPS{} + return &this +} + +// NewProtocolOptionsHTTPSWithDefaults instantiates a new ProtocolOptionsHTTPS 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 NewProtocolOptionsHTTPSWithDefaults() *ProtocolOptionsHTTPS { + this := ProtocolOptionsHTTPS{} + return &this +} + +// GetCertificateConfig returns the CertificateConfig field value if set, zero value otherwise. +func (o *ProtocolOptionsHTTPS) GetCertificateConfig() (res ProtocolOptionsHTTPSGetCertificateConfigRetType) { + res, _ = o.GetCertificateConfigOk() + return +} + +// GetCertificateConfigOk returns a tuple with the CertificateConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProtocolOptionsHTTPS) GetCertificateConfigOk() (ret ProtocolOptionsHTTPSGetCertificateConfigRetType, ok bool) { + return getProtocolOptionsHTTPSGetCertificateConfigAttributeTypeOk(o.CertificateConfig) +} + +// HasCertificateConfig returns a boolean if a field has been set. +func (o *ProtocolOptionsHTTPS) HasCertificateConfig() bool { + _, ok := o.GetCertificateConfigOk() + return ok +} + +// SetCertificateConfig gets a reference to the given CertificateConfig and assigns it to the CertificateConfig field. +func (o *ProtocolOptionsHTTPS) SetCertificateConfig(v ProtocolOptionsHTTPSGetCertificateConfigRetType) { + setProtocolOptionsHTTPSGetCertificateConfigAttributeType(&o.CertificateConfig, v) +} + +func (o ProtocolOptionsHTTPS) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getProtocolOptionsHTTPSGetCertificateConfigAttributeTypeOk(o.CertificateConfig); ok { + toSerialize["CertificateConfig"] = val + } + return toSerialize, nil +} + +type NullableProtocolOptionsHTTPS struct { + value *ProtocolOptionsHTTPS + isSet bool +} + +func (v NullableProtocolOptionsHTTPS) Get() *ProtocolOptionsHTTPS { + return v.value +} + +func (v *NullableProtocolOptionsHTTPS) Set(val *ProtocolOptionsHTTPS) { + v.value = val + v.isSet = true +} + +func (v NullableProtocolOptionsHTTPS) IsSet() bool { + return v.isSet +} + +func (v *NullableProtocolOptionsHTTPS) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtocolOptionsHTTPS(val *ProtocolOptionsHTTPS) *NullableProtocolOptionsHTTPS { + return &NullableProtocolOptionsHTTPS{value: val, isSet: true} +} + +func (v NullableProtocolOptionsHTTPS) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtocolOptionsHTTPS) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_protocol_options_https_test.go b/pkg/albbeta/model_protocol_options_https_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_protocol_options_https_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_query_parameter.go b/pkg/albbeta/model_query_parameter.go new file mode 100644 index 00000000..27ad684d --- /dev/null +++ b/pkg/albbeta/model_query_parameter.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the QueryParameter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QueryParameter{} + +/* + types and functions for exactMatch +*/ + +// isNotNullableString +type QueryParameterGetExactMatchAttributeType = *string + +func getQueryParameterGetExactMatchAttributeTypeOk(arg QueryParameterGetExactMatchAttributeType) (ret QueryParameterGetExactMatchRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQueryParameterGetExactMatchAttributeType(arg *QueryParameterGetExactMatchAttributeType, val QueryParameterGetExactMatchRetType) { + *arg = &val +} + +type QueryParameterGetExactMatchArgType = string +type QueryParameterGetExactMatchRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type QueryParameterGetNameAttributeType = *string + +func getQueryParameterGetNameAttributeTypeOk(arg QueryParameterGetNameAttributeType) (ret QueryParameterGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQueryParameterGetNameAttributeType(arg *QueryParameterGetNameAttributeType, val QueryParameterGetNameRetType) { + *arg = &val +} + +type QueryParameterGetNameArgType = string +type QueryParameterGetNameRetType = string + +// QueryParameter struct for QueryParameter +type QueryParameter struct { + // Exact match for the parameter value. + ExactMatch QueryParameterGetExactMatchAttributeType `json:"exactMatch,omitempty"` + // Parameter name. + Name QueryParameterGetNameAttributeType `json:"name,omitempty"` +} + +// NewQueryParameter instantiates a new QueryParameter 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 NewQueryParameter() *QueryParameter { + this := QueryParameter{} + return &this +} + +// NewQueryParameterWithDefaults instantiates a new QueryParameter 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 NewQueryParameterWithDefaults() *QueryParameter { + this := QueryParameter{} + return &this +} + +// GetExactMatch returns the ExactMatch field value if set, zero value otherwise. +func (o *QueryParameter) GetExactMatch() (res QueryParameterGetExactMatchRetType) { + res, _ = o.GetExactMatchOk() + return +} + +// GetExactMatchOk returns a tuple with the ExactMatch field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryParameter) GetExactMatchOk() (ret QueryParameterGetExactMatchRetType, ok bool) { + return getQueryParameterGetExactMatchAttributeTypeOk(o.ExactMatch) +} + +// HasExactMatch returns a boolean if a field has been set. +func (o *QueryParameter) HasExactMatch() bool { + _, ok := o.GetExactMatchOk() + return ok +} + +// SetExactMatch gets a reference to the given string and assigns it to the ExactMatch field. +func (o *QueryParameter) SetExactMatch(v QueryParameterGetExactMatchRetType) { + setQueryParameterGetExactMatchAttributeType(&o.ExactMatch, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *QueryParameter) GetName() (res QueryParameterGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *QueryParameter) GetNameOk() (ret QueryParameterGetNameRetType, ok bool) { + return getQueryParameterGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *QueryParameter) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *QueryParameter) SetName(v QueryParameterGetNameRetType) { + setQueryParameterGetNameAttributeType(&o.Name, v) +} + +func (o QueryParameter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQueryParameterGetExactMatchAttributeTypeOk(o.ExactMatch); ok { + toSerialize["ExactMatch"] = val + } + if val, ok := getQueryParameterGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableQueryParameter struct { + value *QueryParameter + isSet bool +} + +func (v NullableQueryParameter) Get() *QueryParameter { + return v.value +} + +func (v *NullableQueryParameter) Set(val *QueryParameter) { + v.value = val + v.isSet = true +} + +func (v NullableQueryParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableQueryParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQueryParameter(val *QueryParameter) *NullableQueryParameter { + return &NullableQueryParameter{value: val, isSet: true} +} + +func (v NullableQueryParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQueryParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_query_parameter_test.go b/pkg/albbeta/model_query_parameter_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_query_parameter_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_rule.go b/pkg/albbeta/model_rule.go new file mode 100644 index 00000000..a54a3c1f --- /dev/null +++ b/pkg/albbeta/model_rule.go @@ -0,0 +1,416 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the Rule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Rule{} + +/* + types and functions for cookiePersistence +*/ + +// isModel +type RuleGetCookiePersistenceAttributeType = *CookiePersistence +type RuleGetCookiePersistenceArgType = CookiePersistence +type RuleGetCookiePersistenceRetType = CookiePersistence + +func getRuleGetCookiePersistenceAttributeTypeOk(arg RuleGetCookiePersistenceAttributeType) (ret RuleGetCookiePersistenceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRuleGetCookiePersistenceAttributeType(arg *RuleGetCookiePersistenceAttributeType, val RuleGetCookiePersistenceRetType) { + *arg = &val +} + +/* + types and functions for headers +*/ + +// isArray +type RuleGetHeadersAttributeType = *[]HttpHeader +type RuleGetHeadersArgType = []HttpHeader +type RuleGetHeadersRetType = []HttpHeader + +func getRuleGetHeadersAttributeTypeOk(arg RuleGetHeadersAttributeType) (ret RuleGetHeadersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRuleGetHeadersAttributeType(arg *RuleGetHeadersAttributeType, val RuleGetHeadersRetType) { + *arg = &val +} + +/* + types and functions for path +*/ + +// isModel +type RuleGetPathAttributeType = *Path +type RuleGetPathArgType = Path +type RuleGetPathRetType = Path + +func getRuleGetPathAttributeTypeOk(arg RuleGetPathAttributeType) (ret RuleGetPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRuleGetPathAttributeType(arg *RuleGetPathAttributeType, val RuleGetPathRetType) { + *arg = &val +} + +/* + types and functions for pathPrefix +*/ + +// isNotNullableString +type RuleGetPathPrefixAttributeType = *string + +func getRuleGetPathPrefixAttributeTypeOk(arg RuleGetPathPrefixAttributeType) (ret RuleGetPathPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRuleGetPathPrefixAttributeType(arg *RuleGetPathPrefixAttributeType, val RuleGetPathPrefixRetType) { + *arg = &val +} + +type RuleGetPathPrefixArgType = string +type RuleGetPathPrefixRetType = string + +/* + types and functions for queryParameters +*/ + +// isArray +type RuleGetQueryParametersAttributeType = *[]QueryParameter +type RuleGetQueryParametersArgType = []QueryParameter +type RuleGetQueryParametersRetType = []QueryParameter + +func getRuleGetQueryParametersAttributeTypeOk(arg RuleGetQueryParametersAttributeType) (ret RuleGetQueryParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRuleGetQueryParametersAttributeType(arg *RuleGetQueryParametersAttributeType, val RuleGetQueryParametersRetType) { + *arg = &val +} + +/* + types and functions for targetPool +*/ + +// isNotNullableString +type RuleGetTargetPoolAttributeType = *string + +func getRuleGetTargetPoolAttributeTypeOk(arg RuleGetTargetPoolAttributeType) (ret RuleGetTargetPoolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRuleGetTargetPoolAttributeType(arg *RuleGetTargetPoolAttributeType, val RuleGetTargetPoolRetType) { + *arg = &val +} + +type RuleGetTargetPoolArgType = string +type RuleGetTargetPoolRetType = string + +/* + types and functions for webSocket +*/ + +// isBoolean +type RulegetWebSocketAttributeType = *bool +type RulegetWebSocketArgType = bool +type RulegetWebSocketRetType = bool + +func getRulegetWebSocketAttributeTypeOk(arg RulegetWebSocketAttributeType) (ret RulegetWebSocketRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRulegetWebSocketAttributeType(arg *RulegetWebSocketAttributeType, val RulegetWebSocketRetType) { + *arg = &val +} + +// Rule struct for Rule +type Rule struct { + CookiePersistence RuleGetCookiePersistenceAttributeType `json:"cookiePersistence,omitempty"` + // Headers for the rule. + Headers RuleGetHeadersAttributeType `json:"headers,omitempty"` + Path RuleGetPathAttributeType `json:"path,omitempty"` + // Legacy path prefix match. Optional. If not set, defaults to root path '/'. Cannot be set if 'path' is used. Prefer using 'path.prefix' instead. Only matches on full segment boundaries, e.g. '/foo' matches '/foo' and '/foo/bar' but NOT '/foobar'. + PathPrefix RuleGetPathPrefixAttributeType `json:"pathPrefix,omitempty"` + // Query Parameters for the rule. + QueryParameters RuleGetQueryParametersAttributeType `json:"queryParameters,omitempty"` + // Reference target pool by target pool name. + TargetPool RuleGetTargetPoolAttributeType `json:"targetPool,omitempty"` + // If enabled, when client sends an HTTP request with and Upgrade header, indicating the desire to establish a Websocket connection, if backend server supports WebSocket, it responds with HTTP 101 status code, switching protocols from HTTP to WebSocket. Hence the client and the server can exchange data in real-time using one long-lived TCP connection. + WebSocket RulegetWebSocketAttributeType `json:"webSocket,omitempty"` +} + +// NewRule instantiates a new Rule 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 NewRule() *Rule { + this := Rule{} + return &this +} + +// NewRuleWithDefaults instantiates a new Rule 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 NewRuleWithDefaults() *Rule { + this := Rule{} + return &this +} + +// GetCookiePersistence returns the CookiePersistence field value if set, zero value otherwise. +func (o *Rule) GetCookiePersistence() (res RuleGetCookiePersistenceRetType) { + res, _ = o.GetCookiePersistenceOk() + return +} + +// GetCookiePersistenceOk returns a tuple with the CookiePersistence field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Rule) GetCookiePersistenceOk() (ret RuleGetCookiePersistenceRetType, ok bool) { + return getRuleGetCookiePersistenceAttributeTypeOk(o.CookiePersistence) +} + +// HasCookiePersistence returns a boolean if a field has been set. +func (o *Rule) HasCookiePersistence() bool { + _, ok := o.GetCookiePersistenceOk() + return ok +} + +// SetCookiePersistence gets a reference to the given CookiePersistence and assigns it to the CookiePersistence field. +func (o *Rule) SetCookiePersistence(v RuleGetCookiePersistenceRetType) { + setRuleGetCookiePersistenceAttributeType(&o.CookiePersistence, v) +} + +// GetHeaders returns the Headers field value if set, zero value otherwise. +func (o *Rule) GetHeaders() (res RuleGetHeadersRetType) { + res, _ = o.GetHeadersOk() + return +} + +// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Rule) GetHeadersOk() (ret RuleGetHeadersRetType, ok bool) { + return getRuleGetHeadersAttributeTypeOk(o.Headers) +} + +// HasHeaders returns a boolean if a field has been set. +func (o *Rule) HasHeaders() bool { + _, ok := o.GetHeadersOk() + return ok +} + +// SetHeaders gets a reference to the given []HttpHeader and assigns it to the Headers field. +func (o *Rule) SetHeaders(v RuleGetHeadersRetType) { + setRuleGetHeadersAttributeType(&o.Headers, v) +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *Rule) GetPath() (res RuleGetPathRetType) { + res, _ = o.GetPathOk() + return +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Rule) GetPathOk() (ret RuleGetPathRetType, ok bool) { + return getRuleGetPathAttributeTypeOk(o.Path) +} + +// HasPath returns a boolean if a field has been set. +func (o *Rule) HasPath() bool { + _, ok := o.GetPathOk() + return ok +} + +// SetPath gets a reference to the given Path and assigns it to the Path field. +func (o *Rule) SetPath(v RuleGetPathRetType) { + setRuleGetPathAttributeType(&o.Path, v) +} + +// GetPathPrefix returns the PathPrefix field value if set, zero value otherwise. +func (o *Rule) GetPathPrefix() (res RuleGetPathPrefixRetType) { + res, _ = o.GetPathPrefixOk() + return +} + +// GetPathPrefixOk returns a tuple with the PathPrefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Rule) GetPathPrefixOk() (ret RuleGetPathPrefixRetType, ok bool) { + return getRuleGetPathPrefixAttributeTypeOk(o.PathPrefix) +} + +// HasPathPrefix returns a boolean if a field has been set. +func (o *Rule) HasPathPrefix() bool { + _, ok := o.GetPathPrefixOk() + return ok +} + +// SetPathPrefix gets a reference to the given string and assigns it to the PathPrefix field. +func (o *Rule) SetPathPrefix(v RuleGetPathPrefixRetType) { + setRuleGetPathPrefixAttributeType(&o.PathPrefix, v) +} + +// GetQueryParameters returns the QueryParameters field value if set, zero value otherwise. +func (o *Rule) GetQueryParameters() (res RuleGetQueryParametersRetType) { + res, _ = o.GetQueryParametersOk() + return +} + +// GetQueryParametersOk returns a tuple with the QueryParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Rule) GetQueryParametersOk() (ret RuleGetQueryParametersRetType, ok bool) { + return getRuleGetQueryParametersAttributeTypeOk(o.QueryParameters) +} + +// HasQueryParameters returns a boolean if a field has been set. +func (o *Rule) HasQueryParameters() bool { + _, ok := o.GetQueryParametersOk() + return ok +} + +// SetQueryParameters gets a reference to the given []QueryParameter and assigns it to the QueryParameters field. +func (o *Rule) SetQueryParameters(v RuleGetQueryParametersRetType) { + setRuleGetQueryParametersAttributeType(&o.QueryParameters, v) +} + +// GetTargetPool returns the TargetPool field value if set, zero value otherwise. +func (o *Rule) GetTargetPool() (res RuleGetTargetPoolRetType) { + res, _ = o.GetTargetPoolOk() + return +} + +// GetTargetPoolOk returns a tuple with the TargetPool field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Rule) GetTargetPoolOk() (ret RuleGetTargetPoolRetType, ok bool) { + return getRuleGetTargetPoolAttributeTypeOk(o.TargetPool) +} + +// HasTargetPool returns a boolean if a field has been set. +func (o *Rule) HasTargetPool() bool { + _, ok := o.GetTargetPoolOk() + return ok +} + +// SetTargetPool gets a reference to the given string and assigns it to the TargetPool field. +func (o *Rule) SetTargetPool(v RuleGetTargetPoolRetType) { + setRuleGetTargetPoolAttributeType(&o.TargetPool, v) +} + +// GetWebSocket returns the WebSocket field value if set, zero value otherwise. +func (o *Rule) GetWebSocket() (res RulegetWebSocketRetType) { + res, _ = o.GetWebSocketOk() + return +} + +// GetWebSocketOk returns a tuple with the WebSocket field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Rule) GetWebSocketOk() (ret RulegetWebSocketRetType, ok bool) { + return getRulegetWebSocketAttributeTypeOk(o.WebSocket) +} + +// HasWebSocket returns a boolean if a field has been set. +func (o *Rule) HasWebSocket() bool { + _, ok := o.GetWebSocketOk() + return ok +} + +// SetWebSocket gets a reference to the given bool and assigns it to the WebSocket field. +func (o *Rule) SetWebSocket(v RulegetWebSocketRetType) { + setRulegetWebSocketAttributeType(&o.WebSocket, v) +} + +func (o Rule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRuleGetCookiePersistenceAttributeTypeOk(o.CookiePersistence); ok { + toSerialize["CookiePersistence"] = val + } + if val, ok := getRuleGetHeadersAttributeTypeOk(o.Headers); ok { + toSerialize["Headers"] = val + } + if val, ok := getRuleGetPathAttributeTypeOk(o.Path); ok { + toSerialize["Path"] = val + } + if val, ok := getRuleGetPathPrefixAttributeTypeOk(o.PathPrefix); ok { + toSerialize["PathPrefix"] = val + } + if val, ok := getRuleGetQueryParametersAttributeTypeOk(o.QueryParameters); ok { + toSerialize["QueryParameters"] = val + } + if val, ok := getRuleGetTargetPoolAttributeTypeOk(o.TargetPool); ok { + toSerialize["TargetPool"] = val + } + if val, ok := getRulegetWebSocketAttributeTypeOk(o.WebSocket); ok { + toSerialize["WebSocket"] = val + } + return toSerialize, nil +} + +type NullableRule struct { + value *Rule + isSet bool +} + +func (v NullableRule) Get() *Rule { + return v.value +} + +func (v *NullableRule) Set(val *Rule) { + v.value = val + v.isSet = true +} + +func (v NullableRule) IsSet() bool { + return v.isSet +} + +func (v *NullableRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRule(val *Rule) *NullableRule { + return &NullableRule{value: val, isSet: true} +} + +func (v NullableRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_rule_test.go b/pkg/albbeta/model_rule_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_rule_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_security_group.go b/pkg/albbeta/model_security_group.go new file mode 100644 index 00000000..8569f9e7 --- /dev/null +++ b/pkg/albbeta/model_security_group.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the SecurityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroup{} + +/* + types and functions for id +*/ + +// isNotNullableString +type SecurityGroupGetIdAttributeType = *string + +func getSecurityGroupGetIdAttributeTypeOk(arg SecurityGroupGetIdAttributeType) (ret SecurityGroupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetIdAttributeType(arg *SecurityGroupGetIdAttributeType, val SecurityGroupGetIdRetType) { + *arg = &val +} + +type SecurityGroupGetIdArgType = string +type SecurityGroupGetIdRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type SecurityGroupGetNameAttributeType = *string + +func getSecurityGroupGetNameAttributeTypeOk(arg SecurityGroupGetNameAttributeType) (ret SecurityGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetNameAttributeType(arg *SecurityGroupGetNameAttributeType, val SecurityGroupGetNameRetType) { + *arg = &val +} + +type SecurityGroupGetNameArgType = string +type SecurityGroupGetNameRetType = string + +// SecurityGroup struct for SecurityGroup +type SecurityGroup struct { + // ID of the security Group + Id SecurityGroupGetIdAttributeType `json:"id,omitempty"` + // Name of the security Group + Name SecurityGroupGetNameAttributeType `json:"name,omitempty"` +} + +// NewSecurityGroup instantiates a new SecurityGroup 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 NewSecurityGroup() *SecurityGroup { + this := SecurityGroup{} + return &this +} + +// NewSecurityGroupWithDefaults instantiates a new SecurityGroup 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 NewSecurityGroupWithDefaults() *SecurityGroup { + this := SecurityGroup{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityGroup) GetId() (res SecurityGroupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetIdOk() (ret SecurityGroupGetIdRetType, ok bool) { + return getSecurityGroupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityGroup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityGroup) SetId(v SecurityGroupGetIdRetType) { + setSecurityGroupGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SecurityGroup) GetName() (res SecurityGroupGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetNameOk() (ret SecurityGroupGetNameRetType, ok bool) { + return getSecurityGroupGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *SecurityGroup) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SecurityGroup) SetName(v SecurityGroupGetNameRetType) { + setSecurityGroupGetNameAttributeType(&o.Name, v) +} + +func (o SecurityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getSecurityGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroup struct { + value *SecurityGroup + isSet bool +} + +func (v NullableSecurityGroup) Get() *SecurityGroup { + return v.value +} + +func (v *NullableSecurityGroup) Set(val *SecurityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroup(val *SecurityGroup) *NullableSecurityGroup { + return &NullableSecurityGroup{value: val, isSet: true} +} + +func (v NullableSecurityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_security_group_test.go b/pkg/albbeta/model_security_group_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_security_group_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_status.go b/pkg/albbeta/model_status.go new file mode 100644 index 00000000..9e034551 --- /dev/null +++ b/pkg/albbeta/model_status.go @@ -0,0 +1,226 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the Status type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Status{} + +/* + types and functions for code +*/ + +// isInteger +type StatusGetCodeAttributeType = *int64 +type StatusGetCodeArgType = int64 +type StatusGetCodeRetType = int64 + +func getStatusGetCodeAttributeTypeOk(arg StatusGetCodeAttributeType) (ret StatusGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetCodeAttributeType(arg *StatusGetCodeAttributeType, val StatusGetCodeRetType) { + *arg = &val +} + +/* + types and functions for details +*/ + +// isArray +type StatusGetDetailsAttributeType = *[]GoogleProtobufAny +type StatusGetDetailsArgType = []GoogleProtobufAny +type StatusGetDetailsRetType = []GoogleProtobufAny + +func getStatusGetDetailsAttributeTypeOk(arg StatusGetDetailsAttributeType) (ret StatusGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetDetailsAttributeType(arg *StatusGetDetailsAttributeType, val StatusGetDetailsRetType) { + *arg = &val +} + +/* + types and functions for message +*/ + +// isNotNullableString +type StatusGetMessageAttributeType = *string + +func getStatusGetMessageAttributeTypeOk(arg StatusGetMessageAttributeType) (ret StatusGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetMessageAttributeType(arg *StatusGetMessageAttributeType, val StatusGetMessageRetType) { + *arg = &val +} + +type StatusGetMessageArgType = string +type StatusGetMessageRetType = string + +// Status The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). +type Status struct { + // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + // Can be cast to int32 without loss of precision. + Code StatusGetCodeAttributeType `json:"code,omitempty"` + // A list of messages that carry the error details. There is a common set of message types for APIs to use. + Details StatusGetDetailsAttributeType `json:"details,omitempty"` + // A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + Message StatusGetMessageAttributeType `json:"message,omitempty"` +} + +// NewStatus instantiates a new Status 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 NewStatus() *Status { + this := Status{} + return &this +} + +// NewStatusWithDefaults instantiates a new Status 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 NewStatusWithDefaults() *Status { + this := Status{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *Status) GetCode() (res StatusGetCodeRetType) { + res, _ = o.GetCodeOk() + return +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetCodeOk() (ret StatusGetCodeRetType, ok bool) { + return getStatusGetCodeAttributeTypeOk(o.Code) +} + +// HasCode returns a boolean if a field has been set. +func (o *Status) HasCode() bool { + _, ok := o.GetCodeOk() + return ok +} + +// SetCode gets a reference to the given int64 and assigns it to the Code field. +func (o *Status) SetCode(v StatusGetCodeRetType) { + setStatusGetCodeAttributeType(&o.Code, v) +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *Status) GetDetails() (res StatusGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetDetailsOk() (ret StatusGetDetailsRetType, ok bool) { + return getStatusGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *Status) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given []GoogleProtobufAny and assigns it to the Details field. +func (o *Status) SetDetails(v StatusGetDetailsRetType) { + setStatusGetDetailsAttributeType(&o.Details, v) +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *Status) GetMessage() (res StatusGetMessageRetType) { + res, _ = o.GetMessageOk() + return +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetMessageOk() (ret StatusGetMessageRetType, ok bool) { + return getStatusGetMessageAttributeTypeOk(o.Message) +} + +// HasMessage returns a boolean if a field has been set. +func (o *Status) HasMessage() bool { + _, ok := o.GetMessageOk() + return ok +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *Status) SetMessage(v StatusGetMessageRetType) { + setStatusGetMessageAttributeType(&o.Message, v) +} + +func (o Status) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getStatusGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getStatusGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getStatusGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableStatus struct { + value *Status + isSet bool +} + +func (v NullableStatus) Get() *Status { + return v.value +} + +func (v *NullableStatus) Set(val *Status) { + v.value = val + v.isSet = true +} + +func (v NullableStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStatus(val *Status) *NullableStatus { + return &NullableStatus{value: val, isSet: true} +} + +func (v NullableStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_status_test.go b/pkg/albbeta/model_status_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_status_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_target.go b/pkg/albbeta/model_target.go new file mode 100644 index 00000000..41c02b2a --- /dev/null +++ b/pkg/albbeta/model_target.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the Target type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Target{} + +/* + types and functions for displayName +*/ + +// isNotNullableString +type TargetGetDisplayNameAttributeType = *string + +func getTargetGetDisplayNameAttributeTypeOk(arg TargetGetDisplayNameAttributeType) (ret TargetGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTargetGetDisplayNameAttributeType(arg *TargetGetDisplayNameAttributeType, val TargetGetDisplayNameRetType) { + *arg = &val +} + +type TargetGetDisplayNameArgType = string +type TargetGetDisplayNameRetType = string + +/* + types and functions for ip +*/ + +// isNotNullableString +type TargetGetIpAttributeType = *string + +func getTargetGetIpAttributeTypeOk(arg TargetGetIpAttributeType) (ret TargetGetIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTargetGetIpAttributeType(arg *TargetGetIpAttributeType, val TargetGetIpRetType) { + *arg = &val +} + +type TargetGetIpArgType = string +type TargetGetIpRetType = string + +// Target struct for Target +type Target struct { + // Target name + DisplayName TargetGetDisplayNameAttributeType `json:"displayName,omitempty"` + // Target IP. Must by unique within a target pool. + Ip TargetGetIpAttributeType `json:"ip,omitempty"` +} + +// NewTarget instantiates a new Target 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 NewTarget() *Target { + this := Target{} + return &this +} + +// NewTargetWithDefaults instantiates a new Target 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 NewTargetWithDefaults() *Target { + this := Target{} + return &this +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *Target) GetDisplayName() (res TargetGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Target) GetDisplayNameOk() (ret TargetGetDisplayNameRetType, ok bool) { + return getTargetGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *Target) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *Target) SetDisplayName(v TargetGetDisplayNameRetType) { + setTargetGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *Target) GetIp() (res TargetGetIpRetType) { + res, _ = o.GetIpOk() + return +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Target) GetIpOk() (ret TargetGetIpRetType, ok bool) { + return getTargetGetIpAttributeTypeOk(o.Ip) +} + +// HasIp returns a boolean if a field has been set. +func (o *Target) HasIp() bool { + _, ok := o.GetIpOk() + return ok +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *Target) SetIp(v TargetGetIpRetType) { + setTargetGetIpAttributeType(&o.Ip, v) +} + +func (o Target) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTargetGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getTargetGetIpAttributeTypeOk(o.Ip); ok { + toSerialize["Ip"] = val + } + return toSerialize, nil +} + +type NullableTarget struct { + value *Target + isSet bool +} + +func (v NullableTarget) Get() *Target { + return v.value +} + +func (v *NullableTarget) Set(val *Target) { + v.value = val + v.isSet = true +} + +func (v NullableTarget) IsSet() bool { + return v.isSet +} + +func (v *NullableTarget) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTarget(val *Target) *NullableTarget { + return &NullableTarget{value: val, isSet: true} +} + +func (v NullableTarget) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTarget) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_target_pool.go b/pkg/albbeta/model_target_pool.go new file mode 100644 index 00000000..a2d3b70e --- /dev/null +++ b/pkg/albbeta/model_target_pool.go @@ -0,0 +1,320 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the TargetPool type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TargetPool{} + +/* + types and functions for activeHealthCheck +*/ + +// isModel +type TargetPoolGetActiveHealthCheckAttributeType = *ActiveHealthCheck +type TargetPoolGetActiveHealthCheckArgType = ActiveHealthCheck +type TargetPoolGetActiveHealthCheckRetType = ActiveHealthCheck + +func getTargetPoolGetActiveHealthCheckAttributeTypeOk(arg TargetPoolGetActiveHealthCheckAttributeType) (ret TargetPoolGetActiveHealthCheckRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTargetPoolGetActiveHealthCheckAttributeType(arg *TargetPoolGetActiveHealthCheckAttributeType, val TargetPoolGetActiveHealthCheckRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type TargetPoolGetNameAttributeType = *string + +func getTargetPoolGetNameAttributeTypeOk(arg TargetPoolGetNameAttributeType) (ret TargetPoolGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTargetPoolGetNameAttributeType(arg *TargetPoolGetNameAttributeType, val TargetPoolGetNameRetType) { + *arg = &val +} + +type TargetPoolGetNameArgType = string +type TargetPoolGetNameRetType = string + +/* + types and functions for targetPort +*/ + +// isInteger +type TargetPoolGetTargetPortAttributeType = *int64 +type TargetPoolGetTargetPortArgType = int64 +type TargetPoolGetTargetPortRetType = int64 + +func getTargetPoolGetTargetPortAttributeTypeOk(arg TargetPoolGetTargetPortAttributeType) (ret TargetPoolGetTargetPortRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTargetPoolGetTargetPortAttributeType(arg *TargetPoolGetTargetPortAttributeType, val TargetPoolGetTargetPortRetType) { + *arg = &val +} + +/* + types and functions for targets +*/ + +// isArray +type TargetPoolGetTargetsAttributeType = *[]Target +type TargetPoolGetTargetsArgType = []Target +type TargetPoolGetTargetsRetType = []Target + +func getTargetPoolGetTargetsAttributeTypeOk(arg TargetPoolGetTargetsAttributeType) (ret TargetPoolGetTargetsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTargetPoolGetTargetsAttributeType(arg *TargetPoolGetTargetsAttributeType, val TargetPoolGetTargetsRetType) { + *arg = &val +} + +/* + types and functions for tlsConfig +*/ + +// isModel +type TargetPoolGetTlsConfigAttributeType = *TargetPoolTlsConfig +type TargetPoolGetTlsConfigArgType = TargetPoolTlsConfig +type TargetPoolGetTlsConfigRetType = TargetPoolTlsConfig + +func getTargetPoolGetTlsConfigAttributeTypeOk(arg TargetPoolGetTlsConfigAttributeType) (ret TargetPoolGetTlsConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTargetPoolGetTlsConfigAttributeType(arg *TargetPoolGetTlsConfigAttributeType, val TargetPoolGetTlsConfigRetType) { + *arg = &val +} + +// TargetPool struct for TargetPool +type TargetPool struct { + ActiveHealthCheck TargetPoolGetActiveHealthCheckAttributeType `json:"activeHealthCheck,omitempty"` + // Target pool name + Name TargetPoolGetNameAttributeType `json:"name,omitempty"` + // The number identifying the port where each target listens for traffic. + // Can be cast to int32 without loss of precision. + TargetPort TargetPoolGetTargetPortAttributeType `json:"targetPort,omitempty"` + // List of all targets which will be used in the pool. Limited to 250. + Targets TargetPoolGetTargetsAttributeType `json:"targets,omitempty"` + TlsConfig TargetPoolGetTlsConfigAttributeType `json:"tlsConfig,omitempty"` +} + +// NewTargetPool instantiates a new TargetPool 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 NewTargetPool() *TargetPool { + this := TargetPool{} + return &this +} + +// NewTargetPoolWithDefaults instantiates a new TargetPool 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 NewTargetPoolWithDefaults() *TargetPool { + this := TargetPool{} + return &this +} + +// GetActiveHealthCheck returns the ActiveHealthCheck field value if set, zero value otherwise. +func (o *TargetPool) GetActiveHealthCheck() (res TargetPoolGetActiveHealthCheckRetType) { + res, _ = o.GetActiveHealthCheckOk() + return +} + +// GetActiveHealthCheckOk returns a tuple with the ActiveHealthCheck field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TargetPool) GetActiveHealthCheckOk() (ret TargetPoolGetActiveHealthCheckRetType, ok bool) { + return getTargetPoolGetActiveHealthCheckAttributeTypeOk(o.ActiveHealthCheck) +} + +// HasActiveHealthCheck returns a boolean if a field has been set. +func (o *TargetPool) HasActiveHealthCheck() bool { + _, ok := o.GetActiveHealthCheckOk() + return ok +} + +// SetActiveHealthCheck gets a reference to the given ActiveHealthCheck and assigns it to the ActiveHealthCheck field. +func (o *TargetPool) SetActiveHealthCheck(v TargetPoolGetActiveHealthCheckRetType) { + setTargetPoolGetActiveHealthCheckAttributeType(&o.ActiveHealthCheck, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TargetPool) GetName() (res TargetPoolGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TargetPool) GetNameOk() (ret TargetPoolGetNameRetType, ok bool) { + return getTargetPoolGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *TargetPool) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TargetPool) SetName(v TargetPoolGetNameRetType) { + setTargetPoolGetNameAttributeType(&o.Name, v) +} + +// GetTargetPort returns the TargetPort field value if set, zero value otherwise. +func (o *TargetPool) GetTargetPort() (res TargetPoolGetTargetPortRetType) { + res, _ = o.GetTargetPortOk() + return +} + +// GetTargetPortOk returns a tuple with the TargetPort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TargetPool) GetTargetPortOk() (ret TargetPoolGetTargetPortRetType, ok bool) { + return getTargetPoolGetTargetPortAttributeTypeOk(o.TargetPort) +} + +// HasTargetPort returns a boolean if a field has been set. +func (o *TargetPool) HasTargetPort() bool { + _, ok := o.GetTargetPortOk() + return ok +} + +// SetTargetPort gets a reference to the given int64 and assigns it to the TargetPort field. +func (o *TargetPool) SetTargetPort(v TargetPoolGetTargetPortRetType) { + setTargetPoolGetTargetPortAttributeType(&o.TargetPort, v) +} + +// GetTargets returns the Targets field value if set, zero value otherwise. +func (o *TargetPool) GetTargets() (res TargetPoolGetTargetsRetType) { + res, _ = o.GetTargetsOk() + return +} + +// GetTargetsOk returns a tuple with the Targets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TargetPool) GetTargetsOk() (ret TargetPoolGetTargetsRetType, ok bool) { + return getTargetPoolGetTargetsAttributeTypeOk(o.Targets) +} + +// HasTargets returns a boolean if a field has been set. +func (o *TargetPool) HasTargets() bool { + _, ok := o.GetTargetsOk() + return ok +} + +// SetTargets gets a reference to the given []Target and assigns it to the Targets field. +func (o *TargetPool) SetTargets(v TargetPoolGetTargetsRetType) { + setTargetPoolGetTargetsAttributeType(&o.Targets, v) +} + +// GetTlsConfig returns the TlsConfig field value if set, zero value otherwise. +func (o *TargetPool) GetTlsConfig() (res TargetPoolGetTlsConfigRetType) { + res, _ = o.GetTlsConfigOk() + return +} + +// GetTlsConfigOk returns a tuple with the TlsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TargetPool) GetTlsConfigOk() (ret TargetPoolGetTlsConfigRetType, ok bool) { + return getTargetPoolGetTlsConfigAttributeTypeOk(o.TlsConfig) +} + +// HasTlsConfig returns a boolean if a field has been set. +func (o *TargetPool) HasTlsConfig() bool { + _, ok := o.GetTlsConfigOk() + return ok +} + +// SetTlsConfig gets a reference to the given TargetPoolTlsConfig and assigns it to the TlsConfig field. +func (o *TargetPool) SetTlsConfig(v TargetPoolGetTlsConfigRetType) { + setTargetPoolGetTlsConfigAttributeType(&o.TlsConfig, v) +} + +func (o TargetPool) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTargetPoolGetActiveHealthCheckAttributeTypeOk(o.ActiveHealthCheck); ok { + toSerialize["ActiveHealthCheck"] = val + } + if val, ok := getTargetPoolGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getTargetPoolGetTargetPortAttributeTypeOk(o.TargetPort); ok { + toSerialize["TargetPort"] = val + } + if val, ok := getTargetPoolGetTargetsAttributeTypeOk(o.Targets); ok { + toSerialize["Targets"] = val + } + if val, ok := getTargetPoolGetTlsConfigAttributeTypeOk(o.TlsConfig); ok { + toSerialize["TlsConfig"] = val + } + return toSerialize, nil +} + +type NullableTargetPool struct { + value *TargetPool + isSet bool +} + +func (v NullableTargetPool) Get() *TargetPool { + return v.value +} + +func (v *NullableTargetPool) Set(val *TargetPool) { + v.value = val + v.isSet = true +} + +func (v NullableTargetPool) IsSet() bool { + return v.isSet +} + +func (v *NullableTargetPool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTargetPool(val *TargetPool) *NullableTargetPool { + return &NullableTargetPool{value: val, isSet: true} +} + +func (v NullableTargetPool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTargetPool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_target_pool_test.go b/pkg/albbeta/model_target_pool_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_target_pool_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_target_pool_tls_config.go b/pkg/albbeta/model_target_pool_tls_config.go new file mode 100644 index 00000000..ea3ce05f --- /dev/null +++ b/pkg/albbeta/model_target_pool_tls_config.go @@ -0,0 +1,225 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the TargetPoolTlsConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TargetPoolTlsConfig{} + +/* + types and functions for customCa +*/ + +// isNotNullableString +type TargetPoolTlsConfigGetCustomCaAttributeType = *string + +func getTargetPoolTlsConfigGetCustomCaAttributeTypeOk(arg TargetPoolTlsConfigGetCustomCaAttributeType) (ret TargetPoolTlsConfigGetCustomCaRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTargetPoolTlsConfigGetCustomCaAttributeType(arg *TargetPoolTlsConfigGetCustomCaAttributeType, val TargetPoolTlsConfigGetCustomCaRetType) { + *arg = &val +} + +type TargetPoolTlsConfigGetCustomCaArgType = string +type TargetPoolTlsConfigGetCustomCaRetType = string + +/* + types and functions for enabled +*/ + +// isBoolean +type TargetPoolTlsConfiggetEnabledAttributeType = *bool +type TargetPoolTlsConfiggetEnabledArgType = bool +type TargetPoolTlsConfiggetEnabledRetType = bool + +func getTargetPoolTlsConfiggetEnabledAttributeTypeOk(arg TargetPoolTlsConfiggetEnabledAttributeType) (ret TargetPoolTlsConfiggetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTargetPoolTlsConfiggetEnabledAttributeType(arg *TargetPoolTlsConfiggetEnabledAttributeType, val TargetPoolTlsConfiggetEnabledRetType) { + *arg = &val +} + +/* + types and functions for skipCertificateValidation +*/ + +// isBoolean +type TargetPoolTlsConfiggetSkipCertificateValidationAttributeType = *bool +type TargetPoolTlsConfiggetSkipCertificateValidationArgType = bool +type TargetPoolTlsConfiggetSkipCertificateValidationRetType = bool + +func getTargetPoolTlsConfiggetSkipCertificateValidationAttributeTypeOk(arg TargetPoolTlsConfiggetSkipCertificateValidationAttributeType) (ret TargetPoolTlsConfiggetSkipCertificateValidationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTargetPoolTlsConfiggetSkipCertificateValidationAttributeType(arg *TargetPoolTlsConfiggetSkipCertificateValidationAttributeType, val TargetPoolTlsConfiggetSkipCertificateValidationRetType) { + *arg = &val +} + +// TargetPoolTlsConfig struct for TargetPoolTlsConfig +type TargetPoolTlsConfig struct { + // Specifies a custom Certificate Authority (CA). When provided, the target pool will trust certificates signed by this CA, in addition to any system-trusted CAs. This is useful for scenarios where the target pool needs to communicate with servers using self-signed or internally-issued certificates. + CustomCa TargetPoolTlsConfigGetCustomCaAttributeType `json:"customCa,omitempty"` + // Enable or disable TLS (Transport Layer Security) for connections to the target pool. When enabled, the load balancer will establish secure connections using TLS to the target pool. + Enabled TargetPoolTlsConfiggetEnabledAttributeType `json:"enabled,omitempty"` + // Bypass certificate validation for TLS connections to the target pool. This option is insecure. + SkipCertificateValidation TargetPoolTlsConfiggetSkipCertificateValidationAttributeType `json:"skipCertificateValidation,omitempty"` +} + +// NewTargetPoolTlsConfig instantiates a new TargetPoolTlsConfig 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 NewTargetPoolTlsConfig() *TargetPoolTlsConfig { + this := TargetPoolTlsConfig{} + return &this +} + +// NewTargetPoolTlsConfigWithDefaults instantiates a new TargetPoolTlsConfig 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 NewTargetPoolTlsConfigWithDefaults() *TargetPoolTlsConfig { + this := TargetPoolTlsConfig{} + return &this +} + +// GetCustomCa returns the CustomCa field value if set, zero value otherwise. +func (o *TargetPoolTlsConfig) GetCustomCa() (res TargetPoolTlsConfigGetCustomCaRetType) { + res, _ = o.GetCustomCaOk() + return +} + +// GetCustomCaOk returns a tuple with the CustomCa field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TargetPoolTlsConfig) GetCustomCaOk() (ret TargetPoolTlsConfigGetCustomCaRetType, ok bool) { + return getTargetPoolTlsConfigGetCustomCaAttributeTypeOk(o.CustomCa) +} + +// HasCustomCa returns a boolean if a field has been set. +func (o *TargetPoolTlsConfig) HasCustomCa() bool { + _, ok := o.GetCustomCaOk() + return ok +} + +// SetCustomCa gets a reference to the given string and assigns it to the CustomCa field. +func (o *TargetPoolTlsConfig) SetCustomCa(v TargetPoolTlsConfigGetCustomCaRetType) { + setTargetPoolTlsConfigGetCustomCaAttributeType(&o.CustomCa, v) +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *TargetPoolTlsConfig) GetEnabled() (res TargetPoolTlsConfiggetEnabledRetType) { + res, _ = o.GetEnabledOk() + return +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TargetPoolTlsConfig) GetEnabledOk() (ret TargetPoolTlsConfiggetEnabledRetType, ok bool) { + return getTargetPoolTlsConfiggetEnabledAttributeTypeOk(o.Enabled) +} + +// HasEnabled returns a boolean if a field has been set. +func (o *TargetPoolTlsConfig) HasEnabled() bool { + _, ok := o.GetEnabledOk() + return ok +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *TargetPoolTlsConfig) SetEnabled(v TargetPoolTlsConfiggetEnabledRetType) { + setTargetPoolTlsConfiggetEnabledAttributeType(&o.Enabled, v) +} + +// GetSkipCertificateValidation returns the SkipCertificateValidation field value if set, zero value otherwise. +func (o *TargetPoolTlsConfig) GetSkipCertificateValidation() (res TargetPoolTlsConfiggetSkipCertificateValidationRetType) { + res, _ = o.GetSkipCertificateValidationOk() + return +} + +// GetSkipCertificateValidationOk returns a tuple with the SkipCertificateValidation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TargetPoolTlsConfig) GetSkipCertificateValidationOk() (ret TargetPoolTlsConfiggetSkipCertificateValidationRetType, ok bool) { + return getTargetPoolTlsConfiggetSkipCertificateValidationAttributeTypeOk(o.SkipCertificateValidation) +} + +// HasSkipCertificateValidation returns a boolean if a field has been set. +func (o *TargetPoolTlsConfig) HasSkipCertificateValidation() bool { + _, ok := o.GetSkipCertificateValidationOk() + return ok +} + +// SetSkipCertificateValidation gets a reference to the given bool and assigns it to the SkipCertificateValidation field. +func (o *TargetPoolTlsConfig) SetSkipCertificateValidation(v TargetPoolTlsConfiggetSkipCertificateValidationRetType) { + setTargetPoolTlsConfiggetSkipCertificateValidationAttributeType(&o.SkipCertificateValidation, v) +} + +func (o TargetPoolTlsConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTargetPoolTlsConfigGetCustomCaAttributeTypeOk(o.CustomCa); ok { + toSerialize["CustomCa"] = val + } + if val, ok := getTargetPoolTlsConfiggetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getTargetPoolTlsConfiggetSkipCertificateValidationAttributeTypeOk(o.SkipCertificateValidation); ok { + toSerialize["SkipCertificateValidation"] = val + } + return toSerialize, nil +} + +type NullableTargetPoolTlsConfig struct { + value *TargetPoolTlsConfig + isSet bool +} + +func (v NullableTargetPoolTlsConfig) Get() *TargetPoolTlsConfig { + return v.value +} + +func (v *NullableTargetPoolTlsConfig) Set(val *TargetPoolTlsConfig) { + v.value = val + v.isSet = true +} + +func (v NullableTargetPoolTlsConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableTargetPoolTlsConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTargetPoolTlsConfig(val *TargetPoolTlsConfig) *NullableTargetPoolTlsConfig { + return &NullableTargetPoolTlsConfig{value: val, isSet: true} +} + +func (v NullableTargetPoolTlsConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTargetPoolTlsConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_target_pool_tls_config_test.go b/pkg/albbeta/model_target_pool_tls_config_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_target_pool_tls_config_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_target_test.go b/pkg/albbeta/model_target_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_target_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_update_credentials_payload.go b/pkg/albbeta/model_update_credentials_payload.go new file mode 100644 index 00000000..bf54183f --- /dev/null +++ b/pkg/albbeta/model_update_credentials_payload.go @@ -0,0 +1,227 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the UpdateCredentialsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateCredentialsPayload{} + +/* + types and functions for displayName +*/ + +// isNotNullableString +type UpdateCredentialsPayloadGetDisplayNameAttributeType = *string + +func getUpdateCredentialsPayloadGetDisplayNameAttributeTypeOk(arg UpdateCredentialsPayloadGetDisplayNameAttributeType) (ret UpdateCredentialsPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCredentialsPayloadGetDisplayNameAttributeType(arg *UpdateCredentialsPayloadGetDisplayNameAttributeType, val UpdateCredentialsPayloadGetDisplayNameRetType) { + *arg = &val +} + +type UpdateCredentialsPayloadGetDisplayNameArgType = string +type UpdateCredentialsPayloadGetDisplayNameRetType = string + +/* + types and functions for password +*/ + +// isNotNullableString +type UpdateCredentialsPayloadGetPasswordAttributeType = *string + +func getUpdateCredentialsPayloadGetPasswordAttributeTypeOk(arg UpdateCredentialsPayloadGetPasswordAttributeType) (ret UpdateCredentialsPayloadGetPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCredentialsPayloadGetPasswordAttributeType(arg *UpdateCredentialsPayloadGetPasswordAttributeType, val UpdateCredentialsPayloadGetPasswordRetType) { + *arg = &val +} + +type UpdateCredentialsPayloadGetPasswordArgType = string +type UpdateCredentialsPayloadGetPasswordRetType = string + +/* + types and functions for username +*/ + +// isNotNullableString +type UpdateCredentialsPayloadGetUsernameAttributeType = *string + +func getUpdateCredentialsPayloadGetUsernameAttributeTypeOk(arg UpdateCredentialsPayloadGetUsernameAttributeType) (ret UpdateCredentialsPayloadGetUsernameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCredentialsPayloadGetUsernameAttributeType(arg *UpdateCredentialsPayloadGetUsernameAttributeType, val UpdateCredentialsPayloadGetUsernameRetType) { + *arg = &val +} + +type UpdateCredentialsPayloadGetUsernameArgType = string +type UpdateCredentialsPayloadGetUsernameRetType = string + +// UpdateCredentialsPayload struct for UpdateCredentialsPayload +type UpdateCredentialsPayload struct { + // Credential name + DisplayName UpdateCredentialsPayloadGetDisplayNameAttributeType `json:"displayName,omitempty"` + // A valid password used for an existing STACKIT Observability instance, which is used during basic auth. + Password UpdateCredentialsPayloadGetPasswordAttributeType `json:"password,omitempty"` + // A valid username used for an existing STACKIT Observability instance, which is used during basic auth. + Username UpdateCredentialsPayloadGetUsernameAttributeType `json:"username,omitempty"` +} + +// NewUpdateCredentialsPayload instantiates a new UpdateCredentialsPayload 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 NewUpdateCredentialsPayload() *UpdateCredentialsPayload { + this := UpdateCredentialsPayload{} + return &this +} + +// NewUpdateCredentialsPayloadWithDefaults instantiates a new UpdateCredentialsPayload 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 NewUpdateCredentialsPayloadWithDefaults() *UpdateCredentialsPayload { + this := UpdateCredentialsPayload{} + return &this +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateCredentialsPayload) GetDisplayName() (res UpdateCredentialsPayloadGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCredentialsPayload) GetDisplayNameOk() (ret UpdateCredentialsPayloadGetDisplayNameRetType, ok bool) { + return getUpdateCredentialsPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateCredentialsPayload) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateCredentialsPayload) SetDisplayName(v UpdateCredentialsPayloadGetDisplayNameRetType) { + setUpdateCredentialsPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *UpdateCredentialsPayload) GetPassword() (res UpdateCredentialsPayloadGetPasswordRetType) { + res, _ = o.GetPasswordOk() + return +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCredentialsPayload) GetPasswordOk() (ret UpdateCredentialsPayloadGetPasswordRetType, ok bool) { + return getUpdateCredentialsPayloadGetPasswordAttributeTypeOk(o.Password) +} + +// HasPassword returns a boolean if a field has been set. +func (o *UpdateCredentialsPayload) HasPassword() bool { + _, ok := o.GetPasswordOk() + return ok +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *UpdateCredentialsPayload) SetPassword(v UpdateCredentialsPayloadGetPasswordRetType) { + setUpdateCredentialsPayloadGetPasswordAttributeType(&o.Password, v) +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *UpdateCredentialsPayload) GetUsername() (res UpdateCredentialsPayloadGetUsernameRetType) { + res, _ = o.GetUsernameOk() + return +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCredentialsPayload) GetUsernameOk() (ret UpdateCredentialsPayloadGetUsernameRetType, ok bool) { + return getUpdateCredentialsPayloadGetUsernameAttributeTypeOk(o.Username) +} + +// HasUsername returns a boolean if a field has been set. +func (o *UpdateCredentialsPayload) HasUsername() bool { + _, ok := o.GetUsernameOk() + return ok +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *UpdateCredentialsPayload) SetUsername(v UpdateCredentialsPayloadGetUsernameRetType) { + setUpdateCredentialsPayloadGetUsernameAttributeType(&o.Username, v) +} + +func (o UpdateCredentialsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateCredentialsPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getUpdateCredentialsPayloadGetPasswordAttributeTypeOk(o.Password); ok { + toSerialize["Password"] = val + } + if val, ok := getUpdateCredentialsPayloadGetUsernameAttributeTypeOk(o.Username); ok { + toSerialize["Username"] = val + } + return toSerialize, nil +} + +type NullableUpdateCredentialsPayload struct { + value *UpdateCredentialsPayload + isSet bool +} + +func (v NullableUpdateCredentialsPayload) Get() *UpdateCredentialsPayload { + return v.value +} + +func (v *NullableUpdateCredentialsPayload) Set(val *UpdateCredentialsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateCredentialsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateCredentialsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateCredentialsPayload(val *UpdateCredentialsPayload) *NullableUpdateCredentialsPayload { + return &NullableUpdateCredentialsPayload{value: val, isSet: true} +} + +func (v NullableUpdateCredentialsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateCredentialsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_update_credentials_payload_test.go b/pkg/albbeta/model_update_credentials_payload_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_update_credentials_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_update_credentials_response.go b/pkg/albbeta/model_update_credentials_response.go new file mode 100644 index 00000000..74c05eba --- /dev/null +++ b/pkg/albbeta/model_update_credentials_response.go @@ -0,0 +1,127 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the UpdateCredentialsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateCredentialsResponse{} + +/* + types and functions for credential +*/ + +// isModel +type UpdateCredentialsResponseGetCredentialAttributeType = *CredentialsResponse +type UpdateCredentialsResponseGetCredentialArgType = CredentialsResponse +type UpdateCredentialsResponseGetCredentialRetType = CredentialsResponse + +func getUpdateCredentialsResponseGetCredentialAttributeTypeOk(arg UpdateCredentialsResponseGetCredentialAttributeType) (ret UpdateCredentialsResponseGetCredentialRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCredentialsResponseGetCredentialAttributeType(arg *UpdateCredentialsResponseGetCredentialAttributeType, val UpdateCredentialsResponseGetCredentialRetType) { + *arg = &val +} + +// UpdateCredentialsResponse struct for UpdateCredentialsResponse +type UpdateCredentialsResponse struct { + Credential UpdateCredentialsResponseGetCredentialAttributeType `json:"credential,omitempty"` +} + +// NewUpdateCredentialsResponse instantiates a new UpdateCredentialsResponse 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 NewUpdateCredentialsResponse() *UpdateCredentialsResponse { + this := UpdateCredentialsResponse{} + return &this +} + +// NewUpdateCredentialsResponseWithDefaults instantiates a new UpdateCredentialsResponse 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 NewUpdateCredentialsResponseWithDefaults() *UpdateCredentialsResponse { + this := UpdateCredentialsResponse{} + return &this +} + +// GetCredential returns the Credential field value if set, zero value otherwise. +func (o *UpdateCredentialsResponse) GetCredential() (res UpdateCredentialsResponseGetCredentialRetType) { + res, _ = o.GetCredentialOk() + return +} + +// GetCredentialOk returns a tuple with the Credential field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCredentialsResponse) GetCredentialOk() (ret UpdateCredentialsResponseGetCredentialRetType, ok bool) { + return getUpdateCredentialsResponseGetCredentialAttributeTypeOk(o.Credential) +} + +// HasCredential returns a boolean if a field has been set. +func (o *UpdateCredentialsResponse) HasCredential() bool { + _, ok := o.GetCredentialOk() + return ok +} + +// SetCredential gets a reference to the given CredentialsResponse and assigns it to the Credential field. +func (o *UpdateCredentialsResponse) SetCredential(v UpdateCredentialsResponseGetCredentialRetType) { + setUpdateCredentialsResponseGetCredentialAttributeType(&o.Credential, v) +} + +func (o UpdateCredentialsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateCredentialsResponseGetCredentialAttributeTypeOk(o.Credential); ok { + toSerialize["Credential"] = val + } + return toSerialize, nil +} + +type NullableUpdateCredentialsResponse struct { + value *UpdateCredentialsResponse + isSet bool +} + +func (v NullableUpdateCredentialsResponse) Get() *UpdateCredentialsResponse { + return v.value +} + +func (v *NullableUpdateCredentialsResponse) Set(val *UpdateCredentialsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateCredentialsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateCredentialsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateCredentialsResponse(val *UpdateCredentialsResponse) *NullableUpdateCredentialsResponse { + return &NullableUpdateCredentialsResponse{value: val, isSet: true} +} + +func (v NullableUpdateCredentialsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateCredentialsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_update_credentials_response_test.go b/pkg/albbeta/model_update_credentials_response_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_update_credentials_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/model_update_load_balancer_payload.go b/pkg/albbeta/model_update_load_balancer_payload.go new file mode 100644 index 00000000..e62e5d72 --- /dev/null +++ b/pkg/albbeta/model_update_load_balancer_payload.go @@ -0,0 +1,961 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateLoadBalancerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLoadBalancerPayload{} + +/* + types and functions for disableTargetSecurityGroupAssignment +*/ + +// isBoolean +type UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType = *bool +type UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentArgType = bool +type UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType = bool + +func getUpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeTypeOk(arg UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType) (ret UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType(arg *UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType, val UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType) { + *arg = &val +} + +/* + types and functions for errors +*/ + +// isArray +type UpdateLoadBalancerPayloadGetErrorsAttributeType = *[]LoadBalancerError +type UpdateLoadBalancerPayloadGetErrorsArgType = []LoadBalancerError +type UpdateLoadBalancerPayloadGetErrorsRetType = []LoadBalancerError + +func getUpdateLoadBalancerPayloadGetErrorsAttributeTypeOk(arg UpdateLoadBalancerPayloadGetErrorsAttributeType) (ret UpdateLoadBalancerPayloadGetErrorsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetErrorsAttributeType(arg *UpdateLoadBalancerPayloadGetErrorsAttributeType, val UpdateLoadBalancerPayloadGetErrorsRetType) { + *arg = &val +} + +/* + types and functions for externalAddress +*/ + +// isNotNullableString +type UpdateLoadBalancerPayloadGetExternalAddressAttributeType = *string + +func getUpdateLoadBalancerPayloadGetExternalAddressAttributeTypeOk(arg UpdateLoadBalancerPayloadGetExternalAddressAttributeType) (ret UpdateLoadBalancerPayloadGetExternalAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetExternalAddressAttributeType(arg *UpdateLoadBalancerPayloadGetExternalAddressAttributeType, val UpdateLoadBalancerPayloadGetExternalAddressRetType) { + *arg = &val +} + +type UpdateLoadBalancerPayloadGetExternalAddressArgType = string +type UpdateLoadBalancerPayloadGetExternalAddressRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type UpdateLoadBalancerPayloadGetLabelsAttributeType = *map[string]string +type UpdateLoadBalancerPayloadGetLabelsArgType = map[string]string +type UpdateLoadBalancerPayloadGetLabelsRetType = map[string]string + +func getUpdateLoadBalancerPayloadGetLabelsAttributeTypeOk(arg UpdateLoadBalancerPayloadGetLabelsAttributeType) (ret UpdateLoadBalancerPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetLabelsAttributeType(arg *UpdateLoadBalancerPayloadGetLabelsAttributeType, val UpdateLoadBalancerPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for listeners +*/ + +// isArray +type UpdateLoadBalancerPayloadGetListenersAttributeType = *[]Listener +type UpdateLoadBalancerPayloadGetListenersArgType = []Listener +type UpdateLoadBalancerPayloadGetListenersRetType = []Listener + +func getUpdateLoadBalancerPayloadGetListenersAttributeTypeOk(arg UpdateLoadBalancerPayloadGetListenersAttributeType) (ret UpdateLoadBalancerPayloadGetListenersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetListenersAttributeType(arg *UpdateLoadBalancerPayloadGetListenersAttributeType, val UpdateLoadBalancerPayloadGetListenersRetType) { + *arg = &val +} + +/* + types and functions for loadBalancerSecurityGroup +*/ + +// isModel +type UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType = *CreateLoadBalancerPayloadLoadBalancerSecurityGroup +type UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupArgType = CreateLoadBalancerPayloadLoadBalancerSecurityGroup +type UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType = CreateLoadBalancerPayloadLoadBalancerSecurityGroup + +func getUpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeTypeOk(arg UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType) (ret UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType(arg *UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType, val UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateLoadBalancerPayloadGetNameAttributeType = *string + +func getUpdateLoadBalancerPayloadGetNameAttributeTypeOk(arg UpdateLoadBalancerPayloadGetNameAttributeType) (ret UpdateLoadBalancerPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetNameAttributeType(arg *UpdateLoadBalancerPayloadGetNameAttributeType, val UpdateLoadBalancerPayloadGetNameRetType) { + *arg = &val +} + +type UpdateLoadBalancerPayloadGetNameArgType = string +type UpdateLoadBalancerPayloadGetNameRetType = string + +/* + types and functions for networks +*/ + +// isArray +type UpdateLoadBalancerPayloadGetNetworksAttributeType = *[]Network +type UpdateLoadBalancerPayloadGetNetworksArgType = []Network +type UpdateLoadBalancerPayloadGetNetworksRetType = []Network + +func getUpdateLoadBalancerPayloadGetNetworksAttributeTypeOk(arg UpdateLoadBalancerPayloadGetNetworksAttributeType) (ret UpdateLoadBalancerPayloadGetNetworksRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetNetworksAttributeType(arg *UpdateLoadBalancerPayloadGetNetworksAttributeType, val UpdateLoadBalancerPayloadGetNetworksRetType) { + *arg = &val +} + +/* + types and functions for options +*/ + +// isModel +type UpdateLoadBalancerPayloadGetOptionsAttributeType = *LoadBalancerOptions +type UpdateLoadBalancerPayloadGetOptionsArgType = LoadBalancerOptions +type UpdateLoadBalancerPayloadGetOptionsRetType = LoadBalancerOptions + +func getUpdateLoadBalancerPayloadGetOptionsAttributeTypeOk(arg UpdateLoadBalancerPayloadGetOptionsAttributeType) (ret UpdateLoadBalancerPayloadGetOptionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetOptionsAttributeType(arg *UpdateLoadBalancerPayloadGetOptionsAttributeType, val UpdateLoadBalancerPayloadGetOptionsRetType) { + *arg = &val +} + +/* + types and functions for planId +*/ + +// isNotNullableString +type UpdateLoadBalancerPayloadGetPlanIdAttributeType = *string + +func getUpdateLoadBalancerPayloadGetPlanIdAttributeTypeOk(arg UpdateLoadBalancerPayloadGetPlanIdAttributeType) (ret UpdateLoadBalancerPayloadGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetPlanIdAttributeType(arg *UpdateLoadBalancerPayloadGetPlanIdAttributeType, val UpdateLoadBalancerPayloadGetPlanIdRetType) { + *arg = &val +} + +type UpdateLoadBalancerPayloadGetPlanIdArgType = string +type UpdateLoadBalancerPayloadGetPlanIdRetType = string + +/* + types and functions for privateAddress +*/ + +// isNotNullableString +type UpdateLoadBalancerPayloadGetPrivateAddressAttributeType = *string + +func getUpdateLoadBalancerPayloadGetPrivateAddressAttributeTypeOk(arg UpdateLoadBalancerPayloadGetPrivateAddressAttributeType) (ret UpdateLoadBalancerPayloadGetPrivateAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetPrivateAddressAttributeType(arg *UpdateLoadBalancerPayloadGetPrivateAddressAttributeType, val UpdateLoadBalancerPayloadGetPrivateAddressRetType) { + *arg = &val +} + +type UpdateLoadBalancerPayloadGetPrivateAddressArgType = string +type UpdateLoadBalancerPayloadGetPrivateAddressRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type UpdateLoadBalancerPayloadGetRegionAttributeType = *string + +func getUpdateLoadBalancerPayloadGetRegionAttributeTypeOk(arg UpdateLoadBalancerPayloadGetRegionAttributeType) (ret UpdateLoadBalancerPayloadGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetRegionAttributeType(arg *UpdateLoadBalancerPayloadGetRegionAttributeType, val UpdateLoadBalancerPayloadGetRegionRetType) { + *arg = &val +} + +type UpdateLoadBalancerPayloadGetRegionArgType = string +type UpdateLoadBalancerPayloadGetRegionRetType = string + +/* + types and functions for status +*/ + +// isEnum + +// UpdateLoadBalancerPayloadStatus the model 'UpdateLoadBalancerPayload' +// value type for enums +type UpdateLoadBalancerPayloadStatus string + +// List of Status +const ( + UPDATELOADBALANCERPAYLOADSTATUS_UNSPECIFIED UpdateLoadBalancerPayloadStatus = "STATUS_UNSPECIFIED" + UPDATELOADBALANCERPAYLOADSTATUS_PENDING UpdateLoadBalancerPayloadStatus = "STATUS_PENDING" + UPDATELOADBALANCERPAYLOADSTATUS_READY UpdateLoadBalancerPayloadStatus = "STATUS_READY" + UPDATELOADBALANCERPAYLOADSTATUS_ERROR UpdateLoadBalancerPayloadStatus = "STATUS_ERROR" + UPDATELOADBALANCERPAYLOADSTATUS_TERMINATING UpdateLoadBalancerPayloadStatus = "STATUS_TERMINATING" +) + +// All allowed values of UpdateLoadBalancerPayload enum +var AllowedUpdateLoadBalancerPayloadStatusEnumValues = []UpdateLoadBalancerPayloadStatus{ + "STATUS_UNSPECIFIED", + "STATUS_PENDING", + "STATUS_READY", + "STATUS_ERROR", + "STATUS_TERMINATING", +} + +func (v *UpdateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson UpdateLoadBalancerPayloadStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := UpdateLoadBalancerPayloadStatus(value) + for _, existing := range AllowedUpdateLoadBalancerPayloadStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid UpdateLoadBalancerPayload", value) +} + +// NewUpdateLoadBalancerPayloadStatusFromValue returns a pointer to a valid UpdateLoadBalancerPayloadStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUpdateLoadBalancerPayloadStatusFromValue(v UpdateLoadBalancerPayloadStatus) (*UpdateLoadBalancerPayloadStatus, error) { + ev := UpdateLoadBalancerPayloadStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UpdateLoadBalancerPayloadStatus: valid values are %v", v, AllowedUpdateLoadBalancerPayloadStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UpdateLoadBalancerPayloadStatus) IsValid() bool { + for _, existing := range AllowedUpdateLoadBalancerPayloadStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v UpdateLoadBalancerPayloadStatus) Ptr() *UpdateLoadBalancerPayloadStatus { + return &v +} + +type NullableUpdateLoadBalancerPayloadStatus struct { + value *UpdateLoadBalancerPayloadStatus + isSet bool +} + +func (v NullableUpdateLoadBalancerPayloadStatus) Get() *UpdateLoadBalancerPayloadStatus { + return v.value +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) Set(val *UpdateLoadBalancerPayloadStatus) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateLoadBalancerPayloadStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateLoadBalancerPayloadStatus(val *UpdateLoadBalancerPayloadStatus) *NullableUpdateLoadBalancerPayloadStatus { + return &NullableUpdateLoadBalancerPayloadStatus{value: val, isSet: true} +} + +func (v NullableUpdateLoadBalancerPayloadStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateLoadBalancerPayloadStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type UpdateLoadBalancerPayloadGetStatusAttributeType = *UpdateLoadBalancerPayloadStatus +type UpdateLoadBalancerPayloadGetStatusArgType = UpdateLoadBalancerPayloadStatus +type UpdateLoadBalancerPayloadGetStatusRetType = UpdateLoadBalancerPayloadStatus + +func getUpdateLoadBalancerPayloadGetStatusAttributeTypeOk(arg UpdateLoadBalancerPayloadGetStatusAttributeType) (ret UpdateLoadBalancerPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetStatusAttributeType(arg *UpdateLoadBalancerPayloadGetStatusAttributeType, val UpdateLoadBalancerPayloadGetStatusRetType) { + *arg = &val +} + +/* + types and functions for targetPools +*/ + +// isArray +type UpdateLoadBalancerPayloadGetTargetPoolsAttributeType = *[]TargetPool +type UpdateLoadBalancerPayloadGetTargetPoolsArgType = []TargetPool +type UpdateLoadBalancerPayloadGetTargetPoolsRetType = []TargetPool + +func getUpdateLoadBalancerPayloadGetTargetPoolsAttributeTypeOk(arg UpdateLoadBalancerPayloadGetTargetPoolsAttributeType) (ret UpdateLoadBalancerPayloadGetTargetPoolsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetTargetPoolsAttributeType(arg *UpdateLoadBalancerPayloadGetTargetPoolsAttributeType, val UpdateLoadBalancerPayloadGetTargetPoolsRetType) { + *arg = &val +} + +/* + types and functions for targetSecurityGroup +*/ + +// isModel +type UpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType = *CreateLoadBalancerPayloadTargetSecurityGroup +type UpdateLoadBalancerPayloadGetTargetSecurityGroupArgType = CreateLoadBalancerPayloadTargetSecurityGroup +type UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType = CreateLoadBalancerPayloadTargetSecurityGroup + +func getUpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(arg UpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType) (ret UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType(arg *UpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType, val UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + *arg = &val +} + +/* + types and functions for version +*/ + +// isNotNullableString +type UpdateLoadBalancerPayloadGetVersionAttributeType = *string + +func getUpdateLoadBalancerPayloadGetVersionAttributeTypeOk(arg UpdateLoadBalancerPayloadGetVersionAttributeType) (ret UpdateLoadBalancerPayloadGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLoadBalancerPayloadGetVersionAttributeType(arg *UpdateLoadBalancerPayloadGetVersionAttributeType, val UpdateLoadBalancerPayloadGetVersionRetType) { + *arg = &val +} + +type UpdateLoadBalancerPayloadGetVersionArgType = string +type UpdateLoadBalancerPayloadGetVersionRetType = string + +// UpdateLoadBalancerPayload struct for UpdateLoadBalancerPayload +type UpdateLoadBalancerPayload struct { + // Disable target security group assignemt to allow targets outside of the given network. Connectivity to targets need to be ensured by the customer, including routing and Security Groups (targetSecurityGroup can be assigned). Not changeable after creation. + DisableTargetSecurityGroupAssignment UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType `json:"disableTargetSecurityGroupAssignment,omitempty"` + // Reports all errors a application load balancer has. + Errors UpdateLoadBalancerPayloadGetErrorsAttributeType `json:"errors,omitempty"` + // External application load balancer IP address where this application load balancer is exposed. Not changeable after creation. + ExternalAddress UpdateLoadBalancerPayloadGetExternalAddressAttributeType `json:"externalAddress,omitempty"` + // Labels represent user-defined metadata as key-value pairs. Label count should not exceed 64 per ALB. **Key Formatting Rules:** Length: 1-63 characters. Characters: Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. Keys starting with 'stackit-' are system-reserved; users MUST NOT manage them. **Value Formatting Rules:** Length: 0-63 characters (empty string explicitly allowed). Characters (for non-empty values): Must begin and end with [a-zA-Z0-9]. May contain dashes (-), underscores (_), dots (.), and alphanumerics in between. + Labels UpdateLoadBalancerPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // There is a maximum listener count of 20. + Listeners UpdateLoadBalancerPayloadGetListenersAttributeType `json:"listeners,omitempty"` + LoadBalancerSecurityGroup UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType `json:"loadBalancerSecurityGroup,omitempty"` + // Application Load Balancer name. Not changeable after creation. + Name UpdateLoadBalancerPayloadGetNameAttributeType `json:"name,omitempty"` + // List of networks that listeners and targets reside in. Currently limited to one. Not changeable after creation. + Networks UpdateLoadBalancerPayloadGetNetworksAttributeType `json:"networks,omitempty"` + Options UpdateLoadBalancerPayloadGetOptionsAttributeType `json:"options,omitempty"` + // Service Plan configures the size of the Application Load Balancer. Currently supported plans are p10, p50, p250 and p750. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + PlanId UpdateLoadBalancerPayloadGetPlanIdAttributeType `json:"planId,omitempty"` + // Transient private application load balancer IP address that can change any time. + PrivateAddress UpdateLoadBalancerPayloadGetPrivateAddressAttributeType `json:"privateAddress,omitempty"` + // Region of the LoadBalancer. + Region UpdateLoadBalancerPayloadGetRegionAttributeType `json:"region,omitempty"` + Status UpdateLoadBalancerPayloadGetStatusAttributeType `json:"status,omitempty"` + // List of all target pools which will be used in the application load balancer. Limited to 20. + TargetPools UpdateLoadBalancerPayloadGetTargetPoolsAttributeType `json:"targetPools,omitempty"` + TargetSecurityGroup UpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType `json:"targetSecurityGroup,omitempty"` + // Application Load Balancer resource version. Must be empty or unset for creating load balancers, non-empty for updating load balancers. Semantics: While retrieving load balancers, this is the current version of this application load balancer resource that changes during updates of the load balancers. On updates this field specified the application load balancer version you calculated your update for instead of the future version to enable concurrency safe updates. Update calls will then report the new version in their result as you would see with a application load balancer retrieval call later. There exist no total order of the version, so you can only compare it for equality, but not for less/greater than another version. Since the creation of application load balancer is always intended to create the first version of it, there should be no existing version. That's why this field must by empty of not present in that case. + Version UpdateLoadBalancerPayloadGetVersionAttributeType `json:"version,omitempty"` +} + +// NewUpdateLoadBalancerPayload instantiates a new UpdateLoadBalancerPayload 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 NewUpdateLoadBalancerPayload() *UpdateLoadBalancerPayload { + this := UpdateLoadBalancerPayload{} + return &this +} + +// NewUpdateLoadBalancerPayloadWithDefaults instantiates a new UpdateLoadBalancerPayload 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 NewUpdateLoadBalancerPayloadWithDefaults() *UpdateLoadBalancerPayload { + this := UpdateLoadBalancerPayload{} + return &this +} + +// GetDisableTargetSecurityGroupAssignment returns the DisableTargetSecurityGroupAssignment field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetDisableTargetSecurityGroupAssignment() (res UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType) { + res, _ = o.GetDisableTargetSecurityGroupAssignmentOk() + return +} + +// GetDisableTargetSecurityGroupAssignmentOk returns a tuple with the DisableTargetSecurityGroupAssignment field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetDisableTargetSecurityGroupAssignmentOk() (ret UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType, ok bool) { + return getUpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeTypeOk(o.DisableTargetSecurityGroupAssignment) +} + +// HasDisableTargetSecurityGroupAssignment returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasDisableTargetSecurityGroupAssignment() bool { + _, ok := o.GetDisableTargetSecurityGroupAssignmentOk() + return ok +} + +// SetDisableTargetSecurityGroupAssignment gets a reference to the given bool and assigns it to the DisableTargetSecurityGroupAssignment field. +func (o *UpdateLoadBalancerPayload) SetDisableTargetSecurityGroupAssignment(v UpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentRetType) { + setUpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeType(&o.DisableTargetSecurityGroupAssignment, v) +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetErrors() (res UpdateLoadBalancerPayloadGetErrorsRetType) { + res, _ = o.GetErrorsOk() + return +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetErrorsOk() (ret UpdateLoadBalancerPayloadGetErrorsRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetErrorsAttributeTypeOk(o.Errors) +} + +// HasErrors returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasErrors() bool { + _, ok := o.GetErrorsOk() + return ok +} + +// SetErrors gets a reference to the given []LoadBalancerError and assigns it to the Errors field. +func (o *UpdateLoadBalancerPayload) SetErrors(v UpdateLoadBalancerPayloadGetErrorsRetType) { + setUpdateLoadBalancerPayloadGetErrorsAttributeType(&o.Errors, v) +} + +// GetExternalAddress returns the ExternalAddress field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetExternalAddress() (res UpdateLoadBalancerPayloadGetExternalAddressRetType) { + res, _ = o.GetExternalAddressOk() + return +} + +// GetExternalAddressOk returns a tuple with the ExternalAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetExternalAddressOk() (ret UpdateLoadBalancerPayloadGetExternalAddressRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetExternalAddressAttributeTypeOk(o.ExternalAddress) +} + +// HasExternalAddress returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasExternalAddress() bool { + _, ok := o.GetExternalAddressOk() + return ok +} + +// SetExternalAddress gets a reference to the given string and assigns it to the ExternalAddress field. +func (o *UpdateLoadBalancerPayload) SetExternalAddress(v UpdateLoadBalancerPayloadGetExternalAddressRetType) { + setUpdateLoadBalancerPayloadGetExternalAddressAttributeType(&o.ExternalAddress, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetLabels() (res UpdateLoadBalancerPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetLabelsOk() (ret UpdateLoadBalancerPayloadGetLabelsRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateLoadBalancerPayload) SetLabels(v UpdateLoadBalancerPayloadGetLabelsRetType) { + setUpdateLoadBalancerPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetListeners returns the Listeners field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetListeners() (res UpdateLoadBalancerPayloadGetListenersRetType) { + res, _ = o.GetListenersOk() + return +} + +// GetListenersOk returns a tuple with the Listeners field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetListenersOk() (ret UpdateLoadBalancerPayloadGetListenersRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetListenersAttributeTypeOk(o.Listeners) +} + +// HasListeners returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasListeners() bool { + _, ok := o.GetListenersOk() + return ok +} + +// SetListeners gets a reference to the given []Listener and assigns it to the Listeners field. +func (o *UpdateLoadBalancerPayload) SetListeners(v UpdateLoadBalancerPayloadGetListenersRetType) { + setUpdateLoadBalancerPayloadGetListenersAttributeType(&o.Listeners, v) +} + +// GetLoadBalancerSecurityGroup returns the LoadBalancerSecurityGroup field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetLoadBalancerSecurityGroup() (res UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType) { + res, _ = o.GetLoadBalancerSecurityGroupOk() + return +} + +// GetLoadBalancerSecurityGroupOk returns a tuple with the LoadBalancerSecurityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetLoadBalancerSecurityGroupOk() (ret UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeTypeOk(o.LoadBalancerSecurityGroup) +} + +// HasLoadBalancerSecurityGroup returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasLoadBalancerSecurityGroup() bool { + _, ok := o.GetLoadBalancerSecurityGroupOk() + return ok +} + +// SetLoadBalancerSecurityGroup gets a reference to the given CreateLoadBalancerPayloadLoadBalancerSecurityGroup and assigns it to the LoadBalancerSecurityGroup field. +func (o *UpdateLoadBalancerPayload) SetLoadBalancerSecurityGroup(v UpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupRetType) { + setUpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeType(&o.LoadBalancerSecurityGroup, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetName() (res UpdateLoadBalancerPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetNameOk() (ret UpdateLoadBalancerPayloadGetNameRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateLoadBalancerPayload) SetName(v UpdateLoadBalancerPayloadGetNameRetType) { + setUpdateLoadBalancerPayloadGetNameAttributeType(&o.Name, v) +} + +// GetNetworks returns the Networks field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetNetworks() (res UpdateLoadBalancerPayloadGetNetworksRetType) { + res, _ = o.GetNetworksOk() + return +} + +// GetNetworksOk returns a tuple with the Networks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetNetworksOk() (ret UpdateLoadBalancerPayloadGetNetworksRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetNetworksAttributeTypeOk(o.Networks) +} + +// HasNetworks returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasNetworks() bool { + _, ok := o.GetNetworksOk() + return ok +} + +// SetNetworks gets a reference to the given []Network and assigns it to the Networks field. +func (o *UpdateLoadBalancerPayload) SetNetworks(v UpdateLoadBalancerPayloadGetNetworksRetType) { + setUpdateLoadBalancerPayloadGetNetworksAttributeType(&o.Networks, v) +} + +// GetOptions returns the Options field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetOptions() (res UpdateLoadBalancerPayloadGetOptionsRetType) { + res, _ = o.GetOptionsOk() + return +} + +// GetOptionsOk returns a tuple with the Options field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetOptionsOk() (ret UpdateLoadBalancerPayloadGetOptionsRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetOptionsAttributeTypeOk(o.Options) +} + +// HasOptions returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasOptions() bool { + _, ok := o.GetOptionsOk() + return ok +} + +// SetOptions gets a reference to the given LoadBalancerOptions and assigns it to the Options field. +func (o *UpdateLoadBalancerPayload) SetOptions(v UpdateLoadBalancerPayloadGetOptionsRetType) { + setUpdateLoadBalancerPayloadGetOptionsAttributeType(&o.Options, v) +} + +// GetPlanId returns the PlanId field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetPlanId() (res UpdateLoadBalancerPayloadGetPlanIdRetType) { + res, _ = o.GetPlanIdOk() + return +} + +// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetPlanIdOk() (ret UpdateLoadBalancerPayloadGetPlanIdRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetPlanIdAttributeTypeOk(o.PlanId) +} + +// HasPlanId returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasPlanId() bool { + _, ok := o.GetPlanIdOk() + return ok +} + +// SetPlanId gets a reference to the given string and assigns it to the PlanId field. +func (o *UpdateLoadBalancerPayload) SetPlanId(v UpdateLoadBalancerPayloadGetPlanIdRetType) { + setUpdateLoadBalancerPayloadGetPlanIdAttributeType(&o.PlanId, v) +} + +// GetPrivateAddress returns the PrivateAddress field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetPrivateAddress() (res UpdateLoadBalancerPayloadGetPrivateAddressRetType) { + res, _ = o.GetPrivateAddressOk() + return +} + +// GetPrivateAddressOk returns a tuple with the PrivateAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetPrivateAddressOk() (ret UpdateLoadBalancerPayloadGetPrivateAddressRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetPrivateAddressAttributeTypeOk(o.PrivateAddress) +} + +// HasPrivateAddress returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasPrivateAddress() bool { + _, ok := o.GetPrivateAddressOk() + return ok +} + +// SetPrivateAddress gets a reference to the given string and assigns it to the PrivateAddress field. +func (o *UpdateLoadBalancerPayload) SetPrivateAddress(v UpdateLoadBalancerPayloadGetPrivateAddressRetType) { + setUpdateLoadBalancerPayloadGetPrivateAddressAttributeType(&o.PrivateAddress, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetRegion() (res UpdateLoadBalancerPayloadGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetRegionOk() (ret UpdateLoadBalancerPayloadGetRegionRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *UpdateLoadBalancerPayload) SetRegion(v UpdateLoadBalancerPayloadGetRegionRetType) { + setUpdateLoadBalancerPayloadGetRegionAttributeType(&o.Region, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetStatus() (res UpdateLoadBalancerPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetStatusOk() (ret UpdateLoadBalancerPayloadGetStatusRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *UpdateLoadBalancerPayload) SetStatus(v UpdateLoadBalancerPayloadGetStatusRetType) { + setUpdateLoadBalancerPayloadGetStatusAttributeType(&o.Status, v) +} + +// GetTargetPools returns the TargetPools field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetTargetPools() (res UpdateLoadBalancerPayloadGetTargetPoolsRetType) { + res, _ = o.GetTargetPoolsOk() + return +} + +// GetTargetPoolsOk returns a tuple with the TargetPools field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetTargetPoolsOk() (ret UpdateLoadBalancerPayloadGetTargetPoolsRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetTargetPoolsAttributeTypeOk(o.TargetPools) +} + +// HasTargetPools returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasTargetPools() bool { + _, ok := o.GetTargetPoolsOk() + return ok +} + +// SetTargetPools gets a reference to the given []TargetPool and assigns it to the TargetPools field. +func (o *UpdateLoadBalancerPayload) SetTargetPools(v UpdateLoadBalancerPayloadGetTargetPoolsRetType) { + setUpdateLoadBalancerPayloadGetTargetPoolsAttributeType(&o.TargetPools, v) +} + +// GetTargetSecurityGroup returns the TargetSecurityGroup field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetTargetSecurityGroup() (res UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + res, _ = o.GetTargetSecurityGroupOk() + return +} + +// GetTargetSecurityGroupOk returns a tuple with the TargetSecurityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetTargetSecurityGroupOk() (ret UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup) +} + +// HasTargetSecurityGroup returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasTargetSecurityGroup() bool { + _, ok := o.GetTargetSecurityGroupOk() + return ok +} + +// SetTargetSecurityGroup gets a reference to the given CreateLoadBalancerPayloadTargetSecurityGroup and assigns it to the TargetSecurityGroup field. +func (o *UpdateLoadBalancerPayload) SetTargetSecurityGroup(v UpdateLoadBalancerPayloadGetTargetSecurityGroupRetType) { + setUpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeType(&o.TargetSecurityGroup, v) +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *UpdateLoadBalancerPayload) GetVersion() (res UpdateLoadBalancerPayloadGetVersionRetType) { + res, _ = o.GetVersionOk() + return +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLoadBalancerPayload) GetVersionOk() (ret UpdateLoadBalancerPayloadGetVersionRetType, ok bool) { + return getUpdateLoadBalancerPayloadGetVersionAttributeTypeOk(o.Version) +} + +// HasVersion returns a boolean if a field has been set. +func (o *UpdateLoadBalancerPayload) HasVersion() bool { + _, ok := o.GetVersionOk() + return ok +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *UpdateLoadBalancerPayload) SetVersion(v UpdateLoadBalancerPayloadGetVersionRetType) { + setUpdateLoadBalancerPayloadGetVersionAttributeType(&o.Version, v) +} + +func (o UpdateLoadBalancerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateLoadBalancerPayloadgetDisableTargetSecurityGroupAssignmentAttributeTypeOk(o.DisableTargetSecurityGroupAssignment); ok { + toSerialize["DisableTargetSecurityGroupAssignment"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetErrorsAttributeTypeOk(o.Errors); ok { + toSerialize["Errors"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetExternalAddressAttributeTypeOk(o.ExternalAddress); ok { + toSerialize["ExternalAddress"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetListenersAttributeTypeOk(o.Listeners); ok { + toSerialize["Listeners"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetLoadBalancerSecurityGroupAttributeTypeOk(o.LoadBalancerSecurityGroup); ok { + toSerialize["LoadBalancerSecurityGroup"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetNetworksAttributeTypeOk(o.Networks); ok { + toSerialize["Networks"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetOptionsAttributeTypeOk(o.Options); ok { + toSerialize["Options"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetPrivateAddressAttributeTypeOk(o.PrivateAddress); ok { + toSerialize["PrivateAddress"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetTargetPoolsAttributeTypeOk(o.TargetPools); ok { + toSerialize["TargetPools"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetTargetSecurityGroupAttributeTypeOk(o.TargetSecurityGroup); ok { + toSerialize["TargetSecurityGroup"] = val + } + if val, ok := getUpdateLoadBalancerPayloadGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +type NullableUpdateLoadBalancerPayload struct { + value *UpdateLoadBalancerPayload + isSet bool +} + +func (v NullableUpdateLoadBalancerPayload) Get() *UpdateLoadBalancerPayload { + return v.value +} + +func (v *NullableUpdateLoadBalancerPayload) Set(val *UpdateLoadBalancerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateLoadBalancerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateLoadBalancerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateLoadBalancerPayload(val *UpdateLoadBalancerPayload) *NullableUpdateLoadBalancerPayload { + return &NullableUpdateLoadBalancerPayload{value: val, isSet: true} +} + +func (v NullableUpdateLoadBalancerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateLoadBalancerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_update_load_balancer_payload_test.go b/pkg/albbeta/model_update_load_balancer_payload_test.go new file mode 100644 index 00000000..e8b2a684 --- /dev/null +++ b/pkg/albbeta/model_update_load_balancer_payload_test.go @@ -0,0 +1,79 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "testing" +) + +// isEnum + +func TestUpdateLoadBalancerPayloadStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"STATUS_UNSPECIFIED"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"STATUS_PENDING"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"STATUS_READY"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"STATUS_ERROR"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 5`, + args: args{ + src: []byte(`"STATUS_TERMINATING"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := UpdateLoadBalancerPayloadStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/albbeta/model_update_target_pool_payload.go b/pkg/albbeta/model_update_target_pool_payload.go new file mode 100644 index 00000000..f8bcb539 --- /dev/null +++ b/pkg/albbeta/model_update_target_pool_payload.go @@ -0,0 +1,320 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" +) + +// checks if the UpdateTargetPoolPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateTargetPoolPayload{} + +/* + types and functions for activeHealthCheck +*/ + +// isModel +type UpdateTargetPoolPayloadGetActiveHealthCheckAttributeType = *ActiveHealthCheck +type UpdateTargetPoolPayloadGetActiveHealthCheckArgType = ActiveHealthCheck +type UpdateTargetPoolPayloadGetActiveHealthCheckRetType = ActiveHealthCheck + +func getUpdateTargetPoolPayloadGetActiveHealthCheckAttributeTypeOk(arg UpdateTargetPoolPayloadGetActiveHealthCheckAttributeType) (ret UpdateTargetPoolPayloadGetActiveHealthCheckRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateTargetPoolPayloadGetActiveHealthCheckAttributeType(arg *UpdateTargetPoolPayloadGetActiveHealthCheckAttributeType, val UpdateTargetPoolPayloadGetActiveHealthCheckRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateTargetPoolPayloadGetNameAttributeType = *string + +func getUpdateTargetPoolPayloadGetNameAttributeTypeOk(arg UpdateTargetPoolPayloadGetNameAttributeType) (ret UpdateTargetPoolPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateTargetPoolPayloadGetNameAttributeType(arg *UpdateTargetPoolPayloadGetNameAttributeType, val UpdateTargetPoolPayloadGetNameRetType) { + *arg = &val +} + +type UpdateTargetPoolPayloadGetNameArgType = string +type UpdateTargetPoolPayloadGetNameRetType = string + +/* + types and functions for targetPort +*/ + +// isInteger +type UpdateTargetPoolPayloadGetTargetPortAttributeType = *int64 +type UpdateTargetPoolPayloadGetTargetPortArgType = int64 +type UpdateTargetPoolPayloadGetTargetPortRetType = int64 + +func getUpdateTargetPoolPayloadGetTargetPortAttributeTypeOk(arg UpdateTargetPoolPayloadGetTargetPortAttributeType) (ret UpdateTargetPoolPayloadGetTargetPortRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateTargetPoolPayloadGetTargetPortAttributeType(arg *UpdateTargetPoolPayloadGetTargetPortAttributeType, val UpdateTargetPoolPayloadGetTargetPortRetType) { + *arg = &val +} + +/* + types and functions for targets +*/ + +// isArray +type UpdateTargetPoolPayloadGetTargetsAttributeType = *[]Target +type UpdateTargetPoolPayloadGetTargetsArgType = []Target +type UpdateTargetPoolPayloadGetTargetsRetType = []Target + +func getUpdateTargetPoolPayloadGetTargetsAttributeTypeOk(arg UpdateTargetPoolPayloadGetTargetsAttributeType) (ret UpdateTargetPoolPayloadGetTargetsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateTargetPoolPayloadGetTargetsAttributeType(arg *UpdateTargetPoolPayloadGetTargetsAttributeType, val UpdateTargetPoolPayloadGetTargetsRetType) { + *arg = &val +} + +/* + types and functions for tlsConfig +*/ + +// isModel +type UpdateTargetPoolPayloadGetTlsConfigAttributeType = *TargetPoolTlsConfig +type UpdateTargetPoolPayloadGetTlsConfigArgType = TargetPoolTlsConfig +type UpdateTargetPoolPayloadGetTlsConfigRetType = TargetPoolTlsConfig + +func getUpdateTargetPoolPayloadGetTlsConfigAttributeTypeOk(arg UpdateTargetPoolPayloadGetTlsConfigAttributeType) (ret UpdateTargetPoolPayloadGetTlsConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateTargetPoolPayloadGetTlsConfigAttributeType(arg *UpdateTargetPoolPayloadGetTlsConfigAttributeType, val UpdateTargetPoolPayloadGetTlsConfigRetType) { + *arg = &val +} + +// UpdateTargetPoolPayload struct for UpdateTargetPoolPayload +type UpdateTargetPoolPayload struct { + ActiveHealthCheck UpdateTargetPoolPayloadGetActiveHealthCheckAttributeType `json:"activeHealthCheck,omitempty"` + // Target pool name + Name UpdateTargetPoolPayloadGetNameAttributeType `json:"name,omitempty"` + // The number identifying the port where each target listens for traffic. + // Can be cast to int32 without loss of precision. + TargetPort UpdateTargetPoolPayloadGetTargetPortAttributeType `json:"targetPort,omitempty"` + // List of all targets which will be used in the pool. Limited to 250. + Targets UpdateTargetPoolPayloadGetTargetsAttributeType `json:"targets,omitempty"` + TlsConfig UpdateTargetPoolPayloadGetTlsConfigAttributeType `json:"tlsConfig,omitempty"` +} + +// NewUpdateTargetPoolPayload instantiates a new UpdateTargetPoolPayload 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 NewUpdateTargetPoolPayload() *UpdateTargetPoolPayload { + this := UpdateTargetPoolPayload{} + return &this +} + +// NewUpdateTargetPoolPayloadWithDefaults instantiates a new UpdateTargetPoolPayload 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 NewUpdateTargetPoolPayloadWithDefaults() *UpdateTargetPoolPayload { + this := UpdateTargetPoolPayload{} + return &this +} + +// GetActiveHealthCheck returns the ActiveHealthCheck field value if set, zero value otherwise. +func (o *UpdateTargetPoolPayload) GetActiveHealthCheck() (res UpdateTargetPoolPayloadGetActiveHealthCheckRetType) { + res, _ = o.GetActiveHealthCheckOk() + return +} + +// GetActiveHealthCheckOk returns a tuple with the ActiveHealthCheck field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTargetPoolPayload) GetActiveHealthCheckOk() (ret UpdateTargetPoolPayloadGetActiveHealthCheckRetType, ok bool) { + return getUpdateTargetPoolPayloadGetActiveHealthCheckAttributeTypeOk(o.ActiveHealthCheck) +} + +// HasActiveHealthCheck returns a boolean if a field has been set. +func (o *UpdateTargetPoolPayload) HasActiveHealthCheck() bool { + _, ok := o.GetActiveHealthCheckOk() + return ok +} + +// SetActiveHealthCheck gets a reference to the given ActiveHealthCheck and assigns it to the ActiveHealthCheck field. +func (o *UpdateTargetPoolPayload) SetActiveHealthCheck(v UpdateTargetPoolPayloadGetActiveHealthCheckRetType) { + setUpdateTargetPoolPayloadGetActiveHealthCheckAttributeType(&o.ActiveHealthCheck, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateTargetPoolPayload) GetName() (res UpdateTargetPoolPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTargetPoolPayload) GetNameOk() (ret UpdateTargetPoolPayloadGetNameRetType, ok bool) { + return getUpdateTargetPoolPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateTargetPoolPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateTargetPoolPayload) SetName(v UpdateTargetPoolPayloadGetNameRetType) { + setUpdateTargetPoolPayloadGetNameAttributeType(&o.Name, v) +} + +// GetTargetPort returns the TargetPort field value if set, zero value otherwise. +func (o *UpdateTargetPoolPayload) GetTargetPort() (res UpdateTargetPoolPayloadGetTargetPortRetType) { + res, _ = o.GetTargetPortOk() + return +} + +// GetTargetPortOk returns a tuple with the TargetPort field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTargetPoolPayload) GetTargetPortOk() (ret UpdateTargetPoolPayloadGetTargetPortRetType, ok bool) { + return getUpdateTargetPoolPayloadGetTargetPortAttributeTypeOk(o.TargetPort) +} + +// HasTargetPort returns a boolean if a field has been set. +func (o *UpdateTargetPoolPayload) HasTargetPort() bool { + _, ok := o.GetTargetPortOk() + return ok +} + +// SetTargetPort gets a reference to the given int64 and assigns it to the TargetPort field. +func (o *UpdateTargetPoolPayload) SetTargetPort(v UpdateTargetPoolPayloadGetTargetPortRetType) { + setUpdateTargetPoolPayloadGetTargetPortAttributeType(&o.TargetPort, v) +} + +// GetTargets returns the Targets field value if set, zero value otherwise. +func (o *UpdateTargetPoolPayload) GetTargets() (res UpdateTargetPoolPayloadGetTargetsRetType) { + res, _ = o.GetTargetsOk() + return +} + +// GetTargetsOk returns a tuple with the Targets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTargetPoolPayload) GetTargetsOk() (ret UpdateTargetPoolPayloadGetTargetsRetType, ok bool) { + return getUpdateTargetPoolPayloadGetTargetsAttributeTypeOk(o.Targets) +} + +// HasTargets returns a boolean if a field has been set. +func (o *UpdateTargetPoolPayload) HasTargets() bool { + _, ok := o.GetTargetsOk() + return ok +} + +// SetTargets gets a reference to the given []Target and assigns it to the Targets field. +func (o *UpdateTargetPoolPayload) SetTargets(v UpdateTargetPoolPayloadGetTargetsRetType) { + setUpdateTargetPoolPayloadGetTargetsAttributeType(&o.Targets, v) +} + +// GetTlsConfig returns the TlsConfig field value if set, zero value otherwise. +func (o *UpdateTargetPoolPayload) GetTlsConfig() (res UpdateTargetPoolPayloadGetTlsConfigRetType) { + res, _ = o.GetTlsConfigOk() + return +} + +// GetTlsConfigOk returns a tuple with the TlsConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateTargetPoolPayload) GetTlsConfigOk() (ret UpdateTargetPoolPayloadGetTlsConfigRetType, ok bool) { + return getUpdateTargetPoolPayloadGetTlsConfigAttributeTypeOk(o.TlsConfig) +} + +// HasTlsConfig returns a boolean if a field has been set. +func (o *UpdateTargetPoolPayload) HasTlsConfig() bool { + _, ok := o.GetTlsConfigOk() + return ok +} + +// SetTlsConfig gets a reference to the given TargetPoolTlsConfig and assigns it to the TlsConfig field. +func (o *UpdateTargetPoolPayload) SetTlsConfig(v UpdateTargetPoolPayloadGetTlsConfigRetType) { + setUpdateTargetPoolPayloadGetTlsConfigAttributeType(&o.TlsConfig, v) +} + +func (o UpdateTargetPoolPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateTargetPoolPayloadGetActiveHealthCheckAttributeTypeOk(o.ActiveHealthCheck); ok { + toSerialize["ActiveHealthCheck"] = val + } + if val, ok := getUpdateTargetPoolPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateTargetPoolPayloadGetTargetPortAttributeTypeOk(o.TargetPort); ok { + toSerialize["TargetPort"] = val + } + if val, ok := getUpdateTargetPoolPayloadGetTargetsAttributeTypeOk(o.Targets); ok { + toSerialize["Targets"] = val + } + if val, ok := getUpdateTargetPoolPayloadGetTlsConfigAttributeTypeOk(o.TlsConfig); ok { + toSerialize["TlsConfig"] = val + } + return toSerialize, nil +} + +type NullableUpdateTargetPoolPayload struct { + value *UpdateTargetPoolPayload + isSet bool +} + +func (v NullableUpdateTargetPoolPayload) Get() *UpdateTargetPoolPayload { + return v.value +} + +func (v *NullableUpdateTargetPoolPayload) Set(val *UpdateTargetPoolPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateTargetPoolPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateTargetPoolPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateTargetPoolPayload(val *UpdateTargetPoolPayload) *NullableUpdateTargetPoolPayload { + return &NullableUpdateTargetPoolPayload{value: val, isSet: true} +} + +func (v NullableUpdateTargetPoolPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateTargetPoolPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albbeta/model_update_target_pool_payload_test.go b/pkg/albbeta/model_update_target_pool_payload_test.go new file mode 100644 index 00000000..29bd360c --- /dev/null +++ b/pkg/albbeta/model_update_target_pool_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta diff --git a/pkg/albbeta/utils.go b/pkg/albbeta/utils.go new file mode 100644 index 00000000..14781b08 --- /dev/null +++ b/pkg/albbeta/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT Application Load Balancer API + +### DEPRECATED! This API offers an interface to provision and manage load balancing servers in your STACKIT project. It also has the possibility of pooling target servers for load balancing purposes. For each application load balancer provided, two VMs are deployed in your OpenStack project subject to a fee. + +API version: 2beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albbeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/albwafalpha/.openapi-generator/VERSION b/pkg/albwafalpha/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/albwafalpha/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/albwafalpha/api_default.go b/pkg/albwafalpha/api_default.go new file mode 100644 index 00000000..11c66166 --- /dev/null +++ b/pkg/albwafalpha/api_default.go @@ -0,0 +1,2778 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateCoreRuleSet Create a CRS configuration + With this endpoint a core rule set (CRS) configuration is created and stored in this project. Currently it is only possible to enable it. This rule configuration is supposed to be referenced by a WAF configuration. It can be referenced by any number of WAF configurations in the same project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateCoreRuleSetRequest + */ + CreateCoreRuleSet(ctx context.Context, projectId string, region string) ApiCreateCoreRuleSetRequest + /* + CreateCoreRuleSetExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return CreateCoreRuleSetResponse + + */ + CreateCoreRuleSetExecute(ctx context.Context, projectId string, region string) (*CreateCoreRuleSetResponse, error) + /* + CreateRules Create a rule configuration + With this endpoint a rule configuration is created and stored in this project. The rules are written in Seclang. This rule configuration is supposed to be referenced by a WAF configuration. It can be referenced by any number of WAF configurations in the same project. There is a limit of 1 MB of data on these rules. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateRulesRequest + */ + CreateRules(ctx context.Context, projectId string, region string) ApiCreateRulesRequest + /* + CreateRulesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return CreateRulesResponse + + */ + CreateRulesExecute(ctx context.Context, projectId string, region string) (*CreateRulesResponse, error) + /* + CreateWAF Create a WAF configuration + This endpoint will create and store a WAF configuration in a project. The name of this WAF configuration is supposed to be used in the listener of an Application Load Balancer, which will activate this configuration and in addition it is possible to enable the core rule set. This WAF configuration can be used by any number of Application Load Balancers in the same project. The configuration has a reference to a rule configuration. This rule configuration has to exist when trying to create a WAF configuration. Later other configuration references will be added to this object. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateWAFRequest + */ + CreateWAF(ctx context.Context, projectId string, region string) ApiCreateWAFRequest + /* + CreateWAFExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return CreateWAFResponse + + */ + CreateWAFExecute(ctx context.Context, projectId string, region string) (*CreateWAFResponse, error) + /* + DeleteCoreRuleSet Delete a CRS configuration + To delete a core rule set (CRS) configuration this endpoint is used, but it is only possible to delete it if no WAF configuration is referencing it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiDeleteCoreRuleSetRequest + */ + DeleteCoreRuleSet(ctx context.Context, projectId string, region string, name string) ApiDeleteCoreRuleSetRequest + /* + DeleteCoreRuleSetExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return map[string]interface{} + + */ + DeleteCoreRuleSetExecute(ctx context.Context, projectId string, region string, name string) (map[string]interface{}, error) + /* + DeleteRules Delete a rule configuration + To delete a rule configuration this endpoint is used, but it is only possible to delete it if no WAF configuration is referencing it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiDeleteRulesRequest + */ + DeleteRules(ctx context.Context, projectId string, region string, name string) ApiDeleteRulesRequest + /* + DeleteRulesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return map[string]interface{} + + */ + DeleteRulesExecute(ctx context.Context, projectId string, region string, name string) (map[string]interface{}, error) + /* + DeleteWAF Delete a WAF configuration + This will delete the specified WAF configuration, but only if it is not used by any Application Load Balancer in the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiDeleteWAFRequest + */ + DeleteWAF(ctx context.Context, projectId string, region string, name string) ApiDeleteWAFRequest + /* + DeleteWAFExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return map[string]interface{} + + */ + DeleteWAFExecute(ctx context.Context, projectId string, region string, name string) (map[string]interface{}, error) + /* + GetCoreRuleSet Retrieve a CRS configuration + To retrieve an existing core rule set (CRS) configuration this endpoint can be used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiGetCoreRuleSetRequest + */ + GetCoreRuleSet(ctx context.Context, projectId string, region string, name string) ApiGetCoreRuleSetRequest + /* + GetCoreRuleSetExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return GetCoreRuleSetResponse + + */ + GetCoreRuleSetExecute(ctx context.Context, projectId string, region string, name string) (*GetCoreRuleSetResponse, error) + /* + GetRules Retrieve a rule configuration + To retrieve an existing rule configuration this endpoint can be used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiGetRulesRequest + */ + GetRules(ctx context.Context, projectId string, region string, name string) ApiGetRulesRequest + /* + GetRulesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return GetRulesResponse + + */ + GetRulesExecute(ctx context.Context, projectId string, region string, name string) (*GetRulesResponse, error) + /* + GetWAF Retrieve a WAF configuration + This endpoint will return the specified WAF configuration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiGetWAFRequest + */ + GetWAF(ctx context.Context, projectId string, region string, name string) ApiGetWAFRequest + /* + GetWAFExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return GetWAFResponse + + */ + GetWAFExecute(ctx context.Context, projectId string, region string, name string) (*GetWAFResponse, error) + /* + ListCoreRuleSets List of CRS configurations + List all existing core rule set (CRS) configurations that are stored in the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListCoreRuleSetsRequest + */ + ListCoreRuleSets(ctx context.Context, projectId string, region string) ApiListCoreRuleSetsRequest + /* + ListCoreRuleSetsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ListCoreRuleSetResponse + + */ + ListCoreRuleSetsExecute(ctx context.Context, projectId string, region string) (*ListCoreRuleSetResponse, error) + /* + ListRules List of rule configurations + List all existing rule configurations that are stored in the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListRulesRequest + */ + ListRules(ctx context.Context, projectId string, region string) ApiListRulesRequest + /* + ListRulesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ListRulesResponse + + */ + ListRulesExecute(ctx context.Context, projectId string, region string) (*ListRulesResponse, error) + /* + ListWAF List of WAF configurations + To list all WAF configurations stored in a project, use this endpoint. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListWAFRequest + */ + ListWAF(ctx context.Context, projectId string, region string) ApiListWAFRequest + /* + ListWAFExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ListWAFResponse + + */ + ListWAFExecute(ctx context.Context, projectId string, region string) (*ListWAFResponse, error) + /* + UpdateCoreRuleSet Update a CRS configuration + This endpoint will update an existing core rule set (CRS) configuration and also inturn update all WAF configurations that reference it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiUpdateCoreRuleSetRequest + */ + UpdateCoreRuleSet(ctx context.Context, projectId string, region string, name string) ApiUpdateCoreRuleSetRequest + /* + UpdateCoreRuleSetExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return UpdateCoreRuleSetResponse + + */ + UpdateCoreRuleSetExecute(ctx context.Context, projectId string, region string, name string) (*UpdateCoreRuleSetResponse, error) + /* + UpdateRules Update a rule configuration + This endpoint will update an existing rules configuration and also inturn update all WAF configurations that reference it. There is a limit of 1 MB of data on these rules. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiUpdateRulesRequest + */ + UpdateRules(ctx context.Context, projectId string, region string, name string) ApiUpdateRulesRequest + /* + UpdateRulesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return UpdateRulesResponse + + */ + UpdateRulesExecute(ctx context.Context, projectId string, region string, name string) (*UpdateRulesResponse, error) + /* + UpdateWAF Update a WAF configuration + The update endpoint will update a stored WAF configuration in project and not yet but later will also update the Load Balancers that reference it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiUpdateWAFRequest + */ + UpdateWAF(ctx context.Context, projectId string, region string, name string) ApiUpdateWAFRequest + /* + UpdateWAFExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return UpdateWAFResponse + + */ + UpdateWAFExecute(ctx context.Context, projectId string, region string, name string) (*UpdateWAFResponse, error) +} + +type ApiCreateCoreRuleSetRequest interface { + CreateCoreRuleSetPayload(createCoreRuleSetPayload CreateCoreRuleSetPayload) ApiCreateCoreRuleSetRequest + Execute() (*CreateCoreRuleSetResponse, error) +} + +type ApiCreateRulesRequest interface { + CreateRulesPayload(createRulesPayload CreateRulesPayload) ApiCreateRulesRequest + Execute() (*CreateRulesResponse, error) +} + +type ApiCreateWAFRequest interface { + CreateWAFPayload(createWAFPayload CreateWAFPayload) ApiCreateWAFRequest + Execute() (*CreateWAFResponse, error) +} + +type ApiDeleteCoreRuleSetRequest interface { + Execute() (map[string]interface{}, error) +} + +type ApiDeleteRulesRequest interface { + Execute() (map[string]interface{}, error) +} + +type ApiDeleteWAFRequest interface { + Execute() (map[string]interface{}, error) +} + +type ApiGetCoreRuleSetRequest interface { + Execute() (*GetCoreRuleSetResponse, error) +} + +type ApiGetRulesRequest interface { + Execute() (*GetRulesResponse, error) +} + +type ApiGetWAFRequest interface { + Execute() (*GetWAFResponse, error) +} + +type ApiListCoreRuleSetsRequest interface { + // page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000 + PageSize(pageSize string) ApiListCoreRuleSetsRequest + // page_id is a page identifier returned by the previous response and is used to request the next page + PageId(pageId string) ApiListCoreRuleSetsRequest + Execute() (*ListCoreRuleSetResponse, error) +} + +type ApiListRulesRequest interface { + // page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000 + PageSize(pageSize string) ApiListRulesRequest + // page_id is a page identifier returned by the previous response and is used to request the next page + PageId(pageId string) ApiListRulesRequest + Execute() (*ListRulesResponse, error) +} + +type ApiListWAFRequest interface { + // page_size specifies how many WAFs should be returned on this page. Must be a positive number <= 1000 + PageSize(pageSize string) ApiListWAFRequest + // page_id is a page identifier returned by the previous response and is used to request the next page + PageId(pageId string) ApiListWAFRequest + Execute() (*ListWAFResponse, error) +} + +type ApiUpdateCoreRuleSetRequest interface { + UpdateCoreRuleSetPayload(updateCoreRuleSetPayload UpdateCoreRuleSetPayload) ApiUpdateCoreRuleSetRequest + Execute() (*UpdateCoreRuleSetResponse, error) +} + +type ApiUpdateRulesRequest interface { + UpdateRulesPayload(updateRulesPayload UpdateRulesPayload) ApiUpdateRulesRequest + Execute() (*UpdateRulesResponse, error) +} + +type ApiUpdateWAFRequest interface { + UpdateWAFPayload(updateWAFPayload UpdateWAFPayload) ApiUpdateWAFRequest + Execute() (*UpdateWAFResponse, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateCoreRuleSetRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createCoreRuleSetPayload *CreateCoreRuleSetPayload +} + +func (r CreateCoreRuleSetRequest) CreateCoreRuleSetPayload(createCoreRuleSetPayload CreateCoreRuleSetPayload) ApiCreateCoreRuleSetRequest { + r.createCoreRuleSetPayload = &createCoreRuleSetPayload + return r +} + +func (r CreateCoreRuleSetRequest) Execute() (*CreateCoreRuleSetResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateCoreRuleSetResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateCoreRuleSet") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/core-rule-sets" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createCoreRuleSetPayload == nil { + return localVarReturnValue, fmt.Errorf("createCoreRuleSetPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createCoreRuleSetPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateCoreRuleSet: Create a CRS configuration + +With this endpoint a core rule set (CRS) configuration is created and stored in this project. Currently it is only possible to enable it. This rule configuration is supposed to be referenced by a WAF configuration. It can be referenced by any number of WAF configurations in the same project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateCoreRuleSetRequest +*/ +func (a *APIClient) CreateCoreRuleSet(ctx context.Context, projectId string, region string) ApiCreateCoreRuleSetRequest { + return CreateCoreRuleSetRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateCoreRuleSetExecute(ctx context.Context, projectId string, region string) (*CreateCoreRuleSetResponse, error) { + r := CreateCoreRuleSetRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateRulesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createRulesPayload *CreateRulesPayload +} + +func (r CreateRulesRequest) CreateRulesPayload(createRulesPayload CreateRulesPayload) ApiCreateRulesRequest { + r.createRulesPayload = &createRulesPayload + return r +} + +func (r CreateRulesRequest) Execute() (*CreateRulesResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateRulesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateRules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createRulesPayload == nil { + return localVarReturnValue, fmt.Errorf("createRulesPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createRulesPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateRules: Create a rule configuration + +With this endpoint a rule configuration is created and stored in this project. The rules are written in Seclang. This rule configuration is supposed to be referenced by a WAF configuration. It can be referenced by any number of WAF configurations in the same project. There is a limit of 1 MB of data on these rules. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateRulesRequest +*/ +func (a *APIClient) CreateRules(ctx context.Context, projectId string, region string) ApiCreateRulesRequest { + return CreateRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateRulesExecute(ctx context.Context, projectId string, region string) (*CreateRulesResponse, error) { + r := CreateRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateWAFRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createWAFPayload *CreateWAFPayload +} + +func (r CreateWAFRequest) CreateWAFPayload(createWAFPayload CreateWAFPayload) ApiCreateWAFRequest { + r.createWAFPayload = &createWAFPayload + return r +} + +func (r CreateWAFRequest) Execute() (*CreateWAFResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateWAFResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateWAF") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/wafs" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createWAFPayload == nil { + return localVarReturnValue, fmt.Errorf("createWAFPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createWAFPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateWAF: Create a WAF configuration + +This endpoint will create and store a WAF configuration in a project. The name of this WAF configuration is supposed to be used in the listener of an Application Load Balancer, which will activate this configuration and in addition it is possible to enable the core rule set. This WAF configuration can be used by any number of Application Load Balancers in the same project. The configuration has a reference to a rule configuration. This rule configuration has to exist when trying to create a WAF configuration. Later other configuration references will be added to this object. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateWAFRequest +*/ +func (a *APIClient) CreateWAF(ctx context.Context, projectId string, region string) ApiCreateWAFRequest { + return CreateWAFRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateWAFExecute(ctx context.Context, projectId string, region string) (*CreateWAFResponse, error) { + r := CreateWAFRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type DeleteCoreRuleSetRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string +} + +func (r DeleteCoreRuleSetRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteCoreRuleSet") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/core-rule-sets/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteCoreRuleSet: Delete a CRS configuration + +To delete a core rule set (CRS) configuration this endpoint is used, but it is only possible to delete it if no WAF configuration is referencing it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiDeleteCoreRuleSetRequest +*/ +func (a *APIClient) DeleteCoreRuleSet(ctx context.Context, projectId string, region string, name string) ApiDeleteCoreRuleSetRequest { + return DeleteCoreRuleSetRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) DeleteCoreRuleSetExecute(ctx context.Context, projectId string, region string, name string) (map[string]interface{}, error) { + r := DeleteCoreRuleSetRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type DeleteRulesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string +} + +func (r DeleteRulesRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteRules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/rules/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteRules: Delete a rule configuration + +To delete a rule configuration this endpoint is used, but it is only possible to delete it if no WAF configuration is referencing it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiDeleteRulesRequest +*/ +func (a *APIClient) DeleteRules(ctx context.Context, projectId string, region string, name string) ApiDeleteRulesRequest { + return DeleteRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) DeleteRulesExecute(ctx context.Context, projectId string, region string, name string) (map[string]interface{}, error) { + r := DeleteRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type DeleteWAFRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string +} + +func (r DeleteWAFRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteWAF") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/wafs/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteWAF: Delete a WAF configuration + +This will delete the specified WAF configuration, but only if it is not used by any Application Load Balancer in the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiDeleteWAFRequest +*/ +func (a *APIClient) DeleteWAF(ctx context.Context, projectId string, region string, name string) ApiDeleteWAFRequest { + return DeleteWAFRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) DeleteWAFExecute(ctx context.Context, projectId string, region string, name string) (map[string]interface{}, error) { + r := DeleteWAFRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type GetCoreRuleSetRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string +} + +func (r GetCoreRuleSetRequest) Execute() (*GetCoreRuleSetResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCoreRuleSetResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCoreRuleSet") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/core-rule-sets/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCoreRuleSet: Retrieve a CRS configuration + +To retrieve an existing core rule set (CRS) configuration this endpoint can be used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiGetCoreRuleSetRequest +*/ +func (a *APIClient) GetCoreRuleSet(ctx context.Context, projectId string, region string, name string) ApiGetCoreRuleSetRequest { + return GetCoreRuleSetRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) GetCoreRuleSetExecute(ctx context.Context, projectId string, region string, name string) (*GetCoreRuleSetResponse, error) { + r := GetCoreRuleSetRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type GetRulesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string +} + +func (r GetRulesRequest) Execute() (*GetRulesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetRulesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/rules/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetRules: Retrieve a rule configuration + +To retrieve an existing rule configuration this endpoint can be used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiGetRulesRequest +*/ +func (a *APIClient) GetRules(ctx context.Context, projectId string, region string, name string) ApiGetRulesRequest { + return GetRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) GetRulesExecute(ctx context.Context, projectId string, region string, name string) (*GetRulesResponse, error) { + r := GetRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type GetWAFRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string +} + +func (r GetWAFRequest) Execute() (*GetWAFResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetWAFResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetWAF") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/wafs/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetWAF: Retrieve a WAF configuration + +This endpoint will return the specified WAF configuration. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiGetWAFRequest +*/ +func (a *APIClient) GetWAF(ctx context.Context, projectId string, region string, name string) ApiGetWAFRequest { + return GetWAFRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) GetWAFExecute(ctx context.Context, projectId string, region string, name string) (*GetWAFResponse, error) { + r := GetWAFRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type ListCoreRuleSetsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + pageSize *string + pageId *string +} + +// page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000 + +func (r ListCoreRuleSetsRequest) PageSize(pageSize string) ApiListCoreRuleSetsRequest { + r.pageSize = &pageSize + return r +} + +// page_id is a page identifier returned by the previous response and is used to request the next page + +func (r ListCoreRuleSetsRequest) PageId(pageId string) ApiListCoreRuleSetsRequest { + r.pageId = &pageId + return r +} + +func (r ListCoreRuleSetsRequest) Execute() (*ListCoreRuleSetResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListCoreRuleSetResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListCoreRuleSets") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/core-rule-sets" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.pageId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageId", r.pageId, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListCoreRuleSets: List of CRS configurations + +List all existing core rule set (CRS) configurations that are stored in the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListCoreRuleSetsRequest +*/ +func (a *APIClient) ListCoreRuleSets(ctx context.Context, projectId string, region string) ApiListCoreRuleSetsRequest { + return ListCoreRuleSetsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListCoreRuleSetsExecute(ctx context.Context, projectId string, region string) (*ListCoreRuleSetResponse, error) { + r := ListCoreRuleSetsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListRulesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + pageSize *string + pageId *string +} + +// page_size specifies how many rule configurations should be returned on this page. Must be a positive number <= 1000 + +func (r ListRulesRequest) PageSize(pageSize string) ApiListRulesRequest { + r.pageSize = &pageSize + return r +} + +// page_id is a page identifier returned by the previous response and is used to request the next page + +func (r ListRulesRequest) PageId(pageId string) ApiListRulesRequest { + r.pageId = &pageId + return r +} + +func (r ListRulesRequest) Execute() (*ListRulesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListRulesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListRules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.pageId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageId", r.pageId, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListRules: List of rule configurations + +List all existing rule configurations that are stored in the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListRulesRequest +*/ +func (a *APIClient) ListRules(ctx context.Context, projectId string, region string) ApiListRulesRequest { + return ListRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListRulesExecute(ctx context.Context, projectId string, region string) (*ListRulesResponse, error) { + r := ListRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListWAFRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + pageSize *string + pageId *string +} + +// page_size specifies how many WAFs should be returned on this page. Must be a positive number <= 1000 + +func (r ListWAFRequest) PageSize(pageSize string) ApiListWAFRequest { + r.pageSize = &pageSize + return r +} + +// page_id is a page identifier returned by the previous response and is used to request the next page + +func (r ListWAFRequest) PageId(pageId string) ApiListWAFRequest { + r.pageId = &pageId + return r +} + +func (r ListWAFRequest) Execute() (*ListWAFResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListWAFResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListWAF") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/wafs" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.pageId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageId", r.pageId, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListWAF: List of WAF configurations + +To list all WAF configurations stored in a project, use this endpoint. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListWAFRequest +*/ +func (a *APIClient) ListWAF(ctx context.Context, projectId string, region string) ApiListWAFRequest { + return ListWAFRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListWAFExecute(ctx context.Context, projectId string, region string) (*ListWAFResponse, error) { + r := ListWAFRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type UpdateCoreRuleSetRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string + updateCoreRuleSetPayload *UpdateCoreRuleSetPayload +} + +func (r UpdateCoreRuleSetRequest) UpdateCoreRuleSetPayload(updateCoreRuleSetPayload UpdateCoreRuleSetPayload) ApiUpdateCoreRuleSetRequest { + r.updateCoreRuleSetPayload = &updateCoreRuleSetPayload + return r +} + +func (r UpdateCoreRuleSetRequest) Execute() (*UpdateCoreRuleSetResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UpdateCoreRuleSetResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateCoreRuleSet") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/core-rule-sets/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateCoreRuleSetPayload == nil { + return localVarReturnValue, fmt.Errorf("updateCoreRuleSetPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateCoreRuleSetPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateCoreRuleSet: Update a CRS configuration + +This endpoint will update an existing core rule set (CRS) configuration and also inturn update all WAF configurations that reference it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiUpdateCoreRuleSetRequest +*/ +func (a *APIClient) UpdateCoreRuleSet(ctx context.Context, projectId string, region string, name string) ApiUpdateCoreRuleSetRequest { + return UpdateCoreRuleSetRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) UpdateCoreRuleSetExecute(ctx context.Context, projectId string, region string, name string) (*UpdateCoreRuleSetResponse, error) { + r := UpdateCoreRuleSetRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type UpdateRulesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string + updateRulesPayload *UpdateRulesPayload +} + +func (r UpdateRulesRequest) UpdateRulesPayload(updateRulesPayload UpdateRulesPayload) ApiUpdateRulesRequest { + r.updateRulesPayload = &updateRulesPayload + return r +} + +func (r UpdateRulesRequest) Execute() (*UpdateRulesResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UpdateRulesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateRules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/rules/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateRulesPayload == nil { + return localVarReturnValue, fmt.Errorf("updateRulesPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateRulesPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateRules: Update a rule configuration + +This endpoint will update an existing rules configuration and also inturn update all WAF configurations that reference it. There is a limit of 1 MB of data on these rules. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiUpdateRulesRequest +*/ +func (a *APIClient) UpdateRules(ctx context.Context, projectId string, region string, name string) ApiUpdateRulesRequest { + return UpdateRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) UpdateRulesExecute(ctx context.Context, projectId string, region string, name string) (*UpdateRulesResponse, error) { + r := UpdateRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} + +type UpdateWAFRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + name string + updateWAFPayload *UpdateWAFPayload +} + +func (r UpdateWAFRequest) UpdateWAFPayload(updateWAFPayload UpdateWAFPayload) ApiUpdateWAFRequest { + r.updateWAFPayload = &updateWAFPayload + return r +} + +func (r UpdateWAFRequest) Execute() (*UpdateWAFResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UpdateWAFResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateWAF") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{region}/wafs/{name}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(r.name, "name")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateWAFPayload == nil { + return localVarReturnValue, fmt.Errorf("updateWAFPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateWAFPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateWAF: Update a WAF configuration + +The update endpoint will update a stored WAF configuration in project and not yet but later will also update the Load Balancers that reference it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param name + @return ApiUpdateWAFRequest +*/ +func (a *APIClient) UpdateWAF(ctx context.Context, projectId string, region string, name string) ApiUpdateWAFRequest { + return UpdateWAFRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } +} + +func (a *APIClient) UpdateWAFExecute(ctx context.Context, projectId string, region string, name string) (*UpdateWAFResponse, error) { + r := UpdateWAFRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + name: name, + } + return r.Execute() +} diff --git a/pkg/albwafalpha/api_default_test.go b/pkg/albwafalpha/api_default_test.go new file mode 100644 index 00000000..5d8bc548 --- /dev/null +++ b/pkg/albwafalpha/api_default_test.go @@ -0,0 +1,884 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package albwafalpha + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_albwafalpha_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateCoreRuleSet", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/core-rule-sets" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateCoreRuleSetResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createCoreRuleSetPayload := CreateCoreRuleSetPayload{} + + resp, reqErr := apiClient.CreateCoreRuleSet(context.Background(), projectId, region).CreateCoreRuleSetPayload(createCoreRuleSetPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateRules", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/rules" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateRulesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createRulesPayload := CreateRulesPayload{} + + resp, reqErr := apiClient.CreateRules(context.Background(), projectId, region).CreateRulesPayload(createRulesPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateWAF", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/wafs" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateWAFResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createWAFPayload := CreateWAFPayload{} + + resp, reqErr := apiClient.CreateWAF(context.Background(), projectId, region).CreateWAFPayload(createWAFPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteCoreRuleSet", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/core-rule-sets/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + + resp, reqErr := apiClient.DeleteCoreRuleSet(context.Background(), projectId, region, name).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteRules", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/rules/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + + resp, reqErr := apiClient.DeleteRules(context.Background(), projectId, region, name).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteWAF", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/wafs/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + + resp, reqErr := apiClient.DeleteWAF(context.Background(), projectId, region, name).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetCoreRuleSet", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/core-rule-sets/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetCoreRuleSetResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + + resp, reqErr := apiClient.GetCoreRuleSet(context.Background(), projectId, region, name).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetRules", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/rules/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetRulesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + + resp, reqErr := apiClient.GetRules(context.Background(), projectId, region, name).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetWAF", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/wafs/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetWAFResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + + resp, reqErr := apiClient.GetWAF(context.Background(), projectId, region, name).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListCoreRuleSets", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/core-rule-sets" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListCoreRuleSetResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListCoreRuleSets(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListRules", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/rules" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListRulesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListRules(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListWAF", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/wafs" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListWAFResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListWAF(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateCoreRuleSet", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/core-rule-sets/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := UpdateCoreRuleSetResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + updateCoreRuleSetPayload := UpdateCoreRuleSetPayload{} + + resp, reqErr := apiClient.UpdateCoreRuleSet(context.Background(), projectId, region, name).UpdateCoreRuleSetPayload(updateCoreRuleSetPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateRules", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/rules/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := UpdateRulesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + updateRulesPayload := UpdateRulesPayload{} + + resp, reqErr := apiClient.UpdateRules(context.Background(), projectId, region, name).UpdateRulesPayload(updateRulesPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateWAF", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{region}/wafs/{name}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nameValue := "name-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"name"+"}", url.PathEscape(ParameterValueToString(nameValue, "name")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := UpdateWAFResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for albwafalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + name := nameValue + updateWAFPayload := UpdateWAFPayload{} + + resp, reqErr := apiClient.UpdateWAF(context.Background(), projectId, region, name).UpdateWAFPayload(updateWAFPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/albwafalpha/client.go b/pkg/albwafalpha/client.go new file mode 100644 index 00000000..4a3605d5 --- /dev/null +++ b/pkg/albwafalpha/client.go @@ -0,0 +1,628 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Application Load Balancer Web Application Firewall API API v1alpha.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/albwafalpha/configuration.go b/pkg/albwafalpha/configuration.go new file mode 100644 index 00000000..0c5f4e1d --- /dev/null +++ b/pkg/albwafalpha/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/albwafalpha", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://alb-waf.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/albwafalpha/model_create_core_rule_set_payload.go b/pkg/albwafalpha/model_create_core_rule_set_payload.go new file mode 100644 index 00000000..6d39d096 --- /dev/null +++ b/pkg/albwafalpha/model_create_core_rule_set_payload.go @@ -0,0 +1,275 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the CreateCoreRuleSetPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCoreRuleSetPayload{} + +/* + types and functions for active +*/ + +// isBoolean +type CreateCoreRuleSetPayloadgetActiveAttributeType = *bool +type CreateCoreRuleSetPayloadgetActiveArgType = bool +type CreateCoreRuleSetPayloadgetActiveRetType = bool + +func getCreateCoreRuleSetPayloadgetActiveAttributeTypeOk(arg CreateCoreRuleSetPayloadgetActiveAttributeType) (ret CreateCoreRuleSetPayloadgetActiveRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCoreRuleSetPayloadgetActiveAttributeType(arg *CreateCoreRuleSetPayloadgetActiveAttributeType, val CreateCoreRuleSetPayloadgetActiveRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateCoreRuleSetPayloadGetNameAttributeType = *string + +func getCreateCoreRuleSetPayloadGetNameAttributeTypeOk(arg CreateCoreRuleSetPayloadGetNameAttributeType) (ret CreateCoreRuleSetPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCoreRuleSetPayloadGetNameAttributeType(arg *CreateCoreRuleSetPayloadGetNameAttributeType, val CreateCoreRuleSetPayloadGetNameRetType) { + *arg = &val +} + +type CreateCoreRuleSetPayloadGetNameArgType = string +type CreateCoreRuleSetPayloadGetNameRetType = string + +/* + types and functions for projectId +*/ + +// isNotNullableString +type CreateCoreRuleSetPayloadGetProjectIdAttributeType = *string + +func getCreateCoreRuleSetPayloadGetProjectIdAttributeTypeOk(arg CreateCoreRuleSetPayloadGetProjectIdAttributeType) (ret CreateCoreRuleSetPayloadGetProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCoreRuleSetPayloadGetProjectIdAttributeType(arg *CreateCoreRuleSetPayloadGetProjectIdAttributeType, val CreateCoreRuleSetPayloadGetProjectIdRetType) { + *arg = &val +} + +type CreateCoreRuleSetPayloadGetProjectIdArgType = string +type CreateCoreRuleSetPayloadGetProjectIdRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type CreateCoreRuleSetPayloadGetRegionAttributeType = *string + +func getCreateCoreRuleSetPayloadGetRegionAttributeTypeOk(arg CreateCoreRuleSetPayloadGetRegionAttributeType) (ret CreateCoreRuleSetPayloadGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCoreRuleSetPayloadGetRegionAttributeType(arg *CreateCoreRuleSetPayloadGetRegionAttributeType, val CreateCoreRuleSetPayloadGetRegionRetType) { + *arg = &val +} + +type CreateCoreRuleSetPayloadGetRegionArgType = string +type CreateCoreRuleSetPayloadGetRegionRetType = string + +// CreateCoreRuleSetPayload CreateCoreRuleSetRequest creates a rule configuration. +type CreateCoreRuleSetPayload struct { + // To activate the OWASP core rule set, set this boolean to true. + Active CreateCoreRuleSetPayloadgetActiveAttributeType `json:"active,omitempty"` + // Core rule set configuration name. + Name CreateCoreRuleSetPayloadGetNameAttributeType `json:"name,omitempty"` + // Project identifier + ProjectId CreateCoreRuleSetPayloadGetProjectIdAttributeType `json:"projectId,omitempty"` + // Region + Region CreateCoreRuleSetPayloadGetRegionAttributeType `json:"region,omitempty"` +} + +// NewCreateCoreRuleSetPayload instantiates a new CreateCoreRuleSetPayload 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 NewCreateCoreRuleSetPayload() *CreateCoreRuleSetPayload { + this := CreateCoreRuleSetPayload{} + return &this +} + +// NewCreateCoreRuleSetPayloadWithDefaults instantiates a new CreateCoreRuleSetPayload 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 NewCreateCoreRuleSetPayloadWithDefaults() *CreateCoreRuleSetPayload { + this := CreateCoreRuleSetPayload{} + return &this +} + +// GetActive returns the Active field value if set, zero value otherwise. +func (o *CreateCoreRuleSetPayload) GetActive() (res CreateCoreRuleSetPayloadgetActiveRetType) { + res, _ = o.GetActiveOk() + return +} + +// GetActiveOk returns a tuple with the Active field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCoreRuleSetPayload) GetActiveOk() (ret CreateCoreRuleSetPayloadgetActiveRetType, ok bool) { + return getCreateCoreRuleSetPayloadgetActiveAttributeTypeOk(o.Active) +} + +// HasActive returns a boolean if a field has been set. +func (o *CreateCoreRuleSetPayload) HasActive() bool { + _, ok := o.GetActiveOk() + return ok +} + +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *CreateCoreRuleSetPayload) SetActive(v CreateCoreRuleSetPayloadgetActiveRetType) { + setCreateCoreRuleSetPayloadgetActiveAttributeType(&o.Active, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateCoreRuleSetPayload) GetName() (res CreateCoreRuleSetPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCoreRuleSetPayload) GetNameOk() (ret CreateCoreRuleSetPayloadGetNameRetType, ok bool) { + return getCreateCoreRuleSetPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateCoreRuleSetPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateCoreRuleSetPayload) SetName(v CreateCoreRuleSetPayloadGetNameRetType) { + setCreateCoreRuleSetPayloadGetNameAttributeType(&o.Name, v) +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *CreateCoreRuleSetPayload) GetProjectId() (res CreateCoreRuleSetPayloadGetProjectIdRetType) { + res, _ = o.GetProjectIdOk() + return +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCoreRuleSetPayload) GetProjectIdOk() (ret CreateCoreRuleSetPayloadGetProjectIdRetType, ok bool) { + return getCreateCoreRuleSetPayloadGetProjectIdAttributeTypeOk(o.ProjectId) +} + +// HasProjectId returns a boolean if a field has been set. +func (o *CreateCoreRuleSetPayload) HasProjectId() bool { + _, ok := o.GetProjectIdOk() + return ok +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *CreateCoreRuleSetPayload) SetProjectId(v CreateCoreRuleSetPayloadGetProjectIdRetType) { + setCreateCoreRuleSetPayloadGetProjectIdAttributeType(&o.ProjectId, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *CreateCoreRuleSetPayload) GetRegion() (res CreateCoreRuleSetPayloadGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCoreRuleSetPayload) GetRegionOk() (ret CreateCoreRuleSetPayloadGetRegionRetType, ok bool) { + return getCreateCoreRuleSetPayloadGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *CreateCoreRuleSetPayload) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *CreateCoreRuleSetPayload) SetRegion(v CreateCoreRuleSetPayloadGetRegionRetType) { + setCreateCoreRuleSetPayloadGetRegionAttributeType(&o.Region, v) +} + +func (o CreateCoreRuleSetPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateCoreRuleSetPayloadgetActiveAttributeTypeOk(o.Active); ok { + toSerialize["Active"] = val + } + if val, ok := getCreateCoreRuleSetPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateCoreRuleSetPayloadGetProjectIdAttributeTypeOk(o.ProjectId); ok { + toSerialize["ProjectId"] = val + } + if val, ok := getCreateCoreRuleSetPayloadGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullableCreateCoreRuleSetPayload struct { + value *CreateCoreRuleSetPayload + isSet bool +} + +func (v NullableCreateCoreRuleSetPayload) Get() *CreateCoreRuleSetPayload { + return v.value +} + +func (v *NullableCreateCoreRuleSetPayload) Set(val *CreateCoreRuleSetPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateCoreRuleSetPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateCoreRuleSetPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateCoreRuleSetPayload(val *CreateCoreRuleSetPayload) *NullableCreateCoreRuleSetPayload { + return &NullableCreateCoreRuleSetPayload{value: val, isSet: true} +} + +func (v NullableCreateCoreRuleSetPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateCoreRuleSetPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_create_core_rule_set_payload_test.go b/pkg/albwafalpha/model_create_core_rule_set_payload_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_create_core_rule_set_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_create_core_rule_set_response.go b/pkg/albwafalpha/model_create_core_rule_set_response.go new file mode 100644 index 00000000..3fc73f9e --- /dev/null +++ b/pkg/albwafalpha/model_create_core_rule_set_response.go @@ -0,0 +1,226 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the CreateCoreRuleSetResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCoreRuleSetResponse{} + +/* + types and functions for active +*/ + +// isBoolean +type CreateCoreRuleSetResponsegetActiveAttributeType = *bool +type CreateCoreRuleSetResponsegetActiveArgType = bool +type CreateCoreRuleSetResponsegetActiveRetType = bool + +func getCreateCoreRuleSetResponsegetActiveAttributeTypeOk(arg CreateCoreRuleSetResponsegetActiveAttributeType) (ret CreateCoreRuleSetResponsegetActiveRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCoreRuleSetResponsegetActiveAttributeType(arg *CreateCoreRuleSetResponsegetActiveAttributeType, val CreateCoreRuleSetResponsegetActiveRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateCoreRuleSetResponseGetNameAttributeType = *string + +func getCreateCoreRuleSetResponseGetNameAttributeTypeOk(arg CreateCoreRuleSetResponseGetNameAttributeType) (ret CreateCoreRuleSetResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCoreRuleSetResponseGetNameAttributeType(arg *CreateCoreRuleSetResponseGetNameAttributeType, val CreateCoreRuleSetResponseGetNameRetType) { + *arg = &val +} + +type CreateCoreRuleSetResponseGetNameArgType = string +type CreateCoreRuleSetResponseGetNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type CreateCoreRuleSetResponseGetRegionAttributeType = *string + +func getCreateCoreRuleSetResponseGetRegionAttributeTypeOk(arg CreateCoreRuleSetResponseGetRegionAttributeType) (ret CreateCoreRuleSetResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCoreRuleSetResponseGetRegionAttributeType(arg *CreateCoreRuleSetResponseGetRegionAttributeType, val CreateCoreRuleSetResponseGetRegionRetType) { + *arg = &val +} + +type CreateCoreRuleSetResponseGetRegionArgType = string +type CreateCoreRuleSetResponseGetRegionRetType = string + +// CreateCoreRuleSetResponse CreateCoreRuleSetResponse returns rule configuration name and it's rules. +type CreateCoreRuleSetResponse struct { + // Indicates if the OWASP core rule set is active. + Active CreateCoreRuleSetResponsegetActiveAttributeType `json:"active,omitempty"` + // Core rule set configuration name. + Name CreateCoreRuleSetResponseGetNameAttributeType `json:"name,omitempty"` + // Region + Region CreateCoreRuleSetResponseGetRegionAttributeType `json:"region,omitempty"` +} + +// NewCreateCoreRuleSetResponse instantiates a new CreateCoreRuleSetResponse 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 NewCreateCoreRuleSetResponse() *CreateCoreRuleSetResponse { + this := CreateCoreRuleSetResponse{} + return &this +} + +// NewCreateCoreRuleSetResponseWithDefaults instantiates a new CreateCoreRuleSetResponse 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 NewCreateCoreRuleSetResponseWithDefaults() *CreateCoreRuleSetResponse { + this := CreateCoreRuleSetResponse{} + return &this +} + +// GetActive returns the Active field value if set, zero value otherwise. +func (o *CreateCoreRuleSetResponse) GetActive() (res CreateCoreRuleSetResponsegetActiveRetType) { + res, _ = o.GetActiveOk() + return +} + +// GetActiveOk returns a tuple with the Active field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCoreRuleSetResponse) GetActiveOk() (ret CreateCoreRuleSetResponsegetActiveRetType, ok bool) { + return getCreateCoreRuleSetResponsegetActiveAttributeTypeOk(o.Active) +} + +// HasActive returns a boolean if a field has been set. +func (o *CreateCoreRuleSetResponse) HasActive() bool { + _, ok := o.GetActiveOk() + return ok +} + +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *CreateCoreRuleSetResponse) SetActive(v CreateCoreRuleSetResponsegetActiveRetType) { + setCreateCoreRuleSetResponsegetActiveAttributeType(&o.Active, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateCoreRuleSetResponse) GetName() (res CreateCoreRuleSetResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCoreRuleSetResponse) GetNameOk() (ret CreateCoreRuleSetResponseGetNameRetType, ok bool) { + return getCreateCoreRuleSetResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateCoreRuleSetResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateCoreRuleSetResponse) SetName(v CreateCoreRuleSetResponseGetNameRetType) { + setCreateCoreRuleSetResponseGetNameAttributeType(&o.Name, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *CreateCoreRuleSetResponse) GetRegion() (res CreateCoreRuleSetResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCoreRuleSetResponse) GetRegionOk() (ret CreateCoreRuleSetResponseGetRegionRetType, ok bool) { + return getCreateCoreRuleSetResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *CreateCoreRuleSetResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *CreateCoreRuleSetResponse) SetRegion(v CreateCoreRuleSetResponseGetRegionRetType) { + setCreateCoreRuleSetResponseGetRegionAttributeType(&o.Region, v) +} + +func (o CreateCoreRuleSetResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateCoreRuleSetResponsegetActiveAttributeTypeOk(o.Active); ok { + toSerialize["Active"] = val + } + if val, ok := getCreateCoreRuleSetResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateCoreRuleSetResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullableCreateCoreRuleSetResponse struct { + value *CreateCoreRuleSetResponse + isSet bool +} + +func (v NullableCreateCoreRuleSetResponse) Get() *CreateCoreRuleSetResponse { + return v.value +} + +func (v *NullableCreateCoreRuleSetResponse) Set(val *CreateCoreRuleSetResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateCoreRuleSetResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateCoreRuleSetResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateCoreRuleSetResponse(val *CreateCoreRuleSetResponse) *NullableCreateCoreRuleSetResponse { + return &NullableCreateCoreRuleSetResponse{value: val, isSet: true} +} + +func (v NullableCreateCoreRuleSetResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateCoreRuleSetResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_create_core_rule_set_response_test.go b/pkg/albwafalpha/model_create_core_rule_set_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_create_core_rule_set_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_create_rules_payload.go b/pkg/albwafalpha/model_create_rules_payload.go new file mode 100644 index 00000000..627440ae --- /dev/null +++ b/pkg/albwafalpha/model_create_rules_payload.go @@ -0,0 +1,276 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the CreateRulesPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateRulesPayload{} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateRulesPayloadGetNameAttributeType = *string + +func getCreateRulesPayloadGetNameAttributeTypeOk(arg CreateRulesPayloadGetNameAttributeType) (ret CreateRulesPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateRulesPayloadGetNameAttributeType(arg *CreateRulesPayloadGetNameAttributeType, val CreateRulesPayloadGetNameRetType) { + *arg = &val +} + +type CreateRulesPayloadGetNameArgType = string +type CreateRulesPayloadGetNameRetType = string + +/* + types and functions for projectId +*/ + +// isNotNullableString +type CreateRulesPayloadGetProjectIdAttributeType = *string + +func getCreateRulesPayloadGetProjectIdAttributeTypeOk(arg CreateRulesPayloadGetProjectIdAttributeType) (ret CreateRulesPayloadGetProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateRulesPayloadGetProjectIdAttributeType(arg *CreateRulesPayloadGetProjectIdAttributeType, val CreateRulesPayloadGetProjectIdRetType) { + *arg = &val +} + +type CreateRulesPayloadGetProjectIdArgType = string +type CreateRulesPayloadGetProjectIdRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type CreateRulesPayloadGetRegionAttributeType = *string + +func getCreateRulesPayloadGetRegionAttributeTypeOk(arg CreateRulesPayloadGetRegionAttributeType) (ret CreateRulesPayloadGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateRulesPayloadGetRegionAttributeType(arg *CreateRulesPayloadGetRegionAttributeType, val CreateRulesPayloadGetRegionRetType) { + *arg = &val +} + +type CreateRulesPayloadGetRegionArgType = string +type CreateRulesPayloadGetRegionRetType = string + +/* + types and functions for rules +*/ + +// isNotNullableString +type CreateRulesPayloadGetRulesAttributeType = *string + +func getCreateRulesPayloadGetRulesAttributeTypeOk(arg CreateRulesPayloadGetRulesAttributeType) (ret CreateRulesPayloadGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateRulesPayloadGetRulesAttributeType(arg *CreateRulesPayloadGetRulesAttributeType, val CreateRulesPayloadGetRulesRetType) { + *arg = &val +} + +type CreateRulesPayloadGetRulesArgType = string +type CreateRulesPayloadGetRulesRetType = string + +// CreateRulesPayload CreateRulesRequest creates a rule configuration. +type CreateRulesPayload struct { + // Rule configuration name. + Name CreateRulesPayloadGetNameAttributeType `json:"name,omitempty"` + // Project identifier + ProjectId CreateRulesPayloadGetProjectIdAttributeType `json:"projectId,omitempty"` + // Region + Region CreateRulesPayloadGetRegionAttributeType `json:"region,omitempty"` + // Custom rules for WAF written in Seclang syntax. + Rules CreateRulesPayloadGetRulesAttributeType `json:"rules,omitempty"` +} + +// NewCreateRulesPayload instantiates a new CreateRulesPayload 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 NewCreateRulesPayload() *CreateRulesPayload { + this := CreateRulesPayload{} + return &this +} + +// NewCreateRulesPayloadWithDefaults instantiates a new CreateRulesPayload 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 NewCreateRulesPayloadWithDefaults() *CreateRulesPayload { + this := CreateRulesPayload{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateRulesPayload) GetName() (res CreateRulesPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRulesPayload) GetNameOk() (ret CreateRulesPayloadGetNameRetType, ok bool) { + return getCreateRulesPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateRulesPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateRulesPayload) SetName(v CreateRulesPayloadGetNameRetType) { + setCreateRulesPayloadGetNameAttributeType(&o.Name, v) +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *CreateRulesPayload) GetProjectId() (res CreateRulesPayloadGetProjectIdRetType) { + res, _ = o.GetProjectIdOk() + return +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRulesPayload) GetProjectIdOk() (ret CreateRulesPayloadGetProjectIdRetType, ok bool) { + return getCreateRulesPayloadGetProjectIdAttributeTypeOk(o.ProjectId) +} + +// HasProjectId returns a boolean if a field has been set. +func (o *CreateRulesPayload) HasProjectId() bool { + _, ok := o.GetProjectIdOk() + return ok +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *CreateRulesPayload) SetProjectId(v CreateRulesPayloadGetProjectIdRetType) { + setCreateRulesPayloadGetProjectIdAttributeType(&o.ProjectId, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *CreateRulesPayload) GetRegion() (res CreateRulesPayloadGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRulesPayload) GetRegionOk() (ret CreateRulesPayloadGetRegionRetType, ok bool) { + return getCreateRulesPayloadGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *CreateRulesPayload) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *CreateRulesPayload) SetRegion(v CreateRulesPayloadGetRegionRetType) { + setCreateRulesPayloadGetRegionAttributeType(&o.Region, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *CreateRulesPayload) GetRules() (res CreateRulesPayloadGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRulesPayload) GetRulesOk() (ret CreateRulesPayloadGetRulesRetType, ok bool) { + return getCreateRulesPayloadGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *CreateRulesPayload) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given string and assigns it to the Rules field. +func (o *CreateRulesPayload) SetRules(v CreateRulesPayloadGetRulesRetType) { + setCreateRulesPayloadGetRulesAttributeType(&o.Rules, v) +} + +func (o CreateRulesPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateRulesPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateRulesPayloadGetProjectIdAttributeTypeOk(o.ProjectId); ok { + toSerialize["ProjectId"] = val + } + if val, ok := getCreateRulesPayloadGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getCreateRulesPayloadGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableCreateRulesPayload struct { + value *CreateRulesPayload + isSet bool +} + +func (v NullableCreateRulesPayload) Get() *CreateRulesPayload { + return v.value +} + +func (v *NullableCreateRulesPayload) Set(val *CreateRulesPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateRulesPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateRulesPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateRulesPayload(val *CreateRulesPayload) *NullableCreateRulesPayload { + return &NullableCreateRulesPayload{value: val, isSet: true} +} + +func (v NullableCreateRulesPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateRulesPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_create_rules_payload_test.go b/pkg/albwafalpha/model_create_rules_payload_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_create_rules_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_create_rules_response.go b/pkg/albwafalpha/model_create_rules_response.go new file mode 100644 index 00000000..f2608b41 --- /dev/null +++ b/pkg/albwafalpha/model_create_rules_response.go @@ -0,0 +1,227 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the CreateRulesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateRulesResponse{} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateRulesResponseGetNameAttributeType = *string + +func getCreateRulesResponseGetNameAttributeTypeOk(arg CreateRulesResponseGetNameAttributeType) (ret CreateRulesResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateRulesResponseGetNameAttributeType(arg *CreateRulesResponseGetNameAttributeType, val CreateRulesResponseGetNameRetType) { + *arg = &val +} + +type CreateRulesResponseGetNameArgType = string +type CreateRulesResponseGetNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type CreateRulesResponseGetRegionAttributeType = *string + +func getCreateRulesResponseGetRegionAttributeTypeOk(arg CreateRulesResponseGetRegionAttributeType) (ret CreateRulesResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateRulesResponseGetRegionAttributeType(arg *CreateRulesResponseGetRegionAttributeType, val CreateRulesResponseGetRegionRetType) { + *arg = &val +} + +type CreateRulesResponseGetRegionArgType = string +type CreateRulesResponseGetRegionRetType = string + +/* + types and functions for rules +*/ + +// isNotNullableString +type CreateRulesResponseGetRulesAttributeType = *string + +func getCreateRulesResponseGetRulesAttributeTypeOk(arg CreateRulesResponseGetRulesAttributeType) (ret CreateRulesResponseGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateRulesResponseGetRulesAttributeType(arg *CreateRulesResponseGetRulesAttributeType, val CreateRulesResponseGetRulesRetType) { + *arg = &val +} + +type CreateRulesResponseGetRulesArgType = string +type CreateRulesResponseGetRulesRetType = string + +// CreateRulesResponse CreateRulesResponse returns rule configuration name and it's rules. +type CreateRulesResponse struct { + // Rule configuration name. + Name CreateRulesResponseGetNameAttributeType `json:"name,omitempty"` + // Region + Region CreateRulesResponseGetRegionAttributeType `json:"region,omitempty"` + // Custom rules written in Seclang syntax. + Rules CreateRulesResponseGetRulesAttributeType `json:"rules,omitempty"` +} + +// NewCreateRulesResponse instantiates a new CreateRulesResponse 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 NewCreateRulesResponse() *CreateRulesResponse { + this := CreateRulesResponse{} + return &this +} + +// NewCreateRulesResponseWithDefaults instantiates a new CreateRulesResponse 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 NewCreateRulesResponseWithDefaults() *CreateRulesResponse { + this := CreateRulesResponse{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateRulesResponse) GetName() (res CreateRulesResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRulesResponse) GetNameOk() (ret CreateRulesResponseGetNameRetType, ok bool) { + return getCreateRulesResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateRulesResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateRulesResponse) SetName(v CreateRulesResponseGetNameRetType) { + setCreateRulesResponseGetNameAttributeType(&o.Name, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *CreateRulesResponse) GetRegion() (res CreateRulesResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRulesResponse) GetRegionOk() (ret CreateRulesResponseGetRegionRetType, ok bool) { + return getCreateRulesResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *CreateRulesResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *CreateRulesResponse) SetRegion(v CreateRulesResponseGetRegionRetType) { + setCreateRulesResponseGetRegionAttributeType(&o.Region, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *CreateRulesResponse) GetRules() (res CreateRulesResponseGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateRulesResponse) GetRulesOk() (ret CreateRulesResponseGetRulesRetType, ok bool) { + return getCreateRulesResponseGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *CreateRulesResponse) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given string and assigns it to the Rules field. +func (o *CreateRulesResponse) SetRules(v CreateRulesResponseGetRulesRetType) { + setCreateRulesResponseGetRulesAttributeType(&o.Rules, v) +} + +func (o CreateRulesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateRulesResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateRulesResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getCreateRulesResponseGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableCreateRulesResponse struct { + value *CreateRulesResponse + isSet bool +} + +func (v NullableCreateRulesResponse) Get() *CreateRulesResponse { + return v.value +} + +func (v *NullableCreateRulesResponse) Set(val *CreateRulesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateRulesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateRulesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateRulesResponse(val *CreateRulesResponse) *NullableCreateRulesResponse { + return &NullableCreateRulesResponse{value: val, isSet: true} +} + +func (v NullableCreateRulesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateRulesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_create_rules_response_test.go b/pkg/albwafalpha/model_create_rules_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_create_rules_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_create_waf_payload.go b/pkg/albwafalpha/model_create_waf_payload.go new file mode 100644 index 00000000..de3d4773 --- /dev/null +++ b/pkg/albwafalpha/model_create_waf_payload.go @@ -0,0 +1,325 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the CreateWAFPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateWAFPayload{} + +/* + types and functions for coreRuleSetName +*/ + +// isNotNullableString +type CreateWAFPayloadGetCoreRuleSetNameAttributeType = *string + +func getCreateWAFPayloadGetCoreRuleSetNameAttributeTypeOk(arg CreateWAFPayloadGetCoreRuleSetNameAttributeType) (ret CreateWAFPayloadGetCoreRuleSetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWAFPayloadGetCoreRuleSetNameAttributeType(arg *CreateWAFPayloadGetCoreRuleSetNameAttributeType, val CreateWAFPayloadGetCoreRuleSetNameRetType) { + *arg = &val +} + +type CreateWAFPayloadGetCoreRuleSetNameArgType = string +type CreateWAFPayloadGetCoreRuleSetNameRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateWAFPayloadGetNameAttributeType = *string + +func getCreateWAFPayloadGetNameAttributeTypeOk(arg CreateWAFPayloadGetNameAttributeType) (ret CreateWAFPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWAFPayloadGetNameAttributeType(arg *CreateWAFPayloadGetNameAttributeType, val CreateWAFPayloadGetNameRetType) { + *arg = &val +} + +type CreateWAFPayloadGetNameArgType = string +type CreateWAFPayloadGetNameRetType = string + +/* + types and functions for projectId +*/ + +// isNotNullableString +type CreateWAFPayloadGetProjectIdAttributeType = *string + +func getCreateWAFPayloadGetProjectIdAttributeTypeOk(arg CreateWAFPayloadGetProjectIdAttributeType) (ret CreateWAFPayloadGetProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWAFPayloadGetProjectIdAttributeType(arg *CreateWAFPayloadGetProjectIdAttributeType, val CreateWAFPayloadGetProjectIdRetType) { + *arg = &val +} + +type CreateWAFPayloadGetProjectIdArgType = string +type CreateWAFPayloadGetProjectIdRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type CreateWAFPayloadGetRegionAttributeType = *string + +func getCreateWAFPayloadGetRegionAttributeTypeOk(arg CreateWAFPayloadGetRegionAttributeType) (ret CreateWAFPayloadGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWAFPayloadGetRegionAttributeType(arg *CreateWAFPayloadGetRegionAttributeType, val CreateWAFPayloadGetRegionRetType) { + *arg = &val +} + +type CreateWAFPayloadGetRegionArgType = string +type CreateWAFPayloadGetRegionRetType = string + +/* + types and functions for rulesConfigName +*/ + +// isNotNullableString +type CreateWAFPayloadGetRulesConfigNameAttributeType = *string + +func getCreateWAFPayloadGetRulesConfigNameAttributeTypeOk(arg CreateWAFPayloadGetRulesConfigNameAttributeType) (ret CreateWAFPayloadGetRulesConfigNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWAFPayloadGetRulesConfigNameAttributeType(arg *CreateWAFPayloadGetRulesConfigNameAttributeType, val CreateWAFPayloadGetRulesConfigNameRetType) { + *arg = &val +} + +type CreateWAFPayloadGetRulesConfigNameArgType = string +type CreateWAFPayloadGetRulesConfigNameRetType = string + +// CreateWAFPayload CreateWAFRequest creates a WAF with rules. +type CreateWAFPayload struct { + // Name of the core rule set configuration for that WAF. + CoreRuleSetName CreateWAFPayloadGetCoreRuleSetNameAttributeType `json:"coreRuleSetName,omitempty"` + // WAF name + Name CreateWAFPayloadGetNameAttributeType `json:"name,omitempty"` + // Project identifier + ProjectId CreateWAFPayloadGetProjectIdAttributeType `json:"projectId,omitempty"` + // Region + Region CreateWAFPayloadGetRegionAttributeType `json:"region,omitempty"` + // Name of the rule configuration for that WAF. + RulesConfigName CreateWAFPayloadGetRulesConfigNameAttributeType `json:"rulesConfigName,omitempty"` +} + +// NewCreateWAFPayload instantiates a new CreateWAFPayload 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 NewCreateWAFPayload() *CreateWAFPayload { + this := CreateWAFPayload{} + return &this +} + +// NewCreateWAFPayloadWithDefaults instantiates a new CreateWAFPayload 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 NewCreateWAFPayloadWithDefaults() *CreateWAFPayload { + this := CreateWAFPayload{} + return &this +} + +// GetCoreRuleSetName returns the CoreRuleSetName field value if set, zero value otherwise. +func (o *CreateWAFPayload) GetCoreRuleSetName() (res CreateWAFPayloadGetCoreRuleSetNameRetType) { + res, _ = o.GetCoreRuleSetNameOk() + return +} + +// GetCoreRuleSetNameOk returns a tuple with the CoreRuleSetName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWAFPayload) GetCoreRuleSetNameOk() (ret CreateWAFPayloadGetCoreRuleSetNameRetType, ok bool) { + return getCreateWAFPayloadGetCoreRuleSetNameAttributeTypeOk(o.CoreRuleSetName) +} + +// HasCoreRuleSetName returns a boolean if a field has been set. +func (o *CreateWAFPayload) HasCoreRuleSetName() bool { + _, ok := o.GetCoreRuleSetNameOk() + return ok +} + +// SetCoreRuleSetName gets a reference to the given string and assigns it to the CoreRuleSetName field. +func (o *CreateWAFPayload) SetCoreRuleSetName(v CreateWAFPayloadGetCoreRuleSetNameRetType) { + setCreateWAFPayloadGetCoreRuleSetNameAttributeType(&o.CoreRuleSetName, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateWAFPayload) GetName() (res CreateWAFPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWAFPayload) GetNameOk() (ret CreateWAFPayloadGetNameRetType, ok bool) { + return getCreateWAFPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateWAFPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateWAFPayload) SetName(v CreateWAFPayloadGetNameRetType) { + setCreateWAFPayloadGetNameAttributeType(&o.Name, v) +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *CreateWAFPayload) GetProjectId() (res CreateWAFPayloadGetProjectIdRetType) { + res, _ = o.GetProjectIdOk() + return +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWAFPayload) GetProjectIdOk() (ret CreateWAFPayloadGetProjectIdRetType, ok bool) { + return getCreateWAFPayloadGetProjectIdAttributeTypeOk(o.ProjectId) +} + +// HasProjectId returns a boolean if a field has been set. +func (o *CreateWAFPayload) HasProjectId() bool { + _, ok := o.GetProjectIdOk() + return ok +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *CreateWAFPayload) SetProjectId(v CreateWAFPayloadGetProjectIdRetType) { + setCreateWAFPayloadGetProjectIdAttributeType(&o.ProjectId, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *CreateWAFPayload) GetRegion() (res CreateWAFPayloadGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWAFPayload) GetRegionOk() (ret CreateWAFPayloadGetRegionRetType, ok bool) { + return getCreateWAFPayloadGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *CreateWAFPayload) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *CreateWAFPayload) SetRegion(v CreateWAFPayloadGetRegionRetType) { + setCreateWAFPayloadGetRegionAttributeType(&o.Region, v) +} + +// GetRulesConfigName returns the RulesConfigName field value if set, zero value otherwise. +func (o *CreateWAFPayload) GetRulesConfigName() (res CreateWAFPayloadGetRulesConfigNameRetType) { + res, _ = o.GetRulesConfigNameOk() + return +} + +// GetRulesConfigNameOk returns a tuple with the RulesConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWAFPayload) GetRulesConfigNameOk() (ret CreateWAFPayloadGetRulesConfigNameRetType, ok bool) { + return getCreateWAFPayloadGetRulesConfigNameAttributeTypeOk(o.RulesConfigName) +} + +// HasRulesConfigName returns a boolean if a field has been set. +func (o *CreateWAFPayload) HasRulesConfigName() bool { + _, ok := o.GetRulesConfigNameOk() + return ok +} + +// SetRulesConfigName gets a reference to the given string and assigns it to the RulesConfigName field. +func (o *CreateWAFPayload) SetRulesConfigName(v CreateWAFPayloadGetRulesConfigNameRetType) { + setCreateWAFPayloadGetRulesConfigNameAttributeType(&o.RulesConfigName, v) +} + +func (o CreateWAFPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateWAFPayloadGetCoreRuleSetNameAttributeTypeOk(o.CoreRuleSetName); ok { + toSerialize["CoreRuleSetName"] = val + } + if val, ok := getCreateWAFPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateWAFPayloadGetProjectIdAttributeTypeOk(o.ProjectId); ok { + toSerialize["ProjectId"] = val + } + if val, ok := getCreateWAFPayloadGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getCreateWAFPayloadGetRulesConfigNameAttributeTypeOk(o.RulesConfigName); ok { + toSerialize["RulesConfigName"] = val + } + return toSerialize, nil +} + +type NullableCreateWAFPayload struct { + value *CreateWAFPayload + isSet bool +} + +func (v NullableCreateWAFPayload) Get() *CreateWAFPayload { + return v.value +} + +func (v *NullableCreateWAFPayload) Set(val *CreateWAFPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateWAFPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateWAFPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateWAFPayload(val *CreateWAFPayload) *NullableCreateWAFPayload { + return &NullableCreateWAFPayload{value: val, isSet: true} +} + +func (v NullableCreateWAFPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateWAFPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_create_waf_payload_test.go b/pkg/albwafalpha/model_create_waf_payload_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_create_waf_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_create_waf_response.go b/pkg/albwafalpha/model_create_waf_response.go new file mode 100644 index 00000000..d53bef2d --- /dev/null +++ b/pkg/albwafalpha/model_create_waf_response.go @@ -0,0 +1,276 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the CreateWAFResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateWAFResponse{} + +/* + types and functions for coreRuleSetName +*/ + +// isNotNullableString +type CreateWAFResponseGetCoreRuleSetNameAttributeType = *string + +func getCreateWAFResponseGetCoreRuleSetNameAttributeTypeOk(arg CreateWAFResponseGetCoreRuleSetNameAttributeType) (ret CreateWAFResponseGetCoreRuleSetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWAFResponseGetCoreRuleSetNameAttributeType(arg *CreateWAFResponseGetCoreRuleSetNameAttributeType, val CreateWAFResponseGetCoreRuleSetNameRetType) { + *arg = &val +} + +type CreateWAFResponseGetCoreRuleSetNameArgType = string +type CreateWAFResponseGetCoreRuleSetNameRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateWAFResponseGetNameAttributeType = *string + +func getCreateWAFResponseGetNameAttributeTypeOk(arg CreateWAFResponseGetNameAttributeType) (ret CreateWAFResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWAFResponseGetNameAttributeType(arg *CreateWAFResponseGetNameAttributeType, val CreateWAFResponseGetNameRetType) { + *arg = &val +} + +type CreateWAFResponseGetNameArgType = string +type CreateWAFResponseGetNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type CreateWAFResponseGetRegionAttributeType = *string + +func getCreateWAFResponseGetRegionAttributeTypeOk(arg CreateWAFResponseGetRegionAttributeType) (ret CreateWAFResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWAFResponseGetRegionAttributeType(arg *CreateWAFResponseGetRegionAttributeType, val CreateWAFResponseGetRegionRetType) { + *arg = &val +} + +type CreateWAFResponseGetRegionArgType = string +type CreateWAFResponseGetRegionRetType = string + +/* + types and functions for rulesConfigName +*/ + +// isNotNullableString +type CreateWAFResponseGetRulesConfigNameAttributeType = *string + +func getCreateWAFResponseGetRulesConfigNameAttributeTypeOk(arg CreateWAFResponseGetRulesConfigNameAttributeType) (ret CreateWAFResponseGetRulesConfigNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWAFResponseGetRulesConfigNameAttributeType(arg *CreateWAFResponseGetRulesConfigNameAttributeType, val CreateWAFResponseGetRulesConfigNameRetType) { + *arg = &val +} + +type CreateWAFResponseGetRulesConfigNameArgType = string +type CreateWAFResponseGetRulesConfigNameRetType = string + +// CreateWAFResponse CreateWAFResponse returns name and custom rules. +type CreateWAFResponse struct { + // Name of the core rule set configuration for that WAF. + CoreRuleSetName CreateWAFResponseGetCoreRuleSetNameAttributeType `json:"coreRuleSetName,omitempty"` + // WAF name + Name CreateWAFResponseGetNameAttributeType `json:"name,omitempty"` + // Region + Region CreateWAFResponseGetRegionAttributeType `json:"region,omitempty"` + // Name of the rule configuration for that WAF. + RulesConfigName CreateWAFResponseGetRulesConfigNameAttributeType `json:"rulesConfigName,omitempty"` +} + +// NewCreateWAFResponse instantiates a new CreateWAFResponse 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 NewCreateWAFResponse() *CreateWAFResponse { + this := CreateWAFResponse{} + return &this +} + +// NewCreateWAFResponseWithDefaults instantiates a new CreateWAFResponse 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 NewCreateWAFResponseWithDefaults() *CreateWAFResponse { + this := CreateWAFResponse{} + return &this +} + +// GetCoreRuleSetName returns the CoreRuleSetName field value if set, zero value otherwise. +func (o *CreateWAFResponse) GetCoreRuleSetName() (res CreateWAFResponseGetCoreRuleSetNameRetType) { + res, _ = o.GetCoreRuleSetNameOk() + return +} + +// GetCoreRuleSetNameOk returns a tuple with the CoreRuleSetName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWAFResponse) GetCoreRuleSetNameOk() (ret CreateWAFResponseGetCoreRuleSetNameRetType, ok bool) { + return getCreateWAFResponseGetCoreRuleSetNameAttributeTypeOk(o.CoreRuleSetName) +} + +// HasCoreRuleSetName returns a boolean if a field has been set. +func (o *CreateWAFResponse) HasCoreRuleSetName() bool { + _, ok := o.GetCoreRuleSetNameOk() + return ok +} + +// SetCoreRuleSetName gets a reference to the given string and assigns it to the CoreRuleSetName field. +func (o *CreateWAFResponse) SetCoreRuleSetName(v CreateWAFResponseGetCoreRuleSetNameRetType) { + setCreateWAFResponseGetCoreRuleSetNameAttributeType(&o.CoreRuleSetName, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateWAFResponse) GetName() (res CreateWAFResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWAFResponse) GetNameOk() (ret CreateWAFResponseGetNameRetType, ok bool) { + return getCreateWAFResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateWAFResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateWAFResponse) SetName(v CreateWAFResponseGetNameRetType) { + setCreateWAFResponseGetNameAttributeType(&o.Name, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *CreateWAFResponse) GetRegion() (res CreateWAFResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWAFResponse) GetRegionOk() (ret CreateWAFResponseGetRegionRetType, ok bool) { + return getCreateWAFResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *CreateWAFResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *CreateWAFResponse) SetRegion(v CreateWAFResponseGetRegionRetType) { + setCreateWAFResponseGetRegionAttributeType(&o.Region, v) +} + +// GetRulesConfigName returns the RulesConfigName field value if set, zero value otherwise. +func (o *CreateWAFResponse) GetRulesConfigName() (res CreateWAFResponseGetRulesConfigNameRetType) { + res, _ = o.GetRulesConfigNameOk() + return +} + +// GetRulesConfigNameOk returns a tuple with the RulesConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWAFResponse) GetRulesConfigNameOk() (ret CreateWAFResponseGetRulesConfigNameRetType, ok bool) { + return getCreateWAFResponseGetRulesConfigNameAttributeTypeOk(o.RulesConfigName) +} + +// HasRulesConfigName returns a boolean if a field has been set. +func (o *CreateWAFResponse) HasRulesConfigName() bool { + _, ok := o.GetRulesConfigNameOk() + return ok +} + +// SetRulesConfigName gets a reference to the given string and assigns it to the RulesConfigName field. +func (o *CreateWAFResponse) SetRulesConfigName(v CreateWAFResponseGetRulesConfigNameRetType) { + setCreateWAFResponseGetRulesConfigNameAttributeType(&o.RulesConfigName, v) +} + +func (o CreateWAFResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateWAFResponseGetCoreRuleSetNameAttributeTypeOk(o.CoreRuleSetName); ok { + toSerialize["CoreRuleSetName"] = val + } + if val, ok := getCreateWAFResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateWAFResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getCreateWAFResponseGetRulesConfigNameAttributeTypeOk(o.RulesConfigName); ok { + toSerialize["RulesConfigName"] = val + } + return toSerialize, nil +} + +type NullableCreateWAFResponse struct { + value *CreateWAFResponse + isSet bool +} + +func (v NullableCreateWAFResponse) Get() *CreateWAFResponse { + return v.value +} + +func (v *NullableCreateWAFResponse) Set(val *CreateWAFResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateWAFResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateWAFResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateWAFResponse(val *CreateWAFResponse) *NullableCreateWAFResponse { + return &NullableCreateWAFResponse{value: val, isSet: true} +} + +func (v NullableCreateWAFResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateWAFResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_create_waf_response_test.go b/pkg/albwafalpha/model_create_waf_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_create_waf_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_get_core_rule_set_response.go b/pkg/albwafalpha/model_get_core_rule_set_response.go new file mode 100644 index 00000000..15510a0a --- /dev/null +++ b/pkg/albwafalpha/model_get_core_rule_set_response.go @@ -0,0 +1,226 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the GetCoreRuleSetResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCoreRuleSetResponse{} + +/* + types and functions for active +*/ + +// isBoolean +type GetCoreRuleSetResponsegetActiveAttributeType = *bool +type GetCoreRuleSetResponsegetActiveArgType = bool +type GetCoreRuleSetResponsegetActiveRetType = bool + +func getGetCoreRuleSetResponsegetActiveAttributeTypeOk(arg GetCoreRuleSetResponsegetActiveAttributeType) (ret GetCoreRuleSetResponsegetActiveRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCoreRuleSetResponsegetActiveAttributeType(arg *GetCoreRuleSetResponsegetActiveAttributeType, val GetCoreRuleSetResponsegetActiveRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type GetCoreRuleSetResponseGetNameAttributeType = *string + +func getGetCoreRuleSetResponseGetNameAttributeTypeOk(arg GetCoreRuleSetResponseGetNameAttributeType) (ret GetCoreRuleSetResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCoreRuleSetResponseGetNameAttributeType(arg *GetCoreRuleSetResponseGetNameAttributeType, val GetCoreRuleSetResponseGetNameRetType) { + *arg = &val +} + +type GetCoreRuleSetResponseGetNameArgType = string +type GetCoreRuleSetResponseGetNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type GetCoreRuleSetResponseGetRegionAttributeType = *string + +func getGetCoreRuleSetResponseGetRegionAttributeTypeOk(arg GetCoreRuleSetResponseGetRegionAttributeType) (ret GetCoreRuleSetResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCoreRuleSetResponseGetRegionAttributeType(arg *GetCoreRuleSetResponseGetRegionAttributeType, val GetCoreRuleSetResponseGetRegionRetType) { + *arg = &val +} + +type GetCoreRuleSetResponseGetRegionArgType = string +type GetCoreRuleSetResponseGetRegionRetType = string + +// GetCoreRuleSetResponse GetCoreRuleSetResponse returns rule configuration name and it's rules. +type GetCoreRuleSetResponse struct { + // Indicates if the OWASP core rule set is active. + Active GetCoreRuleSetResponsegetActiveAttributeType `json:"active,omitempty"` + // Core rule set configuration name. + Name GetCoreRuleSetResponseGetNameAttributeType `json:"name,omitempty"` + // Region + Region GetCoreRuleSetResponseGetRegionAttributeType `json:"region,omitempty"` +} + +// NewGetCoreRuleSetResponse instantiates a new GetCoreRuleSetResponse 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 NewGetCoreRuleSetResponse() *GetCoreRuleSetResponse { + this := GetCoreRuleSetResponse{} + return &this +} + +// NewGetCoreRuleSetResponseWithDefaults instantiates a new GetCoreRuleSetResponse 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 NewGetCoreRuleSetResponseWithDefaults() *GetCoreRuleSetResponse { + this := GetCoreRuleSetResponse{} + return &this +} + +// GetActive returns the Active field value if set, zero value otherwise. +func (o *GetCoreRuleSetResponse) GetActive() (res GetCoreRuleSetResponsegetActiveRetType) { + res, _ = o.GetActiveOk() + return +} + +// GetActiveOk returns a tuple with the Active field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCoreRuleSetResponse) GetActiveOk() (ret GetCoreRuleSetResponsegetActiveRetType, ok bool) { + return getGetCoreRuleSetResponsegetActiveAttributeTypeOk(o.Active) +} + +// HasActive returns a boolean if a field has been set. +func (o *GetCoreRuleSetResponse) HasActive() bool { + _, ok := o.GetActiveOk() + return ok +} + +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *GetCoreRuleSetResponse) SetActive(v GetCoreRuleSetResponsegetActiveRetType) { + setGetCoreRuleSetResponsegetActiveAttributeType(&o.Active, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetCoreRuleSetResponse) GetName() (res GetCoreRuleSetResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCoreRuleSetResponse) GetNameOk() (ret GetCoreRuleSetResponseGetNameRetType, ok bool) { + return getGetCoreRuleSetResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *GetCoreRuleSetResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *GetCoreRuleSetResponse) SetName(v GetCoreRuleSetResponseGetNameRetType) { + setGetCoreRuleSetResponseGetNameAttributeType(&o.Name, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *GetCoreRuleSetResponse) GetRegion() (res GetCoreRuleSetResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCoreRuleSetResponse) GetRegionOk() (ret GetCoreRuleSetResponseGetRegionRetType, ok bool) { + return getGetCoreRuleSetResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *GetCoreRuleSetResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *GetCoreRuleSetResponse) SetRegion(v GetCoreRuleSetResponseGetRegionRetType) { + setGetCoreRuleSetResponseGetRegionAttributeType(&o.Region, v) +} + +func (o GetCoreRuleSetResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCoreRuleSetResponsegetActiveAttributeTypeOk(o.Active); ok { + toSerialize["Active"] = val + } + if val, ok := getGetCoreRuleSetResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGetCoreRuleSetResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullableGetCoreRuleSetResponse struct { + value *GetCoreRuleSetResponse + isSet bool +} + +func (v NullableGetCoreRuleSetResponse) Get() *GetCoreRuleSetResponse { + return v.value +} + +func (v *NullableGetCoreRuleSetResponse) Set(val *GetCoreRuleSetResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetCoreRuleSetResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCoreRuleSetResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCoreRuleSetResponse(val *GetCoreRuleSetResponse) *NullableGetCoreRuleSetResponse { + return &NullableGetCoreRuleSetResponse{value: val, isSet: true} +} + +func (v NullableGetCoreRuleSetResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCoreRuleSetResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_get_core_rule_set_response_test.go b/pkg/albwafalpha/model_get_core_rule_set_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_get_core_rule_set_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_get_rules_response.go b/pkg/albwafalpha/model_get_rules_response.go new file mode 100644 index 00000000..a189ef5c --- /dev/null +++ b/pkg/albwafalpha/model_get_rules_response.go @@ -0,0 +1,227 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the GetRulesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetRulesResponse{} + +/* + types and functions for name +*/ + +// isNotNullableString +type GetRulesResponseGetNameAttributeType = *string + +func getGetRulesResponseGetNameAttributeTypeOk(arg GetRulesResponseGetNameAttributeType) (ret GetRulesResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetRulesResponseGetNameAttributeType(arg *GetRulesResponseGetNameAttributeType, val GetRulesResponseGetNameRetType) { + *arg = &val +} + +type GetRulesResponseGetNameArgType = string +type GetRulesResponseGetNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type GetRulesResponseGetRegionAttributeType = *string + +func getGetRulesResponseGetRegionAttributeTypeOk(arg GetRulesResponseGetRegionAttributeType) (ret GetRulesResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetRulesResponseGetRegionAttributeType(arg *GetRulesResponseGetRegionAttributeType, val GetRulesResponseGetRegionRetType) { + *arg = &val +} + +type GetRulesResponseGetRegionArgType = string +type GetRulesResponseGetRegionRetType = string + +/* + types and functions for rules +*/ + +// isNotNullableString +type GetRulesResponseGetRulesAttributeType = *string + +func getGetRulesResponseGetRulesAttributeTypeOk(arg GetRulesResponseGetRulesAttributeType) (ret GetRulesResponseGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetRulesResponseGetRulesAttributeType(arg *GetRulesResponseGetRulesAttributeType, val GetRulesResponseGetRulesRetType) { + *arg = &val +} + +type GetRulesResponseGetRulesArgType = string +type GetRulesResponseGetRulesRetType = string + +// GetRulesResponse GetRulesResponse returns rule configuration name and it's rules. +type GetRulesResponse struct { + // Rule configuration name. + Name GetRulesResponseGetNameAttributeType `json:"name,omitempty"` + // Region + Region GetRulesResponseGetRegionAttributeType `json:"region,omitempty"` + // Custom rules written in Seclang syntax. + Rules GetRulesResponseGetRulesAttributeType `json:"rules,omitempty"` +} + +// NewGetRulesResponse instantiates a new GetRulesResponse 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 NewGetRulesResponse() *GetRulesResponse { + this := GetRulesResponse{} + return &this +} + +// NewGetRulesResponseWithDefaults instantiates a new GetRulesResponse 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 NewGetRulesResponseWithDefaults() *GetRulesResponse { + this := GetRulesResponse{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetRulesResponse) GetName() (res GetRulesResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRulesResponse) GetNameOk() (ret GetRulesResponseGetNameRetType, ok bool) { + return getGetRulesResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *GetRulesResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *GetRulesResponse) SetName(v GetRulesResponseGetNameRetType) { + setGetRulesResponseGetNameAttributeType(&o.Name, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *GetRulesResponse) GetRegion() (res GetRulesResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRulesResponse) GetRegionOk() (ret GetRulesResponseGetRegionRetType, ok bool) { + return getGetRulesResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *GetRulesResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *GetRulesResponse) SetRegion(v GetRulesResponseGetRegionRetType) { + setGetRulesResponseGetRegionAttributeType(&o.Region, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *GetRulesResponse) GetRules() (res GetRulesResponseGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetRulesResponse) GetRulesOk() (ret GetRulesResponseGetRulesRetType, ok bool) { + return getGetRulesResponseGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *GetRulesResponse) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given string and assigns it to the Rules field. +func (o *GetRulesResponse) SetRules(v GetRulesResponseGetRulesRetType) { + setGetRulesResponseGetRulesAttributeType(&o.Rules, v) +} + +func (o GetRulesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetRulesResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGetRulesResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getGetRulesResponseGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableGetRulesResponse struct { + value *GetRulesResponse + isSet bool +} + +func (v NullableGetRulesResponse) Get() *GetRulesResponse { + return v.value +} + +func (v *NullableGetRulesResponse) Set(val *GetRulesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetRulesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetRulesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetRulesResponse(val *GetRulesResponse) *NullableGetRulesResponse { + return &NullableGetRulesResponse{value: val, isSet: true} +} + +func (v NullableGetRulesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetRulesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_get_rules_response_test.go b/pkg/albwafalpha/model_get_rules_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_get_rules_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_get_waf_response.go b/pkg/albwafalpha/model_get_waf_response.go new file mode 100644 index 00000000..53e4f315 --- /dev/null +++ b/pkg/albwafalpha/model_get_waf_response.go @@ -0,0 +1,276 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the GetWAFResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetWAFResponse{} + +/* + types and functions for coreRuleSetName +*/ + +// isNotNullableString +type GetWAFResponseGetCoreRuleSetNameAttributeType = *string + +func getGetWAFResponseGetCoreRuleSetNameAttributeTypeOk(arg GetWAFResponseGetCoreRuleSetNameAttributeType) (ret GetWAFResponseGetCoreRuleSetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetWAFResponseGetCoreRuleSetNameAttributeType(arg *GetWAFResponseGetCoreRuleSetNameAttributeType, val GetWAFResponseGetCoreRuleSetNameRetType) { + *arg = &val +} + +type GetWAFResponseGetCoreRuleSetNameArgType = string +type GetWAFResponseGetCoreRuleSetNameRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type GetWAFResponseGetNameAttributeType = *string + +func getGetWAFResponseGetNameAttributeTypeOk(arg GetWAFResponseGetNameAttributeType) (ret GetWAFResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetWAFResponseGetNameAttributeType(arg *GetWAFResponseGetNameAttributeType, val GetWAFResponseGetNameRetType) { + *arg = &val +} + +type GetWAFResponseGetNameArgType = string +type GetWAFResponseGetNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type GetWAFResponseGetRegionAttributeType = *string + +func getGetWAFResponseGetRegionAttributeTypeOk(arg GetWAFResponseGetRegionAttributeType) (ret GetWAFResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetWAFResponseGetRegionAttributeType(arg *GetWAFResponseGetRegionAttributeType, val GetWAFResponseGetRegionRetType) { + *arg = &val +} + +type GetWAFResponseGetRegionArgType = string +type GetWAFResponseGetRegionRetType = string + +/* + types and functions for rulesConfigName +*/ + +// isNotNullableString +type GetWAFResponseGetRulesConfigNameAttributeType = *string + +func getGetWAFResponseGetRulesConfigNameAttributeTypeOk(arg GetWAFResponseGetRulesConfigNameAttributeType) (ret GetWAFResponseGetRulesConfigNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetWAFResponseGetRulesConfigNameAttributeType(arg *GetWAFResponseGetRulesConfigNameAttributeType, val GetWAFResponseGetRulesConfigNameRetType) { + *arg = &val +} + +type GetWAFResponseGetRulesConfigNameArgType = string +type GetWAFResponseGetRulesConfigNameRetType = string + +// GetWAFResponse GetWAFResponse returns id, name and custom rules. +type GetWAFResponse struct { + // Name of the core rule set configuration for that WAF. + CoreRuleSetName GetWAFResponseGetCoreRuleSetNameAttributeType `json:"coreRuleSetName,omitempty"` + // WAF name + Name GetWAFResponseGetNameAttributeType `json:"name,omitempty"` + // Region + Region GetWAFResponseGetRegionAttributeType `json:"region,omitempty"` + // Name of the rule configuration for that WAF. + RulesConfigName GetWAFResponseGetRulesConfigNameAttributeType `json:"rulesConfigName,omitempty"` +} + +// NewGetWAFResponse instantiates a new GetWAFResponse 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 NewGetWAFResponse() *GetWAFResponse { + this := GetWAFResponse{} + return &this +} + +// NewGetWAFResponseWithDefaults instantiates a new GetWAFResponse 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 NewGetWAFResponseWithDefaults() *GetWAFResponse { + this := GetWAFResponse{} + return &this +} + +// GetCoreRuleSetName returns the CoreRuleSetName field value if set, zero value otherwise. +func (o *GetWAFResponse) GetCoreRuleSetName() (res GetWAFResponseGetCoreRuleSetNameRetType) { + res, _ = o.GetCoreRuleSetNameOk() + return +} + +// GetCoreRuleSetNameOk returns a tuple with the CoreRuleSetName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetWAFResponse) GetCoreRuleSetNameOk() (ret GetWAFResponseGetCoreRuleSetNameRetType, ok bool) { + return getGetWAFResponseGetCoreRuleSetNameAttributeTypeOk(o.CoreRuleSetName) +} + +// HasCoreRuleSetName returns a boolean if a field has been set. +func (o *GetWAFResponse) HasCoreRuleSetName() bool { + _, ok := o.GetCoreRuleSetNameOk() + return ok +} + +// SetCoreRuleSetName gets a reference to the given string and assigns it to the CoreRuleSetName field. +func (o *GetWAFResponse) SetCoreRuleSetName(v GetWAFResponseGetCoreRuleSetNameRetType) { + setGetWAFResponseGetCoreRuleSetNameAttributeType(&o.CoreRuleSetName, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetWAFResponse) GetName() (res GetWAFResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetWAFResponse) GetNameOk() (ret GetWAFResponseGetNameRetType, ok bool) { + return getGetWAFResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *GetWAFResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *GetWAFResponse) SetName(v GetWAFResponseGetNameRetType) { + setGetWAFResponseGetNameAttributeType(&o.Name, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *GetWAFResponse) GetRegion() (res GetWAFResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetWAFResponse) GetRegionOk() (ret GetWAFResponseGetRegionRetType, ok bool) { + return getGetWAFResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *GetWAFResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *GetWAFResponse) SetRegion(v GetWAFResponseGetRegionRetType) { + setGetWAFResponseGetRegionAttributeType(&o.Region, v) +} + +// GetRulesConfigName returns the RulesConfigName field value if set, zero value otherwise. +func (o *GetWAFResponse) GetRulesConfigName() (res GetWAFResponseGetRulesConfigNameRetType) { + res, _ = o.GetRulesConfigNameOk() + return +} + +// GetRulesConfigNameOk returns a tuple with the RulesConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetWAFResponse) GetRulesConfigNameOk() (ret GetWAFResponseGetRulesConfigNameRetType, ok bool) { + return getGetWAFResponseGetRulesConfigNameAttributeTypeOk(o.RulesConfigName) +} + +// HasRulesConfigName returns a boolean if a field has been set. +func (o *GetWAFResponse) HasRulesConfigName() bool { + _, ok := o.GetRulesConfigNameOk() + return ok +} + +// SetRulesConfigName gets a reference to the given string and assigns it to the RulesConfigName field. +func (o *GetWAFResponse) SetRulesConfigName(v GetWAFResponseGetRulesConfigNameRetType) { + setGetWAFResponseGetRulesConfigNameAttributeType(&o.RulesConfigName, v) +} + +func (o GetWAFResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetWAFResponseGetCoreRuleSetNameAttributeTypeOk(o.CoreRuleSetName); ok { + toSerialize["CoreRuleSetName"] = val + } + if val, ok := getGetWAFResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGetWAFResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getGetWAFResponseGetRulesConfigNameAttributeTypeOk(o.RulesConfigName); ok { + toSerialize["RulesConfigName"] = val + } + return toSerialize, nil +} + +type NullableGetWAFResponse struct { + value *GetWAFResponse + isSet bool +} + +func (v NullableGetWAFResponse) Get() *GetWAFResponse { + return v.value +} + +func (v *NullableGetWAFResponse) Set(val *GetWAFResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetWAFResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetWAFResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetWAFResponse(val *GetWAFResponse) *NullableGetWAFResponse { + return &NullableGetWAFResponse{value: val, isSet: true} +} + +func (v NullableGetWAFResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetWAFResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_get_waf_response_test.go b/pkg/albwafalpha/model_get_waf_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_get_waf_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_google_protobuf_any.go b/pkg/albwafalpha/model_google_protobuf_any.go new file mode 100644 index 00000000..15b55610 --- /dev/null +++ b/pkg/albwafalpha/model_google_protobuf_any.go @@ -0,0 +1,137 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the GoogleProtobufAny type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GoogleProtobufAny{} + +/* + types and functions for @type +*/ + +// isNotNullableString +type GoogleProtobufAnyGetTypeAttributeType = *string + +func getGoogleProtobufAnyGetTypeAttributeTypeOk(arg GoogleProtobufAnyGetTypeAttributeType) (ret GoogleProtobufAnyGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGoogleProtobufAnyGetTypeAttributeType(arg *GoogleProtobufAnyGetTypeAttributeType, val GoogleProtobufAnyGetTypeRetType) { + *arg = &val +} + +type GoogleProtobufAnyGetTypeArgType = string +type GoogleProtobufAnyGetTypeRetType = string + +// GoogleProtobufAny Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. +type GoogleProtobufAny struct { + // The type of the serialized message. + Type GoogleProtobufAnyGetTypeAttributeType `json:"@type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GoogleProtobufAny GoogleProtobufAny + +// NewGoogleProtobufAny instantiates a new GoogleProtobufAny 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 NewGoogleProtobufAny() *GoogleProtobufAny { + this := GoogleProtobufAny{} + return &this +} + +// NewGoogleProtobufAnyWithDefaults instantiates a new GoogleProtobufAny 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 NewGoogleProtobufAnyWithDefaults() *GoogleProtobufAny { + this := GoogleProtobufAny{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *GoogleProtobufAny) GetType() (res GoogleProtobufAnyGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GoogleProtobufAny) GetTypeOk() (ret GoogleProtobufAnyGetTypeRetType, ok bool) { + return getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *GoogleProtobufAny) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *GoogleProtobufAny) SetType(v GoogleProtobufAnyGetTypeRetType) { + setGoogleProtobufAnyGetTypeAttributeType(&o.Type, v) +} + +func (o GoogleProtobufAny) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +type NullableGoogleProtobufAny struct { + value *GoogleProtobufAny + isSet bool +} + +func (v NullableGoogleProtobufAny) Get() *GoogleProtobufAny { + return v.value +} + +func (v *NullableGoogleProtobufAny) Set(val *GoogleProtobufAny) { + v.value = val + v.isSet = true +} + +func (v NullableGoogleProtobufAny) IsSet() bool { + return v.isSet +} + +func (v *NullableGoogleProtobufAny) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGoogleProtobufAny(val *GoogleProtobufAny) *NullableGoogleProtobufAny { + return &NullableGoogleProtobufAny{value: val, isSet: true} +} + +func (v NullableGoogleProtobufAny) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGoogleProtobufAny) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_google_protobuf_any_test.go b/pkg/albwafalpha/model_google_protobuf_any_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_google_protobuf_any_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_list_core_rule_set_response.go b/pkg/albwafalpha/model_list_core_rule_set_response.go new file mode 100644 index 00000000..1c4d8b66 --- /dev/null +++ b/pkg/albwafalpha/model_list_core_rule_set_response.go @@ -0,0 +1,176 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the ListCoreRuleSetResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListCoreRuleSetResponse{} + +/* + types and functions for items +*/ + +// isArray +type ListCoreRuleSetResponseGetItemsAttributeType = *[]GetCoreRuleSetResponse +type ListCoreRuleSetResponseGetItemsArgType = []GetCoreRuleSetResponse +type ListCoreRuleSetResponseGetItemsRetType = []GetCoreRuleSetResponse + +func getListCoreRuleSetResponseGetItemsAttributeTypeOk(arg ListCoreRuleSetResponseGetItemsAttributeType) (ret ListCoreRuleSetResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListCoreRuleSetResponseGetItemsAttributeType(arg *ListCoreRuleSetResponseGetItemsAttributeType, val ListCoreRuleSetResponseGetItemsRetType) { + *arg = &val +} + +/* + types and functions for nextPageId +*/ + +// isNotNullableString +type ListCoreRuleSetResponseGetNextPageIdAttributeType = *string + +func getListCoreRuleSetResponseGetNextPageIdAttributeTypeOk(arg ListCoreRuleSetResponseGetNextPageIdAttributeType) (ret ListCoreRuleSetResponseGetNextPageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListCoreRuleSetResponseGetNextPageIdAttributeType(arg *ListCoreRuleSetResponseGetNextPageIdAttributeType, val ListCoreRuleSetResponseGetNextPageIdRetType) { + *arg = &val +} + +type ListCoreRuleSetResponseGetNextPageIdArgType = string +type ListCoreRuleSetResponseGetNextPageIdRetType = string + +// ListCoreRuleSetResponse ListCoreRuleSetResponse returns a list of rule configuration responses. +type ListCoreRuleSetResponse struct { + Items ListCoreRuleSetResponseGetItemsAttributeType `json:"items,omitempty"` + // Continue token from the ListCoreRuleSetResponse with Limit option + NextPageId ListCoreRuleSetResponseGetNextPageIdAttributeType `json:"nextPageId,omitempty"` +} + +// NewListCoreRuleSetResponse instantiates a new ListCoreRuleSetResponse 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 NewListCoreRuleSetResponse() *ListCoreRuleSetResponse { + this := ListCoreRuleSetResponse{} + return &this +} + +// NewListCoreRuleSetResponseWithDefaults instantiates a new ListCoreRuleSetResponse 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 NewListCoreRuleSetResponseWithDefaults() *ListCoreRuleSetResponse { + this := ListCoreRuleSetResponse{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ListCoreRuleSetResponse) GetItems() (res ListCoreRuleSetResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListCoreRuleSetResponse) GetItemsOk() (ret ListCoreRuleSetResponseGetItemsRetType, ok bool) { + return getListCoreRuleSetResponseGetItemsAttributeTypeOk(o.Items) +} + +// HasItems returns a boolean if a field has been set. +func (o *ListCoreRuleSetResponse) HasItems() bool { + _, ok := o.GetItemsOk() + return ok +} + +// SetItems gets a reference to the given []GetCoreRuleSetResponse and assigns it to the Items field. +func (o *ListCoreRuleSetResponse) SetItems(v ListCoreRuleSetResponseGetItemsRetType) { + setListCoreRuleSetResponseGetItemsAttributeType(&o.Items, v) +} + +// GetNextPageId returns the NextPageId field value if set, zero value otherwise. +func (o *ListCoreRuleSetResponse) GetNextPageId() (res ListCoreRuleSetResponseGetNextPageIdRetType) { + res, _ = o.GetNextPageIdOk() + return +} + +// GetNextPageIdOk returns a tuple with the NextPageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListCoreRuleSetResponse) GetNextPageIdOk() (ret ListCoreRuleSetResponseGetNextPageIdRetType, ok bool) { + return getListCoreRuleSetResponseGetNextPageIdAttributeTypeOk(o.NextPageId) +} + +// HasNextPageId returns a boolean if a field has been set. +func (o *ListCoreRuleSetResponse) HasNextPageId() bool { + _, ok := o.GetNextPageIdOk() + return ok +} + +// SetNextPageId gets a reference to the given string and assigns it to the NextPageId field. +func (o *ListCoreRuleSetResponse) SetNextPageId(v ListCoreRuleSetResponseGetNextPageIdRetType) { + setListCoreRuleSetResponseGetNextPageIdAttributeType(&o.NextPageId, v) +} + +func (o ListCoreRuleSetResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListCoreRuleSetResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + if val, ok := getListCoreRuleSetResponseGetNextPageIdAttributeTypeOk(o.NextPageId); ok { + toSerialize["NextPageId"] = val + } + return toSerialize, nil +} + +type NullableListCoreRuleSetResponse struct { + value *ListCoreRuleSetResponse + isSet bool +} + +func (v NullableListCoreRuleSetResponse) Get() *ListCoreRuleSetResponse { + return v.value +} + +func (v *NullableListCoreRuleSetResponse) Set(val *ListCoreRuleSetResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListCoreRuleSetResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListCoreRuleSetResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListCoreRuleSetResponse(val *ListCoreRuleSetResponse) *NullableListCoreRuleSetResponse { + return &NullableListCoreRuleSetResponse{value: val, isSet: true} +} + +func (v NullableListCoreRuleSetResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListCoreRuleSetResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_list_core_rule_set_response_test.go b/pkg/albwafalpha/model_list_core_rule_set_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_list_core_rule_set_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_list_rules_response.go b/pkg/albwafalpha/model_list_rules_response.go new file mode 100644 index 00000000..befd13ba --- /dev/null +++ b/pkg/albwafalpha/model_list_rules_response.go @@ -0,0 +1,176 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the ListRulesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListRulesResponse{} + +/* + types and functions for items +*/ + +// isArray +type ListRulesResponseGetItemsAttributeType = *[]GetRulesResponse +type ListRulesResponseGetItemsArgType = []GetRulesResponse +type ListRulesResponseGetItemsRetType = []GetRulesResponse + +func getListRulesResponseGetItemsAttributeTypeOk(arg ListRulesResponseGetItemsAttributeType) (ret ListRulesResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListRulesResponseGetItemsAttributeType(arg *ListRulesResponseGetItemsAttributeType, val ListRulesResponseGetItemsRetType) { + *arg = &val +} + +/* + types and functions for nextPageId +*/ + +// isNotNullableString +type ListRulesResponseGetNextPageIdAttributeType = *string + +func getListRulesResponseGetNextPageIdAttributeTypeOk(arg ListRulesResponseGetNextPageIdAttributeType) (ret ListRulesResponseGetNextPageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListRulesResponseGetNextPageIdAttributeType(arg *ListRulesResponseGetNextPageIdAttributeType, val ListRulesResponseGetNextPageIdRetType) { + *arg = &val +} + +type ListRulesResponseGetNextPageIdArgType = string +type ListRulesResponseGetNextPageIdRetType = string + +// ListRulesResponse ListRulesResponse returns a list of rule configuration responses. +type ListRulesResponse struct { + Items ListRulesResponseGetItemsAttributeType `json:"items,omitempty"` + // Continue token from the ListRulesResponse with Limit option + NextPageId ListRulesResponseGetNextPageIdAttributeType `json:"nextPageId,omitempty"` +} + +// NewListRulesResponse instantiates a new ListRulesResponse 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 NewListRulesResponse() *ListRulesResponse { + this := ListRulesResponse{} + return &this +} + +// NewListRulesResponseWithDefaults instantiates a new ListRulesResponse 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 NewListRulesResponseWithDefaults() *ListRulesResponse { + this := ListRulesResponse{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ListRulesResponse) GetItems() (res ListRulesResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListRulesResponse) GetItemsOk() (ret ListRulesResponseGetItemsRetType, ok bool) { + return getListRulesResponseGetItemsAttributeTypeOk(o.Items) +} + +// HasItems returns a boolean if a field has been set. +func (o *ListRulesResponse) HasItems() bool { + _, ok := o.GetItemsOk() + return ok +} + +// SetItems gets a reference to the given []GetRulesResponse and assigns it to the Items field. +func (o *ListRulesResponse) SetItems(v ListRulesResponseGetItemsRetType) { + setListRulesResponseGetItemsAttributeType(&o.Items, v) +} + +// GetNextPageId returns the NextPageId field value if set, zero value otherwise. +func (o *ListRulesResponse) GetNextPageId() (res ListRulesResponseGetNextPageIdRetType) { + res, _ = o.GetNextPageIdOk() + return +} + +// GetNextPageIdOk returns a tuple with the NextPageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListRulesResponse) GetNextPageIdOk() (ret ListRulesResponseGetNextPageIdRetType, ok bool) { + return getListRulesResponseGetNextPageIdAttributeTypeOk(o.NextPageId) +} + +// HasNextPageId returns a boolean if a field has been set. +func (o *ListRulesResponse) HasNextPageId() bool { + _, ok := o.GetNextPageIdOk() + return ok +} + +// SetNextPageId gets a reference to the given string and assigns it to the NextPageId field. +func (o *ListRulesResponse) SetNextPageId(v ListRulesResponseGetNextPageIdRetType) { + setListRulesResponseGetNextPageIdAttributeType(&o.NextPageId, v) +} + +func (o ListRulesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListRulesResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + if val, ok := getListRulesResponseGetNextPageIdAttributeTypeOk(o.NextPageId); ok { + toSerialize["NextPageId"] = val + } + return toSerialize, nil +} + +type NullableListRulesResponse struct { + value *ListRulesResponse + isSet bool +} + +func (v NullableListRulesResponse) Get() *ListRulesResponse { + return v.value +} + +func (v *NullableListRulesResponse) Set(val *ListRulesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListRulesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListRulesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListRulesResponse(val *ListRulesResponse) *NullableListRulesResponse { + return &NullableListRulesResponse{value: val, isSet: true} +} + +func (v NullableListRulesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListRulesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_list_rules_response_test.go b/pkg/albwafalpha/model_list_rules_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_list_rules_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_list_waf_response.go b/pkg/albwafalpha/model_list_waf_response.go new file mode 100644 index 00000000..67bd31a3 --- /dev/null +++ b/pkg/albwafalpha/model_list_waf_response.go @@ -0,0 +1,176 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the ListWAFResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListWAFResponse{} + +/* + types and functions for items +*/ + +// isArray +type ListWAFResponseGetItemsAttributeType = *[]GetWAFResponse +type ListWAFResponseGetItemsArgType = []GetWAFResponse +type ListWAFResponseGetItemsRetType = []GetWAFResponse + +func getListWAFResponseGetItemsAttributeTypeOk(arg ListWAFResponseGetItemsAttributeType) (ret ListWAFResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListWAFResponseGetItemsAttributeType(arg *ListWAFResponseGetItemsAttributeType, val ListWAFResponseGetItemsRetType) { + *arg = &val +} + +/* + types and functions for nextPageId +*/ + +// isNotNullableString +type ListWAFResponseGetNextPageIdAttributeType = *string + +func getListWAFResponseGetNextPageIdAttributeTypeOk(arg ListWAFResponseGetNextPageIdAttributeType) (ret ListWAFResponseGetNextPageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListWAFResponseGetNextPageIdAttributeType(arg *ListWAFResponseGetNextPageIdAttributeType, val ListWAFResponseGetNextPageIdRetType) { + *arg = &val +} + +type ListWAFResponseGetNextPageIdArgType = string +type ListWAFResponseGetNextPageIdRetType = string + +// ListWAFResponse ListWAFResponse returns a list of WAF responses. +type ListWAFResponse struct { + Items ListWAFResponseGetItemsAttributeType `json:"items,omitempty"` + // Continue token from the ListWAFResponse with Limit option + NextPageId ListWAFResponseGetNextPageIdAttributeType `json:"nextPageId,omitempty"` +} + +// NewListWAFResponse instantiates a new ListWAFResponse 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 NewListWAFResponse() *ListWAFResponse { + this := ListWAFResponse{} + return &this +} + +// NewListWAFResponseWithDefaults instantiates a new ListWAFResponse 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 NewListWAFResponseWithDefaults() *ListWAFResponse { + this := ListWAFResponse{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ListWAFResponse) GetItems() (res ListWAFResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListWAFResponse) GetItemsOk() (ret ListWAFResponseGetItemsRetType, ok bool) { + return getListWAFResponseGetItemsAttributeTypeOk(o.Items) +} + +// HasItems returns a boolean if a field has been set. +func (o *ListWAFResponse) HasItems() bool { + _, ok := o.GetItemsOk() + return ok +} + +// SetItems gets a reference to the given []GetWAFResponse and assigns it to the Items field. +func (o *ListWAFResponse) SetItems(v ListWAFResponseGetItemsRetType) { + setListWAFResponseGetItemsAttributeType(&o.Items, v) +} + +// GetNextPageId returns the NextPageId field value if set, zero value otherwise. +func (o *ListWAFResponse) GetNextPageId() (res ListWAFResponseGetNextPageIdRetType) { + res, _ = o.GetNextPageIdOk() + return +} + +// GetNextPageIdOk returns a tuple with the NextPageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListWAFResponse) GetNextPageIdOk() (ret ListWAFResponseGetNextPageIdRetType, ok bool) { + return getListWAFResponseGetNextPageIdAttributeTypeOk(o.NextPageId) +} + +// HasNextPageId returns a boolean if a field has been set. +func (o *ListWAFResponse) HasNextPageId() bool { + _, ok := o.GetNextPageIdOk() + return ok +} + +// SetNextPageId gets a reference to the given string and assigns it to the NextPageId field. +func (o *ListWAFResponse) SetNextPageId(v ListWAFResponseGetNextPageIdRetType) { + setListWAFResponseGetNextPageIdAttributeType(&o.NextPageId, v) +} + +func (o ListWAFResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListWAFResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + if val, ok := getListWAFResponseGetNextPageIdAttributeTypeOk(o.NextPageId); ok { + toSerialize["NextPageId"] = val + } + return toSerialize, nil +} + +type NullableListWAFResponse struct { + value *ListWAFResponse + isSet bool +} + +func (v NullableListWAFResponse) Get() *ListWAFResponse { + return v.value +} + +func (v *NullableListWAFResponse) Set(val *ListWAFResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListWAFResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListWAFResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListWAFResponse(val *ListWAFResponse) *NullableListWAFResponse { + return &NullableListWAFResponse{value: val, isSet: true} +} + +func (v NullableListWAFResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListWAFResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_list_waf_response_test.go b/pkg/albwafalpha/model_list_waf_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_list_waf_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_status.go b/pkg/albwafalpha/model_status.go new file mode 100644 index 00000000..a12fd4ce --- /dev/null +++ b/pkg/albwafalpha/model_status.go @@ -0,0 +1,226 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the Status type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Status{} + +/* + types and functions for code +*/ + +// isInteger +type StatusGetCodeAttributeType = *int64 +type StatusGetCodeArgType = int64 +type StatusGetCodeRetType = int64 + +func getStatusGetCodeAttributeTypeOk(arg StatusGetCodeAttributeType) (ret StatusGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetCodeAttributeType(arg *StatusGetCodeAttributeType, val StatusGetCodeRetType) { + *arg = &val +} + +/* + types and functions for details +*/ + +// isArray +type StatusGetDetailsAttributeType = *[]GoogleProtobufAny +type StatusGetDetailsArgType = []GoogleProtobufAny +type StatusGetDetailsRetType = []GoogleProtobufAny + +func getStatusGetDetailsAttributeTypeOk(arg StatusGetDetailsAttributeType) (ret StatusGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetDetailsAttributeType(arg *StatusGetDetailsAttributeType, val StatusGetDetailsRetType) { + *arg = &val +} + +/* + types and functions for message +*/ + +// isNotNullableString +type StatusGetMessageAttributeType = *string + +func getStatusGetMessageAttributeTypeOk(arg StatusGetMessageAttributeType) (ret StatusGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetMessageAttributeType(arg *StatusGetMessageAttributeType, val StatusGetMessageRetType) { + *arg = &val +} + +type StatusGetMessageArgType = string +type StatusGetMessageRetType = string + +// Status The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). +type Status struct { + // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + // Can be cast to int32 without loss of precision. + Code StatusGetCodeAttributeType `json:"code,omitempty"` + // A list of messages that carry the error details. There is a common set of message types for APIs to use. + Details StatusGetDetailsAttributeType `json:"details,omitempty"` + // A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + Message StatusGetMessageAttributeType `json:"message,omitempty"` +} + +// NewStatus instantiates a new Status 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 NewStatus() *Status { + this := Status{} + return &this +} + +// NewStatusWithDefaults instantiates a new Status 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 NewStatusWithDefaults() *Status { + this := Status{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *Status) GetCode() (res StatusGetCodeRetType) { + res, _ = o.GetCodeOk() + return +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetCodeOk() (ret StatusGetCodeRetType, ok bool) { + return getStatusGetCodeAttributeTypeOk(o.Code) +} + +// HasCode returns a boolean if a field has been set. +func (o *Status) HasCode() bool { + _, ok := o.GetCodeOk() + return ok +} + +// SetCode gets a reference to the given int64 and assigns it to the Code field. +func (o *Status) SetCode(v StatusGetCodeRetType) { + setStatusGetCodeAttributeType(&o.Code, v) +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *Status) GetDetails() (res StatusGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetDetailsOk() (ret StatusGetDetailsRetType, ok bool) { + return getStatusGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *Status) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given []GoogleProtobufAny and assigns it to the Details field. +func (o *Status) SetDetails(v StatusGetDetailsRetType) { + setStatusGetDetailsAttributeType(&o.Details, v) +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *Status) GetMessage() (res StatusGetMessageRetType) { + res, _ = o.GetMessageOk() + return +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetMessageOk() (ret StatusGetMessageRetType, ok bool) { + return getStatusGetMessageAttributeTypeOk(o.Message) +} + +// HasMessage returns a boolean if a field has been set. +func (o *Status) HasMessage() bool { + _, ok := o.GetMessageOk() + return ok +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *Status) SetMessage(v StatusGetMessageRetType) { + setStatusGetMessageAttributeType(&o.Message, v) +} + +func (o Status) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getStatusGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getStatusGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getStatusGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableStatus struct { + value *Status + isSet bool +} + +func (v NullableStatus) Get() *Status { + return v.value +} + +func (v *NullableStatus) Set(val *Status) { + v.value = val + v.isSet = true +} + +func (v NullableStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStatus(val *Status) *NullableStatus { + return &NullableStatus{value: val, isSet: true} +} + +func (v NullableStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_status_test.go b/pkg/albwafalpha/model_status_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_status_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_update_core_rule_set_payload.go b/pkg/albwafalpha/model_update_core_rule_set_payload.go new file mode 100644 index 00000000..a5ce556c --- /dev/null +++ b/pkg/albwafalpha/model_update_core_rule_set_payload.go @@ -0,0 +1,275 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the UpdateCoreRuleSetPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateCoreRuleSetPayload{} + +/* + types and functions for active +*/ + +// isBoolean +type UpdateCoreRuleSetPayloadgetActiveAttributeType = *bool +type UpdateCoreRuleSetPayloadgetActiveArgType = bool +type UpdateCoreRuleSetPayloadgetActiveRetType = bool + +func getUpdateCoreRuleSetPayloadgetActiveAttributeTypeOk(arg UpdateCoreRuleSetPayloadgetActiveAttributeType) (ret UpdateCoreRuleSetPayloadgetActiveRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCoreRuleSetPayloadgetActiveAttributeType(arg *UpdateCoreRuleSetPayloadgetActiveAttributeType, val UpdateCoreRuleSetPayloadgetActiveRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateCoreRuleSetPayloadGetNameAttributeType = *string + +func getUpdateCoreRuleSetPayloadGetNameAttributeTypeOk(arg UpdateCoreRuleSetPayloadGetNameAttributeType) (ret UpdateCoreRuleSetPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCoreRuleSetPayloadGetNameAttributeType(arg *UpdateCoreRuleSetPayloadGetNameAttributeType, val UpdateCoreRuleSetPayloadGetNameRetType) { + *arg = &val +} + +type UpdateCoreRuleSetPayloadGetNameArgType = string +type UpdateCoreRuleSetPayloadGetNameRetType = string + +/* + types and functions for projectId +*/ + +// isNotNullableString +type UpdateCoreRuleSetPayloadGetProjectIdAttributeType = *string + +func getUpdateCoreRuleSetPayloadGetProjectIdAttributeTypeOk(arg UpdateCoreRuleSetPayloadGetProjectIdAttributeType) (ret UpdateCoreRuleSetPayloadGetProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCoreRuleSetPayloadGetProjectIdAttributeType(arg *UpdateCoreRuleSetPayloadGetProjectIdAttributeType, val UpdateCoreRuleSetPayloadGetProjectIdRetType) { + *arg = &val +} + +type UpdateCoreRuleSetPayloadGetProjectIdArgType = string +type UpdateCoreRuleSetPayloadGetProjectIdRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type UpdateCoreRuleSetPayloadGetRegionAttributeType = *string + +func getUpdateCoreRuleSetPayloadGetRegionAttributeTypeOk(arg UpdateCoreRuleSetPayloadGetRegionAttributeType) (ret UpdateCoreRuleSetPayloadGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCoreRuleSetPayloadGetRegionAttributeType(arg *UpdateCoreRuleSetPayloadGetRegionAttributeType, val UpdateCoreRuleSetPayloadGetRegionRetType) { + *arg = &val +} + +type UpdateCoreRuleSetPayloadGetRegionArgType = string +type UpdateCoreRuleSetPayloadGetRegionRetType = string + +// UpdateCoreRuleSetPayload UpdateCoreRuleSetRequest updates a rules configuration, but only if it changed. +type UpdateCoreRuleSetPayload struct { + // To activate the OWASP core rule set, set this boolean to true. + Active UpdateCoreRuleSetPayloadgetActiveAttributeType `json:"active,omitempty"` + // Core rule set configuration name. + Name UpdateCoreRuleSetPayloadGetNameAttributeType `json:"name,omitempty"` + // Project identifier + ProjectId UpdateCoreRuleSetPayloadGetProjectIdAttributeType `json:"projectId,omitempty"` + // Region + Region UpdateCoreRuleSetPayloadGetRegionAttributeType `json:"region,omitempty"` +} + +// NewUpdateCoreRuleSetPayload instantiates a new UpdateCoreRuleSetPayload 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 NewUpdateCoreRuleSetPayload() *UpdateCoreRuleSetPayload { + this := UpdateCoreRuleSetPayload{} + return &this +} + +// NewUpdateCoreRuleSetPayloadWithDefaults instantiates a new UpdateCoreRuleSetPayload 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 NewUpdateCoreRuleSetPayloadWithDefaults() *UpdateCoreRuleSetPayload { + this := UpdateCoreRuleSetPayload{} + return &this +} + +// GetActive returns the Active field value if set, zero value otherwise. +func (o *UpdateCoreRuleSetPayload) GetActive() (res UpdateCoreRuleSetPayloadgetActiveRetType) { + res, _ = o.GetActiveOk() + return +} + +// GetActiveOk returns a tuple with the Active field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCoreRuleSetPayload) GetActiveOk() (ret UpdateCoreRuleSetPayloadgetActiveRetType, ok bool) { + return getUpdateCoreRuleSetPayloadgetActiveAttributeTypeOk(o.Active) +} + +// HasActive returns a boolean if a field has been set. +func (o *UpdateCoreRuleSetPayload) HasActive() bool { + _, ok := o.GetActiveOk() + return ok +} + +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *UpdateCoreRuleSetPayload) SetActive(v UpdateCoreRuleSetPayloadgetActiveRetType) { + setUpdateCoreRuleSetPayloadgetActiveAttributeType(&o.Active, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateCoreRuleSetPayload) GetName() (res UpdateCoreRuleSetPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCoreRuleSetPayload) GetNameOk() (ret UpdateCoreRuleSetPayloadGetNameRetType, ok bool) { + return getUpdateCoreRuleSetPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateCoreRuleSetPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateCoreRuleSetPayload) SetName(v UpdateCoreRuleSetPayloadGetNameRetType) { + setUpdateCoreRuleSetPayloadGetNameAttributeType(&o.Name, v) +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *UpdateCoreRuleSetPayload) GetProjectId() (res UpdateCoreRuleSetPayloadGetProjectIdRetType) { + res, _ = o.GetProjectIdOk() + return +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCoreRuleSetPayload) GetProjectIdOk() (ret UpdateCoreRuleSetPayloadGetProjectIdRetType, ok bool) { + return getUpdateCoreRuleSetPayloadGetProjectIdAttributeTypeOk(o.ProjectId) +} + +// HasProjectId returns a boolean if a field has been set. +func (o *UpdateCoreRuleSetPayload) HasProjectId() bool { + _, ok := o.GetProjectIdOk() + return ok +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *UpdateCoreRuleSetPayload) SetProjectId(v UpdateCoreRuleSetPayloadGetProjectIdRetType) { + setUpdateCoreRuleSetPayloadGetProjectIdAttributeType(&o.ProjectId, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *UpdateCoreRuleSetPayload) GetRegion() (res UpdateCoreRuleSetPayloadGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCoreRuleSetPayload) GetRegionOk() (ret UpdateCoreRuleSetPayloadGetRegionRetType, ok bool) { + return getUpdateCoreRuleSetPayloadGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *UpdateCoreRuleSetPayload) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *UpdateCoreRuleSetPayload) SetRegion(v UpdateCoreRuleSetPayloadGetRegionRetType) { + setUpdateCoreRuleSetPayloadGetRegionAttributeType(&o.Region, v) +} + +func (o UpdateCoreRuleSetPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateCoreRuleSetPayloadgetActiveAttributeTypeOk(o.Active); ok { + toSerialize["Active"] = val + } + if val, ok := getUpdateCoreRuleSetPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateCoreRuleSetPayloadGetProjectIdAttributeTypeOk(o.ProjectId); ok { + toSerialize["ProjectId"] = val + } + if val, ok := getUpdateCoreRuleSetPayloadGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullableUpdateCoreRuleSetPayload struct { + value *UpdateCoreRuleSetPayload + isSet bool +} + +func (v NullableUpdateCoreRuleSetPayload) Get() *UpdateCoreRuleSetPayload { + return v.value +} + +func (v *NullableUpdateCoreRuleSetPayload) Set(val *UpdateCoreRuleSetPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateCoreRuleSetPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateCoreRuleSetPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateCoreRuleSetPayload(val *UpdateCoreRuleSetPayload) *NullableUpdateCoreRuleSetPayload { + return &NullableUpdateCoreRuleSetPayload{value: val, isSet: true} +} + +func (v NullableUpdateCoreRuleSetPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateCoreRuleSetPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_update_core_rule_set_payload_test.go b/pkg/albwafalpha/model_update_core_rule_set_payload_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_update_core_rule_set_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_update_core_rule_set_response.go b/pkg/albwafalpha/model_update_core_rule_set_response.go new file mode 100644 index 00000000..84115548 --- /dev/null +++ b/pkg/albwafalpha/model_update_core_rule_set_response.go @@ -0,0 +1,226 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the UpdateCoreRuleSetResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateCoreRuleSetResponse{} + +/* + types and functions for active +*/ + +// isBoolean +type UpdateCoreRuleSetResponsegetActiveAttributeType = *bool +type UpdateCoreRuleSetResponsegetActiveArgType = bool +type UpdateCoreRuleSetResponsegetActiveRetType = bool + +func getUpdateCoreRuleSetResponsegetActiveAttributeTypeOk(arg UpdateCoreRuleSetResponsegetActiveAttributeType) (ret UpdateCoreRuleSetResponsegetActiveRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCoreRuleSetResponsegetActiveAttributeType(arg *UpdateCoreRuleSetResponsegetActiveAttributeType, val UpdateCoreRuleSetResponsegetActiveRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateCoreRuleSetResponseGetNameAttributeType = *string + +func getUpdateCoreRuleSetResponseGetNameAttributeTypeOk(arg UpdateCoreRuleSetResponseGetNameAttributeType) (ret UpdateCoreRuleSetResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCoreRuleSetResponseGetNameAttributeType(arg *UpdateCoreRuleSetResponseGetNameAttributeType, val UpdateCoreRuleSetResponseGetNameRetType) { + *arg = &val +} + +type UpdateCoreRuleSetResponseGetNameArgType = string +type UpdateCoreRuleSetResponseGetNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type UpdateCoreRuleSetResponseGetRegionAttributeType = *string + +func getUpdateCoreRuleSetResponseGetRegionAttributeTypeOk(arg UpdateCoreRuleSetResponseGetRegionAttributeType) (ret UpdateCoreRuleSetResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateCoreRuleSetResponseGetRegionAttributeType(arg *UpdateCoreRuleSetResponseGetRegionAttributeType, val UpdateCoreRuleSetResponseGetRegionRetType) { + *arg = &val +} + +type UpdateCoreRuleSetResponseGetRegionArgType = string +type UpdateCoreRuleSetResponseGetRegionRetType = string + +// UpdateCoreRuleSetResponse UpdateCoreRuleSetResponse returns rule configuration name and it's rules. +type UpdateCoreRuleSetResponse struct { + // Indicates if the OWASP core rule set is active. + Active UpdateCoreRuleSetResponsegetActiveAttributeType `json:"active,omitempty"` + // Core rule set configuration name. + Name UpdateCoreRuleSetResponseGetNameAttributeType `json:"name,omitempty"` + // Region + Region UpdateCoreRuleSetResponseGetRegionAttributeType `json:"region,omitempty"` +} + +// NewUpdateCoreRuleSetResponse instantiates a new UpdateCoreRuleSetResponse 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 NewUpdateCoreRuleSetResponse() *UpdateCoreRuleSetResponse { + this := UpdateCoreRuleSetResponse{} + return &this +} + +// NewUpdateCoreRuleSetResponseWithDefaults instantiates a new UpdateCoreRuleSetResponse 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 NewUpdateCoreRuleSetResponseWithDefaults() *UpdateCoreRuleSetResponse { + this := UpdateCoreRuleSetResponse{} + return &this +} + +// GetActive returns the Active field value if set, zero value otherwise. +func (o *UpdateCoreRuleSetResponse) GetActive() (res UpdateCoreRuleSetResponsegetActiveRetType) { + res, _ = o.GetActiveOk() + return +} + +// GetActiveOk returns a tuple with the Active field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCoreRuleSetResponse) GetActiveOk() (ret UpdateCoreRuleSetResponsegetActiveRetType, ok bool) { + return getUpdateCoreRuleSetResponsegetActiveAttributeTypeOk(o.Active) +} + +// HasActive returns a boolean if a field has been set. +func (o *UpdateCoreRuleSetResponse) HasActive() bool { + _, ok := o.GetActiveOk() + return ok +} + +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *UpdateCoreRuleSetResponse) SetActive(v UpdateCoreRuleSetResponsegetActiveRetType) { + setUpdateCoreRuleSetResponsegetActiveAttributeType(&o.Active, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateCoreRuleSetResponse) GetName() (res UpdateCoreRuleSetResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCoreRuleSetResponse) GetNameOk() (ret UpdateCoreRuleSetResponseGetNameRetType, ok bool) { + return getUpdateCoreRuleSetResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateCoreRuleSetResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateCoreRuleSetResponse) SetName(v UpdateCoreRuleSetResponseGetNameRetType) { + setUpdateCoreRuleSetResponseGetNameAttributeType(&o.Name, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *UpdateCoreRuleSetResponse) GetRegion() (res UpdateCoreRuleSetResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateCoreRuleSetResponse) GetRegionOk() (ret UpdateCoreRuleSetResponseGetRegionRetType, ok bool) { + return getUpdateCoreRuleSetResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *UpdateCoreRuleSetResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *UpdateCoreRuleSetResponse) SetRegion(v UpdateCoreRuleSetResponseGetRegionRetType) { + setUpdateCoreRuleSetResponseGetRegionAttributeType(&o.Region, v) +} + +func (o UpdateCoreRuleSetResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateCoreRuleSetResponsegetActiveAttributeTypeOk(o.Active); ok { + toSerialize["Active"] = val + } + if val, ok := getUpdateCoreRuleSetResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateCoreRuleSetResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullableUpdateCoreRuleSetResponse struct { + value *UpdateCoreRuleSetResponse + isSet bool +} + +func (v NullableUpdateCoreRuleSetResponse) Get() *UpdateCoreRuleSetResponse { + return v.value +} + +func (v *NullableUpdateCoreRuleSetResponse) Set(val *UpdateCoreRuleSetResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateCoreRuleSetResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateCoreRuleSetResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateCoreRuleSetResponse(val *UpdateCoreRuleSetResponse) *NullableUpdateCoreRuleSetResponse { + return &NullableUpdateCoreRuleSetResponse{value: val, isSet: true} +} + +func (v NullableUpdateCoreRuleSetResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateCoreRuleSetResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_update_core_rule_set_response_test.go b/pkg/albwafalpha/model_update_core_rule_set_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_update_core_rule_set_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_update_rules_payload.go b/pkg/albwafalpha/model_update_rules_payload.go new file mode 100644 index 00000000..ff0dbab6 --- /dev/null +++ b/pkg/albwafalpha/model_update_rules_payload.go @@ -0,0 +1,276 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the UpdateRulesPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRulesPayload{} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateRulesPayloadGetNameAttributeType = *string + +func getUpdateRulesPayloadGetNameAttributeTypeOk(arg UpdateRulesPayloadGetNameAttributeType) (ret UpdateRulesPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRulesPayloadGetNameAttributeType(arg *UpdateRulesPayloadGetNameAttributeType, val UpdateRulesPayloadGetNameRetType) { + *arg = &val +} + +type UpdateRulesPayloadGetNameArgType = string +type UpdateRulesPayloadGetNameRetType = string + +/* + types and functions for projectId +*/ + +// isNotNullableString +type UpdateRulesPayloadGetProjectIdAttributeType = *string + +func getUpdateRulesPayloadGetProjectIdAttributeTypeOk(arg UpdateRulesPayloadGetProjectIdAttributeType) (ret UpdateRulesPayloadGetProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRulesPayloadGetProjectIdAttributeType(arg *UpdateRulesPayloadGetProjectIdAttributeType, val UpdateRulesPayloadGetProjectIdRetType) { + *arg = &val +} + +type UpdateRulesPayloadGetProjectIdArgType = string +type UpdateRulesPayloadGetProjectIdRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type UpdateRulesPayloadGetRegionAttributeType = *string + +func getUpdateRulesPayloadGetRegionAttributeTypeOk(arg UpdateRulesPayloadGetRegionAttributeType) (ret UpdateRulesPayloadGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRulesPayloadGetRegionAttributeType(arg *UpdateRulesPayloadGetRegionAttributeType, val UpdateRulesPayloadGetRegionRetType) { + *arg = &val +} + +type UpdateRulesPayloadGetRegionArgType = string +type UpdateRulesPayloadGetRegionRetType = string + +/* + types and functions for rules +*/ + +// isNotNullableString +type UpdateRulesPayloadGetRulesAttributeType = *string + +func getUpdateRulesPayloadGetRulesAttributeTypeOk(arg UpdateRulesPayloadGetRulesAttributeType) (ret UpdateRulesPayloadGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRulesPayloadGetRulesAttributeType(arg *UpdateRulesPayloadGetRulesAttributeType, val UpdateRulesPayloadGetRulesRetType) { + *arg = &val +} + +type UpdateRulesPayloadGetRulesArgType = string +type UpdateRulesPayloadGetRulesRetType = string + +// UpdateRulesPayload UpdateRulesRequest updates a rules configuration, but only if it changed. +type UpdateRulesPayload struct { + // Rule configuration name. + Name UpdateRulesPayloadGetNameAttributeType `json:"name,omitempty"` + // Project identifier + ProjectId UpdateRulesPayloadGetProjectIdAttributeType `json:"projectId,omitempty"` + // Region + Region UpdateRulesPayloadGetRegionAttributeType `json:"region,omitempty"` + // Custom rules for WAF written in Seclang syntax. + Rules UpdateRulesPayloadGetRulesAttributeType `json:"rules,omitempty"` +} + +// NewUpdateRulesPayload instantiates a new UpdateRulesPayload 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 NewUpdateRulesPayload() *UpdateRulesPayload { + this := UpdateRulesPayload{} + return &this +} + +// NewUpdateRulesPayloadWithDefaults instantiates a new UpdateRulesPayload 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 NewUpdateRulesPayloadWithDefaults() *UpdateRulesPayload { + this := UpdateRulesPayload{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateRulesPayload) GetName() (res UpdateRulesPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRulesPayload) GetNameOk() (ret UpdateRulesPayloadGetNameRetType, ok bool) { + return getUpdateRulesPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateRulesPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateRulesPayload) SetName(v UpdateRulesPayloadGetNameRetType) { + setUpdateRulesPayloadGetNameAttributeType(&o.Name, v) +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *UpdateRulesPayload) GetProjectId() (res UpdateRulesPayloadGetProjectIdRetType) { + res, _ = o.GetProjectIdOk() + return +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRulesPayload) GetProjectIdOk() (ret UpdateRulesPayloadGetProjectIdRetType, ok bool) { + return getUpdateRulesPayloadGetProjectIdAttributeTypeOk(o.ProjectId) +} + +// HasProjectId returns a boolean if a field has been set. +func (o *UpdateRulesPayload) HasProjectId() bool { + _, ok := o.GetProjectIdOk() + return ok +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *UpdateRulesPayload) SetProjectId(v UpdateRulesPayloadGetProjectIdRetType) { + setUpdateRulesPayloadGetProjectIdAttributeType(&o.ProjectId, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *UpdateRulesPayload) GetRegion() (res UpdateRulesPayloadGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRulesPayload) GetRegionOk() (ret UpdateRulesPayloadGetRegionRetType, ok bool) { + return getUpdateRulesPayloadGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *UpdateRulesPayload) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *UpdateRulesPayload) SetRegion(v UpdateRulesPayloadGetRegionRetType) { + setUpdateRulesPayloadGetRegionAttributeType(&o.Region, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *UpdateRulesPayload) GetRules() (res UpdateRulesPayloadGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRulesPayload) GetRulesOk() (ret UpdateRulesPayloadGetRulesRetType, ok bool) { + return getUpdateRulesPayloadGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *UpdateRulesPayload) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given string and assigns it to the Rules field. +func (o *UpdateRulesPayload) SetRules(v UpdateRulesPayloadGetRulesRetType) { + setUpdateRulesPayloadGetRulesAttributeType(&o.Rules, v) +} + +func (o UpdateRulesPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateRulesPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateRulesPayloadGetProjectIdAttributeTypeOk(o.ProjectId); ok { + toSerialize["ProjectId"] = val + } + if val, ok := getUpdateRulesPayloadGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getUpdateRulesPayloadGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableUpdateRulesPayload struct { + value *UpdateRulesPayload + isSet bool +} + +func (v NullableUpdateRulesPayload) Get() *UpdateRulesPayload { + return v.value +} + +func (v *NullableUpdateRulesPayload) Set(val *UpdateRulesPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRulesPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRulesPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRulesPayload(val *UpdateRulesPayload) *NullableUpdateRulesPayload { + return &NullableUpdateRulesPayload{value: val, isSet: true} +} + +func (v NullableUpdateRulesPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRulesPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_update_rules_payload_test.go b/pkg/albwafalpha/model_update_rules_payload_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_update_rules_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_update_rules_response.go b/pkg/albwafalpha/model_update_rules_response.go new file mode 100644 index 00000000..2e6056bc --- /dev/null +++ b/pkg/albwafalpha/model_update_rules_response.go @@ -0,0 +1,227 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the UpdateRulesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRulesResponse{} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateRulesResponseGetNameAttributeType = *string + +func getUpdateRulesResponseGetNameAttributeTypeOk(arg UpdateRulesResponseGetNameAttributeType) (ret UpdateRulesResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRulesResponseGetNameAttributeType(arg *UpdateRulesResponseGetNameAttributeType, val UpdateRulesResponseGetNameRetType) { + *arg = &val +} + +type UpdateRulesResponseGetNameArgType = string +type UpdateRulesResponseGetNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type UpdateRulesResponseGetRegionAttributeType = *string + +func getUpdateRulesResponseGetRegionAttributeTypeOk(arg UpdateRulesResponseGetRegionAttributeType) (ret UpdateRulesResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRulesResponseGetRegionAttributeType(arg *UpdateRulesResponseGetRegionAttributeType, val UpdateRulesResponseGetRegionRetType) { + *arg = &val +} + +type UpdateRulesResponseGetRegionArgType = string +type UpdateRulesResponseGetRegionRetType = string + +/* + types and functions for rules +*/ + +// isNotNullableString +type UpdateRulesResponseGetRulesAttributeType = *string + +func getUpdateRulesResponseGetRulesAttributeTypeOk(arg UpdateRulesResponseGetRulesAttributeType) (ret UpdateRulesResponseGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRulesResponseGetRulesAttributeType(arg *UpdateRulesResponseGetRulesAttributeType, val UpdateRulesResponseGetRulesRetType) { + *arg = &val +} + +type UpdateRulesResponseGetRulesArgType = string +type UpdateRulesResponseGetRulesRetType = string + +// UpdateRulesResponse UpdateRulesResponse returns rule configuration name and it's rules. +type UpdateRulesResponse struct { + // Rule configuration name. + Name UpdateRulesResponseGetNameAttributeType `json:"name,omitempty"` + // Region + Region UpdateRulesResponseGetRegionAttributeType `json:"region,omitempty"` + // Custom rules written in Seclang syntax. + Rules UpdateRulesResponseGetRulesAttributeType `json:"rules,omitempty"` +} + +// NewUpdateRulesResponse instantiates a new UpdateRulesResponse 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 NewUpdateRulesResponse() *UpdateRulesResponse { + this := UpdateRulesResponse{} + return &this +} + +// NewUpdateRulesResponseWithDefaults instantiates a new UpdateRulesResponse 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 NewUpdateRulesResponseWithDefaults() *UpdateRulesResponse { + this := UpdateRulesResponse{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateRulesResponse) GetName() (res UpdateRulesResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRulesResponse) GetNameOk() (ret UpdateRulesResponseGetNameRetType, ok bool) { + return getUpdateRulesResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateRulesResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateRulesResponse) SetName(v UpdateRulesResponseGetNameRetType) { + setUpdateRulesResponseGetNameAttributeType(&o.Name, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *UpdateRulesResponse) GetRegion() (res UpdateRulesResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRulesResponse) GetRegionOk() (ret UpdateRulesResponseGetRegionRetType, ok bool) { + return getUpdateRulesResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *UpdateRulesResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *UpdateRulesResponse) SetRegion(v UpdateRulesResponseGetRegionRetType) { + setUpdateRulesResponseGetRegionAttributeType(&o.Region, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *UpdateRulesResponse) GetRules() (res UpdateRulesResponseGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRulesResponse) GetRulesOk() (ret UpdateRulesResponseGetRulesRetType, ok bool) { + return getUpdateRulesResponseGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *UpdateRulesResponse) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given string and assigns it to the Rules field. +func (o *UpdateRulesResponse) SetRules(v UpdateRulesResponseGetRulesRetType) { + setUpdateRulesResponseGetRulesAttributeType(&o.Rules, v) +} + +func (o UpdateRulesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateRulesResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateRulesResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getUpdateRulesResponseGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableUpdateRulesResponse struct { + value *UpdateRulesResponse + isSet bool +} + +func (v NullableUpdateRulesResponse) Get() *UpdateRulesResponse { + return v.value +} + +func (v *NullableUpdateRulesResponse) Set(val *UpdateRulesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRulesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRulesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRulesResponse(val *UpdateRulesResponse) *NullableUpdateRulesResponse { + return &NullableUpdateRulesResponse{value: val, isSet: true} +} + +func (v NullableUpdateRulesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRulesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_update_rules_response_test.go b/pkg/albwafalpha/model_update_rules_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_update_rules_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_update_waf_payload.go b/pkg/albwafalpha/model_update_waf_payload.go new file mode 100644 index 00000000..6fbcde8a --- /dev/null +++ b/pkg/albwafalpha/model_update_waf_payload.go @@ -0,0 +1,325 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the UpdateWAFPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateWAFPayload{} + +/* + types and functions for coreRuleSetName +*/ + +// isNotNullableString +type UpdateWAFPayloadGetCoreRuleSetNameAttributeType = *string + +func getUpdateWAFPayloadGetCoreRuleSetNameAttributeTypeOk(arg UpdateWAFPayloadGetCoreRuleSetNameAttributeType) (ret UpdateWAFPayloadGetCoreRuleSetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateWAFPayloadGetCoreRuleSetNameAttributeType(arg *UpdateWAFPayloadGetCoreRuleSetNameAttributeType, val UpdateWAFPayloadGetCoreRuleSetNameRetType) { + *arg = &val +} + +type UpdateWAFPayloadGetCoreRuleSetNameArgType = string +type UpdateWAFPayloadGetCoreRuleSetNameRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateWAFPayloadGetNameAttributeType = *string + +func getUpdateWAFPayloadGetNameAttributeTypeOk(arg UpdateWAFPayloadGetNameAttributeType) (ret UpdateWAFPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateWAFPayloadGetNameAttributeType(arg *UpdateWAFPayloadGetNameAttributeType, val UpdateWAFPayloadGetNameRetType) { + *arg = &val +} + +type UpdateWAFPayloadGetNameArgType = string +type UpdateWAFPayloadGetNameRetType = string + +/* + types and functions for projectId +*/ + +// isNotNullableString +type UpdateWAFPayloadGetProjectIdAttributeType = *string + +func getUpdateWAFPayloadGetProjectIdAttributeTypeOk(arg UpdateWAFPayloadGetProjectIdAttributeType) (ret UpdateWAFPayloadGetProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateWAFPayloadGetProjectIdAttributeType(arg *UpdateWAFPayloadGetProjectIdAttributeType, val UpdateWAFPayloadGetProjectIdRetType) { + *arg = &val +} + +type UpdateWAFPayloadGetProjectIdArgType = string +type UpdateWAFPayloadGetProjectIdRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type UpdateWAFPayloadGetRegionAttributeType = *string + +func getUpdateWAFPayloadGetRegionAttributeTypeOk(arg UpdateWAFPayloadGetRegionAttributeType) (ret UpdateWAFPayloadGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateWAFPayloadGetRegionAttributeType(arg *UpdateWAFPayloadGetRegionAttributeType, val UpdateWAFPayloadGetRegionRetType) { + *arg = &val +} + +type UpdateWAFPayloadGetRegionArgType = string +type UpdateWAFPayloadGetRegionRetType = string + +/* + types and functions for rulesConfigName +*/ + +// isNotNullableString +type UpdateWAFPayloadGetRulesConfigNameAttributeType = *string + +func getUpdateWAFPayloadGetRulesConfigNameAttributeTypeOk(arg UpdateWAFPayloadGetRulesConfigNameAttributeType) (ret UpdateWAFPayloadGetRulesConfigNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateWAFPayloadGetRulesConfigNameAttributeType(arg *UpdateWAFPayloadGetRulesConfigNameAttributeType, val UpdateWAFPayloadGetRulesConfigNameRetType) { + *arg = &val +} + +type UpdateWAFPayloadGetRulesConfigNameArgType = string +type UpdateWAFPayloadGetRulesConfigNameRetType = string + +// UpdateWAFPayload UpdateWAFRequest updates a WAF if rules changed. +type UpdateWAFPayload struct { + // Name of the core rule set configuration for that WAF. + CoreRuleSetName UpdateWAFPayloadGetCoreRuleSetNameAttributeType `json:"coreRuleSetName,omitempty"` + // WAF name + Name UpdateWAFPayloadGetNameAttributeType `json:"name,omitempty"` + // Project identifier + ProjectId UpdateWAFPayloadGetProjectIdAttributeType `json:"projectId,omitempty"` + // Region + Region UpdateWAFPayloadGetRegionAttributeType `json:"region,omitempty"` + // Name of the rule configuration for that WAF. + RulesConfigName UpdateWAFPayloadGetRulesConfigNameAttributeType `json:"rulesConfigName,omitempty"` +} + +// NewUpdateWAFPayload instantiates a new UpdateWAFPayload 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 NewUpdateWAFPayload() *UpdateWAFPayload { + this := UpdateWAFPayload{} + return &this +} + +// NewUpdateWAFPayloadWithDefaults instantiates a new UpdateWAFPayload 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 NewUpdateWAFPayloadWithDefaults() *UpdateWAFPayload { + this := UpdateWAFPayload{} + return &this +} + +// GetCoreRuleSetName returns the CoreRuleSetName field value if set, zero value otherwise. +func (o *UpdateWAFPayload) GetCoreRuleSetName() (res UpdateWAFPayloadGetCoreRuleSetNameRetType) { + res, _ = o.GetCoreRuleSetNameOk() + return +} + +// GetCoreRuleSetNameOk returns a tuple with the CoreRuleSetName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateWAFPayload) GetCoreRuleSetNameOk() (ret UpdateWAFPayloadGetCoreRuleSetNameRetType, ok bool) { + return getUpdateWAFPayloadGetCoreRuleSetNameAttributeTypeOk(o.CoreRuleSetName) +} + +// HasCoreRuleSetName returns a boolean if a field has been set. +func (o *UpdateWAFPayload) HasCoreRuleSetName() bool { + _, ok := o.GetCoreRuleSetNameOk() + return ok +} + +// SetCoreRuleSetName gets a reference to the given string and assigns it to the CoreRuleSetName field. +func (o *UpdateWAFPayload) SetCoreRuleSetName(v UpdateWAFPayloadGetCoreRuleSetNameRetType) { + setUpdateWAFPayloadGetCoreRuleSetNameAttributeType(&o.CoreRuleSetName, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateWAFPayload) GetName() (res UpdateWAFPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateWAFPayload) GetNameOk() (ret UpdateWAFPayloadGetNameRetType, ok bool) { + return getUpdateWAFPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateWAFPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateWAFPayload) SetName(v UpdateWAFPayloadGetNameRetType) { + setUpdateWAFPayloadGetNameAttributeType(&o.Name, v) +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *UpdateWAFPayload) GetProjectId() (res UpdateWAFPayloadGetProjectIdRetType) { + res, _ = o.GetProjectIdOk() + return +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateWAFPayload) GetProjectIdOk() (ret UpdateWAFPayloadGetProjectIdRetType, ok bool) { + return getUpdateWAFPayloadGetProjectIdAttributeTypeOk(o.ProjectId) +} + +// HasProjectId returns a boolean if a field has been set. +func (o *UpdateWAFPayload) HasProjectId() bool { + _, ok := o.GetProjectIdOk() + return ok +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *UpdateWAFPayload) SetProjectId(v UpdateWAFPayloadGetProjectIdRetType) { + setUpdateWAFPayloadGetProjectIdAttributeType(&o.ProjectId, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *UpdateWAFPayload) GetRegion() (res UpdateWAFPayloadGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateWAFPayload) GetRegionOk() (ret UpdateWAFPayloadGetRegionRetType, ok bool) { + return getUpdateWAFPayloadGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *UpdateWAFPayload) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *UpdateWAFPayload) SetRegion(v UpdateWAFPayloadGetRegionRetType) { + setUpdateWAFPayloadGetRegionAttributeType(&o.Region, v) +} + +// GetRulesConfigName returns the RulesConfigName field value if set, zero value otherwise. +func (o *UpdateWAFPayload) GetRulesConfigName() (res UpdateWAFPayloadGetRulesConfigNameRetType) { + res, _ = o.GetRulesConfigNameOk() + return +} + +// GetRulesConfigNameOk returns a tuple with the RulesConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateWAFPayload) GetRulesConfigNameOk() (ret UpdateWAFPayloadGetRulesConfigNameRetType, ok bool) { + return getUpdateWAFPayloadGetRulesConfigNameAttributeTypeOk(o.RulesConfigName) +} + +// HasRulesConfigName returns a boolean if a field has been set. +func (o *UpdateWAFPayload) HasRulesConfigName() bool { + _, ok := o.GetRulesConfigNameOk() + return ok +} + +// SetRulesConfigName gets a reference to the given string and assigns it to the RulesConfigName field. +func (o *UpdateWAFPayload) SetRulesConfigName(v UpdateWAFPayloadGetRulesConfigNameRetType) { + setUpdateWAFPayloadGetRulesConfigNameAttributeType(&o.RulesConfigName, v) +} + +func (o UpdateWAFPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateWAFPayloadGetCoreRuleSetNameAttributeTypeOk(o.CoreRuleSetName); ok { + toSerialize["CoreRuleSetName"] = val + } + if val, ok := getUpdateWAFPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateWAFPayloadGetProjectIdAttributeTypeOk(o.ProjectId); ok { + toSerialize["ProjectId"] = val + } + if val, ok := getUpdateWAFPayloadGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getUpdateWAFPayloadGetRulesConfigNameAttributeTypeOk(o.RulesConfigName); ok { + toSerialize["RulesConfigName"] = val + } + return toSerialize, nil +} + +type NullableUpdateWAFPayload struct { + value *UpdateWAFPayload + isSet bool +} + +func (v NullableUpdateWAFPayload) Get() *UpdateWAFPayload { + return v.value +} + +func (v *NullableUpdateWAFPayload) Set(val *UpdateWAFPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateWAFPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateWAFPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateWAFPayload(val *UpdateWAFPayload) *NullableUpdateWAFPayload { + return &NullableUpdateWAFPayload{value: val, isSet: true} +} + +func (v NullableUpdateWAFPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateWAFPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_update_waf_payload_test.go b/pkg/albwafalpha/model_update_waf_payload_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_update_waf_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/model_update_waf_response.go b/pkg/albwafalpha/model_update_waf_response.go new file mode 100644 index 00000000..7223b8fb --- /dev/null +++ b/pkg/albwafalpha/model_update_waf_response.go @@ -0,0 +1,276 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" +) + +// checks if the UpdateWAFResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateWAFResponse{} + +/* + types and functions for coreRuleSetName +*/ + +// isNotNullableString +type UpdateWAFResponseGetCoreRuleSetNameAttributeType = *string + +func getUpdateWAFResponseGetCoreRuleSetNameAttributeTypeOk(arg UpdateWAFResponseGetCoreRuleSetNameAttributeType) (ret UpdateWAFResponseGetCoreRuleSetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateWAFResponseGetCoreRuleSetNameAttributeType(arg *UpdateWAFResponseGetCoreRuleSetNameAttributeType, val UpdateWAFResponseGetCoreRuleSetNameRetType) { + *arg = &val +} + +type UpdateWAFResponseGetCoreRuleSetNameArgType = string +type UpdateWAFResponseGetCoreRuleSetNameRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateWAFResponseGetNameAttributeType = *string + +func getUpdateWAFResponseGetNameAttributeTypeOk(arg UpdateWAFResponseGetNameAttributeType) (ret UpdateWAFResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateWAFResponseGetNameAttributeType(arg *UpdateWAFResponseGetNameAttributeType, val UpdateWAFResponseGetNameRetType) { + *arg = &val +} + +type UpdateWAFResponseGetNameArgType = string +type UpdateWAFResponseGetNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type UpdateWAFResponseGetRegionAttributeType = *string + +func getUpdateWAFResponseGetRegionAttributeTypeOk(arg UpdateWAFResponseGetRegionAttributeType) (ret UpdateWAFResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateWAFResponseGetRegionAttributeType(arg *UpdateWAFResponseGetRegionAttributeType, val UpdateWAFResponseGetRegionRetType) { + *arg = &val +} + +type UpdateWAFResponseGetRegionArgType = string +type UpdateWAFResponseGetRegionRetType = string + +/* + types and functions for rulesConfigName +*/ + +// isNotNullableString +type UpdateWAFResponseGetRulesConfigNameAttributeType = *string + +func getUpdateWAFResponseGetRulesConfigNameAttributeTypeOk(arg UpdateWAFResponseGetRulesConfigNameAttributeType) (ret UpdateWAFResponseGetRulesConfigNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateWAFResponseGetRulesConfigNameAttributeType(arg *UpdateWAFResponseGetRulesConfigNameAttributeType, val UpdateWAFResponseGetRulesConfigNameRetType) { + *arg = &val +} + +type UpdateWAFResponseGetRulesConfigNameArgType = string +type UpdateWAFResponseGetRulesConfigNameRetType = string + +// UpdateWAFResponse UpdateWAFResponse returns name and custom rules. +type UpdateWAFResponse struct { + // Name of the core rule set configuration for that WAF. + CoreRuleSetName UpdateWAFResponseGetCoreRuleSetNameAttributeType `json:"coreRuleSetName,omitempty"` + // WAF name + Name UpdateWAFResponseGetNameAttributeType `json:"name,omitempty"` + // Region + Region UpdateWAFResponseGetRegionAttributeType `json:"region,omitempty"` + // Name of the rule configuration for that WAF. + RulesConfigName UpdateWAFResponseGetRulesConfigNameAttributeType `json:"rulesConfigName,omitempty"` +} + +// NewUpdateWAFResponse instantiates a new UpdateWAFResponse 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 NewUpdateWAFResponse() *UpdateWAFResponse { + this := UpdateWAFResponse{} + return &this +} + +// NewUpdateWAFResponseWithDefaults instantiates a new UpdateWAFResponse 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 NewUpdateWAFResponseWithDefaults() *UpdateWAFResponse { + this := UpdateWAFResponse{} + return &this +} + +// GetCoreRuleSetName returns the CoreRuleSetName field value if set, zero value otherwise. +func (o *UpdateWAFResponse) GetCoreRuleSetName() (res UpdateWAFResponseGetCoreRuleSetNameRetType) { + res, _ = o.GetCoreRuleSetNameOk() + return +} + +// GetCoreRuleSetNameOk returns a tuple with the CoreRuleSetName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateWAFResponse) GetCoreRuleSetNameOk() (ret UpdateWAFResponseGetCoreRuleSetNameRetType, ok bool) { + return getUpdateWAFResponseGetCoreRuleSetNameAttributeTypeOk(o.CoreRuleSetName) +} + +// HasCoreRuleSetName returns a boolean if a field has been set. +func (o *UpdateWAFResponse) HasCoreRuleSetName() bool { + _, ok := o.GetCoreRuleSetNameOk() + return ok +} + +// SetCoreRuleSetName gets a reference to the given string and assigns it to the CoreRuleSetName field. +func (o *UpdateWAFResponse) SetCoreRuleSetName(v UpdateWAFResponseGetCoreRuleSetNameRetType) { + setUpdateWAFResponseGetCoreRuleSetNameAttributeType(&o.CoreRuleSetName, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateWAFResponse) GetName() (res UpdateWAFResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateWAFResponse) GetNameOk() (ret UpdateWAFResponseGetNameRetType, ok bool) { + return getUpdateWAFResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateWAFResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateWAFResponse) SetName(v UpdateWAFResponseGetNameRetType) { + setUpdateWAFResponseGetNameAttributeType(&o.Name, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *UpdateWAFResponse) GetRegion() (res UpdateWAFResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateWAFResponse) GetRegionOk() (ret UpdateWAFResponseGetRegionRetType, ok bool) { + return getUpdateWAFResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *UpdateWAFResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *UpdateWAFResponse) SetRegion(v UpdateWAFResponseGetRegionRetType) { + setUpdateWAFResponseGetRegionAttributeType(&o.Region, v) +} + +// GetRulesConfigName returns the RulesConfigName field value if set, zero value otherwise. +func (o *UpdateWAFResponse) GetRulesConfigName() (res UpdateWAFResponseGetRulesConfigNameRetType) { + res, _ = o.GetRulesConfigNameOk() + return +} + +// GetRulesConfigNameOk returns a tuple with the RulesConfigName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateWAFResponse) GetRulesConfigNameOk() (ret UpdateWAFResponseGetRulesConfigNameRetType, ok bool) { + return getUpdateWAFResponseGetRulesConfigNameAttributeTypeOk(o.RulesConfigName) +} + +// HasRulesConfigName returns a boolean if a field has been set. +func (o *UpdateWAFResponse) HasRulesConfigName() bool { + _, ok := o.GetRulesConfigNameOk() + return ok +} + +// SetRulesConfigName gets a reference to the given string and assigns it to the RulesConfigName field. +func (o *UpdateWAFResponse) SetRulesConfigName(v UpdateWAFResponseGetRulesConfigNameRetType) { + setUpdateWAFResponseGetRulesConfigNameAttributeType(&o.RulesConfigName, v) +} + +func (o UpdateWAFResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateWAFResponseGetCoreRuleSetNameAttributeTypeOk(o.CoreRuleSetName); ok { + toSerialize["CoreRuleSetName"] = val + } + if val, ok := getUpdateWAFResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateWAFResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getUpdateWAFResponseGetRulesConfigNameAttributeTypeOk(o.RulesConfigName); ok { + toSerialize["RulesConfigName"] = val + } + return toSerialize, nil +} + +type NullableUpdateWAFResponse struct { + value *UpdateWAFResponse + isSet bool +} + +func (v NullableUpdateWAFResponse) Get() *UpdateWAFResponse { + return v.value +} + +func (v *NullableUpdateWAFResponse) Set(val *UpdateWAFResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateWAFResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateWAFResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateWAFResponse(val *UpdateWAFResponse) *NullableUpdateWAFResponse { + return &NullableUpdateWAFResponse{value: val, isSet: true} +} + +func (v NullableUpdateWAFResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateWAFResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/albwafalpha/model_update_waf_response_test.go b/pkg/albwafalpha/model_update_waf_response_test.go new file mode 100644 index 00000000..94f2ecf2 --- /dev/null +++ b/pkg/albwafalpha/model_update_waf_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha diff --git a/pkg/albwafalpha/utils.go b/pkg/albwafalpha/utils.go new file mode 100644 index 00000000..9a9ac00a --- /dev/null +++ b/pkg/albwafalpha/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT Application Load Balancer Web Application Firewall API + +Generate a Web Application Firewall (WAF) to use with Application Load Balancers (ALB). The name of the WAF configuration is used in the listener of the ALB. This will activate the WAF for that ALB. An ALB with a WAF can have OWASP core rule set enabled and in addition can have custom rule configurations. To create a WAF one first needs to create all the configurations that are referenced in the WAF configuration. Currently this only consists of a rule configuration, which is written in Seclang. Once all configurations are created and referenced in the WAF configuration it can be used with an ALB. Currently updating a WAF configuration will not update an existing ALB until the Load Balancer VMs are restarted. + +API version: 1alpha.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package albwafalpha + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/cdnbeta/.openapi-generator/VERSION b/pkg/cdnbeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/cdnbeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/cdnbeta/api_default.go b/pkg/cdnbeta/api_default.go new file mode 100644 index 00000000..2021d175 --- /dev/null +++ b/pkg/cdnbeta/api_default.go @@ -0,0 +1,3137 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + "time" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateDistribution Create new distribution + CreateDistribution will create a new CDN distribution + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @return ApiCreateDistributionRequest + */ + CreateDistribution(ctx context.Context, projectId string) ApiCreateDistributionRequest + /* + CreateDistributionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @return CreateDistributionResponse + + */ + CreateDistributionExecute(ctx context.Context, projectId string) (*CreateDistributionResponse, error) + /* + DeleteCustomDomain Delete a custom domain + Removes a custom domain + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @param domain + @return ApiDeleteCustomDomainRequest + */ + DeleteCustomDomain(ctx context.Context, projectId string, distributionId string, domain string) ApiDeleteCustomDomainRequest + /* + DeleteCustomDomainExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @param domain + @return DeleteCustomDomainResponse + + */ + DeleteCustomDomainExecute(ctx context.Context, projectId string, distributionId string, domain string) (*DeleteCustomDomainResponse, error) + /* + DeleteDistribution Delete distribution + DeleteDistribution accepts a project- and distribution-Id and will delete a distribution. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiDeleteDistributionRequest + */ + DeleteDistribution(ctx context.Context, projectId string, distributionId string) ApiDeleteDistributionRequest + /* + DeleteDistributionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return DeleteDistributionResponse + + */ + DeleteDistributionExecute(ctx context.Context, projectId string, distributionId string) (*DeleteDistributionResponse, error) + /* + FindCachePaths Return Paths that were purged + This returns paths that are present in the cache purging history. + Only substrings of the provided input are returned. + The response is sorted in descending order by the most recent purge. + + So, assuming you have have the following purged for a distribution + - `/test/1` at `2025-01-01` + - `/test/2` at `2025-01-02` + - `/someOtherPath/1` at `2025-01-03` + - `/test/1` at `2025-01-04` + - `/test/3` at `2025-01-05`, + this would return the following paths, in the following order, assuming `/te` was the search parameter: + - `/test/3` + - `/test/1` + - `/test/2` + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiFindCachePathsRequest + */ + FindCachePaths(ctx context.Context, projectId string, distributionId string) ApiFindCachePathsRequest + /* + FindCachePathsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return FindCachePathsResponse + + */ + FindCachePathsExecute(ctx context.Context, projectId string, distributionId string) (*FindCachePathsResponse, error) + /* + GetCacheInfo Get Infos about the Caching State + Return caching info metadata, which contains the last cache purging time and a history of the most recent *full* purges. + + If (and only if) you provide the path query parameter, the history will also contain granular cache purges. + The request will not fail if no data about a path is found. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiGetCacheInfoRequest + */ + GetCacheInfo(ctx context.Context, projectId string, distributionId string) ApiGetCacheInfoRequest + /* + GetCacheInfoExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return GetCacheInfoResponse + + */ + GetCacheInfoExecute(ctx context.Context, projectId string, distributionId string) (*GetCacheInfoResponse, error) + /* + GetCustomDomain Retrieve a specific custom domain + Returns a 200 and the custom domain if this custom domain was associated to this distribution, else 404 + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @param domain + @return ApiGetCustomDomainRequest + */ + GetCustomDomain(ctx context.Context, projectId string, distributionId string, domain string) ApiGetCustomDomainRequest + /* + GetCustomDomainExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @param domain + @return GetCustomDomainResponse + + */ + GetCustomDomainExecute(ctx context.Context, projectId string, distributionId string, domain string) (*GetCustomDomainResponse, error) + /* + GetDistribution Get distribution by Id + This returns a specific distribution by its Id. If no distribution with the given Id exists the endpoint returns 404. Trying to get a deleted distributions also return 404. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiGetDistributionRequest + */ + GetDistribution(ctx context.Context, projectId string, distributionId string) ApiGetDistributionRequest + /* + GetDistributionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return GetDistributionResponse + + */ + GetDistributionExecute(ctx context.Context, projectId string, distributionId string) (*GetDistributionResponse, error) + /* + GetLogs Retrieve distribution logs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId Your CDN distribution Id + @return ApiGetLogsRequest + */ + GetLogs(ctx context.Context, projectId string, distributionId string) ApiGetLogsRequest + /* + GetLogsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId Your CDN distribution Id + @return GetLogsResponse + + */ + GetLogsExecute(ctx context.Context, projectId string, distributionId string) (*GetLogsResponse, error) + /* + GetStatistics Retrieve the statistics of a distribution + Returns the statistics of the distribution in the given + time range. The response is a list of statistics records. Each record aggregates the statistics for its time interval. + In case no statistics for a time interval exist, no record is returned. + The time range for which statistics should be returned can be configured using query parameters. + + Timestamps are assumed to be UTC. This is especially important for the "buckets" when you, for example, return daily information. A day always starts and ends at 00:00Z. + + **Important Note:** Lower bounds are inclusive, upper bounds are exclusive. If you, for example, want a daily grouped which starts on the 1st Jan and also contains the full 10th Jan day, you would define `2025-01-01T00:00:00Z` as the lower and `2025-01-11T00:00:00Z` as the upper bound. + + The upper bound is optional. If you omit it, the API will use the start of the next interval as the upper bound. + Example: if `interval` is `hourly`, `from` would default to the start of the next hour, if it's `daily`, `from` would default to the start of the next day, etc. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiGetStatisticsRequest + */ + GetStatistics(ctx context.Context, projectId string, distributionId string) ApiGetStatisticsRequest + /* + GetStatisticsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return GetStatisticsResponse + + */ + GetStatisticsExecute(ctx context.Context, projectId string, distributionId string) (*GetStatisticsResponse, error) + /* + ListDistributions List all distributions belonging to a specific project + ListDistributions returns a list of all CDN distributions associated with + a given project, ordered by their distribution Id. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @return ApiListDistributionsRequest + */ + ListDistributions(ctx context.Context, projectId string) ApiListDistributionsRequest + /* + ListDistributionsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @return ListDistributionsResponse + + */ + ListDistributionsExecute(ctx context.Context, projectId string) (*ListDistributionsResponse, error) + /* + ListWafCollections List all WAF rule collections of the project + Returns all WAF rule collections available to the project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @return ApiListWafCollectionsRequest + */ + ListWafCollections(ctx context.Context, projectId string) ApiListWafCollectionsRequest + /* + ListWafCollectionsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @return ListWafCollectionsResponse + + */ + ListWafCollectionsExecute(ctx context.Context, projectId string) (*ListWafCollectionsResponse, error) + /* + PatchDistribution Update existing distribution + Modify a CDN distribution with a partial update. Only the fields specified in the request will be modified. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiPatchDistributionRequest + */ + PatchDistribution(ctx context.Context, projectId string, distributionId string) ApiPatchDistributionRequest + /* + PatchDistributionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return PatchDistributionResponse + + */ + PatchDistributionExecute(ctx context.Context, projectId string, distributionId string) (*PatchDistributionResponse, error) + /* + PurgeCache Clear distribution cache + Clear the cache for this distribution. + All content, regardless of its staleness, will get refetched from the host. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiPurgeCacheRequest + */ + PurgeCache(ctx context.Context, projectId string, distributionId string) ApiPurgeCacheRequest + /* + PurgeCacheExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return map[string]interface{} + + */ + PurgeCacheExecute(ctx context.Context, projectId string, distributionId string) (map[string]interface{}, error) + /* + PutCustomDomain Create or update a custom domain + Creates a new custom domain. If it already exists, this will overwrite the previous custom domain's properties. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @param domain + @return ApiPutCustomDomainRequest + */ + PutCustomDomain(ctx context.Context, projectId string, distributionId string, domain string) ApiPutCustomDomainRequest + /* + PutCustomDomainExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @param domain + @return PutCustomDomainResponse + + */ + PutCustomDomainExecute(ctx context.Context, projectId string, distributionId string, domain string) (*PutCustomDomainResponse, error) +} + +type ApiCreateDistributionRequest interface { + CreateDistributionPayload(createDistributionPayload CreateDistributionPayload) ApiCreateDistributionRequest + Execute() (*CreateDistributionResponse, error) +} + +type ApiDeleteCustomDomainRequest interface { + IntentId(intentId string) ApiDeleteCustomDomainRequest + Execute() (*DeleteCustomDomainResponse, error) +} + +type ApiDeleteDistributionRequest interface { + // While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple DELETE-Requests with the same `intentId` are received, all but the first request are dropped. + IntentId(intentId string) ApiDeleteDistributionRequest + Execute() (*DeleteDistributionResponse, error) +} + +type ApiFindCachePathsRequest interface { + // A substring of the search query. + Path(path string) ApiFindCachePathsRequest + Execute() (*FindCachePathsResponse, error) +} + +type ApiGetCacheInfoRequest interface { + PurgePath(purgePath string) ApiGetCacheInfoRequest + Execute() (*GetCacheInfoResponse, error) +} + +type ApiGetCustomDomainRequest interface { + Execute() (*GetCustomDomainResponse, error) +} + +type ApiGetDistributionRequest interface { + // If set, the top level of a distribution contains a `waf` property, which defines the status of the waf. This includes a list of all resolved rules. + WithWafStatus(withWafStatus bool) ApiGetDistributionRequest + Execute() (*GetDistributionResponse, error) +} + +type ApiGetLogsRequest interface { + // the start of the time range for which logs should be returned + From(from time.Time) ApiGetLogsRequest + // the end of the time range for which logs should be returned. If not specified, \"now\" is used. + To(to time.Time) ApiGetLogsRequest + // Quantifies how many log entries should be returned on this page. Must be a natural number between 1 and 1000 (inclusive) + PageSize(pageSize int32) ApiGetLogsRequest + // Identifier is returned by the previous response and is used to request the next page. As the `pageIdentifier` encodes an element, inserts during pagination will *not* shift the result. So a scenario like: - Start listing first page - Insert new element - Start listing second page will *never* result in an element from the first page to get \"pushed\" to the second page, like it could occur with basic limit + offset pagination. The identifier should be treated as an opaque string and never modified. Only pass values returned by the API. + PageIdentifier(pageIdentifier string) ApiGetLogsRequest + // Sorts the log messages by a specific field. Defaults to `timestamp`. Supported sort options: - `timestamp` - `dataCenterRegion` - `requestCountryCode` - `statusCode` - `cacheHit` - `size` - `path` - `host` + SortBy(sortBy string) ApiGetLogsRequest + SortOrder(sortOrder string) ApiGetLogsRequest + // Filters by the CDN data center region that served the request. Can be combined with other filters + DataCenterRegion(dataCenterRegion string) ApiGetLogsRequest + // Filters by the originating country of the user request. Can be combined with other filters + RequestCountryCode(requestCountryCode string) ApiGetLogsRequest + // Filters by the HTTP status code returned to the client. Can be combined with other filters + StatusCode(statusCode int32) ApiGetLogsRequest + // Filters based on whether the request was served from the CDN cache. Can be combined with other filters + CacheHit(cacheHit bool) ApiGetLogsRequest + Execute() (*GetLogsResponse, error) +} + +type ApiGetStatisticsRequest interface { + // the start of the time range for which statistics should be returned + From(from time.Time) ApiGetStatisticsRequest + // the end of the time range for which statistics should be returned. If not specified, the end of the current time interval is used, e.g. next day for daily, next month for monthly, and so on. + To(to time.Time) ApiGetStatisticsRequest + // Over which interval should statistics be aggregated? defaults to hourly resolution **NOTE**: Intervals are grouped in buckets that start and end based on a day in UTC+0 time. So for the `daily` interval, the group starts (inclusive) and ends (exclusive) at `00:00Z` + Interval(interval string) ApiGetStatisticsRequest + Execute() (*GetStatisticsResponse, error) +} + +type ApiListDistributionsRequest interface { + // Quantifies how many distributions should be returned on this page. Must be a natural number between 1 and 100 (inclusive) + PageSize(pageSize int32) ApiListDistributionsRequest + // If set, the top level of a distribution contains a `waf` property, which defines the status of the waf. This includes a list of all resolved rules. + WithWafStatus(withWafStatus bool) ApiListDistributionsRequest + // Identifier is returned by the previous response and is used to request the next page. As the `pageIdentifier` encodes an element, inserts during pagination will *not* shift the result. So a scenario like: - Start listing first page - Insert new element - Start listing second page will *never* result in an element from the first page to get \"pushed\" to the second page, like it could occur with basic limit + offset pagination. The identifier should be treated as an opaque string and never modified. Only pass values returned by the API. + PageIdentifier(pageIdentifier string) ApiListDistributionsRequest + // The following sort options exist. We default to `createdAt` - `id` - Sort by distribution Id using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originUrl using String comparison - `status` - Sort by distribution status, using String comparison - `originUrlRelated` - The originUrl is segmented and reversed before sorting. E.g. `www.example.com` is converted to `com.example.www` for sorting. This way, distributions pointing to the same domain trees are grouped next to each other. + SortBy(sortBy string) ApiListDistributionsRequest + SortOrder(sortOrder string) ApiListDistributionsRequest + Execute() (*ListDistributionsResponse, error) +} + +type ApiListWafCollectionsRequest interface { + Execute() (*ListWafCollectionsResponse, error) +} + +type ApiPatchDistributionRequest interface { + PatchDistributionPayload(patchDistributionPayload PatchDistributionPayload) ApiPatchDistributionRequest + Execute() (*PatchDistributionResponse, error) +} + +type ApiPurgeCacheRequest interface { + PurgeCachePayload(purgeCachePayload PurgeCachePayload) ApiPurgeCacheRequest + Execute() (map[string]interface{}, error) +} + +type ApiPutCustomDomainRequest interface { + PutCustomDomainPayload(putCustomDomainPayload PutCustomDomainPayload) ApiPutCustomDomainRequest + Execute() (*PutCustomDomainResponse, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateDistributionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createDistributionPayload *CreateDistributionPayload +} + +func (r CreateDistributionRequest) CreateDistributionPayload(createDistributionPayload CreateDistributionPayload) ApiCreateDistributionRequest { + r.createDistributionPayload = &createDistributionPayload + return r +} + +func (r CreateDistributionRequest) Execute() (*CreateDistributionResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateDistributionResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateDistribution") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createDistributionPayload == nil { + return localVarReturnValue, fmt.Errorf("createDistributionPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createDistributionPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateDistribution: Create new distribution + +CreateDistribution will create a new CDN distribution + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @return ApiCreateDistributionRequest +*/ +func (a *APIClient) CreateDistribution(ctx context.Context, projectId string) ApiCreateDistributionRequest { + return CreateDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreateDistributionExecute(ctx context.Context, projectId string) (*CreateDistributionResponse, error) { + r := CreateDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type DeleteCustomDomainRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + domain string + intentId *string +} + +func (r DeleteCustomDomainRequest) IntentId(intentId string) ApiDeleteCustomDomainRequest { + r.intentId = &intentId + return r +} + +func (r DeleteCustomDomainRequest) Execute() (*DeleteCustomDomainResponse, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteCustomDomainResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteCustomDomain") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(r.domain, "domain")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.domain) > 72 { + return localVarReturnValue, fmt.Errorf("domain must have less than 72 elements") + } + + if r.intentId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "intentId", r.intentId, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteCustomDomain: Delete a custom domain + +# Removes a custom domain + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @param domain + @return ApiDeleteCustomDomainRequest +*/ +func (a *APIClient) DeleteCustomDomain(ctx context.Context, projectId string, distributionId string, domain string) ApiDeleteCustomDomainRequest { + return DeleteCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } +} + +func (a *APIClient) DeleteCustomDomainExecute(ctx context.Context, projectId string, distributionId string, domain string) (*DeleteCustomDomainResponse, error) { + r := DeleteCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } + return r.Execute() +} + +type DeleteDistributionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + intentId *string +} + +// While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple DELETE-Requests with the same `intentId` are received, all but the first request are dropped. + +func (r DeleteDistributionRequest) IntentId(intentId string) ApiDeleteDistributionRequest { + r.intentId = &intentId + return r +} + +func (r DeleteDistributionRequest) Execute() (*DeleteDistributionResponse, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteDistributionResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteDistribution") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.intentId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "intentId", r.intentId, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteDistribution: Delete distribution + +DeleteDistribution accepts a project- and distribution-Id and will delete a distribution. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiDeleteDistributionRequest +*/ +func (a *APIClient) DeleteDistribution(ctx context.Context, projectId string, distributionId string) ApiDeleteDistributionRequest { + return DeleteDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) DeleteDistributionExecute(ctx context.Context, projectId string, distributionId string) (*DeleteDistributionResponse, error) { + r := DeleteDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type FindCachePathsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + path *string +} + +// A substring of the search query. + +func (r FindCachePathsRequest) Path(path string) ApiFindCachePathsRequest { + r.path = &path + return r +} + +func (r FindCachePathsRequest) Execute() (*FindCachePathsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindCachePathsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.FindCachePaths") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}/cache/paths" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, fmt.Errorf("path is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "path", r.path, "") + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +FindCachePaths: Return Paths that were purged + +This returns paths that are present in the cache purging history. +Only substrings of the provided input are returned. +The response is sorted in descending order by the most recent purge. + +So, assuming you have have the following purged for a distribution +- `/test/1` at `2025-01-01` +- `/test/2` at `2025-01-02` +- `/someOtherPath/1` at `2025-01-03` +- `/test/1` at `2025-01-04` +- `/test/3` at `2025-01-05`, +this would return the following paths, in the following order, assuming `/te` was the search parameter: +- `/test/3` +- `/test/1` +- `/test/2` + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiFindCachePathsRequest +*/ +func (a *APIClient) FindCachePaths(ctx context.Context, projectId string, distributionId string) ApiFindCachePathsRequest { + return FindCachePathsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) FindCachePathsExecute(ctx context.Context, projectId string, distributionId string) (*FindCachePathsResponse, error) { + r := FindCachePathsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type GetCacheInfoRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + purgePath *string +} + +func (r GetCacheInfoRequest) PurgePath(purgePath string) ApiGetCacheInfoRequest { + r.purgePath = &purgePath + return r +} + +func (r GetCacheInfoRequest) Execute() (*GetCacheInfoResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCacheInfoResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCacheInfo") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}/cache" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.purgePath != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "purgePath", r.purgePath, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCacheInfo: Get Infos about the Caching State + +Return caching info metadata, which contains the last cache purging time and a history of the most recent *full* purges. + +If (and only if) you provide the path query parameter, the history will also contain granular cache purges. +The request will not fail if no data about a path is found. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiGetCacheInfoRequest +*/ +func (a *APIClient) GetCacheInfo(ctx context.Context, projectId string, distributionId string) ApiGetCacheInfoRequest { + return GetCacheInfoRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) GetCacheInfoExecute(ctx context.Context, projectId string, distributionId string) (*GetCacheInfoResponse, error) { + r := GetCacheInfoRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type GetCustomDomainRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + domain string +} + +func (r GetCustomDomainRequest) Execute() (*GetCustomDomainResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCustomDomainResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCustomDomain") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(r.domain, "domain")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.domain) > 72 { + return localVarReturnValue, fmt.Errorf("domain must have less than 72 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCustomDomain: Retrieve a specific custom domain + +# Returns a 200 and the custom domain if this custom domain was associated to this distribution, else 404 + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @param domain + @return ApiGetCustomDomainRequest +*/ +func (a *APIClient) GetCustomDomain(ctx context.Context, projectId string, distributionId string, domain string) ApiGetCustomDomainRequest { + return GetCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } +} + +func (a *APIClient) GetCustomDomainExecute(ctx context.Context, projectId string, distributionId string, domain string) (*GetCustomDomainResponse, error) { + r := GetCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } + return r.Execute() +} + +type GetDistributionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + withWafStatus *bool +} + +// If set, the top level of a distribution contains a `waf` property, which defines the status of the waf. This includes a list of all resolved rules. + +func (r GetDistributionRequest) WithWafStatus(withWafStatus bool) ApiGetDistributionRequest { + r.withWafStatus = &withWafStatus + return r +} + +func (r GetDistributionRequest) Execute() (*GetDistributionResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetDistributionResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetDistribution") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.withWafStatus != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "withWafStatus", r.withWafStatus, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetDistribution: Get distribution by Id + +This returns a specific distribution by its Id. If no distribution with the given Id exists the endpoint returns 404. Trying to get a deleted distributions also return 404. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiGetDistributionRequest +*/ +func (a *APIClient) GetDistribution(ctx context.Context, projectId string, distributionId string) ApiGetDistributionRequest { + return GetDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) GetDistributionExecute(ctx context.Context, projectId string, distributionId string) (*GetDistributionResponse, error) { + r := GetDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type GetLogsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + from *time.Time + to *time.Time + pageSize *int32 + pageIdentifier *string + sortBy *string + sortOrder *string + dataCenterRegion *string + requestCountryCode *string + statusCode *int32 + cacheHit *bool +} + +// the start of the time range for which logs should be returned + +func (r GetLogsRequest) From(from time.Time) ApiGetLogsRequest { + r.from = &from + return r +} + +// the end of the time range for which logs should be returned. If not specified, \"now\" is used. + +func (r GetLogsRequest) To(to time.Time) ApiGetLogsRequest { + r.to = &to + return r +} + +// Quantifies how many log entries should be returned on this page. Must be a natural number between 1 and 1000 (inclusive) + +func (r GetLogsRequest) PageSize(pageSize int32) ApiGetLogsRequest { + r.pageSize = &pageSize + return r +} + +// Identifier is returned by the previous response and is used to request the next page. As the `pageIdentifier` encodes an element, inserts during pagination will *not* shift the result. So a scenario like: - Start listing first page - Insert new element - Start listing second page will *never* result in an element from the first page to get \"pushed\" to the second page, like it could occur with basic limit + offset pagination. The identifier should be treated as an opaque string and never modified. Only pass values returned by the API. + +func (r GetLogsRequest) PageIdentifier(pageIdentifier string) ApiGetLogsRequest { + r.pageIdentifier = &pageIdentifier + return r +} + +// Sorts the log messages by a specific field. Defaults to `timestamp`. Supported sort options: - `timestamp` - `dataCenterRegion` - `requestCountryCode` - `statusCode` - `cacheHit` - `size` - `path` - `host` + +func (r GetLogsRequest) SortBy(sortBy string) ApiGetLogsRequest { + r.sortBy = &sortBy + return r +} + +func (r GetLogsRequest) SortOrder(sortOrder string) ApiGetLogsRequest { + r.sortOrder = &sortOrder + return r +} + +// Filters by the CDN data center region that served the request. Can be combined with other filters + +func (r GetLogsRequest) DataCenterRegion(dataCenterRegion string) ApiGetLogsRequest { + r.dataCenterRegion = &dataCenterRegion + return r +} + +// Filters by the originating country of the user request. Can be combined with other filters + +func (r GetLogsRequest) RequestCountryCode(requestCountryCode string) ApiGetLogsRequest { + r.requestCountryCode = &requestCountryCode + return r +} + +// Filters by the HTTP status code returned to the client. Can be combined with other filters + +func (r GetLogsRequest) StatusCode(statusCode int32) ApiGetLogsRequest { + r.statusCode = &statusCode + return r +} + +// Filters based on whether the request was served from the CDN cache. Can be combined with other filters + +func (r GetLogsRequest) CacheHit(cacheHit bool) ApiGetLogsRequest { + r.cacheHit = &cacheHit + return r +} + +func (r GetLogsRequest) Execute() (*GetLogsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetLogsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetLogs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}/logs" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.from != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "") + } + if r.to != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.pageIdentifier != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageIdentifier", r.pageIdentifier, "") + } + if r.sortBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + if r.dataCenterRegion != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "dataCenterRegion", r.dataCenterRegion, "") + } + if r.requestCountryCode != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "requestCountryCode", r.requestCountryCode, "") + } + if r.statusCode != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "statusCode", r.statusCode, "") + } + if r.cacheHit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cacheHit", r.cacheHit, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetLogs: Retrieve distribution logs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId Your CDN distribution Id + @return ApiGetLogsRequest +*/ +func (a *APIClient) GetLogs(ctx context.Context, projectId string, distributionId string) ApiGetLogsRequest { + return GetLogsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) GetLogsExecute(ctx context.Context, projectId string, distributionId string) (*GetLogsResponse, error) { + r := GetLogsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type GetStatisticsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + from *time.Time + to *time.Time + interval *string +} + +// the start of the time range for which statistics should be returned + +func (r GetStatisticsRequest) From(from time.Time) ApiGetStatisticsRequest { + r.from = &from + return r +} + +// the end of the time range for which statistics should be returned. If not specified, the end of the current time interval is used, e.g. next day for daily, next month for monthly, and so on. + +func (r GetStatisticsRequest) To(to time.Time) ApiGetStatisticsRequest { + r.to = &to + return r +} + +// Over which interval should statistics be aggregated? defaults to hourly resolution **NOTE**: Intervals are grouped in buckets that start and end based on a day in UTC+0 time. So for the `daily` interval, the group starts (inclusive) and ends (exclusive) at `00:00Z` + +func (r GetStatisticsRequest) Interval(interval string) ApiGetStatisticsRequest { + r.interval = &interval + return r +} + +func (r GetStatisticsRequest) Execute() (*GetStatisticsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetStatisticsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetStatistics") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}/statistics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.from == nil { + return localVarReturnValue, fmt.Errorf("from is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "") + if r.to != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "") + } + if r.interval != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "interval", r.interval, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetStatistics: Retrieve the statistics of a distribution + +Returns the statistics of the distribution in the given +time range. The response is a list of statistics records. Each record aggregates the statistics for its time interval. +In case no statistics for a time interval exist, no record is returned. +The time range for which statistics should be returned can be configured using query parameters. + +Timestamps are assumed to be UTC. This is especially important for the "buckets" when you, for example, return daily information. A day always starts and ends at 00:00Z. + +**Important Note:** Lower bounds are inclusive, upper bounds are exclusive. If you, for example, want a daily grouped which starts on the 1st Jan and also contains the full 10th Jan day, you would define `2025-01-01T00:00:00Z` as the lower and `2025-01-11T00:00:00Z` as the upper bound. + +The upper bound is optional. If you omit it, the API will use the start of the next interval as the upper bound. +Example: if `interval` is `hourly`, `from` would default to the start of the next hour, if it's `daily`, `from` would default to the start of the next day, etc. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiGetStatisticsRequest +*/ +func (a *APIClient) GetStatistics(ctx context.Context, projectId string, distributionId string) ApiGetStatisticsRequest { + return GetStatisticsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) GetStatisticsExecute(ctx context.Context, projectId string, distributionId string) (*GetStatisticsResponse, error) { + r := GetStatisticsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type ListDistributionsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + pageSize *int32 + withWafStatus *bool + pageIdentifier *string + sortBy *string + sortOrder *string +} + +// Quantifies how many distributions should be returned on this page. Must be a natural number between 1 and 100 (inclusive) + +func (r ListDistributionsRequest) PageSize(pageSize int32) ApiListDistributionsRequest { + r.pageSize = &pageSize + return r +} + +// If set, the top level of a distribution contains a `waf` property, which defines the status of the waf. This includes a list of all resolved rules. + +func (r ListDistributionsRequest) WithWafStatus(withWafStatus bool) ApiListDistributionsRequest { + r.withWafStatus = &withWafStatus + return r +} + +// Identifier is returned by the previous response and is used to request the next page. As the `pageIdentifier` encodes an element, inserts during pagination will *not* shift the result. So a scenario like: - Start listing first page - Insert new element - Start listing second page will *never* result in an element from the first page to get \"pushed\" to the second page, like it could occur with basic limit + offset pagination. The identifier should be treated as an opaque string and never modified. Only pass values returned by the API. + +func (r ListDistributionsRequest) PageIdentifier(pageIdentifier string) ApiListDistributionsRequest { + r.pageIdentifier = &pageIdentifier + return r +} + +// The following sort options exist. We default to `createdAt` - `id` - Sort by distribution Id using String comparison - `updatedAt` - Sort by when the distribution configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originUrl using String comparison - `status` - Sort by distribution status, using String comparison - `originUrlRelated` - The originUrl is segmented and reversed before sorting. E.g. `www.example.com` is converted to `com.example.www` for sorting. This way, distributions pointing to the same domain trees are grouped next to each other. + +func (r ListDistributionsRequest) SortBy(sortBy string) ApiListDistributionsRequest { + r.sortBy = &sortBy + return r +} + +func (r ListDistributionsRequest) SortOrder(sortOrder string) ApiListDistributionsRequest { + r.sortOrder = &sortOrder + return r +} + +func (r ListDistributionsRequest) Execute() (*ListDistributionsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListDistributionsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListDistributions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.withWafStatus != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "withWafStatus", r.withWafStatus, "") + } + if r.pageIdentifier != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageIdentifier", r.pageIdentifier, "") + } + if r.sortBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListDistributions: List all distributions belonging to a specific project + +ListDistributions returns a list of all CDN distributions associated with +a given project, ordered by their distribution Id. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @return ApiListDistributionsRequest +*/ +func (a *APIClient) ListDistributions(ctx context.Context, projectId string) ApiListDistributionsRequest { + return ListDistributionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListDistributionsExecute(ctx context.Context, projectId string) (*ListDistributionsResponse, error) { + r := ListDistributionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ListWafCollectionsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r ListWafCollectionsRequest) Execute() (*ListWafCollectionsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListWafCollectionsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListWafCollections") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/waf/collections" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListWafCollections: List all WAF rule collections of the project + +Returns all WAF rule collections available to the project + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @return ApiListWafCollectionsRequest +*/ +func (a *APIClient) ListWafCollections(ctx context.Context, projectId string) ApiListWafCollectionsRequest { + return ListWafCollectionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListWafCollectionsExecute(ctx context.Context, projectId string) (*ListWafCollectionsResponse, error) { + r := ListWafCollectionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type PatchDistributionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + patchDistributionPayload *PatchDistributionPayload +} + +func (r PatchDistributionRequest) PatchDistributionPayload(patchDistributionPayload PatchDistributionPayload) ApiPatchDistributionRequest { + r.patchDistributionPayload = &patchDistributionPayload + return r +} + +func (r PatchDistributionRequest) Execute() (*PatchDistributionResponse, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PatchDistributionResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PatchDistribution") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.patchDistributionPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +PatchDistribution: Update existing distribution + +Modify a CDN distribution with a partial update. Only the fields specified in the request will be modified. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiPatchDistributionRequest +*/ +func (a *APIClient) PatchDistribution(ctx context.Context, projectId string, distributionId string) ApiPatchDistributionRequest { + return PatchDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) PatchDistributionExecute(ctx context.Context, projectId string, distributionId string) (*PatchDistributionResponse, error) { + r := PatchDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type PurgeCacheRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + purgeCachePayload *PurgeCachePayload +} + +func (r PurgeCacheRequest) PurgeCachePayload(purgeCachePayload PurgeCachePayload) ApiPurgeCacheRequest { + r.purgeCachePayload = &purgeCachePayload + return r +} + +func (r PurgeCacheRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PurgeCache") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}/cache/purge" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.purgeCachePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +PurgeCache: Clear distribution cache + +Clear the cache for this distribution. +All content, regardless of its staleness, will get refetched from the host. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @return ApiPurgeCacheRequest +*/ +func (a *APIClient) PurgeCache(ctx context.Context, projectId string, distributionId string) ApiPurgeCacheRequest { + return PurgeCacheRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) PurgeCacheExecute(ctx context.Context, projectId string, distributionId string) (map[string]interface{}, error) { + r := PurgeCacheRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type PutCustomDomainRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + domain string + putCustomDomainPayload *PutCustomDomainPayload +} + +func (r PutCustomDomainRequest) PutCustomDomainPayload(putCustomDomainPayload PutCustomDomainPayload) ApiPutCustomDomainRequest { + r.putCustomDomainPayload = &putCustomDomainPayload + return r +} + +func (r PutCustomDomainRequest) Execute() (*PutCustomDomainResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PutCustomDomainResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PutCustomDomain") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta2/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(r.domain, "domain")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.domain) > 72 { + return localVarReturnValue, fmt.Errorf("domain must have less than 72 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.putCustomDomainPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJsonResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +PutCustomDomain: Create or update a custom domain + +Creates a new custom domain. If it already exists, this will overwrite the previous custom domain's properties. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project Id + @param distributionId + @param domain + @return ApiPutCustomDomainRequest +*/ +func (a *APIClient) PutCustomDomain(ctx context.Context, projectId string, distributionId string, domain string) ApiPutCustomDomainRequest { + return PutCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } +} + +func (a *APIClient) PutCustomDomainExecute(ctx context.Context, projectId string, distributionId string, domain string) (*PutCustomDomainResponse, error) { + r := PutCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } + return r.Execute() +} diff --git a/pkg/cdnbeta/api_default_test.go b/pkg/cdnbeta/api_default_test.go new file mode 100644 index 00000000..c91093a1 --- /dev/null +++ b/pkg/cdnbeta/api_default_test.go @@ -0,0 +1,801 @@ +/* +CDN API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package cdnbeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_cdnbeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateDistribution", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateDistributionResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + createDistributionPayload := CreateDistributionPayload{} + + resp, reqErr := apiClient.CreateDistribution(context.Background(), projectId).CreateDistributionPayload(createDistributionPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteCustomDomain", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + domainValue := randString(72) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(domainValue, "domain")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := DeleteCustomDomainResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + domain := domainValue + + resp, reqErr := apiClient.DeleteCustomDomain(context.Background(), projectId, distributionId, domain).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteDistribution", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := DeleteDistributionResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + + resp, reqErr := apiClient.DeleteDistribution(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService FindCachePaths", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}/cache/paths" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := FindCachePathsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + var path string + + resp, reqErr := apiClient.FindCachePaths(context.Background(), projectId, distributionId).Path(path).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetCacheInfo", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}/cache" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetCacheInfoResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + + resp, reqErr := apiClient.GetCacheInfo(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetCustomDomain", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + domainValue := randString(72) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(domainValue, "domain")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetCustomDomainResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + domain := domainValue + + resp, reqErr := apiClient.GetCustomDomain(context.Background(), projectId, distributionId, domain).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetDistribution", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetDistributionResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + + resp, reqErr := apiClient.GetDistribution(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetLogs", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}/logs" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetLogsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + + resp, reqErr := apiClient.GetLogs(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetStatistics", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}/statistics" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetStatisticsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + var from time.Time + + resp, reqErr := apiClient.GetStatistics(context.Background(), projectId, distributionId).From(from).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListDistributions", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListDistributionsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + + resp, reqErr := apiClient.ListDistributions(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListWafCollections", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/waf/collections" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListWafCollectionsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + + resp, reqErr := apiClient.ListWafCollections(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService PatchDistribution", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := PatchDistributionResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + + resp, reqErr := apiClient.PatchDistribution(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService PurgeCache", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}/cache/purge" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + + resp, reqErr := apiClient.PurgeCache(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService PutCustomDomain", func(t *testing.T) { + _apiUrlPath := "/v1beta2/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + domainValue := randString(72) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(domainValue, "domain")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := PutCustomDomainResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdnbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + distributionId := distributionIdValue + domain := domainValue + + resp, reqErr := apiClient.PutCustomDomain(context.Background(), projectId, distributionId, domain).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/cdnbeta/client.go b/pkg/cdnbeta/client.go new file mode 100644 index 00000000..01316883 --- /dev/null +++ b/pkg/cdnbeta/client.go @@ -0,0 +1,628 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the CDN API API v1beta2.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/cdnbeta/configuration.go b/pkg/cdnbeta/configuration.go new file mode 100644 index 00000000..53719619 --- /dev/null +++ b/pkg/cdnbeta/configuration.go @@ -0,0 +1,38 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/cdnbeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://cdn.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/cdnbeta/model_bucket_backend.go b/pkg/cdnbeta/model_bucket_backend.go new file mode 100644 index 00000000..30191829 --- /dev/null +++ b/pkg/cdnbeta/model_bucket_backend.go @@ -0,0 +1,214 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the BucketBackend type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BucketBackend{} + +/* + types and functions for bucketUrl +*/ + +// isNotNullableString +type BucketBackendGetBucketUrlAttributeType = *string + +func getBucketBackendGetBucketUrlAttributeTypeOk(arg BucketBackendGetBucketUrlAttributeType) (ret BucketBackendGetBucketUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendGetBucketUrlAttributeType(arg *BucketBackendGetBucketUrlAttributeType, val BucketBackendGetBucketUrlRetType) { + *arg = &val +} + +type BucketBackendGetBucketUrlArgType = string +type BucketBackendGetBucketUrlRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type BucketBackendGetRegionAttributeType = *string + +func getBucketBackendGetRegionAttributeTypeOk(arg BucketBackendGetRegionAttributeType) (ret BucketBackendGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendGetRegionAttributeType(arg *BucketBackendGetRegionAttributeType, val BucketBackendGetRegionRetType) { + *arg = &val +} + +type BucketBackendGetRegionArgType = string +type BucketBackendGetRegionRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type BucketBackendGetTypeAttributeType = *string + +func getBucketBackendGetTypeAttributeTypeOk(arg BucketBackendGetTypeAttributeType) (ret BucketBackendGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendGetTypeAttributeType(arg *BucketBackendGetTypeAttributeType, val BucketBackendGetTypeRetType) { + *arg = &val +} + +type BucketBackendGetTypeArgType = string +type BucketBackendGetTypeRetType = string + +// BucketBackend struct for BucketBackend +type BucketBackend struct { + // REQUIRED + BucketUrl BucketBackendGetBucketUrlAttributeType `json:"bucketUrl" required:"true"` + // REQUIRED + Region BucketBackendGetRegionAttributeType `json:"region" required:"true"` + // REQUIRED + Type BucketBackendGetTypeAttributeType `json:"type" required:"true"` +} + +type _BucketBackend BucketBackend + +// NewBucketBackend instantiates a new BucketBackend 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 NewBucketBackend(bucketUrl BucketBackendGetBucketUrlArgType, region BucketBackendGetRegionArgType, types BucketBackendGetTypeArgType) *BucketBackend { + this := BucketBackend{} + setBucketBackendGetBucketUrlAttributeType(&this.BucketUrl, bucketUrl) + setBucketBackendGetRegionAttributeType(&this.Region, region) + setBucketBackendGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewBucketBackendWithDefaults instantiates a new BucketBackend 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 NewBucketBackendWithDefaults() *BucketBackend { + this := BucketBackend{} + return &this +} + +// GetBucketUrl returns the BucketUrl field value +func (o *BucketBackend) GetBucketUrl() (ret BucketBackendGetBucketUrlRetType) { + ret, _ = o.GetBucketUrlOk() + return ret +} + +// GetBucketUrlOk returns a tuple with the BucketUrl field value +// and a boolean to check if the value has been set. +func (o *BucketBackend) GetBucketUrlOk() (ret BucketBackendGetBucketUrlRetType, ok bool) { + return getBucketBackendGetBucketUrlAttributeTypeOk(o.BucketUrl) +} + +// SetBucketUrl sets field value +func (o *BucketBackend) SetBucketUrl(v BucketBackendGetBucketUrlRetType) { + setBucketBackendGetBucketUrlAttributeType(&o.BucketUrl, v) +} + +// GetRegion returns the Region field value +func (o *BucketBackend) GetRegion() (ret BucketBackendGetRegionRetType) { + ret, _ = o.GetRegionOk() + return ret +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *BucketBackend) GetRegionOk() (ret BucketBackendGetRegionRetType, ok bool) { + return getBucketBackendGetRegionAttributeTypeOk(o.Region) +} + +// SetRegion sets field value +func (o *BucketBackend) SetRegion(v BucketBackendGetRegionRetType) { + setBucketBackendGetRegionAttributeType(&o.Region, v) +} + +// GetType returns the Type field value +func (o *BucketBackend) GetType() (ret BucketBackendGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *BucketBackend) GetTypeOk() (ret BucketBackendGetTypeRetType, ok bool) { + return getBucketBackendGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *BucketBackend) SetType(v BucketBackendGetTypeRetType) { + setBucketBackendGetTypeAttributeType(&o.Type, v) +} + +func (o BucketBackend) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBucketBackendGetBucketUrlAttributeTypeOk(o.BucketUrl); ok { + toSerialize["BucketUrl"] = val + } + if val, ok := getBucketBackendGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getBucketBackendGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableBucketBackend struct { + value *BucketBackend + isSet bool +} + +func (v NullableBucketBackend) Get() *BucketBackend { + return v.value +} + +func (v *NullableBucketBackend) Set(val *BucketBackend) { + v.value = val + v.isSet = true +} + +func (v NullableBucketBackend) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketBackend) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketBackend(val *BucketBackend) *NullableBucketBackend { + return &NullableBucketBackend{value: val, isSet: true} +} + +func (v NullableBucketBackend) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketBackend) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_bucket_backend_create.go b/pkg/cdnbeta/model_bucket_backend_create.go new file mode 100644 index 00000000..dd1078d4 --- /dev/null +++ b/pkg/cdnbeta/model_bucket_backend_create.go @@ -0,0 +1,257 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the BucketBackendCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BucketBackendCreate{} + +/* + types and functions for bucketUrl +*/ + +// isNotNullableString +type BucketBackendCreateGetBucketUrlAttributeType = *string + +func getBucketBackendCreateGetBucketUrlAttributeTypeOk(arg BucketBackendCreateGetBucketUrlAttributeType) (ret BucketBackendCreateGetBucketUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendCreateGetBucketUrlAttributeType(arg *BucketBackendCreateGetBucketUrlAttributeType, val BucketBackendCreateGetBucketUrlRetType) { + *arg = &val +} + +type BucketBackendCreateGetBucketUrlArgType = string +type BucketBackendCreateGetBucketUrlRetType = string + +/* + types and functions for credentials +*/ + +// isModel +type BucketBackendCreateGetCredentialsAttributeType = *BucketCredentials +type BucketBackendCreateGetCredentialsArgType = BucketCredentials +type BucketBackendCreateGetCredentialsRetType = BucketCredentials + +func getBucketBackendCreateGetCredentialsAttributeTypeOk(arg BucketBackendCreateGetCredentialsAttributeType) (ret BucketBackendCreateGetCredentialsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendCreateGetCredentialsAttributeType(arg *BucketBackendCreateGetCredentialsAttributeType, val BucketBackendCreateGetCredentialsRetType) { + *arg = &val +} + +/* + types and functions for region +*/ + +// isNotNullableString +type BucketBackendCreateGetRegionAttributeType = *string + +func getBucketBackendCreateGetRegionAttributeTypeOk(arg BucketBackendCreateGetRegionAttributeType) (ret BucketBackendCreateGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendCreateGetRegionAttributeType(arg *BucketBackendCreateGetRegionAttributeType, val BucketBackendCreateGetRegionRetType) { + *arg = &val +} + +type BucketBackendCreateGetRegionArgType = string +type BucketBackendCreateGetRegionRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type BucketBackendCreateGetTypeAttributeType = *string + +func getBucketBackendCreateGetTypeAttributeTypeOk(arg BucketBackendCreateGetTypeAttributeType) (ret BucketBackendCreateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendCreateGetTypeAttributeType(arg *BucketBackendCreateGetTypeAttributeType, val BucketBackendCreateGetTypeRetType) { + *arg = &val +} + +type BucketBackendCreateGetTypeArgType = string +type BucketBackendCreateGetTypeRetType = string + +// BucketBackendCreate struct for BucketBackendCreate +type BucketBackendCreate struct { + // REQUIRED + BucketUrl BucketBackendCreateGetBucketUrlAttributeType `json:"bucketUrl" required:"true"` + // REQUIRED + Credentials BucketBackendCreateGetCredentialsAttributeType `json:"credentials" required:"true"` + // REQUIRED + Region BucketBackendCreateGetRegionAttributeType `json:"region" required:"true"` + // REQUIRED + Type BucketBackendCreateGetTypeAttributeType `json:"type" required:"true"` +} + +type _BucketBackendCreate BucketBackendCreate + +// NewBucketBackendCreate instantiates a new BucketBackendCreate 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 NewBucketBackendCreate(bucketUrl BucketBackendCreateGetBucketUrlArgType, credentials BucketBackendCreateGetCredentialsArgType, region BucketBackendCreateGetRegionArgType, types BucketBackendCreateGetTypeArgType) *BucketBackendCreate { + this := BucketBackendCreate{} + setBucketBackendCreateGetBucketUrlAttributeType(&this.BucketUrl, bucketUrl) + setBucketBackendCreateGetCredentialsAttributeType(&this.Credentials, credentials) + setBucketBackendCreateGetRegionAttributeType(&this.Region, region) + setBucketBackendCreateGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewBucketBackendCreateWithDefaults instantiates a new BucketBackendCreate 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 NewBucketBackendCreateWithDefaults() *BucketBackendCreate { + this := BucketBackendCreate{} + return &this +} + +// GetBucketUrl returns the BucketUrl field value +func (o *BucketBackendCreate) GetBucketUrl() (ret BucketBackendCreateGetBucketUrlRetType) { + ret, _ = o.GetBucketUrlOk() + return ret +} + +// GetBucketUrlOk returns a tuple with the BucketUrl field value +// and a boolean to check if the value has been set. +func (o *BucketBackendCreate) GetBucketUrlOk() (ret BucketBackendCreateGetBucketUrlRetType, ok bool) { + return getBucketBackendCreateGetBucketUrlAttributeTypeOk(o.BucketUrl) +} + +// SetBucketUrl sets field value +func (o *BucketBackendCreate) SetBucketUrl(v BucketBackendCreateGetBucketUrlRetType) { + setBucketBackendCreateGetBucketUrlAttributeType(&o.BucketUrl, v) +} + +// GetCredentials returns the Credentials field value +func (o *BucketBackendCreate) GetCredentials() (ret BucketBackendCreateGetCredentialsRetType) { + ret, _ = o.GetCredentialsOk() + return ret +} + +// GetCredentialsOk returns a tuple with the Credentials field value +// and a boolean to check if the value has been set. +func (o *BucketBackendCreate) GetCredentialsOk() (ret BucketBackendCreateGetCredentialsRetType, ok bool) { + return getBucketBackendCreateGetCredentialsAttributeTypeOk(o.Credentials) +} + +// SetCredentials sets field value +func (o *BucketBackendCreate) SetCredentials(v BucketBackendCreateGetCredentialsRetType) { + setBucketBackendCreateGetCredentialsAttributeType(&o.Credentials, v) +} + +// GetRegion returns the Region field value +func (o *BucketBackendCreate) GetRegion() (ret BucketBackendCreateGetRegionRetType) { + ret, _ = o.GetRegionOk() + return ret +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *BucketBackendCreate) GetRegionOk() (ret BucketBackendCreateGetRegionRetType, ok bool) { + return getBucketBackendCreateGetRegionAttributeTypeOk(o.Region) +} + +// SetRegion sets field value +func (o *BucketBackendCreate) SetRegion(v BucketBackendCreateGetRegionRetType) { + setBucketBackendCreateGetRegionAttributeType(&o.Region, v) +} + +// GetType returns the Type field value +func (o *BucketBackendCreate) GetType() (ret BucketBackendCreateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *BucketBackendCreate) GetTypeOk() (ret BucketBackendCreateGetTypeRetType, ok bool) { + return getBucketBackendCreateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *BucketBackendCreate) SetType(v BucketBackendCreateGetTypeRetType) { + setBucketBackendCreateGetTypeAttributeType(&o.Type, v) +} + +func (o BucketBackendCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBucketBackendCreateGetBucketUrlAttributeTypeOk(o.BucketUrl); ok { + toSerialize["BucketUrl"] = val + } + if val, ok := getBucketBackendCreateGetCredentialsAttributeTypeOk(o.Credentials); ok { + toSerialize["Credentials"] = val + } + if val, ok := getBucketBackendCreateGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getBucketBackendCreateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableBucketBackendCreate struct { + value *BucketBackendCreate + isSet bool +} + +func (v NullableBucketBackendCreate) Get() *BucketBackendCreate { + return v.value +} + +func (v *NullableBucketBackendCreate) Set(val *BucketBackendCreate) { + v.value = val + v.isSet = true +} + +func (v NullableBucketBackendCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketBackendCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketBackendCreate(val *BucketBackendCreate) *NullableBucketBackendCreate { + return &NullableBucketBackendCreate{value: val, isSet: true} +} + +func (v NullableBucketBackendCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketBackendCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_bucket_backend_create_test.go b/pkg/cdnbeta/model_bucket_backend_create_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_bucket_backend_create_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_bucket_backend_patch.go b/pkg/cdnbeta/model_bucket_backend_patch.go new file mode 100644 index 00000000..8a9d4aa4 --- /dev/null +++ b/pkg/cdnbeta/model_bucket_backend_patch.go @@ -0,0 +1,269 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the BucketBackendPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BucketBackendPatch{} + +/* + types and functions for bucketUrl +*/ + +// isNotNullableString +type BucketBackendPatchGetBucketUrlAttributeType = *string + +func getBucketBackendPatchGetBucketUrlAttributeTypeOk(arg BucketBackendPatchGetBucketUrlAttributeType) (ret BucketBackendPatchGetBucketUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendPatchGetBucketUrlAttributeType(arg *BucketBackendPatchGetBucketUrlAttributeType, val BucketBackendPatchGetBucketUrlRetType) { + *arg = &val +} + +type BucketBackendPatchGetBucketUrlArgType = string +type BucketBackendPatchGetBucketUrlRetType = string + +/* + types and functions for credentials +*/ + +// isModel +type BucketBackendPatchGetCredentialsAttributeType = *BucketCredentials +type BucketBackendPatchGetCredentialsArgType = BucketCredentials +type BucketBackendPatchGetCredentialsRetType = BucketCredentials + +func getBucketBackendPatchGetCredentialsAttributeTypeOk(arg BucketBackendPatchGetCredentialsAttributeType) (ret BucketBackendPatchGetCredentialsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendPatchGetCredentialsAttributeType(arg *BucketBackendPatchGetCredentialsAttributeType, val BucketBackendPatchGetCredentialsRetType) { + *arg = &val +} + +/* + types and functions for region +*/ + +// isNotNullableString +type BucketBackendPatchGetRegionAttributeType = *string + +func getBucketBackendPatchGetRegionAttributeTypeOk(arg BucketBackendPatchGetRegionAttributeType) (ret BucketBackendPatchGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendPatchGetRegionAttributeType(arg *BucketBackendPatchGetRegionAttributeType, val BucketBackendPatchGetRegionRetType) { + *arg = &val +} + +type BucketBackendPatchGetRegionArgType = string +type BucketBackendPatchGetRegionRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type BucketBackendPatchGetTypeAttributeType = *string + +func getBucketBackendPatchGetTypeAttributeTypeOk(arg BucketBackendPatchGetTypeAttributeType) (ret BucketBackendPatchGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketBackendPatchGetTypeAttributeType(arg *BucketBackendPatchGetTypeAttributeType, val BucketBackendPatchGetTypeRetType) { + *arg = &val +} + +type BucketBackendPatchGetTypeArgType = string +type BucketBackendPatchGetTypeRetType = string + +// BucketBackendPatch struct for BucketBackendPatch +type BucketBackendPatch struct { + BucketUrl BucketBackendPatchGetBucketUrlAttributeType `json:"bucketUrl,omitempty"` + Credentials BucketBackendPatchGetCredentialsAttributeType `json:"credentials,omitempty"` + Region BucketBackendPatchGetRegionAttributeType `json:"region,omitempty"` + // REQUIRED + Type BucketBackendPatchGetTypeAttributeType `json:"type" required:"true"` +} + +type _BucketBackendPatch BucketBackendPatch + +// NewBucketBackendPatch instantiates a new BucketBackendPatch 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 NewBucketBackendPatch(types BucketBackendPatchGetTypeArgType) *BucketBackendPatch { + this := BucketBackendPatch{} + setBucketBackendPatchGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewBucketBackendPatchWithDefaults instantiates a new BucketBackendPatch 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 NewBucketBackendPatchWithDefaults() *BucketBackendPatch { + this := BucketBackendPatch{} + return &this +} + +// GetBucketUrl returns the BucketUrl field value if set, zero value otherwise. +func (o *BucketBackendPatch) GetBucketUrl() (res BucketBackendPatchGetBucketUrlRetType) { + res, _ = o.GetBucketUrlOk() + return +} + +// GetBucketUrlOk returns a tuple with the BucketUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BucketBackendPatch) GetBucketUrlOk() (ret BucketBackendPatchGetBucketUrlRetType, ok bool) { + return getBucketBackendPatchGetBucketUrlAttributeTypeOk(o.BucketUrl) +} + +// HasBucketUrl returns a boolean if a field has been set. +func (o *BucketBackendPatch) HasBucketUrl() bool { + _, ok := o.GetBucketUrlOk() + return ok +} + +// SetBucketUrl gets a reference to the given string and assigns it to the BucketUrl field. +func (o *BucketBackendPatch) SetBucketUrl(v BucketBackendPatchGetBucketUrlRetType) { + setBucketBackendPatchGetBucketUrlAttributeType(&o.BucketUrl, v) +} + +// GetCredentials returns the Credentials field value if set, zero value otherwise. +func (o *BucketBackendPatch) GetCredentials() (res BucketBackendPatchGetCredentialsRetType) { + res, _ = o.GetCredentialsOk() + return +} + +// GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BucketBackendPatch) GetCredentialsOk() (ret BucketBackendPatchGetCredentialsRetType, ok bool) { + return getBucketBackendPatchGetCredentialsAttributeTypeOk(o.Credentials) +} + +// HasCredentials returns a boolean if a field has been set. +func (o *BucketBackendPatch) HasCredentials() bool { + _, ok := o.GetCredentialsOk() + return ok +} + +// SetCredentials gets a reference to the given BucketCredentials and assigns it to the Credentials field. +func (o *BucketBackendPatch) SetCredentials(v BucketBackendPatchGetCredentialsRetType) { + setBucketBackendPatchGetCredentialsAttributeType(&o.Credentials, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *BucketBackendPatch) GetRegion() (res BucketBackendPatchGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BucketBackendPatch) GetRegionOk() (ret BucketBackendPatchGetRegionRetType, ok bool) { + return getBucketBackendPatchGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *BucketBackendPatch) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *BucketBackendPatch) SetRegion(v BucketBackendPatchGetRegionRetType) { + setBucketBackendPatchGetRegionAttributeType(&o.Region, v) +} + +// GetType returns the Type field value +func (o *BucketBackendPatch) GetType() (ret BucketBackendPatchGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *BucketBackendPatch) GetTypeOk() (ret BucketBackendPatchGetTypeRetType, ok bool) { + return getBucketBackendPatchGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *BucketBackendPatch) SetType(v BucketBackendPatchGetTypeRetType) { + setBucketBackendPatchGetTypeAttributeType(&o.Type, v) +} + +func (o BucketBackendPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBucketBackendPatchGetBucketUrlAttributeTypeOk(o.BucketUrl); ok { + toSerialize["BucketUrl"] = val + } + if val, ok := getBucketBackendPatchGetCredentialsAttributeTypeOk(o.Credentials); ok { + toSerialize["Credentials"] = val + } + if val, ok := getBucketBackendPatchGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getBucketBackendPatchGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableBucketBackendPatch struct { + value *BucketBackendPatch + isSet bool +} + +func (v NullableBucketBackendPatch) Get() *BucketBackendPatch { + return v.value +} + +func (v *NullableBucketBackendPatch) Set(val *BucketBackendPatch) { + v.value = val + v.isSet = true +} + +func (v NullableBucketBackendPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketBackendPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketBackendPatch(val *BucketBackendPatch) *NullableBucketBackendPatch { + return &NullableBucketBackendPatch{value: val, isSet: true} +} + +func (v NullableBucketBackendPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketBackendPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_bucket_backend_patch_test.go b/pkg/cdnbeta/model_bucket_backend_patch_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_bucket_backend_patch_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_bucket_backend_test.go b/pkg/cdnbeta/model_bucket_backend_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_bucket_backend_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_bucket_credentials.go b/pkg/cdnbeta/model_bucket_credentials.go new file mode 100644 index 00000000..6df4643d --- /dev/null +++ b/pkg/cdnbeta/model_bucket_credentials.go @@ -0,0 +1,170 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the BucketCredentials type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BucketCredentials{} + +/* + types and functions for accessKeyId +*/ + +// isNotNullableString +type BucketCredentialsGetAccessKeyIdAttributeType = *string + +func getBucketCredentialsGetAccessKeyIdAttributeTypeOk(arg BucketCredentialsGetAccessKeyIdAttributeType) (ret BucketCredentialsGetAccessKeyIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketCredentialsGetAccessKeyIdAttributeType(arg *BucketCredentialsGetAccessKeyIdAttributeType, val BucketCredentialsGetAccessKeyIdRetType) { + *arg = &val +} + +type BucketCredentialsGetAccessKeyIdArgType = string +type BucketCredentialsGetAccessKeyIdRetType = string + +/* + types and functions for secretAccessKey +*/ + +// isNotNullableString +type BucketCredentialsGetSecretAccessKeyAttributeType = *string + +func getBucketCredentialsGetSecretAccessKeyAttributeTypeOk(arg BucketCredentialsGetSecretAccessKeyAttributeType) (ret BucketCredentialsGetSecretAccessKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBucketCredentialsGetSecretAccessKeyAttributeType(arg *BucketCredentialsGetSecretAccessKeyAttributeType, val BucketCredentialsGetSecretAccessKeyRetType) { + *arg = &val +} + +type BucketCredentialsGetSecretAccessKeyArgType = string +type BucketCredentialsGetSecretAccessKeyRetType = string + +// BucketCredentials struct for BucketCredentials +type BucketCredentials struct { + // REQUIRED + AccessKeyId BucketCredentialsGetAccessKeyIdAttributeType `json:"accessKeyId" required:"true"` + // REQUIRED + SecretAccessKey BucketCredentialsGetSecretAccessKeyAttributeType `json:"secretAccessKey" required:"true"` +} + +type _BucketCredentials BucketCredentials + +// NewBucketCredentials instantiates a new BucketCredentials 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 NewBucketCredentials(accessKeyId BucketCredentialsGetAccessKeyIdArgType, secretAccessKey BucketCredentialsGetSecretAccessKeyArgType) *BucketCredentials { + this := BucketCredentials{} + setBucketCredentialsGetAccessKeyIdAttributeType(&this.AccessKeyId, accessKeyId) + setBucketCredentialsGetSecretAccessKeyAttributeType(&this.SecretAccessKey, secretAccessKey) + return &this +} + +// NewBucketCredentialsWithDefaults instantiates a new BucketCredentials 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 NewBucketCredentialsWithDefaults() *BucketCredentials { + this := BucketCredentials{} + return &this +} + +// GetAccessKeyId returns the AccessKeyId field value +func (o *BucketCredentials) GetAccessKeyId() (ret BucketCredentialsGetAccessKeyIdRetType) { + ret, _ = o.GetAccessKeyIdOk() + return ret +} + +// GetAccessKeyIdOk returns a tuple with the AccessKeyId field value +// and a boolean to check if the value has been set. +func (o *BucketCredentials) GetAccessKeyIdOk() (ret BucketCredentialsGetAccessKeyIdRetType, ok bool) { + return getBucketCredentialsGetAccessKeyIdAttributeTypeOk(o.AccessKeyId) +} + +// SetAccessKeyId sets field value +func (o *BucketCredentials) SetAccessKeyId(v BucketCredentialsGetAccessKeyIdRetType) { + setBucketCredentialsGetAccessKeyIdAttributeType(&o.AccessKeyId, v) +} + +// GetSecretAccessKey returns the SecretAccessKey field value +func (o *BucketCredentials) GetSecretAccessKey() (ret BucketCredentialsGetSecretAccessKeyRetType) { + ret, _ = o.GetSecretAccessKeyOk() + return ret +} + +// GetSecretAccessKeyOk returns a tuple with the SecretAccessKey field value +// and a boolean to check if the value has been set. +func (o *BucketCredentials) GetSecretAccessKeyOk() (ret BucketCredentialsGetSecretAccessKeyRetType, ok bool) { + return getBucketCredentialsGetSecretAccessKeyAttributeTypeOk(o.SecretAccessKey) +} + +// SetSecretAccessKey sets field value +func (o *BucketCredentials) SetSecretAccessKey(v BucketCredentialsGetSecretAccessKeyRetType) { + setBucketCredentialsGetSecretAccessKeyAttributeType(&o.SecretAccessKey, v) +} + +func (o BucketCredentials) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBucketCredentialsGetAccessKeyIdAttributeTypeOk(o.AccessKeyId); ok { + toSerialize["AccessKeyId"] = val + } + if val, ok := getBucketCredentialsGetSecretAccessKeyAttributeTypeOk(o.SecretAccessKey); ok { + toSerialize["SecretAccessKey"] = val + } + return toSerialize, nil +} + +type NullableBucketCredentials struct { + value *BucketCredentials + isSet bool +} + +func (v NullableBucketCredentials) Get() *BucketCredentials { + return v.value +} + +func (v *NullableBucketCredentials) Set(val *BucketCredentials) { + v.value = val + v.isSet = true +} + +func (v NullableBucketCredentials) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketCredentials) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketCredentials(val *BucketCredentials) *NullableBucketCredentials { + return &NullableBucketCredentials{value: val, isSet: true} +} + +func (v NullableBucketCredentials) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketCredentials) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_bucket_credentials_test.go b/pkg/cdnbeta/model_bucket_credentials_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_bucket_credentials_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_config.go b/pkg/cdnbeta/model_config.go new file mode 100644 index 00000000..c05e8f0d --- /dev/null +++ b/pkg/cdnbeta/model_config.go @@ -0,0 +1,516 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the Config type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Config{} + +/* + types and functions for backend +*/ + +// isModel +type ConfigGetBackendAttributeType = *ConfigBackend +type ConfigGetBackendArgType = ConfigBackend +type ConfigGetBackendRetType = ConfigBackend + +func getConfigGetBackendAttributeTypeOk(arg ConfigGetBackendAttributeType) (ret ConfigGetBackendRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigGetBackendAttributeType(arg *ConfigGetBackendAttributeType, val ConfigGetBackendRetType) { + *arg = &val +} + +/* + types and functions for blockedCountries +*/ + +// isArray +type ConfigGetBlockedCountriesAttributeType = *[]string +type ConfigGetBlockedCountriesArgType = []string +type ConfigGetBlockedCountriesRetType = []string + +func getConfigGetBlockedCountriesAttributeTypeOk(arg ConfigGetBlockedCountriesAttributeType) (ret ConfigGetBlockedCountriesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigGetBlockedCountriesAttributeType(arg *ConfigGetBlockedCountriesAttributeType, val ConfigGetBlockedCountriesRetType) { + *arg = &val +} + +/* + types and functions for blockedIps +*/ + +// isArray +type ConfigGetBlockedIpsAttributeType = *[]string +type ConfigGetBlockedIpsArgType = []string +type ConfigGetBlockedIpsRetType = []string + +func getConfigGetBlockedIpsAttributeTypeOk(arg ConfigGetBlockedIpsAttributeType) (ret ConfigGetBlockedIpsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigGetBlockedIpsAttributeType(arg *ConfigGetBlockedIpsAttributeType, val ConfigGetBlockedIpsRetType) { + *arg = &val +} + +/* + types and functions for defaultCacheDuration +*/ + +// isNullableString +type ConfigGetDefaultCacheDurationAttributeType = *NullableString + +func getConfigGetDefaultCacheDurationAttributeTypeOk(arg ConfigGetDefaultCacheDurationAttributeType) (ret ConfigGetDefaultCacheDurationRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setConfigGetDefaultCacheDurationAttributeType(arg *ConfigGetDefaultCacheDurationAttributeType, val ConfigGetDefaultCacheDurationRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ConfigGetDefaultCacheDurationArgType = *string +type ConfigGetDefaultCacheDurationRetType = *string + +/* + types and functions for logSink +*/ + +// isModel +type ConfigGetLogSinkAttributeType = *ConfigLogSink +type ConfigGetLogSinkArgType = ConfigLogSink +type ConfigGetLogSinkRetType = ConfigLogSink + +func getConfigGetLogSinkAttributeTypeOk(arg ConfigGetLogSinkAttributeType) (ret ConfigGetLogSinkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigGetLogSinkAttributeType(arg *ConfigGetLogSinkAttributeType, val ConfigGetLogSinkRetType) { + *arg = &val +} + +/* + types and functions for monthlyLimitBytes +*/ + +// isLong +type ConfigGetMonthlyLimitBytesAttributeType = *int64 +type ConfigGetMonthlyLimitBytesArgType = *int64 +type ConfigGetMonthlyLimitBytesRetType = *int64 + +func getConfigGetMonthlyLimitBytesAttributeTypeOk(arg ConfigGetMonthlyLimitBytesAttributeType) (ret ConfigGetMonthlyLimitBytesRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setConfigGetMonthlyLimitBytesAttributeType(arg *ConfigGetMonthlyLimitBytesAttributeType, val ConfigGetMonthlyLimitBytesRetType) { + *arg = val +} + +/* + types and functions for optimizer +*/ + +// isModel +type ConfigGetOptimizerAttributeType = *Optimizer +type ConfigGetOptimizerArgType = Optimizer +type ConfigGetOptimizerRetType = Optimizer + +func getConfigGetOptimizerAttributeTypeOk(arg ConfigGetOptimizerAttributeType) (ret ConfigGetOptimizerRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigGetOptimizerAttributeType(arg *ConfigGetOptimizerAttributeType, val ConfigGetOptimizerRetType) { + *arg = &val +} + +/* + types and functions for regions +*/ + +// isArray +type ConfigGetRegionsAttributeType = *[]Region +type ConfigGetRegionsArgType = []Region +type ConfigGetRegionsRetType = []Region + +func getConfigGetRegionsAttributeTypeOk(arg ConfigGetRegionsAttributeType) (ret ConfigGetRegionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigGetRegionsAttributeType(arg *ConfigGetRegionsAttributeType, val ConfigGetRegionsRetType) { + *arg = &val +} + +/* + types and functions for waf +*/ + +// isModel +type ConfigGetWafAttributeType = *WafConfig +type ConfigGetWafArgType = WafConfig +type ConfigGetWafRetType = WafConfig + +func getConfigGetWafAttributeTypeOk(arg ConfigGetWafAttributeType) (ret ConfigGetWafRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigGetWafAttributeType(arg *ConfigGetWafAttributeType, val ConfigGetWafRetType) { + *arg = &val +} + +// Config struct for Config +type Config struct { + // REQUIRED + Backend ConfigGetBackendAttributeType `json:"backend" required:"true"` + // Restricts access to your content based on country. We use the ISO 3166-1 alpha-2 standard for country codes (e.g. DE, ES, GB). This setting blocks users from the specified countries. + // REQUIRED + BlockedCountries ConfigGetBlockedCountriesAttributeType `json:"blockedCountries" required:"true"` + // Restricts access to your content by specifying a list of blocked IPv4 addresses. This feature enhances security and privacy by preventing these addresses from accessing your distribution. + // REQUIRED + BlockedIps ConfigGetBlockedIpsAttributeType `json:"blockedIps" required:"true"` + // Sets the default cache duration for the distribution. The default cache duration is applied when a 'Cache-Control' header is not presented in the origin's response. We use ISO8601 duration format for cache duration (e.g. P1DT2H30M) + DefaultCacheDuration ConfigGetDefaultCacheDurationAttributeType `json:"defaultCacheDuration,omitempty"` + LogSink ConfigGetLogSinkAttributeType `json:"logSink,omitempty"` + // Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. + MonthlyLimitBytes ConfigGetMonthlyLimitBytesAttributeType `json:"monthlyLimitBytes,omitempty"` + Optimizer ConfigGetOptimizerAttributeType `json:"optimizer,omitempty"` + // REQUIRED + Regions ConfigGetRegionsAttributeType `json:"regions" required:"true"` + // REQUIRED + Waf ConfigGetWafAttributeType `json:"waf" required:"true"` +} + +type _Config Config + +// NewConfig instantiates a new Config 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 NewConfig(backend ConfigGetBackendArgType, blockedCountries ConfigGetBlockedCountriesArgType, blockedIps ConfigGetBlockedIpsArgType, regions ConfigGetRegionsArgType, waf ConfigGetWafArgType) *Config { + this := Config{} + setConfigGetBackendAttributeType(&this.Backend, backend) + setConfigGetBlockedCountriesAttributeType(&this.BlockedCountries, blockedCountries) + setConfigGetBlockedIpsAttributeType(&this.BlockedIps, blockedIps) + setConfigGetRegionsAttributeType(&this.Regions, regions) + setConfigGetWafAttributeType(&this.Waf, waf) + return &this +} + +// NewConfigWithDefaults instantiates a new Config 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 NewConfigWithDefaults() *Config { + this := Config{} + return &this +} + +// GetBackend returns the Backend field value +func (o *Config) GetBackend() (ret ConfigGetBackendRetType) { + ret, _ = o.GetBackendOk() + return ret +} + +// GetBackendOk returns a tuple with the Backend field value +// and a boolean to check if the value has been set. +func (o *Config) GetBackendOk() (ret ConfigGetBackendRetType, ok bool) { + return getConfigGetBackendAttributeTypeOk(o.Backend) +} + +// SetBackend sets field value +func (o *Config) SetBackend(v ConfigGetBackendRetType) { + setConfigGetBackendAttributeType(&o.Backend, v) +} + +// GetBlockedCountries returns the BlockedCountries field value +func (o *Config) GetBlockedCountries() (ret ConfigGetBlockedCountriesRetType) { + ret, _ = o.GetBlockedCountriesOk() + return ret +} + +// GetBlockedCountriesOk returns a tuple with the BlockedCountries field value +// and a boolean to check if the value has been set. +func (o *Config) GetBlockedCountriesOk() (ret ConfigGetBlockedCountriesRetType, ok bool) { + return getConfigGetBlockedCountriesAttributeTypeOk(o.BlockedCountries) +} + +// SetBlockedCountries sets field value +func (o *Config) SetBlockedCountries(v ConfigGetBlockedCountriesRetType) { + setConfigGetBlockedCountriesAttributeType(&o.BlockedCountries, v) +} + +// GetBlockedIps returns the BlockedIps field value +func (o *Config) GetBlockedIps() (ret ConfigGetBlockedIpsRetType) { + ret, _ = o.GetBlockedIpsOk() + return ret +} + +// GetBlockedIpsOk returns a tuple with the BlockedIps field value +// and a boolean to check if the value has been set. +func (o *Config) GetBlockedIpsOk() (ret ConfigGetBlockedIpsRetType, ok bool) { + return getConfigGetBlockedIpsAttributeTypeOk(o.BlockedIps) +} + +// SetBlockedIps sets field value +func (o *Config) SetBlockedIps(v ConfigGetBlockedIpsRetType) { + setConfigGetBlockedIpsAttributeType(&o.BlockedIps, v) +} + +// GetDefaultCacheDuration returns the DefaultCacheDuration field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Config) GetDefaultCacheDuration() (res ConfigGetDefaultCacheDurationRetType) { + res, _ = o.GetDefaultCacheDurationOk() + return +} + +// GetDefaultCacheDurationOk returns a tuple with the DefaultCacheDuration field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Config) GetDefaultCacheDurationOk() (ret ConfigGetDefaultCacheDurationRetType, ok bool) { + return getConfigGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration) +} + +// HasDefaultCacheDuration returns a boolean if a field has been set. +func (o *Config) HasDefaultCacheDuration() bool { + _, ok := o.GetDefaultCacheDurationOk() + return ok +} + +// SetDefaultCacheDuration gets a reference to the given string and assigns it to the DefaultCacheDuration field. +func (o *Config) SetDefaultCacheDuration(v ConfigGetDefaultCacheDurationRetType) { + setConfigGetDefaultCacheDurationAttributeType(&o.DefaultCacheDuration, v) +} + +// SetDefaultCacheDurationNil sets the value for DefaultCacheDuration to be an explicit nil +func (o *Config) SetDefaultCacheDurationNil() { + o.DefaultCacheDuration = nil +} + +// UnsetDefaultCacheDuration ensures that no value is present for DefaultCacheDuration, not even an explicit nil +func (o *Config) UnsetDefaultCacheDuration() { + o.DefaultCacheDuration = nil +} + +// GetLogSink returns the LogSink field value if set, zero value otherwise. +func (o *Config) GetLogSink() (res ConfigGetLogSinkRetType) { + res, _ = o.GetLogSinkOk() + return +} + +// GetLogSinkOk returns a tuple with the LogSink field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Config) GetLogSinkOk() (ret ConfigGetLogSinkRetType, ok bool) { + return getConfigGetLogSinkAttributeTypeOk(o.LogSink) +} + +// HasLogSink returns a boolean if a field has been set. +func (o *Config) HasLogSink() bool { + _, ok := o.GetLogSinkOk() + return ok +} + +// SetLogSink gets a reference to the given ConfigLogSink and assigns it to the LogSink field. +func (o *Config) SetLogSink(v ConfigGetLogSinkRetType) { + setConfigGetLogSinkAttributeType(&o.LogSink, v) +} + +// GetMonthlyLimitBytes returns the MonthlyLimitBytes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Config) GetMonthlyLimitBytes() (res ConfigGetMonthlyLimitBytesRetType) { + res, _ = o.GetMonthlyLimitBytesOk() + return +} + +// GetMonthlyLimitBytesOk returns a tuple with the MonthlyLimitBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Config) GetMonthlyLimitBytesOk() (ret ConfigGetMonthlyLimitBytesRetType, ok bool) { + return getConfigGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes) +} + +// HasMonthlyLimitBytes returns a boolean if a field has been set. +func (o *Config) HasMonthlyLimitBytes() bool { + _, ok := o.GetMonthlyLimitBytesOk() + return ok +} + +// SetMonthlyLimitBytes gets a reference to the given int64 and assigns it to the MonthlyLimitBytes field. +func (o *Config) SetMonthlyLimitBytes(v ConfigGetMonthlyLimitBytesRetType) { + setConfigGetMonthlyLimitBytesAttributeType(&o.MonthlyLimitBytes, v) +} + +// SetMonthlyLimitBytesNil sets the value for MonthlyLimitBytes to be an explicit nil +func (o *Config) SetMonthlyLimitBytesNil() { + o.MonthlyLimitBytes = nil +} + +// UnsetMonthlyLimitBytes ensures that no value is present for MonthlyLimitBytes, not even an explicit nil +func (o *Config) UnsetMonthlyLimitBytes() { + o.MonthlyLimitBytes = nil +} + +// GetOptimizer returns the Optimizer field value if set, zero value otherwise. +func (o *Config) GetOptimizer() (res ConfigGetOptimizerRetType) { + res, _ = o.GetOptimizerOk() + return +} + +// GetOptimizerOk returns a tuple with the Optimizer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Config) GetOptimizerOk() (ret ConfigGetOptimizerRetType, ok bool) { + return getConfigGetOptimizerAttributeTypeOk(o.Optimizer) +} + +// HasOptimizer returns a boolean if a field has been set. +func (o *Config) HasOptimizer() bool { + _, ok := o.GetOptimizerOk() + return ok +} + +// SetOptimizer gets a reference to the given Optimizer and assigns it to the Optimizer field. +func (o *Config) SetOptimizer(v ConfigGetOptimizerRetType) { + setConfigGetOptimizerAttributeType(&o.Optimizer, v) +} + +// GetRegions returns the Regions field value +func (o *Config) GetRegions() (ret ConfigGetRegionsRetType) { + ret, _ = o.GetRegionsOk() + return ret +} + +// GetRegionsOk returns a tuple with the Regions field value +// and a boolean to check if the value has been set. +func (o *Config) GetRegionsOk() (ret ConfigGetRegionsRetType, ok bool) { + return getConfigGetRegionsAttributeTypeOk(o.Regions) +} + +// SetRegions sets field value +func (o *Config) SetRegions(v ConfigGetRegionsRetType) { + setConfigGetRegionsAttributeType(&o.Regions, v) +} + +// GetWaf returns the Waf field value +func (o *Config) GetWaf() (ret ConfigGetWafRetType) { + ret, _ = o.GetWafOk() + return ret +} + +// GetWafOk returns a tuple with the Waf field value +// and a boolean to check if the value has been set. +func (o *Config) GetWafOk() (ret ConfigGetWafRetType, ok bool) { + return getConfigGetWafAttributeTypeOk(o.Waf) +} + +// SetWaf sets field value +func (o *Config) SetWaf(v ConfigGetWafRetType) { + setConfigGetWafAttributeType(&o.Waf, v) +} + +func (o Config) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getConfigGetBackendAttributeTypeOk(o.Backend); ok { + toSerialize["Backend"] = val + } + if val, ok := getConfigGetBlockedCountriesAttributeTypeOk(o.BlockedCountries); ok { + toSerialize["BlockedCountries"] = val + } + if val, ok := getConfigGetBlockedIpsAttributeTypeOk(o.BlockedIps); ok { + toSerialize["BlockedIps"] = val + } + if val, ok := getConfigGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration); ok { + toSerialize["DefaultCacheDuration"] = val + } + if val, ok := getConfigGetLogSinkAttributeTypeOk(o.LogSink); ok { + toSerialize["LogSink"] = val + } + if val, ok := getConfigGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes); ok { + toSerialize["MonthlyLimitBytes"] = val + } + if val, ok := getConfigGetOptimizerAttributeTypeOk(o.Optimizer); ok { + toSerialize["Optimizer"] = val + } + if val, ok := getConfigGetRegionsAttributeTypeOk(o.Regions); ok { + toSerialize["Regions"] = val + } + if val, ok := getConfigGetWafAttributeTypeOk(o.Waf); ok { + toSerialize["Waf"] = val + } + return toSerialize, nil +} + +type NullableConfig struct { + value *Config + isSet bool +} + +func (v NullableConfig) Get() *Config { + return v.value +} + +func (v *NullableConfig) Set(val *Config) { + v.value = val + v.isSet = true +} + +func (v NullableConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfig(val *Config) *NullableConfig { + return &NullableConfig{value: val, isSet: true} +} + +func (v NullableConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_config_backend.go b/pkg/cdnbeta/model_config_backend.go new file mode 100644 index 00000000..b5d5c66b --- /dev/null +++ b/pkg/cdnbeta/model_config_backend.go @@ -0,0 +1,163 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// ConfigBackend - struct for ConfigBackend +type ConfigBackend struct { + BucketBackend *BucketBackend + HttpBackend *HttpBackend +} + +// BucketBackendAsConfigBackend is a convenience function that returns BucketBackend wrapped in ConfigBackend +func BucketBackendAsConfigBackend(v *BucketBackend) ConfigBackend { + return ConfigBackend{ + BucketBackend: v, + } +} + +// HttpBackendAsConfigBackend is a convenience function that returns HttpBackend wrapped in ConfigBackend +func HttpBackendAsConfigBackend(v *HttpBackend) ConfigBackend { + return ConfigBackend{ + HttpBackend: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ConfigBackend) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'BucketBackend' + if jsonDict["type"] == "BucketBackend" { + // try to unmarshal JSON data into BucketBackend + err = json.Unmarshal(data, &dst.BucketBackend) + if err == nil { + return nil // data stored in dst.BucketBackend, return on the first match + } else { + dst.BucketBackend = nil + return fmt.Errorf("failed to unmarshal ConfigBackend as BucketBackend: %s", err.Error()) + } + } + + // check if the discriminator value is 'HttpBackend' + if jsonDict["type"] == "HttpBackend" { + // try to unmarshal JSON data into HttpBackend + err = json.Unmarshal(data, &dst.HttpBackend) + if err == nil { + return nil // data stored in dst.HttpBackend, return on the first match + } else { + dst.HttpBackend = nil + return fmt.Errorf("failed to unmarshal ConfigBackend as HttpBackend: %s", err.Error()) + } + } + + // check if the discriminator value is 'bucket' + if jsonDict["type"] == "bucket" { + // try to unmarshal JSON data into BucketBackend + err = json.Unmarshal(data, &dst.BucketBackend) + if err == nil { + return nil // data stored in dst.BucketBackend, return on the first match + } else { + dst.BucketBackend = nil + return fmt.Errorf("failed to unmarshal ConfigBackend as BucketBackend: %s", err.Error()) + } + } + + // check if the discriminator value is 'http' + if jsonDict["type"] == "http" { + // try to unmarshal JSON data into HttpBackend + err = json.Unmarshal(data, &dst.HttpBackend) + if err == nil { + return nil // data stored in dst.HttpBackend, return on the first match + } else { + dst.HttpBackend = nil + return fmt.Errorf("failed to unmarshal ConfigBackend as HttpBackend: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ConfigBackend) MarshalJSON() ([]byte, error) { + if src.BucketBackend != nil { + return json.Marshal(&src.BucketBackend) + } + + if src.HttpBackend != nil { + return json.Marshal(&src.HttpBackend) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *ConfigBackend) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.BucketBackend != nil { + return obj.BucketBackend + } + + if obj.HttpBackend != nil { + return obj.HttpBackend + } + + // all schemas are nil + return nil +} + +type NullableConfigBackend struct { + value *ConfigBackend + isSet bool +} + +func (v NullableConfigBackend) Get() *ConfigBackend { + return v.value +} + +func (v *NullableConfigBackend) Set(val *ConfigBackend) { + v.value = val + v.isSet = true +} + +func (v NullableConfigBackend) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigBackend) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigBackend(val *ConfigBackend) *NullableConfigBackend { + return &NullableConfigBackend{value: val, isSet: true} +} + +func (v NullableConfigBackend) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigBackend) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_config_backend_test.go b/pkg/cdnbeta/model_config_backend_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_config_backend_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_config_log_sink.go b/pkg/cdnbeta/model_config_log_sink.go new file mode 100644 index 00000000..74691d6a --- /dev/null +++ b/pkg/cdnbeta/model_config_log_sink.go @@ -0,0 +1,123 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// ConfigLogSink - struct for ConfigLogSink +type ConfigLogSink struct { + LokiLogSink *LokiLogSink +} + +// LokiLogSinkAsConfigLogSink is a convenience function that returns LokiLogSink wrapped in ConfigLogSink +func LokiLogSinkAsConfigLogSink(v *LokiLogSink) ConfigLogSink { + return ConfigLogSink{ + LokiLogSink: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ConfigLogSink) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'LokiLogSink' + if jsonDict["type"] == "LokiLogSink" { + // try to unmarshal JSON data into LokiLogSink + err = json.Unmarshal(data, &dst.LokiLogSink) + if err == nil { + return nil // data stored in dst.LokiLogSink, return on the first match + } else { + dst.LokiLogSink = nil + return fmt.Errorf("failed to unmarshal ConfigLogSink as LokiLogSink: %s", err.Error()) + } + } + + // check if the discriminator value is 'loki' + if jsonDict["type"] == "loki" { + // try to unmarshal JSON data into LokiLogSink + err = json.Unmarshal(data, &dst.LokiLogSink) + if err == nil { + return nil // data stored in dst.LokiLogSink, return on the first match + } else { + dst.LokiLogSink = nil + return fmt.Errorf("failed to unmarshal ConfigLogSink as LokiLogSink: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ConfigLogSink) MarshalJSON() ([]byte, error) { + if src.LokiLogSink != nil { + return json.Marshal(&src.LokiLogSink) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *ConfigLogSink) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.LokiLogSink != nil { + return obj.LokiLogSink + } + + // all schemas are nil + return nil +} + +type NullableConfigLogSink struct { + value *ConfigLogSink + isSet bool +} + +func (v NullableConfigLogSink) Get() *ConfigLogSink { + return v.value +} + +func (v *NullableConfigLogSink) Set(val *ConfigLogSink) { + v.value = val + v.isSet = true +} + +func (v NullableConfigLogSink) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigLogSink) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigLogSink(val *ConfigLogSink) *NullableConfigLogSink { + return &NullableConfigLogSink{value: val, isSet: true} +} + +func (v NullableConfigLogSink) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigLogSink) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_config_log_sink_test.go b/pkg/cdnbeta/model_config_log_sink_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_config_log_sink_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_config_patch.go b/pkg/cdnbeta/model_config_patch.go new file mode 100644 index 00000000..9a0ae64b --- /dev/null +++ b/pkg/cdnbeta/model_config_patch.go @@ -0,0 +1,545 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the ConfigPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConfigPatch{} + +/* + types and functions for backend +*/ + +// isModel +type ConfigPatchGetBackendAttributeType = *ConfigPatchBackend +type ConfigPatchGetBackendArgType = ConfigPatchBackend +type ConfigPatchGetBackendRetType = ConfigPatchBackend + +func getConfigPatchGetBackendAttributeTypeOk(arg ConfigPatchGetBackendAttributeType) (ret ConfigPatchGetBackendRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigPatchGetBackendAttributeType(arg *ConfigPatchGetBackendAttributeType, val ConfigPatchGetBackendRetType) { + *arg = &val +} + +/* + types and functions for blockedCountries +*/ + +// isArray +type ConfigPatchGetBlockedCountriesAttributeType = *[]string +type ConfigPatchGetBlockedCountriesArgType = []string +type ConfigPatchGetBlockedCountriesRetType = []string + +func getConfigPatchGetBlockedCountriesAttributeTypeOk(arg ConfigPatchGetBlockedCountriesAttributeType) (ret ConfigPatchGetBlockedCountriesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigPatchGetBlockedCountriesAttributeType(arg *ConfigPatchGetBlockedCountriesAttributeType, val ConfigPatchGetBlockedCountriesRetType) { + *arg = &val +} + +/* + types and functions for blockedIps +*/ + +// isArray +type ConfigPatchGetBlockedIpsAttributeType = *[]string +type ConfigPatchGetBlockedIpsArgType = []string +type ConfigPatchGetBlockedIpsRetType = []string + +func getConfigPatchGetBlockedIpsAttributeTypeOk(arg ConfigPatchGetBlockedIpsAttributeType) (ret ConfigPatchGetBlockedIpsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigPatchGetBlockedIpsAttributeType(arg *ConfigPatchGetBlockedIpsAttributeType, val ConfigPatchGetBlockedIpsRetType) { + *arg = &val +} + +/* + types and functions for defaultCacheDuration +*/ + +// isNullableString +type ConfigPatchGetDefaultCacheDurationAttributeType = *NullableString + +func getConfigPatchGetDefaultCacheDurationAttributeTypeOk(arg ConfigPatchGetDefaultCacheDurationAttributeType) (ret ConfigPatchGetDefaultCacheDurationRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setConfigPatchGetDefaultCacheDurationAttributeType(arg *ConfigPatchGetDefaultCacheDurationAttributeType, val ConfigPatchGetDefaultCacheDurationRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ConfigPatchGetDefaultCacheDurationArgType = *string +type ConfigPatchGetDefaultCacheDurationRetType = *string + +/* + types and functions for logSink +*/ + +// isModel +type ConfigPatchGetLogSinkAttributeType = *NullableConfigPatchLogSink +type ConfigPatchGetLogSinkArgType = *NullableConfigPatchLogSink +type ConfigPatchGetLogSinkRetType = *NullableConfigPatchLogSink + +func getConfigPatchGetLogSinkAttributeTypeOk(arg ConfigPatchGetLogSinkAttributeType) (ret ConfigPatchGetLogSinkRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setConfigPatchGetLogSinkAttributeType(arg *ConfigPatchGetLogSinkAttributeType, val ConfigPatchGetLogSinkRetType) { + *arg = val +} + +/* + types and functions for monthlyLimitBytes +*/ + +// isLong +type ConfigPatchGetMonthlyLimitBytesAttributeType = *int64 +type ConfigPatchGetMonthlyLimitBytesArgType = *int64 +type ConfigPatchGetMonthlyLimitBytesRetType = *int64 + +func getConfigPatchGetMonthlyLimitBytesAttributeTypeOk(arg ConfigPatchGetMonthlyLimitBytesAttributeType) (ret ConfigPatchGetMonthlyLimitBytesRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setConfigPatchGetMonthlyLimitBytesAttributeType(arg *ConfigPatchGetMonthlyLimitBytesAttributeType, val ConfigPatchGetMonthlyLimitBytesRetType) { + *arg = val +} + +/* + types and functions for optimizer +*/ + +// isModel +type ConfigPatchGetOptimizerAttributeType = *OptimizerPatch +type ConfigPatchGetOptimizerArgType = OptimizerPatch +type ConfigPatchGetOptimizerRetType = OptimizerPatch + +func getConfigPatchGetOptimizerAttributeTypeOk(arg ConfigPatchGetOptimizerAttributeType) (ret ConfigPatchGetOptimizerRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigPatchGetOptimizerAttributeType(arg *ConfigPatchGetOptimizerAttributeType, val ConfigPatchGetOptimizerRetType) { + *arg = &val +} + +/* + types and functions for regions +*/ + +// isArray +type ConfigPatchGetRegionsAttributeType = *[]Region +type ConfigPatchGetRegionsArgType = []Region +type ConfigPatchGetRegionsRetType = []Region + +func getConfigPatchGetRegionsAttributeTypeOk(arg ConfigPatchGetRegionsAttributeType) (ret ConfigPatchGetRegionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigPatchGetRegionsAttributeType(arg *ConfigPatchGetRegionsAttributeType, val ConfigPatchGetRegionsRetType) { + *arg = &val +} + +/* + types and functions for waf +*/ + +// isModel +type ConfigPatchGetWafAttributeType = *WafConfigPatch +type ConfigPatchGetWafArgType = WafConfigPatch +type ConfigPatchGetWafRetType = WafConfigPatch + +func getConfigPatchGetWafAttributeTypeOk(arg ConfigPatchGetWafAttributeType) (ret ConfigPatchGetWafRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConfigPatchGetWafAttributeType(arg *ConfigPatchGetWafAttributeType, val ConfigPatchGetWafRetType) { + *arg = &val +} + +// ConfigPatch struct for ConfigPatch +type ConfigPatch struct { + Backend ConfigPatchGetBackendAttributeType `json:"backend,omitempty"` + // Restricts access to your content based on country. We use the ISO 3166-1 alpha-2 standard for country codes (e.g., DE, ES, GB). This setting blocks users from the specified countries. + BlockedCountries ConfigPatchGetBlockedCountriesAttributeType `json:"blockedCountries,omitempty"` + // Restricts access to your content by specifying a list of blocked IPv4 addresses. This feature enhances security and privacy by preventing these addresses from accessing your distribution. + BlockedIps ConfigPatchGetBlockedIpsAttributeType `json:"blockedIps,omitempty"` + // Sets the default cache duration for the distribution. The default cache duration is applied when a 'Cache-Control' header is not presented in the origin's response. We use ISO8601 duration format for cache duration (e.g. P1DT2H30M) + DefaultCacheDuration ConfigPatchGetDefaultCacheDurationAttributeType `json:"defaultCacheDuration,omitempty"` + LogSink ConfigPatchGetLogSinkAttributeType `json:"logSink,omitempty"` + // Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. + MonthlyLimitBytes ConfigPatchGetMonthlyLimitBytesAttributeType `json:"monthlyLimitBytes,omitempty"` + Optimizer ConfigPatchGetOptimizerAttributeType `json:"optimizer,omitempty"` + Regions ConfigPatchGetRegionsAttributeType `json:"regions,omitempty"` + Waf ConfigPatchGetWafAttributeType `json:"waf,omitempty"` +} + +// NewConfigPatch instantiates a new ConfigPatch 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 NewConfigPatch() *ConfigPatch { + this := ConfigPatch{} + return &this +} + +// NewConfigPatchWithDefaults instantiates a new ConfigPatch 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 NewConfigPatchWithDefaults() *ConfigPatch { + this := ConfigPatch{} + return &this +} + +// GetBackend returns the Backend field value if set, zero value otherwise. +func (o *ConfigPatch) GetBackend() (res ConfigPatchGetBackendRetType) { + res, _ = o.GetBackendOk() + return +} + +// GetBackendOk returns a tuple with the Backend field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfigPatch) GetBackendOk() (ret ConfigPatchGetBackendRetType, ok bool) { + return getConfigPatchGetBackendAttributeTypeOk(o.Backend) +} + +// HasBackend returns a boolean if a field has been set. +func (o *ConfigPatch) HasBackend() bool { + _, ok := o.GetBackendOk() + return ok +} + +// SetBackend gets a reference to the given ConfigPatchBackend and assigns it to the Backend field. +func (o *ConfigPatch) SetBackend(v ConfigPatchGetBackendRetType) { + setConfigPatchGetBackendAttributeType(&o.Backend, v) +} + +// GetBlockedCountries returns the BlockedCountries field value if set, zero value otherwise. +func (o *ConfigPatch) GetBlockedCountries() (res ConfigPatchGetBlockedCountriesRetType) { + res, _ = o.GetBlockedCountriesOk() + return +} + +// GetBlockedCountriesOk returns a tuple with the BlockedCountries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfigPatch) GetBlockedCountriesOk() (ret ConfigPatchGetBlockedCountriesRetType, ok bool) { + return getConfigPatchGetBlockedCountriesAttributeTypeOk(o.BlockedCountries) +} + +// HasBlockedCountries returns a boolean if a field has been set. +func (o *ConfigPatch) HasBlockedCountries() bool { + _, ok := o.GetBlockedCountriesOk() + return ok +} + +// SetBlockedCountries gets a reference to the given []string and assigns it to the BlockedCountries field. +func (o *ConfigPatch) SetBlockedCountries(v ConfigPatchGetBlockedCountriesRetType) { + setConfigPatchGetBlockedCountriesAttributeType(&o.BlockedCountries, v) +} + +// GetBlockedIps returns the BlockedIps field value if set, zero value otherwise. +func (o *ConfigPatch) GetBlockedIps() (res ConfigPatchGetBlockedIpsRetType) { + res, _ = o.GetBlockedIpsOk() + return +} + +// GetBlockedIpsOk returns a tuple with the BlockedIps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfigPatch) GetBlockedIpsOk() (ret ConfigPatchGetBlockedIpsRetType, ok bool) { + return getConfigPatchGetBlockedIpsAttributeTypeOk(o.BlockedIps) +} + +// HasBlockedIps returns a boolean if a field has been set. +func (o *ConfigPatch) HasBlockedIps() bool { + _, ok := o.GetBlockedIpsOk() + return ok +} + +// SetBlockedIps gets a reference to the given []string and assigns it to the BlockedIps field. +func (o *ConfigPatch) SetBlockedIps(v ConfigPatchGetBlockedIpsRetType) { + setConfigPatchGetBlockedIpsAttributeType(&o.BlockedIps, v) +} + +// GetDefaultCacheDuration returns the DefaultCacheDuration field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ConfigPatch) GetDefaultCacheDuration() (res ConfigPatchGetDefaultCacheDurationRetType) { + res, _ = o.GetDefaultCacheDurationOk() + return +} + +// GetDefaultCacheDurationOk returns a tuple with the DefaultCacheDuration field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ConfigPatch) GetDefaultCacheDurationOk() (ret ConfigPatchGetDefaultCacheDurationRetType, ok bool) { + return getConfigPatchGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration) +} + +// HasDefaultCacheDuration returns a boolean if a field has been set. +func (o *ConfigPatch) HasDefaultCacheDuration() bool { + _, ok := o.GetDefaultCacheDurationOk() + return ok +} + +// SetDefaultCacheDuration gets a reference to the given string and assigns it to the DefaultCacheDuration field. +func (o *ConfigPatch) SetDefaultCacheDuration(v ConfigPatchGetDefaultCacheDurationRetType) { + setConfigPatchGetDefaultCacheDurationAttributeType(&o.DefaultCacheDuration, v) +} + +// SetDefaultCacheDurationNil sets the value for DefaultCacheDuration to be an explicit nil +func (o *ConfigPatch) SetDefaultCacheDurationNil() { + o.DefaultCacheDuration = nil +} + +// UnsetDefaultCacheDuration ensures that no value is present for DefaultCacheDuration, not even an explicit nil +func (o *ConfigPatch) UnsetDefaultCacheDuration() { + o.DefaultCacheDuration = nil +} + +// GetLogSink returns the LogSink field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ConfigPatch) GetLogSink() (res ConfigPatchGetLogSinkRetType) { + res, _ = o.GetLogSinkOk() + return +} + +// GetLogSinkOk returns a tuple with the LogSink field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ConfigPatch) GetLogSinkOk() (ret ConfigPatchGetLogSinkRetType, ok bool) { + return getConfigPatchGetLogSinkAttributeTypeOk(o.LogSink) +} + +// HasLogSink returns a boolean if a field has been set. +func (o *ConfigPatch) HasLogSink() bool { + _, ok := o.GetLogSinkOk() + return ok +} + +// SetLogSink gets a reference to the given ConfigPatchLogSink and assigns it to the LogSink field. +func (o *ConfigPatch) SetLogSink(v ConfigPatchGetLogSinkRetType) { + setConfigPatchGetLogSinkAttributeType(&o.LogSink, v) +} + +// SetLogSinkNil sets the value for LogSink to be an explicit nil +func (o *ConfigPatch) SetLogSinkNil() { + o.LogSink = nil +} + +// UnsetLogSink ensures that no value is present for LogSink, not even an explicit nil +func (o *ConfigPatch) UnsetLogSink() { + o.LogSink = nil +} + +// GetMonthlyLimitBytes returns the MonthlyLimitBytes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ConfigPatch) GetMonthlyLimitBytes() (res ConfigPatchGetMonthlyLimitBytesRetType) { + res, _ = o.GetMonthlyLimitBytesOk() + return +} + +// GetMonthlyLimitBytesOk returns a tuple with the MonthlyLimitBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ConfigPatch) GetMonthlyLimitBytesOk() (ret ConfigPatchGetMonthlyLimitBytesRetType, ok bool) { + return getConfigPatchGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes) +} + +// HasMonthlyLimitBytes returns a boolean if a field has been set. +func (o *ConfigPatch) HasMonthlyLimitBytes() bool { + _, ok := o.GetMonthlyLimitBytesOk() + return ok +} + +// SetMonthlyLimitBytes gets a reference to the given int64 and assigns it to the MonthlyLimitBytes field. +func (o *ConfigPatch) SetMonthlyLimitBytes(v ConfigPatchGetMonthlyLimitBytesRetType) { + setConfigPatchGetMonthlyLimitBytesAttributeType(&o.MonthlyLimitBytes, v) +} + +// SetMonthlyLimitBytesNil sets the value for MonthlyLimitBytes to be an explicit nil +func (o *ConfigPatch) SetMonthlyLimitBytesNil() { + o.MonthlyLimitBytes = nil +} + +// UnsetMonthlyLimitBytes ensures that no value is present for MonthlyLimitBytes, not even an explicit nil +func (o *ConfigPatch) UnsetMonthlyLimitBytes() { + o.MonthlyLimitBytes = nil +} + +// GetOptimizer returns the Optimizer field value if set, zero value otherwise. +func (o *ConfigPatch) GetOptimizer() (res ConfigPatchGetOptimizerRetType) { + res, _ = o.GetOptimizerOk() + return +} + +// GetOptimizerOk returns a tuple with the Optimizer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfigPatch) GetOptimizerOk() (ret ConfigPatchGetOptimizerRetType, ok bool) { + return getConfigPatchGetOptimizerAttributeTypeOk(o.Optimizer) +} + +// HasOptimizer returns a boolean if a field has been set. +func (o *ConfigPatch) HasOptimizer() bool { + _, ok := o.GetOptimizerOk() + return ok +} + +// SetOptimizer gets a reference to the given OptimizerPatch and assigns it to the Optimizer field. +func (o *ConfigPatch) SetOptimizer(v ConfigPatchGetOptimizerRetType) { + setConfigPatchGetOptimizerAttributeType(&o.Optimizer, v) +} + +// GetRegions returns the Regions field value if set, zero value otherwise. +func (o *ConfigPatch) GetRegions() (res ConfigPatchGetRegionsRetType) { + res, _ = o.GetRegionsOk() + return +} + +// GetRegionsOk returns a tuple with the Regions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfigPatch) GetRegionsOk() (ret ConfigPatchGetRegionsRetType, ok bool) { + return getConfigPatchGetRegionsAttributeTypeOk(o.Regions) +} + +// HasRegions returns a boolean if a field has been set. +func (o *ConfigPatch) HasRegions() bool { + _, ok := o.GetRegionsOk() + return ok +} + +// SetRegions gets a reference to the given []Region and assigns it to the Regions field. +func (o *ConfigPatch) SetRegions(v ConfigPatchGetRegionsRetType) { + setConfigPatchGetRegionsAttributeType(&o.Regions, v) +} + +// GetWaf returns the Waf field value if set, zero value otherwise. +func (o *ConfigPatch) GetWaf() (res ConfigPatchGetWafRetType) { + res, _ = o.GetWafOk() + return +} + +// GetWafOk returns a tuple with the Waf field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfigPatch) GetWafOk() (ret ConfigPatchGetWafRetType, ok bool) { + return getConfigPatchGetWafAttributeTypeOk(o.Waf) +} + +// HasWaf returns a boolean if a field has been set. +func (o *ConfigPatch) HasWaf() bool { + _, ok := o.GetWafOk() + return ok +} + +// SetWaf gets a reference to the given WafConfigPatch and assigns it to the Waf field. +func (o *ConfigPatch) SetWaf(v ConfigPatchGetWafRetType) { + setConfigPatchGetWafAttributeType(&o.Waf, v) +} + +func (o ConfigPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getConfigPatchGetBackendAttributeTypeOk(o.Backend); ok { + toSerialize["Backend"] = val + } + if val, ok := getConfigPatchGetBlockedCountriesAttributeTypeOk(o.BlockedCountries); ok { + toSerialize["BlockedCountries"] = val + } + if val, ok := getConfigPatchGetBlockedIpsAttributeTypeOk(o.BlockedIps); ok { + toSerialize["BlockedIps"] = val + } + if val, ok := getConfigPatchGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration); ok { + toSerialize["DefaultCacheDuration"] = val + } + if val, ok := getConfigPatchGetLogSinkAttributeTypeOk(o.LogSink); ok { + toSerialize["LogSink"] = val + } + if val, ok := getConfigPatchGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes); ok { + toSerialize["MonthlyLimitBytes"] = val + } + if val, ok := getConfigPatchGetOptimizerAttributeTypeOk(o.Optimizer); ok { + toSerialize["Optimizer"] = val + } + if val, ok := getConfigPatchGetRegionsAttributeTypeOk(o.Regions); ok { + toSerialize["Regions"] = val + } + if val, ok := getConfigPatchGetWafAttributeTypeOk(o.Waf); ok { + toSerialize["Waf"] = val + } + return toSerialize, nil +} + +type NullableConfigPatch struct { + value *ConfigPatch + isSet bool +} + +func (v NullableConfigPatch) Get() *ConfigPatch { + return v.value +} + +func (v *NullableConfigPatch) Set(val *ConfigPatch) { + v.value = val + v.isSet = true +} + +func (v NullableConfigPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigPatch(val *ConfigPatch) *NullableConfigPatch { + return &NullableConfigPatch{value: val, isSet: true} +} + +func (v NullableConfigPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_config_patch_backend.go b/pkg/cdnbeta/model_config_patch_backend.go new file mode 100644 index 00000000..ec3a7bd0 --- /dev/null +++ b/pkg/cdnbeta/model_config_patch_backend.go @@ -0,0 +1,163 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// ConfigPatchBackend - struct for ConfigPatchBackend +type ConfigPatchBackend struct { + BucketBackendPatch *BucketBackendPatch + HttpBackendPatch *HttpBackendPatch +} + +// BucketBackendPatchAsConfigPatchBackend is a convenience function that returns BucketBackendPatch wrapped in ConfigPatchBackend +func BucketBackendPatchAsConfigPatchBackend(v *BucketBackendPatch) ConfigPatchBackend { + return ConfigPatchBackend{ + BucketBackendPatch: v, + } +} + +// HttpBackendPatchAsConfigPatchBackend is a convenience function that returns HttpBackendPatch wrapped in ConfigPatchBackend +func HttpBackendPatchAsConfigPatchBackend(v *HttpBackendPatch) ConfigPatchBackend { + return ConfigPatchBackend{ + HttpBackendPatch: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ConfigPatchBackend) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'BucketBackendPatch' + if jsonDict["type"] == "BucketBackendPatch" { + // try to unmarshal JSON data into BucketBackendPatch + err = json.Unmarshal(data, &dst.BucketBackendPatch) + if err == nil { + return nil // data stored in dst.BucketBackendPatch, return on the first match + } else { + dst.BucketBackendPatch = nil + return fmt.Errorf("failed to unmarshal ConfigPatchBackend as BucketBackendPatch: %s", err.Error()) + } + } + + // check if the discriminator value is 'HttpBackendPatch' + if jsonDict["type"] == "HttpBackendPatch" { + // try to unmarshal JSON data into HttpBackendPatch + err = json.Unmarshal(data, &dst.HttpBackendPatch) + if err == nil { + return nil // data stored in dst.HttpBackendPatch, return on the first match + } else { + dst.HttpBackendPatch = nil + return fmt.Errorf("failed to unmarshal ConfigPatchBackend as HttpBackendPatch: %s", err.Error()) + } + } + + // check if the discriminator value is 'bucket' + if jsonDict["type"] == "bucket" { + // try to unmarshal JSON data into BucketBackendPatch + err = json.Unmarshal(data, &dst.BucketBackendPatch) + if err == nil { + return nil // data stored in dst.BucketBackendPatch, return on the first match + } else { + dst.BucketBackendPatch = nil + return fmt.Errorf("failed to unmarshal ConfigPatchBackend as BucketBackendPatch: %s", err.Error()) + } + } + + // check if the discriminator value is 'http' + if jsonDict["type"] == "http" { + // try to unmarshal JSON data into HttpBackendPatch + err = json.Unmarshal(data, &dst.HttpBackendPatch) + if err == nil { + return nil // data stored in dst.HttpBackendPatch, return on the first match + } else { + dst.HttpBackendPatch = nil + return fmt.Errorf("failed to unmarshal ConfigPatchBackend as HttpBackendPatch: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ConfigPatchBackend) MarshalJSON() ([]byte, error) { + if src.BucketBackendPatch != nil { + return json.Marshal(&src.BucketBackendPatch) + } + + if src.HttpBackendPatch != nil { + return json.Marshal(&src.HttpBackendPatch) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *ConfigPatchBackend) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.BucketBackendPatch != nil { + return obj.BucketBackendPatch + } + + if obj.HttpBackendPatch != nil { + return obj.HttpBackendPatch + } + + // all schemas are nil + return nil +} + +type NullableConfigPatchBackend struct { + value *ConfigPatchBackend + isSet bool +} + +func (v NullableConfigPatchBackend) Get() *ConfigPatchBackend { + return v.value +} + +func (v *NullableConfigPatchBackend) Set(val *ConfigPatchBackend) { + v.value = val + v.isSet = true +} + +func (v NullableConfigPatchBackend) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigPatchBackend) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigPatchBackend(val *ConfigPatchBackend) *NullableConfigPatchBackend { + return &NullableConfigPatchBackend{value: val, isSet: true} +} + +func (v NullableConfigPatchBackend) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigPatchBackend) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_config_patch_backend_test.go b/pkg/cdnbeta/model_config_patch_backend_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_config_patch_backend_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_config_patch_log_sink.go b/pkg/cdnbeta/model_config_patch_log_sink.go new file mode 100644 index 00000000..032deafd --- /dev/null +++ b/pkg/cdnbeta/model_config_patch_log_sink.go @@ -0,0 +1,128 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// ConfigPatchLogSink - struct for ConfigPatchLogSink +type ConfigPatchLogSink struct { + LokiLogSinkPatch *LokiLogSinkPatch +} + +// LokiLogSinkPatchAsConfigPatchLogSink is a convenience function that returns LokiLogSinkPatch wrapped in ConfigPatchLogSink +func LokiLogSinkPatchAsConfigPatchLogSink(v *LokiLogSinkPatch) ConfigPatchLogSink { + return ConfigPatchLogSink{ + LokiLogSinkPatch: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ConfigPatchLogSink) UnmarshalJSON(data []byte) error { + var err error + // this object is nullable so check if the payload is null or empty string + if string(data) == "" || string(data) == "{}" { + return nil + } + + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'LokiLogSinkPatch' + if jsonDict["type"] == "LokiLogSinkPatch" { + // try to unmarshal JSON data into LokiLogSinkPatch + err = json.Unmarshal(data, &dst.LokiLogSinkPatch) + if err == nil { + return nil // data stored in dst.LokiLogSinkPatch, return on the first match + } else { + dst.LokiLogSinkPatch = nil + return fmt.Errorf("failed to unmarshal ConfigPatchLogSink as LokiLogSinkPatch: %s", err.Error()) + } + } + + // check if the discriminator value is 'loki' + if jsonDict["type"] == "loki" { + // try to unmarshal JSON data into LokiLogSinkPatch + err = json.Unmarshal(data, &dst.LokiLogSinkPatch) + if err == nil { + return nil // data stored in dst.LokiLogSinkPatch, return on the first match + } else { + dst.LokiLogSinkPatch = nil + return fmt.Errorf("failed to unmarshal ConfigPatchLogSink as LokiLogSinkPatch: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ConfigPatchLogSink) MarshalJSON() ([]byte, error) { + if src.LokiLogSinkPatch != nil { + return json.Marshal(&src.LokiLogSinkPatch) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *ConfigPatchLogSink) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.LokiLogSinkPatch != nil { + return obj.LokiLogSinkPatch + } + + // all schemas are nil + return nil +} + +type NullableConfigPatchLogSink struct { + value *ConfigPatchLogSink + isSet bool +} + +func (v NullableConfigPatchLogSink) Get() *ConfigPatchLogSink { + return v.value +} + +func (v *NullableConfigPatchLogSink) Set(val *ConfigPatchLogSink) { + v.value = val + v.isSet = true +} + +func (v NullableConfigPatchLogSink) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigPatchLogSink) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigPatchLogSink(val *ConfigPatchLogSink) *NullableConfigPatchLogSink { + return &NullableConfigPatchLogSink{value: val, isSet: true} +} + +func (v NullableConfigPatchLogSink) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigPatchLogSink) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_config_patch_log_sink_test.go b/pkg/cdnbeta/model_config_patch_log_sink_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_config_patch_log_sink_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_config_patch_test.go b/pkg/cdnbeta/model_config_patch_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_config_patch_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_config_test.go b/pkg/cdnbeta/model_config_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_config_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_create_distribution_payload.go b/pkg/cdnbeta/model_create_distribution_payload.go new file mode 100644 index 00000000..c53912fc --- /dev/null +++ b/pkg/cdnbeta/model_create_distribution_payload.go @@ -0,0 +1,552 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the CreateDistributionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateDistributionPayload{} + +/* + types and functions for backend +*/ + +// isModel +type CreateDistributionPayloadGetBackendAttributeType = *CreateDistributionPayloadBackend +type CreateDistributionPayloadGetBackendArgType = CreateDistributionPayloadBackend +type CreateDistributionPayloadGetBackendRetType = CreateDistributionPayloadBackend + +func getCreateDistributionPayloadGetBackendAttributeTypeOk(arg CreateDistributionPayloadGetBackendAttributeType) (ret CreateDistributionPayloadGetBackendRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetBackendAttributeType(arg *CreateDistributionPayloadGetBackendAttributeType, val CreateDistributionPayloadGetBackendRetType) { + *arg = &val +} + +/* + types and functions for blockedCountries +*/ + +// isArray +type CreateDistributionPayloadGetBlockedCountriesAttributeType = *[]string +type CreateDistributionPayloadGetBlockedCountriesArgType = []string +type CreateDistributionPayloadGetBlockedCountriesRetType = []string + +func getCreateDistributionPayloadGetBlockedCountriesAttributeTypeOk(arg CreateDistributionPayloadGetBlockedCountriesAttributeType) (ret CreateDistributionPayloadGetBlockedCountriesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetBlockedCountriesAttributeType(arg *CreateDistributionPayloadGetBlockedCountriesAttributeType, val CreateDistributionPayloadGetBlockedCountriesRetType) { + *arg = &val +} + +/* + types and functions for blockedIps +*/ + +// isArray +type CreateDistributionPayloadGetBlockedIpsAttributeType = *[]string +type CreateDistributionPayloadGetBlockedIpsArgType = []string +type CreateDistributionPayloadGetBlockedIpsRetType = []string + +func getCreateDistributionPayloadGetBlockedIpsAttributeTypeOk(arg CreateDistributionPayloadGetBlockedIpsAttributeType) (ret CreateDistributionPayloadGetBlockedIpsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetBlockedIpsAttributeType(arg *CreateDistributionPayloadGetBlockedIpsAttributeType, val CreateDistributionPayloadGetBlockedIpsRetType) { + *arg = &val +} + +/* + types and functions for defaultCacheDuration +*/ + +// isNotNullableString +type CreateDistributionPayloadGetDefaultCacheDurationAttributeType = *string + +func getCreateDistributionPayloadGetDefaultCacheDurationAttributeTypeOk(arg CreateDistributionPayloadGetDefaultCacheDurationAttributeType) (ret CreateDistributionPayloadGetDefaultCacheDurationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetDefaultCacheDurationAttributeType(arg *CreateDistributionPayloadGetDefaultCacheDurationAttributeType, val CreateDistributionPayloadGetDefaultCacheDurationRetType) { + *arg = &val +} + +type CreateDistributionPayloadGetDefaultCacheDurationArgType = string +type CreateDistributionPayloadGetDefaultCacheDurationRetType = string + +/* + types and functions for intentId +*/ + +// isNotNullableString +type CreateDistributionPayloadGetIntentIdAttributeType = *string + +func getCreateDistributionPayloadGetIntentIdAttributeTypeOk(arg CreateDistributionPayloadGetIntentIdAttributeType) (ret CreateDistributionPayloadGetIntentIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetIntentIdAttributeType(arg *CreateDistributionPayloadGetIntentIdAttributeType, val CreateDistributionPayloadGetIntentIdRetType) { + *arg = &val +} + +type CreateDistributionPayloadGetIntentIdArgType = string +type CreateDistributionPayloadGetIntentIdRetType = string + +/* + types and functions for logSink +*/ + +// isModel +type CreateDistributionPayloadGetLogSinkAttributeType = *CreateDistributionPayloadLogSink +type CreateDistributionPayloadGetLogSinkArgType = CreateDistributionPayloadLogSink +type CreateDistributionPayloadGetLogSinkRetType = CreateDistributionPayloadLogSink + +func getCreateDistributionPayloadGetLogSinkAttributeTypeOk(arg CreateDistributionPayloadGetLogSinkAttributeType) (ret CreateDistributionPayloadGetLogSinkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetLogSinkAttributeType(arg *CreateDistributionPayloadGetLogSinkAttributeType, val CreateDistributionPayloadGetLogSinkRetType) { + *arg = &val +} + +/* + types and functions for monthlyLimitBytes +*/ + +// isLong +type CreateDistributionPayloadGetMonthlyLimitBytesAttributeType = *int64 +type CreateDistributionPayloadGetMonthlyLimitBytesArgType = int64 +type CreateDistributionPayloadGetMonthlyLimitBytesRetType = int64 + +func getCreateDistributionPayloadGetMonthlyLimitBytesAttributeTypeOk(arg CreateDistributionPayloadGetMonthlyLimitBytesAttributeType) (ret CreateDistributionPayloadGetMonthlyLimitBytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetMonthlyLimitBytesAttributeType(arg *CreateDistributionPayloadGetMonthlyLimitBytesAttributeType, val CreateDistributionPayloadGetMonthlyLimitBytesRetType) { + *arg = &val +} + +/* + types and functions for optimizer +*/ + +// isModel +type CreateDistributionPayloadGetOptimizerAttributeType = *Optimizer +type CreateDistributionPayloadGetOptimizerArgType = Optimizer +type CreateDistributionPayloadGetOptimizerRetType = Optimizer + +func getCreateDistributionPayloadGetOptimizerAttributeTypeOk(arg CreateDistributionPayloadGetOptimizerAttributeType) (ret CreateDistributionPayloadGetOptimizerRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetOptimizerAttributeType(arg *CreateDistributionPayloadGetOptimizerAttributeType, val CreateDistributionPayloadGetOptimizerRetType) { + *arg = &val +} + +/* + types and functions for regions +*/ + +// isArray +type CreateDistributionPayloadGetRegionsAttributeType = *[]Region +type CreateDistributionPayloadGetRegionsArgType = []Region +type CreateDistributionPayloadGetRegionsRetType = []Region + +func getCreateDistributionPayloadGetRegionsAttributeTypeOk(arg CreateDistributionPayloadGetRegionsAttributeType) (ret CreateDistributionPayloadGetRegionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetRegionsAttributeType(arg *CreateDistributionPayloadGetRegionsAttributeType, val CreateDistributionPayloadGetRegionsRetType) { + *arg = &val +} + +/* + types and functions for waf +*/ + +// isModel +type CreateDistributionPayloadGetWafAttributeType = *WafConfig +type CreateDistributionPayloadGetWafArgType = WafConfig +type CreateDistributionPayloadGetWafRetType = WafConfig + +func getCreateDistributionPayloadGetWafAttributeTypeOk(arg CreateDistributionPayloadGetWafAttributeType) (ret CreateDistributionPayloadGetWafRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionPayloadGetWafAttributeType(arg *CreateDistributionPayloadGetWafAttributeType, val CreateDistributionPayloadGetWafRetType) { + *arg = &val +} + +// CreateDistributionPayload struct for CreateDistributionPayload +type CreateDistributionPayload struct { + // REQUIRED + Backend CreateDistributionPayloadGetBackendAttributeType `json:"backend" required:"true"` + // Restricts access to your content based on country. We use the ISO 3166-1 alpha-2 standard for country codes (e.g., DE, ES, GB). This setting blocks users from the specified countries. + BlockedCountries CreateDistributionPayloadGetBlockedCountriesAttributeType `json:"blockedCountries,omitempty"` + // Restricts access to your content by specifying a list of blocked IPv4 addresses. This feature enhances security and privacy by preventing these addresses from accessing your distribution. + BlockedIps CreateDistributionPayloadGetBlockedIpsAttributeType `json:"blockedIps,omitempty"` + // Sets the default cache duration for the distribution. The default cache duration is applied when a 'Cache-Control' header is not presented in the origin's response. We use ISO8601 duration format for cache duration (e.g. P1DT2H30M) + DefaultCacheDuration CreateDistributionPayloadGetDefaultCacheDurationAttributeType `json:"defaultCacheDuration,omitempty"` + // While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple POST-Requests with the same `intentId` for a given `projectId` are received, all but the first request are dropped. + IntentId CreateDistributionPayloadGetIntentIdAttributeType `json:"intentId,omitempty"` + LogSink CreateDistributionPayloadGetLogSinkAttributeType `json:"logSink,omitempty"` + // Sets the monthly limit of bandwidth in bytes that the pullzone is allowed to use. + MonthlyLimitBytes CreateDistributionPayloadGetMonthlyLimitBytesAttributeType `json:"monthlyLimitBytes,omitempty"` + Optimizer CreateDistributionPayloadGetOptimizerAttributeType `json:"optimizer,omitempty"` + // Define in which regions you would like your content to be cached. + // REQUIRED + Regions CreateDistributionPayloadGetRegionsAttributeType `json:"regions" required:"true"` + Waf CreateDistributionPayloadGetWafAttributeType `json:"waf,omitempty"` +} + +type _CreateDistributionPayload CreateDistributionPayload + +// NewCreateDistributionPayload instantiates a new CreateDistributionPayload 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 NewCreateDistributionPayload(backend CreateDistributionPayloadGetBackendArgType, regions CreateDistributionPayloadGetRegionsArgType) *CreateDistributionPayload { + this := CreateDistributionPayload{} + setCreateDistributionPayloadGetBackendAttributeType(&this.Backend, backend) + setCreateDistributionPayloadGetRegionsAttributeType(&this.Regions, regions) + return &this +} + +// NewCreateDistributionPayloadWithDefaults instantiates a new CreateDistributionPayload 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 NewCreateDistributionPayloadWithDefaults() *CreateDistributionPayload { + this := CreateDistributionPayload{} + return &this +} + +// GetBackend returns the Backend field value +func (o *CreateDistributionPayload) GetBackend() (ret CreateDistributionPayloadGetBackendRetType) { + ret, _ = o.GetBackendOk() + return ret +} + +// GetBackendOk returns a tuple with the Backend field value +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetBackendOk() (ret CreateDistributionPayloadGetBackendRetType, ok bool) { + return getCreateDistributionPayloadGetBackendAttributeTypeOk(o.Backend) +} + +// SetBackend sets field value +func (o *CreateDistributionPayload) SetBackend(v CreateDistributionPayloadGetBackendRetType) { + setCreateDistributionPayloadGetBackendAttributeType(&o.Backend, v) +} + +// GetBlockedCountries returns the BlockedCountries field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetBlockedCountries() (res CreateDistributionPayloadGetBlockedCountriesRetType) { + res, _ = o.GetBlockedCountriesOk() + return +} + +// GetBlockedCountriesOk returns a tuple with the BlockedCountries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetBlockedCountriesOk() (ret CreateDistributionPayloadGetBlockedCountriesRetType, ok bool) { + return getCreateDistributionPayloadGetBlockedCountriesAttributeTypeOk(o.BlockedCountries) +} + +// HasBlockedCountries returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasBlockedCountries() bool { + _, ok := o.GetBlockedCountriesOk() + return ok +} + +// SetBlockedCountries gets a reference to the given []string and assigns it to the BlockedCountries field. +func (o *CreateDistributionPayload) SetBlockedCountries(v CreateDistributionPayloadGetBlockedCountriesRetType) { + setCreateDistributionPayloadGetBlockedCountriesAttributeType(&o.BlockedCountries, v) +} + +// GetBlockedIps returns the BlockedIps field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetBlockedIps() (res CreateDistributionPayloadGetBlockedIpsRetType) { + res, _ = o.GetBlockedIpsOk() + return +} + +// GetBlockedIpsOk returns a tuple with the BlockedIps field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetBlockedIpsOk() (ret CreateDistributionPayloadGetBlockedIpsRetType, ok bool) { + return getCreateDistributionPayloadGetBlockedIpsAttributeTypeOk(o.BlockedIps) +} + +// HasBlockedIps returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasBlockedIps() bool { + _, ok := o.GetBlockedIpsOk() + return ok +} + +// SetBlockedIps gets a reference to the given []string and assigns it to the BlockedIps field. +func (o *CreateDistributionPayload) SetBlockedIps(v CreateDistributionPayloadGetBlockedIpsRetType) { + setCreateDistributionPayloadGetBlockedIpsAttributeType(&o.BlockedIps, v) +} + +// GetDefaultCacheDuration returns the DefaultCacheDuration field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetDefaultCacheDuration() (res CreateDistributionPayloadGetDefaultCacheDurationRetType) { + res, _ = o.GetDefaultCacheDurationOk() + return +} + +// GetDefaultCacheDurationOk returns a tuple with the DefaultCacheDuration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetDefaultCacheDurationOk() (ret CreateDistributionPayloadGetDefaultCacheDurationRetType, ok bool) { + return getCreateDistributionPayloadGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration) +} + +// HasDefaultCacheDuration returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasDefaultCacheDuration() bool { + _, ok := o.GetDefaultCacheDurationOk() + return ok +} + +// SetDefaultCacheDuration gets a reference to the given string and assigns it to the DefaultCacheDuration field. +func (o *CreateDistributionPayload) SetDefaultCacheDuration(v CreateDistributionPayloadGetDefaultCacheDurationRetType) { + setCreateDistributionPayloadGetDefaultCacheDurationAttributeType(&o.DefaultCacheDuration, v) +} + +// GetIntentId returns the IntentId field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetIntentId() (res CreateDistributionPayloadGetIntentIdRetType) { + res, _ = o.GetIntentIdOk() + return +} + +// GetIntentIdOk returns a tuple with the IntentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetIntentIdOk() (ret CreateDistributionPayloadGetIntentIdRetType, ok bool) { + return getCreateDistributionPayloadGetIntentIdAttributeTypeOk(o.IntentId) +} + +// HasIntentId returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasIntentId() bool { + _, ok := o.GetIntentIdOk() + return ok +} + +// SetIntentId gets a reference to the given string and assigns it to the IntentId field. +func (o *CreateDistributionPayload) SetIntentId(v CreateDistributionPayloadGetIntentIdRetType) { + setCreateDistributionPayloadGetIntentIdAttributeType(&o.IntentId, v) +} + +// GetLogSink returns the LogSink field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetLogSink() (res CreateDistributionPayloadGetLogSinkRetType) { + res, _ = o.GetLogSinkOk() + return +} + +// GetLogSinkOk returns a tuple with the LogSink field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetLogSinkOk() (ret CreateDistributionPayloadGetLogSinkRetType, ok bool) { + return getCreateDistributionPayloadGetLogSinkAttributeTypeOk(o.LogSink) +} + +// HasLogSink returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasLogSink() bool { + _, ok := o.GetLogSinkOk() + return ok +} + +// SetLogSink gets a reference to the given CreateDistributionPayloadLogSink and assigns it to the LogSink field. +func (o *CreateDistributionPayload) SetLogSink(v CreateDistributionPayloadGetLogSinkRetType) { + setCreateDistributionPayloadGetLogSinkAttributeType(&o.LogSink, v) +} + +// GetMonthlyLimitBytes returns the MonthlyLimitBytes field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetMonthlyLimitBytes() (res CreateDistributionPayloadGetMonthlyLimitBytesRetType) { + res, _ = o.GetMonthlyLimitBytesOk() + return +} + +// GetMonthlyLimitBytesOk returns a tuple with the MonthlyLimitBytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetMonthlyLimitBytesOk() (ret CreateDistributionPayloadGetMonthlyLimitBytesRetType, ok bool) { + return getCreateDistributionPayloadGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes) +} + +// HasMonthlyLimitBytes returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasMonthlyLimitBytes() bool { + _, ok := o.GetMonthlyLimitBytesOk() + return ok +} + +// SetMonthlyLimitBytes gets a reference to the given int64 and assigns it to the MonthlyLimitBytes field. +func (o *CreateDistributionPayload) SetMonthlyLimitBytes(v CreateDistributionPayloadGetMonthlyLimitBytesRetType) { + setCreateDistributionPayloadGetMonthlyLimitBytesAttributeType(&o.MonthlyLimitBytes, v) +} + +// GetOptimizer returns the Optimizer field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetOptimizer() (res CreateDistributionPayloadGetOptimizerRetType) { + res, _ = o.GetOptimizerOk() + return +} + +// GetOptimizerOk returns a tuple with the Optimizer field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetOptimizerOk() (ret CreateDistributionPayloadGetOptimizerRetType, ok bool) { + return getCreateDistributionPayloadGetOptimizerAttributeTypeOk(o.Optimizer) +} + +// HasOptimizer returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasOptimizer() bool { + _, ok := o.GetOptimizerOk() + return ok +} + +// SetOptimizer gets a reference to the given Optimizer and assigns it to the Optimizer field. +func (o *CreateDistributionPayload) SetOptimizer(v CreateDistributionPayloadGetOptimizerRetType) { + setCreateDistributionPayloadGetOptimizerAttributeType(&o.Optimizer, v) +} + +// GetRegions returns the Regions field value +func (o *CreateDistributionPayload) GetRegions() (ret CreateDistributionPayloadGetRegionsRetType) { + ret, _ = o.GetRegionsOk() + return ret +} + +// GetRegionsOk returns a tuple with the Regions field value +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetRegionsOk() (ret CreateDistributionPayloadGetRegionsRetType, ok bool) { + return getCreateDistributionPayloadGetRegionsAttributeTypeOk(o.Regions) +} + +// SetRegions sets field value +func (o *CreateDistributionPayload) SetRegions(v CreateDistributionPayloadGetRegionsRetType) { + setCreateDistributionPayloadGetRegionsAttributeType(&o.Regions, v) +} + +// GetWaf returns the Waf field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetWaf() (res CreateDistributionPayloadGetWafRetType) { + res, _ = o.GetWafOk() + return +} + +// GetWafOk returns a tuple with the Waf field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetWafOk() (ret CreateDistributionPayloadGetWafRetType, ok bool) { + return getCreateDistributionPayloadGetWafAttributeTypeOk(o.Waf) +} + +// HasWaf returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasWaf() bool { + _, ok := o.GetWafOk() + return ok +} + +// SetWaf gets a reference to the given WafConfig and assigns it to the Waf field. +func (o *CreateDistributionPayload) SetWaf(v CreateDistributionPayloadGetWafRetType) { + setCreateDistributionPayloadGetWafAttributeType(&o.Waf, v) +} + +func (o CreateDistributionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateDistributionPayloadGetBackendAttributeTypeOk(o.Backend); ok { + toSerialize["Backend"] = val + } + if val, ok := getCreateDistributionPayloadGetBlockedCountriesAttributeTypeOk(o.BlockedCountries); ok { + toSerialize["BlockedCountries"] = val + } + if val, ok := getCreateDistributionPayloadGetBlockedIpsAttributeTypeOk(o.BlockedIps); ok { + toSerialize["BlockedIps"] = val + } + if val, ok := getCreateDistributionPayloadGetDefaultCacheDurationAttributeTypeOk(o.DefaultCacheDuration); ok { + toSerialize["DefaultCacheDuration"] = val + } + if val, ok := getCreateDistributionPayloadGetIntentIdAttributeTypeOk(o.IntentId); ok { + toSerialize["IntentId"] = val + } + if val, ok := getCreateDistributionPayloadGetLogSinkAttributeTypeOk(o.LogSink); ok { + toSerialize["LogSink"] = val + } + if val, ok := getCreateDistributionPayloadGetMonthlyLimitBytesAttributeTypeOk(o.MonthlyLimitBytes); ok { + toSerialize["MonthlyLimitBytes"] = val + } + if val, ok := getCreateDistributionPayloadGetOptimizerAttributeTypeOk(o.Optimizer); ok { + toSerialize["Optimizer"] = val + } + if val, ok := getCreateDistributionPayloadGetRegionsAttributeTypeOk(o.Regions); ok { + toSerialize["Regions"] = val + } + if val, ok := getCreateDistributionPayloadGetWafAttributeTypeOk(o.Waf); ok { + toSerialize["Waf"] = val + } + return toSerialize, nil +} + +type NullableCreateDistributionPayload struct { + value *CreateDistributionPayload + isSet bool +} + +func (v NullableCreateDistributionPayload) Get() *CreateDistributionPayload { + return v.value +} + +func (v *NullableCreateDistributionPayload) Set(val *CreateDistributionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDistributionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDistributionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDistributionPayload(val *CreateDistributionPayload) *NullableCreateDistributionPayload { + return &NullableCreateDistributionPayload{value: val, isSet: true} +} + +func (v NullableCreateDistributionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDistributionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_create_distribution_payload_backend.go b/pkg/cdnbeta/model_create_distribution_payload_backend.go new file mode 100644 index 00000000..0b60caed --- /dev/null +++ b/pkg/cdnbeta/model_create_distribution_payload_backend.go @@ -0,0 +1,163 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// CreateDistributionPayloadBackend - Configuration for the content origin backend. +type CreateDistributionPayloadBackend struct { + BucketBackendCreate *BucketBackendCreate + HttpBackendCreate *HttpBackendCreate +} + +// BucketBackendCreateAsCreateDistributionPayloadBackend is a convenience function that returns BucketBackendCreate wrapped in CreateDistributionPayloadBackend +func BucketBackendCreateAsCreateDistributionPayloadBackend(v *BucketBackendCreate) CreateDistributionPayloadBackend { + return CreateDistributionPayloadBackend{ + BucketBackendCreate: v, + } +} + +// HttpBackendCreateAsCreateDistributionPayloadBackend is a convenience function that returns HttpBackendCreate wrapped in CreateDistributionPayloadBackend +func HttpBackendCreateAsCreateDistributionPayloadBackend(v *HttpBackendCreate) CreateDistributionPayloadBackend { + return CreateDistributionPayloadBackend{ + HttpBackendCreate: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateDistributionPayloadBackend) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'BucketBackendCreate' + if jsonDict["type"] == "BucketBackendCreate" { + // try to unmarshal JSON data into BucketBackendCreate + err = json.Unmarshal(data, &dst.BucketBackendCreate) + if err == nil { + return nil // data stored in dst.BucketBackendCreate, return on the first match + } else { + dst.BucketBackendCreate = nil + return fmt.Errorf("failed to unmarshal CreateDistributionPayloadBackend as BucketBackendCreate: %s", err.Error()) + } + } + + // check if the discriminator value is 'HttpBackendCreate' + if jsonDict["type"] == "HttpBackendCreate" { + // try to unmarshal JSON data into HttpBackendCreate + err = json.Unmarshal(data, &dst.HttpBackendCreate) + if err == nil { + return nil // data stored in dst.HttpBackendCreate, return on the first match + } else { + dst.HttpBackendCreate = nil + return fmt.Errorf("failed to unmarshal CreateDistributionPayloadBackend as HttpBackendCreate: %s", err.Error()) + } + } + + // check if the discriminator value is 'bucket' + if jsonDict["type"] == "bucket" { + // try to unmarshal JSON data into BucketBackendCreate + err = json.Unmarshal(data, &dst.BucketBackendCreate) + if err == nil { + return nil // data stored in dst.BucketBackendCreate, return on the first match + } else { + dst.BucketBackendCreate = nil + return fmt.Errorf("failed to unmarshal CreateDistributionPayloadBackend as BucketBackendCreate: %s", err.Error()) + } + } + + // check if the discriminator value is 'http' + if jsonDict["type"] == "http" { + // try to unmarshal JSON data into HttpBackendCreate + err = json.Unmarshal(data, &dst.HttpBackendCreate) + if err == nil { + return nil // data stored in dst.HttpBackendCreate, return on the first match + } else { + dst.HttpBackendCreate = nil + return fmt.Errorf("failed to unmarshal CreateDistributionPayloadBackend as HttpBackendCreate: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateDistributionPayloadBackend) MarshalJSON() ([]byte, error) { + if src.BucketBackendCreate != nil { + return json.Marshal(&src.BucketBackendCreate) + } + + if src.HttpBackendCreate != nil { + return json.Marshal(&src.HttpBackendCreate) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateDistributionPayloadBackend) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.BucketBackendCreate != nil { + return obj.BucketBackendCreate + } + + if obj.HttpBackendCreate != nil { + return obj.HttpBackendCreate + } + + // all schemas are nil + return nil +} + +type NullableCreateDistributionPayloadBackend struct { + value *CreateDistributionPayloadBackend + isSet bool +} + +func (v NullableCreateDistributionPayloadBackend) Get() *CreateDistributionPayloadBackend { + return v.value +} + +func (v *NullableCreateDistributionPayloadBackend) Set(val *CreateDistributionPayloadBackend) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDistributionPayloadBackend) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDistributionPayloadBackend) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDistributionPayloadBackend(val *CreateDistributionPayloadBackend) *NullableCreateDistributionPayloadBackend { + return &NullableCreateDistributionPayloadBackend{value: val, isSet: true} +} + +func (v NullableCreateDistributionPayloadBackend) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDistributionPayloadBackend) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_create_distribution_payload_backend_test.go b/pkg/cdnbeta/model_create_distribution_payload_backend_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_create_distribution_payload_backend_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_create_distribution_payload_log_sink.go b/pkg/cdnbeta/model_create_distribution_payload_log_sink.go new file mode 100644 index 00000000..5895a519 --- /dev/null +++ b/pkg/cdnbeta/model_create_distribution_payload_log_sink.go @@ -0,0 +1,123 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// CreateDistributionPayloadLogSink - struct for CreateDistributionPayloadLogSink +type CreateDistributionPayloadLogSink struct { + LokiLogSinkCreate *LokiLogSinkCreate +} + +// LokiLogSinkCreateAsCreateDistributionPayloadLogSink is a convenience function that returns LokiLogSinkCreate wrapped in CreateDistributionPayloadLogSink +func LokiLogSinkCreateAsCreateDistributionPayloadLogSink(v *LokiLogSinkCreate) CreateDistributionPayloadLogSink { + return CreateDistributionPayloadLogSink{ + LokiLogSinkCreate: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateDistributionPayloadLogSink) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'LokiLogSinkCreate' + if jsonDict["type"] == "LokiLogSinkCreate" { + // try to unmarshal JSON data into LokiLogSinkCreate + err = json.Unmarshal(data, &dst.LokiLogSinkCreate) + if err == nil { + return nil // data stored in dst.LokiLogSinkCreate, return on the first match + } else { + dst.LokiLogSinkCreate = nil + return fmt.Errorf("failed to unmarshal CreateDistributionPayloadLogSink as LokiLogSinkCreate: %s", err.Error()) + } + } + + // check if the discriminator value is 'loki' + if jsonDict["type"] == "loki" { + // try to unmarshal JSON data into LokiLogSinkCreate + err = json.Unmarshal(data, &dst.LokiLogSinkCreate) + if err == nil { + return nil // data stored in dst.LokiLogSinkCreate, return on the first match + } else { + dst.LokiLogSinkCreate = nil + return fmt.Errorf("failed to unmarshal CreateDistributionPayloadLogSink as LokiLogSinkCreate: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateDistributionPayloadLogSink) MarshalJSON() ([]byte, error) { + if src.LokiLogSinkCreate != nil { + return json.Marshal(&src.LokiLogSinkCreate) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateDistributionPayloadLogSink) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.LokiLogSinkCreate != nil { + return obj.LokiLogSinkCreate + } + + // all schemas are nil + return nil +} + +type NullableCreateDistributionPayloadLogSink struct { + value *CreateDistributionPayloadLogSink + isSet bool +} + +func (v NullableCreateDistributionPayloadLogSink) Get() *CreateDistributionPayloadLogSink { + return v.value +} + +func (v *NullableCreateDistributionPayloadLogSink) Set(val *CreateDistributionPayloadLogSink) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDistributionPayloadLogSink) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDistributionPayloadLogSink) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDistributionPayloadLogSink(val *CreateDistributionPayloadLogSink) *NullableCreateDistributionPayloadLogSink { + return &NullableCreateDistributionPayloadLogSink{value: val, isSet: true} +} + +func (v NullableCreateDistributionPayloadLogSink) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDistributionPayloadLogSink) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_create_distribution_payload_log_sink_test.go b/pkg/cdnbeta/model_create_distribution_payload_log_sink_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_create_distribution_payload_log_sink_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_create_distribution_payload_test.go b/pkg/cdnbeta/model_create_distribution_payload_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_create_distribution_payload_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_create_distribution_response.go b/pkg/cdnbeta/model_create_distribution_response.go new file mode 100644 index 00000000..45c7b3f7 --- /dev/null +++ b/pkg/cdnbeta/model_create_distribution_response.go @@ -0,0 +1,125 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the CreateDistributionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateDistributionResponse{} + +/* + types and functions for distribution +*/ + +// isModel +type CreateDistributionResponseGetDistributionAttributeType = *Distribution +type CreateDistributionResponseGetDistributionArgType = Distribution +type CreateDistributionResponseGetDistributionRetType = Distribution + +func getCreateDistributionResponseGetDistributionAttributeTypeOk(arg CreateDistributionResponseGetDistributionAttributeType) (ret CreateDistributionResponseGetDistributionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateDistributionResponseGetDistributionAttributeType(arg *CreateDistributionResponseGetDistributionAttributeType, val CreateDistributionResponseGetDistributionRetType) { + *arg = &val +} + +// CreateDistributionResponse struct for CreateDistributionResponse +type CreateDistributionResponse struct { + // REQUIRED + Distribution CreateDistributionResponseGetDistributionAttributeType `json:"distribution" required:"true"` +} + +type _CreateDistributionResponse CreateDistributionResponse + +// NewCreateDistributionResponse instantiates a new CreateDistributionResponse 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 NewCreateDistributionResponse(distribution CreateDistributionResponseGetDistributionArgType) *CreateDistributionResponse { + this := CreateDistributionResponse{} + setCreateDistributionResponseGetDistributionAttributeType(&this.Distribution, distribution) + return &this +} + +// NewCreateDistributionResponseWithDefaults instantiates a new CreateDistributionResponse 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 NewCreateDistributionResponseWithDefaults() *CreateDistributionResponse { + this := CreateDistributionResponse{} + return &this +} + +// GetDistribution returns the Distribution field value +func (o *CreateDistributionResponse) GetDistribution() (ret CreateDistributionResponseGetDistributionRetType) { + ret, _ = o.GetDistributionOk() + return ret +} + +// GetDistributionOk returns a tuple with the Distribution field value +// and a boolean to check if the value has been set. +func (o *CreateDistributionResponse) GetDistributionOk() (ret CreateDistributionResponseGetDistributionRetType, ok bool) { + return getCreateDistributionResponseGetDistributionAttributeTypeOk(o.Distribution) +} + +// SetDistribution sets field value +func (o *CreateDistributionResponse) SetDistribution(v CreateDistributionResponseGetDistributionRetType) { + setCreateDistributionResponseGetDistributionAttributeType(&o.Distribution, v) +} + +func (o CreateDistributionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateDistributionResponseGetDistributionAttributeTypeOk(o.Distribution); ok { + toSerialize["Distribution"] = val + } + return toSerialize, nil +} + +type NullableCreateDistributionResponse struct { + value *CreateDistributionResponse + isSet bool +} + +func (v NullableCreateDistributionResponse) Get() *CreateDistributionResponse { + return v.value +} + +func (v *NullableCreateDistributionResponse) Set(val *CreateDistributionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDistributionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDistributionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDistributionResponse(val *CreateDistributionResponse) *NullableCreateDistributionResponse { + return &NullableCreateDistributionResponse{value: val, isSet: true} +} + +func (v NullableCreateDistributionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDistributionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_create_distribution_response_test.go b/pkg/cdnbeta/model_create_distribution_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_create_distribution_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_custom_domain.go b/pkg/cdnbeta/model_custom_domain.go new file mode 100644 index 00000000..61a2c869 --- /dev/null +++ b/pkg/cdnbeta/model_custom_domain.go @@ -0,0 +1,218 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the CustomDomain type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CustomDomain{} + +/* + types and functions for errors +*/ + +// isArray +type CustomDomainGetErrorsAttributeType = *[]StatusError +type CustomDomainGetErrorsArgType = []StatusError +type CustomDomainGetErrorsRetType = []StatusError + +func getCustomDomainGetErrorsAttributeTypeOk(arg CustomDomainGetErrorsAttributeType) (ret CustomDomainGetErrorsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCustomDomainGetErrorsAttributeType(arg *CustomDomainGetErrorsAttributeType, val CustomDomainGetErrorsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CustomDomainGetNameAttributeType = *string + +func getCustomDomainGetNameAttributeTypeOk(arg CustomDomainGetNameAttributeType) (ret CustomDomainGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCustomDomainGetNameAttributeType(arg *CustomDomainGetNameAttributeType, val CustomDomainGetNameRetType) { + *arg = &val +} + +type CustomDomainGetNameArgType = string +type CustomDomainGetNameRetType = string + +/* + types and functions for status +*/ + +// isEnumRef +type CustomDomainGetStatusAttributeType = *DomainStatus +type CustomDomainGetStatusArgType = DomainStatus +type CustomDomainGetStatusRetType = DomainStatus + +func getCustomDomainGetStatusAttributeTypeOk(arg CustomDomainGetStatusAttributeType) (ret CustomDomainGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCustomDomainGetStatusAttributeType(arg *CustomDomainGetStatusAttributeType, val CustomDomainGetStatusRetType) { + *arg = &val +} + +// CustomDomain Definition of a custom domain +type CustomDomain struct { + // This object is present if the custom domain has errors. + Errors CustomDomainGetErrorsAttributeType `json:"errors,omitempty"` + // The domain. Can be used as input for the GetCustomDomain endpoint + // REQUIRED + Name CustomDomainGetNameAttributeType `json:"name" required:"true"` + // REQUIRED + Status CustomDomainGetStatusAttributeType `json:"status" required:"true"` +} + +type _CustomDomain CustomDomain + +// NewCustomDomain instantiates a new CustomDomain 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 NewCustomDomain(name CustomDomainGetNameArgType, status CustomDomainGetStatusArgType) *CustomDomain { + this := CustomDomain{} + setCustomDomainGetNameAttributeType(&this.Name, name) + setCustomDomainGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewCustomDomainWithDefaults instantiates a new CustomDomain 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 NewCustomDomainWithDefaults() *CustomDomain { + this := CustomDomain{} + return &this +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *CustomDomain) GetErrors() (res CustomDomainGetErrorsRetType) { + res, _ = o.GetErrorsOk() + return +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomDomain) GetErrorsOk() (ret CustomDomainGetErrorsRetType, ok bool) { + return getCustomDomainGetErrorsAttributeTypeOk(o.Errors) +} + +// HasErrors returns a boolean if a field has been set. +func (o *CustomDomain) HasErrors() bool { + _, ok := o.GetErrorsOk() + return ok +} + +// SetErrors gets a reference to the given []StatusError and assigns it to the Errors field. +func (o *CustomDomain) SetErrors(v CustomDomainGetErrorsRetType) { + setCustomDomainGetErrorsAttributeType(&o.Errors, v) +} + +// GetName returns the Name field value +func (o *CustomDomain) GetName() (ret CustomDomainGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CustomDomain) GetNameOk() (ret CustomDomainGetNameRetType, ok bool) { + return getCustomDomainGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CustomDomain) SetName(v CustomDomainGetNameRetType) { + setCustomDomainGetNameAttributeType(&o.Name, v) +} + +// GetStatus returns the Status field value +func (o *CustomDomain) GetStatus() (ret CustomDomainGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *CustomDomain) GetStatusOk() (ret CustomDomainGetStatusRetType, ok bool) { + return getCustomDomainGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *CustomDomain) SetStatus(v CustomDomainGetStatusRetType) { + setCustomDomainGetStatusAttributeType(&o.Status, v) +} + +func (o CustomDomain) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCustomDomainGetErrorsAttributeTypeOk(o.Errors); ok { + toSerialize["Errors"] = val + } + if val, ok := getCustomDomainGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCustomDomainGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableCustomDomain struct { + value *CustomDomain + isSet bool +} + +func (v NullableCustomDomain) Get() *CustomDomain { + return v.value +} + +func (v *NullableCustomDomain) Set(val *CustomDomain) { + v.value = val + v.isSet = true +} + +func (v NullableCustomDomain) IsSet() bool { + return v.isSet +} + +func (v *NullableCustomDomain) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCustomDomain(val *CustomDomain) *NullableCustomDomain { + return &NullableCustomDomain{value: val, isSet: true} +} + +func (v NullableCustomDomain) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCustomDomain) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_custom_domain_test.go b/pkg/cdnbeta/model_custom_domain_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_custom_domain_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_delete_custom_domain_response.go b/pkg/cdnbeta/model_delete_custom_domain_response.go new file mode 100644 index 00000000..79c3032a --- /dev/null +++ b/pkg/cdnbeta/model_delete_custom_domain_response.go @@ -0,0 +1,127 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the DeleteCustomDomainResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteCustomDomainResponse{} + +/* + types and functions for customDomain +*/ + +// isModel +type DeleteCustomDomainResponseGetCustomDomainAttributeType = *CustomDomain +type DeleteCustomDomainResponseGetCustomDomainArgType = CustomDomain +type DeleteCustomDomainResponseGetCustomDomainRetType = CustomDomain + +func getDeleteCustomDomainResponseGetCustomDomainAttributeTypeOk(arg DeleteCustomDomainResponseGetCustomDomainAttributeType) (ret DeleteCustomDomainResponseGetCustomDomainRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDeleteCustomDomainResponseGetCustomDomainAttributeType(arg *DeleteCustomDomainResponseGetCustomDomainAttributeType, val DeleteCustomDomainResponseGetCustomDomainRetType) { + *arg = &val +} + +// DeleteCustomDomainResponse Returns the custom domain that was deleted while the deletion has not completed yet. After the deletion was successful the response will be empty. +type DeleteCustomDomainResponse struct { + CustomDomain DeleteCustomDomainResponseGetCustomDomainAttributeType `json:"customDomain,omitempty"` +} + +// NewDeleteCustomDomainResponse instantiates a new DeleteCustomDomainResponse 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 NewDeleteCustomDomainResponse() *DeleteCustomDomainResponse { + this := DeleteCustomDomainResponse{} + return &this +} + +// NewDeleteCustomDomainResponseWithDefaults instantiates a new DeleteCustomDomainResponse 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 NewDeleteCustomDomainResponseWithDefaults() *DeleteCustomDomainResponse { + this := DeleteCustomDomainResponse{} + return &this +} + +// GetCustomDomain returns the CustomDomain field value if set, zero value otherwise. +func (o *DeleteCustomDomainResponse) GetCustomDomain() (res DeleteCustomDomainResponseGetCustomDomainRetType) { + res, _ = o.GetCustomDomainOk() + return +} + +// GetCustomDomainOk returns a tuple with the CustomDomain field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeleteCustomDomainResponse) GetCustomDomainOk() (ret DeleteCustomDomainResponseGetCustomDomainRetType, ok bool) { + return getDeleteCustomDomainResponseGetCustomDomainAttributeTypeOk(o.CustomDomain) +} + +// HasCustomDomain returns a boolean if a field has been set. +func (o *DeleteCustomDomainResponse) HasCustomDomain() bool { + _, ok := o.GetCustomDomainOk() + return ok +} + +// SetCustomDomain gets a reference to the given CustomDomain and assigns it to the CustomDomain field. +func (o *DeleteCustomDomainResponse) SetCustomDomain(v DeleteCustomDomainResponseGetCustomDomainRetType) { + setDeleteCustomDomainResponseGetCustomDomainAttributeType(&o.CustomDomain, v) +} + +func (o DeleteCustomDomainResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDeleteCustomDomainResponseGetCustomDomainAttributeTypeOk(o.CustomDomain); ok { + toSerialize["CustomDomain"] = val + } + return toSerialize, nil +} + +type NullableDeleteCustomDomainResponse struct { + value *DeleteCustomDomainResponse + isSet bool +} + +func (v NullableDeleteCustomDomainResponse) Get() *DeleteCustomDomainResponse { + return v.value +} + +func (v *NullableDeleteCustomDomainResponse) Set(val *DeleteCustomDomainResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteCustomDomainResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteCustomDomainResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteCustomDomainResponse(val *DeleteCustomDomainResponse) *NullableDeleteCustomDomainResponse { + return &NullableDeleteCustomDomainResponse{value: val, isSet: true} +} + +func (v NullableDeleteCustomDomainResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteCustomDomainResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_delete_custom_domain_response_test.go b/pkg/cdnbeta/model_delete_custom_domain_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_delete_custom_domain_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_delete_distribution_response.go b/pkg/cdnbeta/model_delete_distribution_response.go new file mode 100644 index 00000000..cca263fe --- /dev/null +++ b/pkg/cdnbeta/model_delete_distribution_response.go @@ -0,0 +1,127 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the DeleteDistributionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteDistributionResponse{} + +/* + types and functions for distribution +*/ + +// isModel +type DeleteDistributionResponseGetDistributionAttributeType = *Distribution +type DeleteDistributionResponseGetDistributionArgType = Distribution +type DeleteDistributionResponseGetDistributionRetType = Distribution + +func getDeleteDistributionResponseGetDistributionAttributeTypeOk(arg DeleteDistributionResponseGetDistributionAttributeType) (ret DeleteDistributionResponseGetDistributionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDeleteDistributionResponseGetDistributionAttributeType(arg *DeleteDistributionResponseGetDistributionAttributeType, val DeleteDistributionResponseGetDistributionRetType) { + *arg = &val +} + +// DeleteDistributionResponse struct for DeleteDistributionResponse +type DeleteDistributionResponse struct { + Distribution DeleteDistributionResponseGetDistributionAttributeType `json:"distribution,omitempty"` +} + +// NewDeleteDistributionResponse instantiates a new DeleteDistributionResponse 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 NewDeleteDistributionResponse() *DeleteDistributionResponse { + this := DeleteDistributionResponse{} + return &this +} + +// NewDeleteDistributionResponseWithDefaults instantiates a new DeleteDistributionResponse 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 NewDeleteDistributionResponseWithDefaults() *DeleteDistributionResponse { + this := DeleteDistributionResponse{} + return &this +} + +// GetDistribution returns the Distribution field value if set, zero value otherwise. +func (o *DeleteDistributionResponse) GetDistribution() (res DeleteDistributionResponseGetDistributionRetType) { + res, _ = o.GetDistributionOk() + return +} + +// GetDistributionOk returns a tuple with the Distribution field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeleteDistributionResponse) GetDistributionOk() (ret DeleteDistributionResponseGetDistributionRetType, ok bool) { + return getDeleteDistributionResponseGetDistributionAttributeTypeOk(o.Distribution) +} + +// HasDistribution returns a boolean if a field has been set. +func (o *DeleteDistributionResponse) HasDistribution() bool { + _, ok := o.GetDistributionOk() + return ok +} + +// SetDistribution gets a reference to the given Distribution and assigns it to the Distribution field. +func (o *DeleteDistributionResponse) SetDistribution(v DeleteDistributionResponseGetDistributionRetType) { + setDeleteDistributionResponseGetDistributionAttributeType(&o.Distribution, v) +} + +func (o DeleteDistributionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDeleteDistributionResponseGetDistributionAttributeTypeOk(o.Distribution); ok { + toSerialize["Distribution"] = val + } + return toSerialize, nil +} + +type NullableDeleteDistributionResponse struct { + value *DeleteDistributionResponse + isSet bool +} + +func (v NullableDeleteDistributionResponse) Get() *DeleteDistributionResponse { + return v.value +} + +func (v *NullableDeleteDistributionResponse) Set(val *DeleteDistributionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteDistributionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteDistributionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteDistributionResponse(val *DeleteDistributionResponse) *NullableDeleteDistributionResponse { + return &NullableDeleteDistributionResponse{value: val, isSet: true} +} + +func (v NullableDeleteDistributionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteDistributionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_delete_distribution_response_test.go b/pkg/cdnbeta/model_delete_distribution_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_delete_distribution_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_distribution.go b/pkg/cdnbeta/model_distribution.go new file mode 100644 index 00000000..429cfad2 --- /dev/null +++ b/pkg/cdnbeta/model_distribution.go @@ -0,0 +1,595 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Distribution type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Distribution{} + +/* + types and functions for config +*/ + +// isModel +type DistributionGetConfigAttributeType = *Config +type DistributionGetConfigArgType = Config +type DistributionGetConfigRetType = Config + +func getDistributionGetConfigAttributeTypeOk(arg DistributionGetConfigAttributeType) (ret DistributionGetConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionGetConfigAttributeType(arg *DistributionGetConfigAttributeType, val DistributionGetConfigRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type DistributionGetCreatedAtAttributeType = *time.Time +type DistributionGetCreatedAtArgType = time.Time +type DistributionGetCreatedAtRetType = time.Time + +func getDistributionGetCreatedAtAttributeTypeOk(arg DistributionGetCreatedAtAttributeType) (ret DistributionGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionGetCreatedAtAttributeType(arg *DistributionGetCreatedAtAttributeType, val DistributionGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for domains +*/ + +// isArray +type DistributionGetDomainsAttributeType = *[]Domain +type DistributionGetDomainsArgType = []Domain +type DistributionGetDomainsRetType = []Domain + +func getDistributionGetDomainsAttributeTypeOk(arg DistributionGetDomainsAttributeType) (ret DistributionGetDomainsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionGetDomainsAttributeType(arg *DistributionGetDomainsAttributeType, val DistributionGetDomainsRetType) { + *arg = &val +} + +/* + types and functions for errors +*/ + +// isArray +type DistributionGetErrorsAttributeType = *[]StatusError +type DistributionGetErrorsArgType = []StatusError +type DistributionGetErrorsRetType = []StatusError + +func getDistributionGetErrorsAttributeTypeOk(arg DistributionGetErrorsAttributeType) (ret DistributionGetErrorsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionGetErrorsAttributeType(arg *DistributionGetErrorsAttributeType, val DistributionGetErrorsRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type DistributionGetIdAttributeType = *string + +func getDistributionGetIdAttributeTypeOk(arg DistributionGetIdAttributeType) (ret DistributionGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionGetIdAttributeType(arg *DistributionGetIdAttributeType, val DistributionGetIdRetType) { + *arg = &val +} + +type DistributionGetIdArgType = string +type DistributionGetIdRetType = string + +/* + types and functions for projectId +*/ + +// isNotNullableString +type DistributionGetProjectIdAttributeType = *string + +func getDistributionGetProjectIdAttributeTypeOk(arg DistributionGetProjectIdAttributeType) (ret DistributionGetProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionGetProjectIdAttributeType(arg *DistributionGetProjectIdAttributeType, val DistributionGetProjectIdRetType) { + *arg = &val +} + +type DistributionGetProjectIdArgType = string +type DistributionGetProjectIdRetType = string + +/* + types and functions for status +*/ + +// isEnum + +// DistributionStatus - `CREATING`: The distribution was just created. All the relevant resources are created in the background. Once fully reconciled, this switches to `ACTIVE`. If there are any issues, the status changes to `ERROR`. You can look at the `errors` array to get more infos. - `ACTIVE`: The usual state. The desired configuration is synced, there are no errors - `UPDATING`: The state when there is a discrepancy between the desired and actual configuration state. This occurs right after an update. Will switch to `ACTIVE` or `ERROR`, depending on if synchronizing succeeds or not. - `DELETING`: The state right after a delete request was received. The distribution will stay in this status until all resources have been successfully removed, or until we encounter an `ERROR` state. **NOTE:** You can keep fetching the distribution while it is deleting. After successful deletion, trying to get a distribution will return a 404 Not Found response - `ERROR`: The error state. Look at the `errors` array for more info. +// value type for enums +type DistributionStatus string + +// List of Status +const ( + DISTRIBUTIONSTATUS_CREATING DistributionStatus = "CREATING" + DISTRIBUTIONSTATUS_ACTIVE DistributionStatus = "ACTIVE" + DISTRIBUTIONSTATUS_UPDATING DistributionStatus = "UPDATING" + DISTRIBUTIONSTATUS_DELETING DistributionStatus = "DELETING" + DISTRIBUTIONSTATUS_ERROR DistributionStatus = "ERROR" +) + +// All allowed values of Distribution enum +var AllowedDistributionStatusEnumValues = []DistributionStatus{ + "CREATING", + "ACTIVE", + "UPDATING", + "DELETING", + "ERROR", +} + +func (v *DistributionStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson DistributionStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := DistributionStatus(value) + for _, existing := range AllowedDistributionStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Distribution", value) +} + +// NewDistributionStatusFromValue returns a pointer to a valid DistributionStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDistributionStatusFromValue(v DistributionStatus) (*DistributionStatus, error) { + ev := DistributionStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DistributionStatus: valid values are %v", v, AllowedDistributionStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DistributionStatus) IsValid() bool { + for _, existing := range AllowedDistributionStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v DistributionStatus) Ptr() *DistributionStatus { + return &v +} + +type NullableDistributionStatus struct { + value *DistributionStatus + isSet bool +} + +func (v NullableDistributionStatus) Get() *DistributionStatus { + return v.value +} + +func (v *NullableDistributionStatus) Set(val *DistributionStatus) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionStatus(val *DistributionStatus) *NullableDistributionStatus { + return &NullableDistributionStatus{value: val, isSet: true} +} + +func (v NullableDistributionStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type DistributionGetStatusAttributeType = *DistributionStatus +type DistributionGetStatusArgType = DistributionStatus +type DistributionGetStatusRetType = DistributionStatus + +func getDistributionGetStatusAttributeTypeOk(arg DistributionGetStatusAttributeType) (ret DistributionGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionGetStatusAttributeType(arg *DistributionGetStatusAttributeType, val DistributionGetStatusRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type DistributionGetUpdatedAtAttributeType = *time.Time +type DistributionGetUpdatedAtArgType = time.Time +type DistributionGetUpdatedAtRetType = time.Time + +func getDistributionGetUpdatedAtAttributeTypeOk(arg DistributionGetUpdatedAtAttributeType) (ret DistributionGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionGetUpdatedAtAttributeType(arg *DistributionGetUpdatedAtAttributeType, val DistributionGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for waf +*/ + +// isModel +type DistributionGetWafAttributeType = *DistributionWaf +type DistributionGetWafArgType = DistributionWaf +type DistributionGetWafRetType = DistributionWaf + +func getDistributionGetWafAttributeTypeOk(arg DistributionGetWafAttributeType) (ret DistributionGetWafRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionGetWafAttributeType(arg *DistributionGetWafAttributeType, val DistributionGetWafRetType) { + *arg = &val +} + +// Distribution struct for Distribution +type Distribution struct { + // REQUIRED + Config DistributionGetConfigAttributeType `json:"config" required:"true"` + // RFC3339 string defining when the distribution was created + // REQUIRED + CreatedAt DistributionGetCreatedAtAttributeType `json:"createdAt" required:"true"` + // REQUIRED + Domains DistributionGetDomainsAttributeType `json:"domains" required:"true"` + // This object may be present if, and only if the distribution has encountered an error state. + Errors DistributionGetErrorsAttributeType `json:"errors,omitempty"` + // REQUIRED + Id DistributionGetIdAttributeType `json:"id" required:"true"` + // REQUIRED + ProjectId DistributionGetProjectIdAttributeType `json:"projectId" required:"true"` + // - `CREATING`: The distribution was just created. All the relevant resources are created in the background. Once fully reconciled, this switches to `ACTIVE`. If there are any issues, the status changes to `ERROR`. You can look at the `errors` array to get more infos. - `ACTIVE`: The usual state. The desired configuration is synced, there are no errors - `UPDATING`: The state when there is a discrepancy between the desired and actual configuration state. This occurs right after an update. Will switch to `ACTIVE` or `ERROR`, depending on if synchronizing succeeds or not. - `DELETING`: The state right after a delete request was received. The distribution will stay in this status until all resources have been successfully removed, or until we encounter an `ERROR` state. **NOTE:** You can keep fetching the distribution while it is deleting. After successful deletion, trying to get a distribution will return a 404 Not Found response - `ERROR`: The error state. Look at the `errors` array for more info. + // REQUIRED + Status DistributionGetStatusAttributeType `json:"status" required:"true"` + // RFC3339 string which returns the last time the distribution configuration was modified. + // REQUIRED + UpdatedAt DistributionGetUpdatedAtAttributeType `json:"updatedAt" required:"true"` + Waf DistributionGetWafAttributeType `json:"waf,omitempty"` +} + +type _Distribution Distribution + +// NewDistribution instantiates a new Distribution 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 NewDistribution(config DistributionGetConfigArgType, createdAt DistributionGetCreatedAtArgType, domains DistributionGetDomainsArgType, id DistributionGetIdArgType, projectId DistributionGetProjectIdArgType, status DistributionGetStatusArgType, updatedAt DistributionGetUpdatedAtArgType) *Distribution { + this := Distribution{} + setDistributionGetConfigAttributeType(&this.Config, config) + setDistributionGetCreatedAtAttributeType(&this.CreatedAt, createdAt) + setDistributionGetDomainsAttributeType(&this.Domains, domains) + setDistributionGetIdAttributeType(&this.Id, id) + setDistributionGetProjectIdAttributeType(&this.ProjectId, projectId) + setDistributionGetStatusAttributeType(&this.Status, status) + setDistributionGetUpdatedAtAttributeType(&this.UpdatedAt, updatedAt) + return &this +} + +// NewDistributionWithDefaults instantiates a new Distribution 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 NewDistributionWithDefaults() *Distribution { + this := Distribution{} + return &this +} + +// GetConfig returns the Config field value +func (o *Distribution) GetConfig() (ret DistributionGetConfigRetType) { + ret, _ = o.GetConfigOk() + return ret +} + +// GetConfigOk returns a tuple with the Config field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetConfigOk() (ret DistributionGetConfigRetType, ok bool) { + return getDistributionGetConfigAttributeTypeOk(o.Config) +} + +// SetConfig sets field value +func (o *Distribution) SetConfig(v DistributionGetConfigRetType) { + setDistributionGetConfigAttributeType(&o.Config, v) +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Distribution) GetCreatedAt() (ret DistributionGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() + return ret +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetCreatedAtOk() (ret DistributionGetCreatedAtRetType, ok bool) { + return getDistributionGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// SetCreatedAt sets field value +func (o *Distribution) SetCreatedAt(v DistributionGetCreatedAtRetType) { + setDistributionGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDomains returns the Domains field value +func (o *Distribution) GetDomains() (ret DistributionGetDomainsRetType) { + ret, _ = o.GetDomainsOk() + return ret +} + +// GetDomainsOk returns a tuple with the Domains field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetDomainsOk() (ret DistributionGetDomainsRetType, ok bool) { + return getDistributionGetDomainsAttributeTypeOk(o.Domains) +} + +// SetDomains sets field value +func (o *Distribution) SetDomains(v DistributionGetDomainsRetType) { + setDistributionGetDomainsAttributeType(&o.Domains, v) +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *Distribution) GetErrors() (res DistributionGetErrorsRetType) { + res, _ = o.GetErrorsOk() + return +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Distribution) GetErrorsOk() (ret DistributionGetErrorsRetType, ok bool) { + return getDistributionGetErrorsAttributeTypeOk(o.Errors) +} + +// HasErrors returns a boolean if a field has been set. +func (o *Distribution) HasErrors() bool { + _, ok := o.GetErrorsOk() + return ok +} + +// SetErrors gets a reference to the given []StatusError and assigns it to the Errors field. +func (o *Distribution) SetErrors(v DistributionGetErrorsRetType) { + setDistributionGetErrorsAttributeType(&o.Errors, v) +} + +// GetId returns the Id field value +func (o *Distribution) GetId() (ret DistributionGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetIdOk() (ret DistributionGetIdRetType, ok bool) { + return getDistributionGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Distribution) SetId(v DistributionGetIdRetType) { + setDistributionGetIdAttributeType(&o.Id, v) +} + +// GetProjectId returns the ProjectId field value +func (o *Distribution) GetProjectId() (ret DistributionGetProjectIdRetType) { + ret, _ = o.GetProjectIdOk() + return ret +} + +// GetProjectIdOk returns a tuple with the ProjectId field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetProjectIdOk() (ret DistributionGetProjectIdRetType, ok bool) { + return getDistributionGetProjectIdAttributeTypeOk(o.ProjectId) +} + +// SetProjectId sets field value +func (o *Distribution) SetProjectId(v DistributionGetProjectIdRetType) { + setDistributionGetProjectIdAttributeType(&o.ProjectId, v) +} + +// GetStatus returns the Status field value +func (o *Distribution) GetStatus() (ret DistributionGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetStatusOk() (ret DistributionGetStatusRetType, ok bool) { + return getDistributionGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Distribution) SetStatus(v DistributionGetStatusRetType) { + setDistributionGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value +func (o *Distribution) GetUpdatedAt() (ret DistributionGetUpdatedAtRetType) { + ret, _ = o.GetUpdatedAtOk() + return ret +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetUpdatedAtOk() (ret DistributionGetUpdatedAtRetType, ok bool) { + return getDistributionGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// SetUpdatedAt sets field value +func (o *Distribution) SetUpdatedAt(v DistributionGetUpdatedAtRetType) { + setDistributionGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetWaf returns the Waf field value if set, zero value otherwise. +func (o *Distribution) GetWaf() (res DistributionGetWafRetType) { + res, _ = o.GetWafOk() + return +} + +// GetWafOk returns a tuple with the Waf field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Distribution) GetWafOk() (ret DistributionGetWafRetType, ok bool) { + return getDistributionGetWafAttributeTypeOk(o.Waf) +} + +// HasWaf returns a boolean if a field has been set. +func (o *Distribution) HasWaf() bool { + _, ok := o.GetWafOk() + return ok +} + +// SetWaf gets a reference to the given DistributionWaf and assigns it to the Waf field. +func (o *Distribution) SetWaf(v DistributionGetWafRetType) { + setDistributionGetWafAttributeType(&o.Waf, v) +} + +func (o Distribution) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDistributionGetConfigAttributeTypeOk(o.Config); ok { + toSerialize["Config"] = val + } + if val, ok := getDistributionGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getDistributionGetDomainsAttributeTypeOk(o.Domains); ok { + toSerialize["Domains"] = val + } + if val, ok := getDistributionGetErrorsAttributeTypeOk(o.Errors); ok { + toSerialize["Errors"] = val + } + if val, ok := getDistributionGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getDistributionGetProjectIdAttributeTypeOk(o.ProjectId); ok { + toSerialize["ProjectId"] = val + } + if val, ok := getDistributionGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getDistributionGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getDistributionGetWafAttributeTypeOk(o.Waf); ok { + toSerialize["Waf"] = val + } + return toSerialize, nil +} + +type NullableDistribution struct { + value *Distribution + isSet bool +} + +func (v NullableDistribution) Get() *Distribution { + return v.value +} + +func (v *NullableDistribution) Set(val *Distribution) { + v.value = val + v.isSet = true +} + +func (v NullableDistribution) IsSet() bool { + return v.isSet +} + +func (v *NullableDistribution) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistribution(val *Distribution) *NullableDistribution { + return &NullableDistribution{value: val, isSet: true} +} + +func (v NullableDistribution) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistribution) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_distribution_logs_record.go b/pkg/cdnbeta/model_distribution_logs_record.go new file mode 100644 index 00000000..bfb527dc --- /dev/null +++ b/pkg/cdnbeta/model_distribution_logs_record.go @@ -0,0 +1,477 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "time" +) + +// checks if the DistributionLogsRecord type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DistributionLogsRecord{} + +/* + types and functions for cacheHit +*/ + +// isBoolean +type DistributionLogsRecordgetCacheHitAttributeType = *bool +type DistributionLogsRecordgetCacheHitArgType = bool +type DistributionLogsRecordgetCacheHitRetType = bool + +func getDistributionLogsRecordgetCacheHitAttributeTypeOk(arg DistributionLogsRecordgetCacheHitAttributeType) (ret DistributionLogsRecordgetCacheHitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionLogsRecordgetCacheHitAttributeType(arg *DistributionLogsRecordgetCacheHitAttributeType, val DistributionLogsRecordgetCacheHitRetType) { + *arg = &val +} + +/* + types and functions for dataCenterRegion +*/ + +// isNotNullableString +type DistributionLogsRecordGetDataCenterRegionAttributeType = *string + +func getDistributionLogsRecordGetDataCenterRegionAttributeTypeOk(arg DistributionLogsRecordGetDataCenterRegionAttributeType) (ret DistributionLogsRecordGetDataCenterRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionLogsRecordGetDataCenterRegionAttributeType(arg *DistributionLogsRecordGetDataCenterRegionAttributeType, val DistributionLogsRecordGetDataCenterRegionRetType) { + *arg = &val +} + +type DistributionLogsRecordGetDataCenterRegionArgType = string +type DistributionLogsRecordGetDataCenterRegionRetType = string + +/* + types and functions for distributionId +*/ + +// isNotNullableString +type DistributionLogsRecordGetDistributionIdAttributeType = *string + +func getDistributionLogsRecordGetDistributionIdAttributeTypeOk(arg DistributionLogsRecordGetDistributionIdAttributeType) (ret DistributionLogsRecordGetDistributionIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionLogsRecordGetDistributionIdAttributeType(arg *DistributionLogsRecordGetDistributionIdAttributeType, val DistributionLogsRecordGetDistributionIdRetType) { + *arg = &val +} + +type DistributionLogsRecordGetDistributionIdArgType = string +type DistributionLogsRecordGetDistributionIdRetType = string + +/* + types and functions for host +*/ + +// isNotNullableString +type DistributionLogsRecordGetHostAttributeType = *string + +func getDistributionLogsRecordGetHostAttributeTypeOk(arg DistributionLogsRecordGetHostAttributeType) (ret DistributionLogsRecordGetHostRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionLogsRecordGetHostAttributeType(arg *DistributionLogsRecordGetHostAttributeType, val DistributionLogsRecordGetHostRetType) { + *arg = &val +} + +type DistributionLogsRecordGetHostArgType = string +type DistributionLogsRecordGetHostRetType = string + +/* + types and functions for path +*/ + +// isNotNullableString +type DistributionLogsRecordGetPathAttributeType = *string + +func getDistributionLogsRecordGetPathAttributeTypeOk(arg DistributionLogsRecordGetPathAttributeType) (ret DistributionLogsRecordGetPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionLogsRecordGetPathAttributeType(arg *DistributionLogsRecordGetPathAttributeType, val DistributionLogsRecordGetPathRetType) { + *arg = &val +} + +type DistributionLogsRecordGetPathArgType = string +type DistributionLogsRecordGetPathRetType = string + +/* + types and functions for requestCountryCode +*/ + +// isNotNullableString +type DistributionLogsRecordGetRequestCountryCodeAttributeType = *string + +func getDistributionLogsRecordGetRequestCountryCodeAttributeTypeOk(arg DistributionLogsRecordGetRequestCountryCodeAttributeType) (ret DistributionLogsRecordGetRequestCountryCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionLogsRecordGetRequestCountryCodeAttributeType(arg *DistributionLogsRecordGetRequestCountryCodeAttributeType, val DistributionLogsRecordGetRequestCountryCodeRetType) { + *arg = &val +} + +type DistributionLogsRecordGetRequestCountryCodeArgType = string +type DistributionLogsRecordGetRequestCountryCodeRetType = string + +/* + types and functions for size +*/ + +// isLong +type DistributionLogsRecordGetSizeAttributeType = *int64 +type DistributionLogsRecordGetSizeArgType = int64 +type DistributionLogsRecordGetSizeRetType = int64 + +func getDistributionLogsRecordGetSizeAttributeTypeOk(arg DistributionLogsRecordGetSizeAttributeType) (ret DistributionLogsRecordGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionLogsRecordGetSizeAttributeType(arg *DistributionLogsRecordGetSizeAttributeType, val DistributionLogsRecordGetSizeRetType) { + *arg = &val +} + +/* + types and functions for statusCode +*/ + +// isInteger +type DistributionLogsRecordGetStatusCodeAttributeType = *int64 +type DistributionLogsRecordGetStatusCodeArgType = int64 +type DistributionLogsRecordGetStatusCodeRetType = int64 + +func getDistributionLogsRecordGetStatusCodeAttributeTypeOk(arg DistributionLogsRecordGetStatusCodeAttributeType) (ret DistributionLogsRecordGetStatusCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionLogsRecordGetStatusCodeAttributeType(arg *DistributionLogsRecordGetStatusCodeAttributeType, val DistributionLogsRecordGetStatusCodeRetType) { + *arg = &val +} + +/* + types and functions for timestamp +*/ + +// isDateTime +type DistributionLogsRecordGetTimestampAttributeType = *time.Time +type DistributionLogsRecordGetTimestampArgType = time.Time +type DistributionLogsRecordGetTimestampRetType = time.Time + +func getDistributionLogsRecordGetTimestampAttributeTypeOk(arg DistributionLogsRecordGetTimestampAttributeType) (ret DistributionLogsRecordGetTimestampRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionLogsRecordGetTimestampAttributeType(arg *DistributionLogsRecordGetTimestampAttributeType, val DistributionLogsRecordGetTimestampRetType) { + *arg = &val +} + +// DistributionLogsRecord struct for DistributionLogsRecord +type DistributionLogsRecord struct { + // REQUIRED + CacheHit DistributionLogsRecordgetCacheHitAttributeType `json:"cacheHit" required:"true"` + // REQUIRED + DataCenterRegion DistributionLogsRecordGetDataCenterRegionAttributeType `json:"dataCenterRegion" required:"true"` + // REQUIRED + DistributionId DistributionLogsRecordGetDistributionIdAttributeType `json:"distributionId" required:"true"` + // REQUIRED + Host DistributionLogsRecordGetHostAttributeType `json:"host" required:"true"` + // REQUIRED + Path DistributionLogsRecordGetPathAttributeType `json:"path" required:"true"` + // ISO 3166-1 A2 compliant country code + // REQUIRED + RequestCountryCode DistributionLogsRecordGetRequestCountryCodeAttributeType `json:"requestCountryCode" required:"true"` + // REQUIRED + Size DistributionLogsRecordGetSizeAttributeType `json:"size" required:"true"` + // Can be cast to int32 without loss of precision. + // REQUIRED + StatusCode DistributionLogsRecordGetStatusCodeAttributeType `json:"statusCode" required:"true"` + // REQUIRED + Timestamp DistributionLogsRecordGetTimestampAttributeType `json:"timestamp" required:"true"` +} + +type _DistributionLogsRecord DistributionLogsRecord + +// NewDistributionLogsRecord instantiates a new DistributionLogsRecord 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 NewDistributionLogsRecord(cacheHit DistributionLogsRecordgetCacheHitArgType, dataCenterRegion DistributionLogsRecordGetDataCenterRegionArgType, distributionId DistributionLogsRecordGetDistributionIdArgType, host DistributionLogsRecordGetHostArgType, path DistributionLogsRecordGetPathArgType, requestCountryCode DistributionLogsRecordGetRequestCountryCodeArgType, size DistributionLogsRecordGetSizeArgType, statusCode DistributionLogsRecordGetStatusCodeArgType, timestamp DistributionLogsRecordGetTimestampArgType) *DistributionLogsRecord { + this := DistributionLogsRecord{} + setDistributionLogsRecordgetCacheHitAttributeType(&this.CacheHit, cacheHit) + setDistributionLogsRecordGetDataCenterRegionAttributeType(&this.DataCenterRegion, dataCenterRegion) + setDistributionLogsRecordGetDistributionIdAttributeType(&this.DistributionId, distributionId) + setDistributionLogsRecordGetHostAttributeType(&this.Host, host) + setDistributionLogsRecordGetPathAttributeType(&this.Path, path) + setDistributionLogsRecordGetRequestCountryCodeAttributeType(&this.RequestCountryCode, requestCountryCode) + setDistributionLogsRecordGetSizeAttributeType(&this.Size, size) + setDistributionLogsRecordGetStatusCodeAttributeType(&this.StatusCode, statusCode) + setDistributionLogsRecordGetTimestampAttributeType(&this.Timestamp, timestamp) + return &this +} + +// NewDistributionLogsRecordWithDefaults instantiates a new DistributionLogsRecord 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 NewDistributionLogsRecordWithDefaults() *DistributionLogsRecord { + this := DistributionLogsRecord{} + return &this +} + +// GetCacheHit returns the CacheHit field value +func (o *DistributionLogsRecord) GetCacheHit() (ret DistributionLogsRecordgetCacheHitRetType) { + ret, _ = o.GetCacheHitOk() + return ret +} + +// GetCacheHitOk returns a tuple with the CacheHit field value +// and a boolean to check if the value has been set. +func (o *DistributionLogsRecord) GetCacheHitOk() (ret DistributionLogsRecordgetCacheHitRetType, ok bool) { + return getDistributionLogsRecordgetCacheHitAttributeTypeOk(o.CacheHit) +} + +// SetCacheHit sets field value +func (o *DistributionLogsRecord) SetCacheHit(v DistributionLogsRecordgetCacheHitRetType) { + setDistributionLogsRecordgetCacheHitAttributeType(&o.CacheHit, v) +} + +// GetDataCenterRegion returns the DataCenterRegion field value +func (o *DistributionLogsRecord) GetDataCenterRegion() (ret DistributionLogsRecordGetDataCenterRegionRetType) { + ret, _ = o.GetDataCenterRegionOk() + return ret +} + +// GetDataCenterRegionOk returns a tuple with the DataCenterRegion field value +// and a boolean to check if the value has been set. +func (o *DistributionLogsRecord) GetDataCenterRegionOk() (ret DistributionLogsRecordGetDataCenterRegionRetType, ok bool) { + return getDistributionLogsRecordGetDataCenterRegionAttributeTypeOk(o.DataCenterRegion) +} + +// SetDataCenterRegion sets field value +func (o *DistributionLogsRecord) SetDataCenterRegion(v DistributionLogsRecordGetDataCenterRegionRetType) { + setDistributionLogsRecordGetDataCenterRegionAttributeType(&o.DataCenterRegion, v) +} + +// GetDistributionId returns the DistributionId field value +func (o *DistributionLogsRecord) GetDistributionId() (ret DistributionLogsRecordGetDistributionIdRetType) { + ret, _ = o.GetDistributionIdOk() + return ret +} + +// GetDistributionIdOk returns a tuple with the DistributionId field value +// and a boolean to check if the value has been set. +func (o *DistributionLogsRecord) GetDistributionIdOk() (ret DistributionLogsRecordGetDistributionIdRetType, ok bool) { + return getDistributionLogsRecordGetDistributionIdAttributeTypeOk(o.DistributionId) +} + +// SetDistributionId sets field value +func (o *DistributionLogsRecord) SetDistributionId(v DistributionLogsRecordGetDistributionIdRetType) { + setDistributionLogsRecordGetDistributionIdAttributeType(&o.DistributionId, v) +} + +// GetHost returns the Host field value +func (o *DistributionLogsRecord) GetHost() (ret DistributionLogsRecordGetHostRetType) { + ret, _ = o.GetHostOk() + return ret +} + +// GetHostOk returns a tuple with the Host field value +// and a boolean to check if the value has been set. +func (o *DistributionLogsRecord) GetHostOk() (ret DistributionLogsRecordGetHostRetType, ok bool) { + return getDistributionLogsRecordGetHostAttributeTypeOk(o.Host) +} + +// SetHost sets field value +func (o *DistributionLogsRecord) SetHost(v DistributionLogsRecordGetHostRetType) { + setDistributionLogsRecordGetHostAttributeType(&o.Host, v) +} + +// GetPath returns the Path field value +func (o *DistributionLogsRecord) GetPath() (ret DistributionLogsRecordGetPathRetType) { + ret, _ = o.GetPathOk() + return ret +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *DistributionLogsRecord) GetPathOk() (ret DistributionLogsRecordGetPathRetType, ok bool) { + return getDistributionLogsRecordGetPathAttributeTypeOk(o.Path) +} + +// SetPath sets field value +func (o *DistributionLogsRecord) SetPath(v DistributionLogsRecordGetPathRetType) { + setDistributionLogsRecordGetPathAttributeType(&o.Path, v) +} + +// GetRequestCountryCode returns the RequestCountryCode field value +func (o *DistributionLogsRecord) GetRequestCountryCode() (ret DistributionLogsRecordGetRequestCountryCodeRetType) { + ret, _ = o.GetRequestCountryCodeOk() + return ret +} + +// GetRequestCountryCodeOk returns a tuple with the RequestCountryCode field value +// and a boolean to check if the value has been set. +func (o *DistributionLogsRecord) GetRequestCountryCodeOk() (ret DistributionLogsRecordGetRequestCountryCodeRetType, ok bool) { + return getDistributionLogsRecordGetRequestCountryCodeAttributeTypeOk(o.RequestCountryCode) +} + +// SetRequestCountryCode sets field value +func (o *DistributionLogsRecord) SetRequestCountryCode(v DistributionLogsRecordGetRequestCountryCodeRetType) { + setDistributionLogsRecordGetRequestCountryCodeAttributeType(&o.RequestCountryCode, v) +} + +// GetSize returns the Size field value +func (o *DistributionLogsRecord) GetSize() (ret DistributionLogsRecordGetSizeRetType) { + ret, _ = o.GetSizeOk() + return ret +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *DistributionLogsRecord) GetSizeOk() (ret DistributionLogsRecordGetSizeRetType, ok bool) { + return getDistributionLogsRecordGetSizeAttributeTypeOk(o.Size) +} + +// SetSize sets field value +func (o *DistributionLogsRecord) SetSize(v DistributionLogsRecordGetSizeRetType) { + setDistributionLogsRecordGetSizeAttributeType(&o.Size, v) +} + +// GetStatusCode returns the StatusCode field value +func (o *DistributionLogsRecord) GetStatusCode() (ret DistributionLogsRecordGetStatusCodeRetType) { + ret, _ = o.GetStatusCodeOk() + return ret +} + +// GetStatusCodeOk returns a tuple with the StatusCode field value +// and a boolean to check if the value has been set. +func (o *DistributionLogsRecord) GetStatusCodeOk() (ret DistributionLogsRecordGetStatusCodeRetType, ok bool) { + return getDistributionLogsRecordGetStatusCodeAttributeTypeOk(o.StatusCode) +} + +// SetStatusCode sets field value +func (o *DistributionLogsRecord) SetStatusCode(v DistributionLogsRecordGetStatusCodeRetType) { + setDistributionLogsRecordGetStatusCodeAttributeType(&o.StatusCode, v) +} + +// GetTimestamp returns the Timestamp field value +func (o *DistributionLogsRecord) GetTimestamp() (ret DistributionLogsRecordGetTimestampRetType) { + ret, _ = o.GetTimestampOk() + return ret +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *DistributionLogsRecord) GetTimestampOk() (ret DistributionLogsRecordGetTimestampRetType, ok bool) { + return getDistributionLogsRecordGetTimestampAttributeTypeOk(o.Timestamp) +} + +// SetTimestamp sets field value +func (o *DistributionLogsRecord) SetTimestamp(v DistributionLogsRecordGetTimestampRetType) { + setDistributionLogsRecordGetTimestampAttributeType(&o.Timestamp, v) +} + +func (o DistributionLogsRecord) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDistributionLogsRecordgetCacheHitAttributeTypeOk(o.CacheHit); ok { + toSerialize["CacheHit"] = val + } + if val, ok := getDistributionLogsRecordGetDataCenterRegionAttributeTypeOk(o.DataCenterRegion); ok { + toSerialize["DataCenterRegion"] = val + } + if val, ok := getDistributionLogsRecordGetDistributionIdAttributeTypeOk(o.DistributionId); ok { + toSerialize["DistributionId"] = val + } + if val, ok := getDistributionLogsRecordGetHostAttributeTypeOk(o.Host); ok { + toSerialize["Host"] = val + } + if val, ok := getDistributionLogsRecordGetPathAttributeTypeOk(o.Path); ok { + toSerialize["Path"] = val + } + if val, ok := getDistributionLogsRecordGetRequestCountryCodeAttributeTypeOk(o.RequestCountryCode); ok { + toSerialize["RequestCountryCode"] = val + } + if val, ok := getDistributionLogsRecordGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getDistributionLogsRecordGetStatusCodeAttributeTypeOk(o.StatusCode); ok { + toSerialize["StatusCode"] = val + } + if val, ok := getDistributionLogsRecordGetTimestampAttributeTypeOk(o.Timestamp); ok { + toSerialize["Timestamp"] = val + } + return toSerialize, nil +} + +type NullableDistributionLogsRecord struct { + value *DistributionLogsRecord + isSet bool +} + +func (v NullableDistributionLogsRecord) Get() *DistributionLogsRecord { + return v.value +} + +func (v *NullableDistributionLogsRecord) Set(val *DistributionLogsRecord) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionLogsRecord) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionLogsRecord) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionLogsRecord(val *DistributionLogsRecord) *NullableDistributionLogsRecord { + return &NullableDistributionLogsRecord{value: val, isSet: true} +} + +func (v NullableDistributionLogsRecord) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionLogsRecord) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_distribution_logs_record_test.go b/pkg/cdnbeta/model_distribution_logs_record_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_logs_record_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_distribution_statistics_record.go b/pkg/cdnbeta/model_distribution_statistics_record.go new file mode 100644 index 00000000..07b1eb4e --- /dev/null +++ b/pkg/cdnbeta/model_distribution_statistics_record.go @@ -0,0 +1,346 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "time" +) + +// checks if the DistributionStatisticsRecord type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DistributionStatisticsRecord{} + +/* + types and functions for cachedRequests +*/ + +// isLong +type DistributionStatisticsRecordGetCachedRequestsAttributeType = *int64 +type DistributionStatisticsRecordGetCachedRequestsArgType = int64 +type DistributionStatisticsRecordGetCachedRequestsRetType = int64 + +func getDistributionStatisticsRecordGetCachedRequestsAttributeTypeOk(arg DistributionStatisticsRecordGetCachedRequestsAttributeType) (ret DistributionStatisticsRecordGetCachedRequestsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordGetCachedRequestsAttributeType(arg *DistributionStatisticsRecordGetCachedRequestsAttributeType, val DistributionStatisticsRecordGetCachedRequestsRetType) { + *arg = &val +} + +/* + types and functions for totalRequests +*/ + +// isLong +type DistributionStatisticsRecordGetTotalRequestsAttributeType = *int64 +type DistributionStatisticsRecordGetTotalRequestsArgType = int64 +type DistributionStatisticsRecordGetTotalRequestsRetType = int64 + +func getDistributionStatisticsRecordGetTotalRequestsAttributeTypeOk(arg DistributionStatisticsRecordGetTotalRequestsAttributeType) (ret DistributionStatisticsRecordGetTotalRequestsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordGetTotalRequestsAttributeType(arg *DistributionStatisticsRecordGetTotalRequestsAttributeType, val DistributionStatisticsRecordGetTotalRequestsRetType) { + *arg = &val +} + +/* + types and functions for totalTrafficBytes +*/ + +// isLong +type DistributionStatisticsRecordGetTotalTrafficBytesAttributeType = *int64 +type DistributionStatisticsRecordGetTotalTrafficBytesArgType = int64 +type DistributionStatisticsRecordGetTotalTrafficBytesRetType = int64 + +func getDistributionStatisticsRecordGetTotalTrafficBytesAttributeTypeOk(arg DistributionStatisticsRecordGetTotalTrafficBytesAttributeType) (ret DistributionStatisticsRecordGetTotalTrafficBytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordGetTotalTrafficBytesAttributeType(arg *DistributionStatisticsRecordGetTotalTrafficBytesAttributeType, val DistributionStatisticsRecordGetTotalTrafficBytesRetType) { + *arg = &val +} + +/* + types and functions for end +*/ + +// isDateTime +type DistributionStatisticsRecordGetEndAttributeType = *time.Time +type DistributionStatisticsRecordGetEndArgType = time.Time +type DistributionStatisticsRecordGetEndRetType = time.Time + +func getDistributionStatisticsRecordGetEndAttributeTypeOk(arg DistributionStatisticsRecordGetEndAttributeType) (ret DistributionStatisticsRecordGetEndRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordGetEndAttributeType(arg *DistributionStatisticsRecordGetEndAttributeType, val DistributionStatisticsRecordGetEndRetType) { + *arg = &val +} + +/* + types and functions for regions +*/ + +// isModel +type DistributionStatisticsRecordGetRegionsAttributeType = *DistributionStatisticsRecordRegions +type DistributionStatisticsRecordGetRegionsArgType = DistributionStatisticsRecordRegions +type DistributionStatisticsRecordGetRegionsRetType = DistributionStatisticsRecordRegions + +func getDistributionStatisticsRecordGetRegionsAttributeTypeOk(arg DistributionStatisticsRecordGetRegionsAttributeType) (ret DistributionStatisticsRecordGetRegionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordGetRegionsAttributeType(arg *DistributionStatisticsRecordGetRegionsAttributeType, val DistributionStatisticsRecordGetRegionsRetType) { + *arg = &val +} + +/* + types and functions for start +*/ + +// isDateTime +type DistributionStatisticsRecordGetStartAttributeType = *time.Time +type DistributionStatisticsRecordGetStartArgType = time.Time +type DistributionStatisticsRecordGetStartRetType = time.Time + +func getDistributionStatisticsRecordGetStartAttributeTypeOk(arg DistributionStatisticsRecordGetStartAttributeType) (ret DistributionStatisticsRecordGetStartRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordGetStartAttributeType(arg *DistributionStatisticsRecordGetStartAttributeType, val DistributionStatisticsRecordGetStartRetType) { + *arg = &val +} + +// DistributionStatisticsRecord Aggregated statistics of a distribution during a time interval +type DistributionStatisticsRecord struct { + // Number of cached requests that were served + // REQUIRED + CachedRequests DistributionStatisticsRecordGetCachedRequestsAttributeType `json:"cachedRequests" required:"true"` + // Total number of requests that were served + // REQUIRED + TotalRequests DistributionStatisticsRecordGetTotalRequestsAttributeType `json:"totalRequests" required:"true"` + // Total traffic in bytes that occurred during the time interval + // REQUIRED + TotalTrafficBytes DistributionStatisticsRecordGetTotalTrafficBytesAttributeType `json:"totalTrafficBytes" required:"true"` + // Exclusive end of the time interval the statistics refer to + // REQUIRED + End DistributionStatisticsRecordGetEndAttributeType `json:"end" required:"true"` + // REQUIRED + Regions DistributionStatisticsRecordGetRegionsAttributeType `json:"regions" required:"true"` + // Start of the time interval the statistics refer to + // REQUIRED + Start DistributionStatisticsRecordGetStartAttributeType `json:"start" required:"true"` +} + +type _DistributionStatisticsRecord DistributionStatisticsRecord + +// NewDistributionStatisticsRecord instantiates a new DistributionStatisticsRecord 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 NewDistributionStatisticsRecord(cachedRequests DistributionStatisticsRecordGetCachedRequestsArgType, totalRequests DistributionStatisticsRecordGetTotalRequestsArgType, totalTrafficBytes DistributionStatisticsRecordGetTotalTrafficBytesArgType, end DistributionStatisticsRecordGetEndArgType, regions DistributionStatisticsRecordGetRegionsArgType, start DistributionStatisticsRecordGetStartArgType) *DistributionStatisticsRecord { + this := DistributionStatisticsRecord{} + setDistributionStatisticsRecordGetCachedRequestsAttributeType(&this.CachedRequests, cachedRequests) + setDistributionStatisticsRecordGetTotalRequestsAttributeType(&this.TotalRequests, totalRequests) + setDistributionStatisticsRecordGetTotalTrafficBytesAttributeType(&this.TotalTrafficBytes, totalTrafficBytes) + setDistributionStatisticsRecordGetEndAttributeType(&this.End, end) + setDistributionStatisticsRecordGetRegionsAttributeType(&this.Regions, regions) + setDistributionStatisticsRecordGetStartAttributeType(&this.Start, start) + return &this +} + +// NewDistributionStatisticsRecordWithDefaults instantiates a new DistributionStatisticsRecord 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 NewDistributionStatisticsRecordWithDefaults() *DistributionStatisticsRecord { + this := DistributionStatisticsRecord{} + return &this +} + +// GetCachedRequests returns the CachedRequests field value +func (o *DistributionStatisticsRecord) GetCachedRequests() (ret DistributionStatisticsRecordGetCachedRequestsRetType) { + ret, _ = o.GetCachedRequestsOk() + return ret +} + +// GetCachedRequestsOk returns a tuple with the CachedRequests field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetCachedRequestsOk() (ret DistributionStatisticsRecordGetCachedRequestsRetType, ok bool) { + return getDistributionStatisticsRecordGetCachedRequestsAttributeTypeOk(o.CachedRequests) +} + +// SetCachedRequests sets field value +func (o *DistributionStatisticsRecord) SetCachedRequests(v DistributionStatisticsRecordGetCachedRequestsRetType) { + setDistributionStatisticsRecordGetCachedRequestsAttributeType(&o.CachedRequests, v) +} + +// GetTotalRequests returns the TotalRequests field value +func (o *DistributionStatisticsRecord) GetTotalRequests() (ret DistributionStatisticsRecordGetTotalRequestsRetType) { + ret, _ = o.GetTotalRequestsOk() + return ret +} + +// GetTotalRequestsOk returns a tuple with the TotalRequests field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetTotalRequestsOk() (ret DistributionStatisticsRecordGetTotalRequestsRetType, ok bool) { + return getDistributionStatisticsRecordGetTotalRequestsAttributeTypeOk(o.TotalRequests) +} + +// SetTotalRequests sets field value +func (o *DistributionStatisticsRecord) SetTotalRequests(v DistributionStatisticsRecordGetTotalRequestsRetType) { + setDistributionStatisticsRecordGetTotalRequestsAttributeType(&o.TotalRequests, v) +} + +// GetTotalTrafficBytes returns the TotalTrafficBytes field value +func (o *DistributionStatisticsRecord) GetTotalTrafficBytes() (ret DistributionStatisticsRecordGetTotalTrafficBytesRetType) { + ret, _ = o.GetTotalTrafficBytesOk() + return ret +} + +// GetTotalTrafficBytesOk returns a tuple with the TotalTrafficBytes field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetTotalTrafficBytesOk() (ret DistributionStatisticsRecordGetTotalTrafficBytesRetType, ok bool) { + return getDistributionStatisticsRecordGetTotalTrafficBytesAttributeTypeOk(o.TotalTrafficBytes) +} + +// SetTotalTrafficBytes sets field value +func (o *DistributionStatisticsRecord) SetTotalTrafficBytes(v DistributionStatisticsRecordGetTotalTrafficBytesRetType) { + setDistributionStatisticsRecordGetTotalTrafficBytesAttributeType(&o.TotalTrafficBytes, v) +} + +// GetEnd returns the End field value +func (o *DistributionStatisticsRecord) GetEnd() (ret DistributionStatisticsRecordGetEndRetType) { + ret, _ = o.GetEndOk() + return ret +} + +// GetEndOk returns a tuple with the End field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetEndOk() (ret DistributionStatisticsRecordGetEndRetType, ok bool) { + return getDistributionStatisticsRecordGetEndAttributeTypeOk(o.End) +} + +// SetEnd sets field value +func (o *DistributionStatisticsRecord) SetEnd(v DistributionStatisticsRecordGetEndRetType) { + setDistributionStatisticsRecordGetEndAttributeType(&o.End, v) +} + +// GetRegions returns the Regions field value +func (o *DistributionStatisticsRecord) GetRegions() (ret DistributionStatisticsRecordGetRegionsRetType) { + ret, _ = o.GetRegionsOk() + return ret +} + +// GetRegionsOk returns a tuple with the Regions field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetRegionsOk() (ret DistributionStatisticsRecordGetRegionsRetType, ok bool) { + return getDistributionStatisticsRecordGetRegionsAttributeTypeOk(o.Regions) +} + +// SetRegions sets field value +func (o *DistributionStatisticsRecord) SetRegions(v DistributionStatisticsRecordGetRegionsRetType) { + setDistributionStatisticsRecordGetRegionsAttributeType(&o.Regions, v) +} + +// GetStart returns the Start field value +func (o *DistributionStatisticsRecord) GetStart() (ret DistributionStatisticsRecordGetStartRetType) { + ret, _ = o.GetStartOk() + return ret +} + +// GetStartOk returns a tuple with the Start field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetStartOk() (ret DistributionStatisticsRecordGetStartRetType, ok bool) { + return getDistributionStatisticsRecordGetStartAttributeTypeOk(o.Start) +} + +// SetStart sets field value +func (o *DistributionStatisticsRecord) SetStart(v DistributionStatisticsRecordGetStartRetType) { + setDistributionStatisticsRecordGetStartAttributeType(&o.Start, v) +} + +func (o DistributionStatisticsRecord) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDistributionStatisticsRecordGetCachedRequestsAttributeTypeOk(o.CachedRequests); ok { + toSerialize["CachedRequests"] = val + } + if val, ok := getDistributionStatisticsRecordGetTotalRequestsAttributeTypeOk(o.TotalRequests); ok { + toSerialize["TotalRequests"] = val + } + if val, ok := getDistributionStatisticsRecordGetTotalTrafficBytesAttributeTypeOk(o.TotalTrafficBytes); ok { + toSerialize["TotalTrafficBytes"] = val + } + if val, ok := getDistributionStatisticsRecordGetEndAttributeTypeOk(o.End); ok { + toSerialize["End"] = val + } + if val, ok := getDistributionStatisticsRecordGetRegionsAttributeTypeOk(o.Regions); ok { + toSerialize["Regions"] = val + } + if val, ok := getDistributionStatisticsRecordGetStartAttributeTypeOk(o.Start); ok { + toSerialize["Start"] = val + } + return toSerialize, nil +} + +type NullableDistributionStatisticsRecord struct { + value *DistributionStatisticsRecord + isSet bool +} + +func (v NullableDistributionStatisticsRecord) Get() *DistributionStatisticsRecord { + return v.value +} + +func (v *NullableDistributionStatisticsRecord) Set(val *DistributionStatisticsRecord) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionStatisticsRecord) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionStatisticsRecord) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionStatisticsRecord(val *DistributionStatisticsRecord) *NullableDistributionStatisticsRecord { + return &NullableDistributionStatisticsRecord{value: val, isSet: true} +} + +func (v NullableDistributionStatisticsRecord) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionStatisticsRecord) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_distribution_statistics_record_all_of.go b/pkg/cdnbeta/model_distribution_statistics_record_all_of.go new file mode 100644 index 00000000..eeedcb78 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_statistics_record_all_of.go @@ -0,0 +1,214 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "time" +) + +// checks if the DistributionStatisticsRecordAllOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DistributionStatisticsRecordAllOf{} + +/* + types and functions for end +*/ + +// isDateTime +type DistributionStatisticsRecordAllOfGetEndAttributeType = *time.Time +type DistributionStatisticsRecordAllOfGetEndArgType = time.Time +type DistributionStatisticsRecordAllOfGetEndRetType = time.Time + +func getDistributionStatisticsRecordAllOfGetEndAttributeTypeOk(arg DistributionStatisticsRecordAllOfGetEndAttributeType) (ret DistributionStatisticsRecordAllOfGetEndRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordAllOfGetEndAttributeType(arg *DistributionStatisticsRecordAllOfGetEndAttributeType, val DistributionStatisticsRecordAllOfGetEndRetType) { + *arg = &val +} + +/* + types and functions for regions +*/ + +// isModel +type DistributionStatisticsRecordAllOfGetRegionsAttributeType = *DistributionStatisticsRecordRegions +type DistributionStatisticsRecordAllOfGetRegionsArgType = DistributionStatisticsRecordRegions +type DistributionStatisticsRecordAllOfGetRegionsRetType = DistributionStatisticsRecordRegions + +func getDistributionStatisticsRecordAllOfGetRegionsAttributeTypeOk(arg DistributionStatisticsRecordAllOfGetRegionsAttributeType) (ret DistributionStatisticsRecordAllOfGetRegionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordAllOfGetRegionsAttributeType(arg *DistributionStatisticsRecordAllOfGetRegionsAttributeType, val DistributionStatisticsRecordAllOfGetRegionsRetType) { + *arg = &val +} + +/* + types and functions for start +*/ + +// isDateTime +type DistributionStatisticsRecordAllOfGetStartAttributeType = *time.Time +type DistributionStatisticsRecordAllOfGetStartArgType = time.Time +type DistributionStatisticsRecordAllOfGetStartRetType = time.Time + +func getDistributionStatisticsRecordAllOfGetStartAttributeTypeOk(arg DistributionStatisticsRecordAllOfGetStartAttributeType) (ret DistributionStatisticsRecordAllOfGetStartRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordAllOfGetStartAttributeType(arg *DistributionStatisticsRecordAllOfGetStartAttributeType, val DistributionStatisticsRecordAllOfGetStartRetType) { + *arg = &val +} + +// DistributionStatisticsRecordAllOf struct for DistributionStatisticsRecordAllOf +type DistributionStatisticsRecordAllOf struct { + // Exclusive end of the time interval the statistics refer to + // REQUIRED + End DistributionStatisticsRecordAllOfGetEndAttributeType `json:"end" required:"true"` + // REQUIRED + Regions DistributionStatisticsRecordAllOfGetRegionsAttributeType `json:"regions" required:"true"` + // Start of the time interval the statistics refer to + // REQUIRED + Start DistributionStatisticsRecordAllOfGetStartAttributeType `json:"start" required:"true"` +} + +type _DistributionStatisticsRecordAllOf DistributionStatisticsRecordAllOf + +// NewDistributionStatisticsRecordAllOf instantiates a new DistributionStatisticsRecordAllOf 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 NewDistributionStatisticsRecordAllOf(end DistributionStatisticsRecordAllOfGetEndArgType, regions DistributionStatisticsRecordAllOfGetRegionsArgType, start DistributionStatisticsRecordAllOfGetStartArgType) *DistributionStatisticsRecordAllOf { + this := DistributionStatisticsRecordAllOf{} + setDistributionStatisticsRecordAllOfGetEndAttributeType(&this.End, end) + setDistributionStatisticsRecordAllOfGetRegionsAttributeType(&this.Regions, regions) + setDistributionStatisticsRecordAllOfGetStartAttributeType(&this.Start, start) + return &this +} + +// NewDistributionStatisticsRecordAllOfWithDefaults instantiates a new DistributionStatisticsRecordAllOf 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 NewDistributionStatisticsRecordAllOfWithDefaults() *DistributionStatisticsRecordAllOf { + this := DistributionStatisticsRecordAllOf{} + return &this +} + +// GetEnd returns the End field value +func (o *DistributionStatisticsRecordAllOf) GetEnd() (ret DistributionStatisticsRecordAllOfGetEndRetType) { + ret, _ = o.GetEndOk() + return ret +} + +// GetEndOk returns a tuple with the End field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordAllOf) GetEndOk() (ret DistributionStatisticsRecordAllOfGetEndRetType, ok bool) { + return getDistributionStatisticsRecordAllOfGetEndAttributeTypeOk(o.End) +} + +// SetEnd sets field value +func (o *DistributionStatisticsRecordAllOf) SetEnd(v DistributionStatisticsRecordAllOfGetEndRetType) { + setDistributionStatisticsRecordAllOfGetEndAttributeType(&o.End, v) +} + +// GetRegions returns the Regions field value +func (o *DistributionStatisticsRecordAllOf) GetRegions() (ret DistributionStatisticsRecordAllOfGetRegionsRetType) { + ret, _ = o.GetRegionsOk() + return ret +} + +// GetRegionsOk returns a tuple with the Regions field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordAllOf) GetRegionsOk() (ret DistributionStatisticsRecordAllOfGetRegionsRetType, ok bool) { + return getDistributionStatisticsRecordAllOfGetRegionsAttributeTypeOk(o.Regions) +} + +// SetRegions sets field value +func (o *DistributionStatisticsRecordAllOf) SetRegions(v DistributionStatisticsRecordAllOfGetRegionsRetType) { + setDistributionStatisticsRecordAllOfGetRegionsAttributeType(&o.Regions, v) +} + +// GetStart returns the Start field value +func (o *DistributionStatisticsRecordAllOf) GetStart() (ret DistributionStatisticsRecordAllOfGetStartRetType) { + ret, _ = o.GetStartOk() + return ret +} + +// GetStartOk returns a tuple with the Start field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordAllOf) GetStartOk() (ret DistributionStatisticsRecordAllOfGetStartRetType, ok bool) { + return getDistributionStatisticsRecordAllOfGetStartAttributeTypeOk(o.Start) +} + +// SetStart sets field value +func (o *DistributionStatisticsRecordAllOf) SetStart(v DistributionStatisticsRecordAllOfGetStartRetType) { + setDistributionStatisticsRecordAllOfGetStartAttributeType(&o.Start, v) +} + +func (o DistributionStatisticsRecordAllOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDistributionStatisticsRecordAllOfGetEndAttributeTypeOk(o.End); ok { + toSerialize["End"] = val + } + if val, ok := getDistributionStatisticsRecordAllOfGetRegionsAttributeTypeOk(o.Regions); ok { + toSerialize["Regions"] = val + } + if val, ok := getDistributionStatisticsRecordAllOfGetStartAttributeTypeOk(o.Start); ok { + toSerialize["Start"] = val + } + return toSerialize, nil +} + +type NullableDistributionStatisticsRecordAllOf struct { + value *DistributionStatisticsRecordAllOf + isSet bool +} + +func (v NullableDistributionStatisticsRecordAllOf) Get() *DistributionStatisticsRecordAllOf { + return v.value +} + +func (v *NullableDistributionStatisticsRecordAllOf) Set(val *DistributionStatisticsRecordAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionStatisticsRecordAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionStatisticsRecordAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionStatisticsRecordAllOf(val *DistributionStatisticsRecordAllOf) *NullableDistributionStatisticsRecordAllOf { + return &NullableDistributionStatisticsRecordAllOf{value: val, isSet: true} +} + +func (v NullableDistributionStatisticsRecordAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionStatisticsRecordAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_distribution_statistics_record_all_of_test.go b/pkg/cdnbeta/model_distribution_statistics_record_all_of_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_statistics_record_all_of_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_distribution_statistics_record_entry.go b/pkg/cdnbeta/model_distribution_statistics_record_entry.go new file mode 100644 index 00000000..bdd23b86 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_statistics_record_entry.go @@ -0,0 +1,214 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the DistributionStatisticsRecordEntry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DistributionStatisticsRecordEntry{} + +/* + types and functions for cachedRequests +*/ + +// isLong +type DistributionStatisticsRecordEntryGetCachedRequestsAttributeType = *int64 +type DistributionStatisticsRecordEntryGetCachedRequestsArgType = int64 +type DistributionStatisticsRecordEntryGetCachedRequestsRetType = int64 + +func getDistributionStatisticsRecordEntryGetCachedRequestsAttributeTypeOk(arg DistributionStatisticsRecordEntryGetCachedRequestsAttributeType) (ret DistributionStatisticsRecordEntryGetCachedRequestsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordEntryGetCachedRequestsAttributeType(arg *DistributionStatisticsRecordEntryGetCachedRequestsAttributeType, val DistributionStatisticsRecordEntryGetCachedRequestsRetType) { + *arg = &val +} + +/* + types and functions for totalRequests +*/ + +// isLong +type DistributionStatisticsRecordEntryGetTotalRequestsAttributeType = *int64 +type DistributionStatisticsRecordEntryGetTotalRequestsArgType = int64 +type DistributionStatisticsRecordEntryGetTotalRequestsRetType = int64 + +func getDistributionStatisticsRecordEntryGetTotalRequestsAttributeTypeOk(arg DistributionStatisticsRecordEntryGetTotalRequestsAttributeType) (ret DistributionStatisticsRecordEntryGetTotalRequestsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordEntryGetTotalRequestsAttributeType(arg *DistributionStatisticsRecordEntryGetTotalRequestsAttributeType, val DistributionStatisticsRecordEntryGetTotalRequestsRetType) { + *arg = &val +} + +/* + types and functions for totalTrafficBytes +*/ + +// isLong +type DistributionStatisticsRecordEntryGetTotalTrafficBytesAttributeType = *int64 +type DistributionStatisticsRecordEntryGetTotalTrafficBytesArgType = int64 +type DistributionStatisticsRecordEntryGetTotalTrafficBytesRetType = int64 + +func getDistributionStatisticsRecordEntryGetTotalTrafficBytesAttributeTypeOk(arg DistributionStatisticsRecordEntryGetTotalTrafficBytesAttributeType) (ret DistributionStatisticsRecordEntryGetTotalTrafficBytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordEntryGetTotalTrafficBytesAttributeType(arg *DistributionStatisticsRecordEntryGetTotalTrafficBytesAttributeType, val DistributionStatisticsRecordEntryGetTotalTrafficBytesRetType) { + *arg = &val +} + +// DistributionStatisticsRecordEntry struct for DistributionStatisticsRecordEntry +type DistributionStatisticsRecordEntry struct { + // Number of cached requests that were served + // REQUIRED + CachedRequests DistributionStatisticsRecordEntryGetCachedRequestsAttributeType `json:"cachedRequests" required:"true"` + // Total number of requests that were served + // REQUIRED + TotalRequests DistributionStatisticsRecordEntryGetTotalRequestsAttributeType `json:"totalRequests" required:"true"` + // Total traffic in bytes that occurred during the time interval + // REQUIRED + TotalTrafficBytes DistributionStatisticsRecordEntryGetTotalTrafficBytesAttributeType `json:"totalTrafficBytes" required:"true"` +} + +type _DistributionStatisticsRecordEntry DistributionStatisticsRecordEntry + +// NewDistributionStatisticsRecordEntry instantiates a new DistributionStatisticsRecordEntry 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 NewDistributionStatisticsRecordEntry(cachedRequests DistributionStatisticsRecordEntryGetCachedRequestsArgType, totalRequests DistributionStatisticsRecordEntryGetTotalRequestsArgType, totalTrafficBytes DistributionStatisticsRecordEntryGetTotalTrafficBytesArgType) *DistributionStatisticsRecordEntry { + this := DistributionStatisticsRecordEntry{} + setDistributionStatisticsRecordEntryGetCachedRequestsAttributeType(&this.CachedRequests, cachedRequests) + setDistributionStatisticsRecordEntryGetTotalRequestsAttributeType(&this.TotalRequests, totalRequests) + setDistributionStatisticsRecordEntryGetTotalTrafficBytesAttributeType(&this.TotalTrafficBytes, totalTrafficBytes) + return &this +} + +// NewDistributionStatisticsRecordEntryWithDefaults instantiates a new DistributionStatisticsRecordEntry 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 NewDistributionStatisticsRecordEntryWithDefaults() *DistributionStatisticsRecordEntry { + this := DistributionStatisticsRecordEntry{} + return &this +} + +// GetCachedRequests returns the CachedRequests field value +func (o *DistributionStatisticsRecordEntry) GetCachedRequests() (ret DistributionStatisticsRecordEntryGetCachedRequestsRetType) { + ret, _ = o.GetCachedRequestsOk() + return ret +} + +// GetCachedRequestsOk returns a tuple with the CachedRequests field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordEntry) GetCachedRequestsOk() (ret DistributionStatisticsRecordEntryGetCachedRequestsRetType, ok bool) { + return getDistributionStatisticsRecordEntryGetCachedRequestsAttributeTypeOk(o.CachedRequests) +} + +// SetCachedRequests sets field value +func (o *DistributionStatisticsRecordEntry) SetCachedRequests(v DistributionStatisticsRecordEntryGetCachedRequestsRetType) { + setDistributionStatisticsRecordEntryGetCachedRequestsAttributeType(&o.CachedRequests, v) +} + +// GetTotalRequests returns the TotalRequests field value +func (o *DistributionStatisticsRecordEntry) GetTotalRequests() (ret DistributionStatisticsRecordEntryGetTotalRequestsRetType) { + ret, _ = o.GetTotalRequestsOk() + return ret +} + +// GetTotalRequestsOk returns a tuple with the TotalRequests field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordEntry) GetTotalRequestsOk() (ret DistributionStatisticsRecordEntryGetTotalRequestsRetType, ok bool) { + return getDistributionStatisticsRecordEntryGetTotalRequestsAttributeTypeOk(o.TotalRequests) +} + +// SetTotalRequests sets field value +func (o *DistributionStatisticsRecordEntry) SetTotalRequests(v DistributionStatisticsRecordEntryGetTotalRequestsRetType) { + setDistributionStatisticsRecordEntryGetTotalRequestsAttributeType(&o.TotalRequests, v) +} + +// GetTotalTrafficBytes returns the TotalTrafficBytes field value +func (o *DistributionStatisticsRecordEntry) GetTotalTrafficBytes() (ret DistributionStatisticsRecordEntryGetTotalTrafficBytesRetType) { + ret, _ = o.GetTotalTrafficBytesOk() + return ret +} + +// GetTotalTrafficBytesOk returns a tuple with the TotalTrafficBytes field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordEntry) GetTotalTrafficBytesOk() (ret DistributionStatisticsRecordEntryGetTotalTrafficBytesRetType, ok bool) { + return getDistributionStatisticsRecordEntryGetTotalTrafficBytesAttributeTypeOk(o.TotalTrafficBytes) +} + +// SetTotalTrafficBytes sets field value +func (o *DistributionStatisticsRecordEntry) SetTotalTrafficBytes(v DistributionStatisticsRecordEntryGetTotalTrafficBytesRetType) { + setDistributionStatisticsRecordEntryGetTotalTrafficBytesAttributeType(&o.TotalTrafficBytes, v) +} + +func (o DistributionStatisticsRecordEntry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDistributionStatisticsRecordEntryGetCachedRequestsAttributeTypeOk(o.CachedRequests); ok { + toSerialize["CachedRequests"] = val + } + if val, ok := getDistributionStatisticsRecordEntryGetTotalRequestsAttributeTypeOk(o.TotalRequests); ok { + toSerialize["TotalRequests"] = val + } + if val, ok := getDistributionStatisticsRecordEntryGetTotalTrafficBytesAttributeTypeOk(o.TotalTrafficBytes); ok { + toSerialize["TotalTrafficBytes"] = val + } + return toSerialize, nil +} + +type NullableDistributionStatisticsRecordEntry struct { + value *DistributionStatisticsRecordEntry + isSet bool +} + +func (v NullableDistributionStatisticsRecordEntry) Get() *DistributionStatisticsRecordEntry { + return v.value +} + +func (v *NullableDistributionStatisticsRecordEntry) Set(val *DistributionStatisticsRecordEntry) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionStatisticsRecordEntry) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionStatisticsRecordEntry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionStatisticsRecordEntry(val *DistributionStatisticsRecordEntry) *NullableDistributionStatisticsRecordEntry { + return &NullableDistributionStatisticsRecordEntry{value: val, isSet: true} +} + +func (v NullableDistributionStatisticsRecordEntry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionStatisticsRecordEntry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_distribution_statistics_record_entry_test.go b/pkg/cdnbeta/model_distribution_statistics_record_entry_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_statistics_record_entry_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_distribution_statistics_record_regions.go b/pkg/cdnbeta/model_distribution_statistics_record_regions.go new file mode 100644 index 00000000..6704e312 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_statistics_record_regions.go @@ -0,0 +1,297 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the DistributionStatisticsRecordRegions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DistributionStatisticsRecordRegions{} + +/* + types and functions for AF +*/ + +// isModel +type DistributionStatisticsRecordRegionsGetAFAttributeType = *DistributionStatisticsRecordEntry +type DistributionStatisticsRecordRegionsGetAFArgType = DistributionStatisticsRecordEntry +type DistributionStatisticsRecordRegionsGetAFRetType = DistributionStatisticsRecordEntry + +func getDistributionStatisticsRecordRegionsGetAFAttributeTypeOk(arg DistributionStatisticsRecordRegionsGetAFAttributeType) (ret DistributionStatisticsRecordRegionsGetAFRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordRegionsGetAFAttributeType(arg *DistributionStatisticsRecordRegionsGetAFAttributeType, val DistributionStatisticsRecordRegionsGetAFRetType) { + *arg = &val +} + +/* + types and functions for ASIA +*/ + +// isModel +type DistributionStatisticsRecordRegionsGetASIAAttributeType = *DistributionStatisticsRecordEntry +type DistributionStatisticsRecordRegionsGetASIAArgType = DistributionStatisticsRecordEntry +type DistributionStatisticsRecordRegionsGetASIARetType = DistributionStatisticsRecordEntry + +func getDistributionStatisticsRecordRegionsGetASIAAttributeTypeOk(arg DistributionStatisticsRecordRegionsGetASIAAttributeType) (ret DistributionStatisticsRecordRegionsGetASIARetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordRegionsGetASIAAttributeType(arg *DistributionStatisticsRecordRegionsGetASIAAttributeType, val DistributionStatisticsRecordRegionsGetASIARetType) { + *arg = &val +} + +/* + types and functions for EU +*/ + +// isModel +type DistributionStatisticsRecordRegionsGetEUAttributeType = *DistributionStatisticsRecordEntry +type DistributionStatisticsRecordRegionsGetEUArgType = DistributionStatisticsRecordEntry +type DistributionStatisticsRecordRegionsGetEURetType = DistributionStatisticsRecordEntry + +func getDistributionStatisticsRecordRegionsGetEUAttributeTypeOk(arg DistributionStatisticsRecordRegionsGetEUAttributeType) (ret DistributionStatisticsRecordRegionsGetEURetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordRegionsGetEUAttributeType(arg *DistributionStatisticsRecordRegionsGetEUAttributeType, val DistributionStatisticsRecordRegionsGetEURetType) { + *arg = &val +} + +/* + types and functions for SA +*/ + +// isModel +type DistributionStatisticsRecordRegionsGetSAAttributeType = *DistributionStatisticsRecordEntry +type DistributionStatisticsRecordRegionsGetSAArgType = DistributionStatisticsRecordEntry +type DistributionStatisticsRecordRegionsGetSARetType = DistributionStatisticsRecordEntry + +func getDistributionStatisticsRecordRegionsGetSAAttributeTypeOk(arg DistributionStatisticsRecordRegionsGetSAAttributeType) (ret DistributionStatisticsRecordRegionsGetSARetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordRegionsGetSAAttributeType(arg *DistributionStatisticsRecordRegionsGetSAAttributeType, val DistributionStatisticsRecordRegionsGetSARetType) { + *arg = &val +} + +/* + types and functions for US +*/ + +// isModel +type DistributionStatisticsRecordRegionsGetUSAttributeType = *DistributionStatisticsRecordEntry +type DistributionStatisticsRecordRegionsGetUSArgType = DistributionStatisticsRecordEntry +type DistributionStatisticsRecordRegionsGetUSRetType = DistributionStatisticsRecordEntry + +func getDistributionStatisticsRecordRegionsGetUSAttributeTypeOk(arg DistributionStatisticsRecordRegionsGetUSAttributeType) (ret DistributionStatisticsRecordRegionsGetUSRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionStatisticsRecordRegionsGetUSAttributeType(arg *DistributionStatisticsRecordRegionsGetUSAttributeType, val DistributionStatisticsRecordRegionsGetUSRetType) { + *arg = &val +} + +// DistributionStatisticsRecordRegions Mapping of regions to the metrics for this region for the defined time interval All regions are always present. If no traffic was reported for a region, it will still contain 0-filled properties +type DistributionStatisticsRecordRegions struct { + // REQUIRED + AF DistributionStatisticsRecordRegionsGetAFAttributeType `json:"AF" required:"true"` + // REQUIRED + ASIA DistributionStatisticsRecordRegionsGetASIAAttributeType `json:"ASIA" required:"true"` + // REQUIRED + EU DistributionStatisticsRecordRegionsGetEUAttributeType `json:"EU" required:"true"` + // REQUIRED + SA DistributionStatisticsRecordRegionsGetSAAttributeType `json:"SA" required:"true"` + // REQUIRED + US DistributionStatisticsRecordRegionsGetUSAttributeType `json:"US" required:"true"` +} + +type _DistributionStatisticsRecordRegions DistributionStatisticsRecordRegions + +// NewDistributionStatisticsRecordRegions instantiates a new DistributionStatisticsRecordRegions 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 NewDistributionStatisticsRecordRegions(aF DistributionStatisticsRecordRegionsGetAFArgType, aSIA DistributionStatisticsRecordRegionsGetASIAArgType, eU DistributionStatisticsRecordRegionsGetEUArgType, sA DistributionStatisticsRecordRegionsGetSAArgType, uS DistributionStatisticsRecordRegionsGetUSArgType) *DistributionStatisticsRecordRegions { + this := DistributionStatisticsRecordRegions{} + setDistributionStatisticsRecordRegionsGetAFAttributeType(&this.AF, aF) + setDistributionStatisticsRecordRegionsGetASIAAttributeType(&this.ASIA, aSIA) + setDistributionStatisticsRecordRegionsGetEUAttributeType(&this.EU, eU) + setDistributionStatisticsRecordRegionsGetSAAttributeType(&this.SA, sA) + setDistributionStatisticsRecordRegionsGetUSAttributeType(&this.US, uS) + return &this +} + +// NewDistributionStatisticsRecordRegionsWithDefaults instantiates a new DistributionStatisticsRecordRegions 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 NewDistributionStatisticsRecordRegionsWithDefaults() *DistributionStatisticsRecordRegions { + this := DistributionStatisticsRecordRegions{} + return &this +} + +// GetAF returns the AF field value +func (o *DistributionStatisticsRecordRegions) GetAF() (ret DistributionStatisticsRecordRegionsGetAFRetType) { + ret, _ = o.GetAFOk() + return ret +} + +// GetAFOk returns a tuple with the AF field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordRegions) GetAFOk() (ret DistributionStatisticsRecordRegionsGetAFRetType, ok bool) { + return getDistributionStatisticsRecordRegionsGetAFAttributeTypeOk(o.AF) +} + +// SetAF sets field value +func (o *DistributionStatisticsRecordRegions) SetAF(v DistributionStatisticsRecordRegionsGetAFRetType) { + setDistributionStatisticsRecordRegionsGetAFAttributeType(&o.AF, v) +} + +// GetASIA returns the ASIA field value +func (o *DistributionStatisticsRecordRegions) GetASIA() (ret DistributionStatisticsRecordRegionsGetASIARetType) { + ret, _ = o.GetASIAOk() + return ret +} + +// GetASIAOk returns a tuple with the ASIA field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordRegions) GetASIAOk() (ret DistributionStatisticsRecordRegionsGetASIARetType, ok bool) { + return getDistributionStatisticsRecordRegionsGetASIAAttributeTypeOk(o.ASIA) +} + +// SetASIA sets field value +func (o *DistributionStatisticsRecordRegions) SetASIA(v DistributionStatisticsRecordRegionsGetASIARetType) { + setDistributionStatisticsRecordRegionsGetASIAAttributeType(&o.ASIA, v) +} + +// GetEU returns the EU field value +func (o *DistributionStatisticsRecordRegions) GetEU() (ret DistributionStatisticsRecordRegionsGetEURetType) { + ret, _ = o.GetEUOk() + return ret +} + +// GetEUOk returns a tuple with the EU field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordRegions) GetEUOk() (ret DistributionStatisticsRecordRegionsGetEURetType, ok bool) { + return getDistributionStatisticsRecordRegionsGetEUAttributeTypeOk(o.EU) +} + +// SetEU sets field value +func (o *DistributionStatisticsRecordRegions) SetEU(v DistributionStatisticsRecordRegionsGetEURetType) { + setDistributionStatisticsRecordRegionsGetEUAttributeType(&o.EU, v) +} + +// GetSA returns the SA field value +func (o *DistributionStatisticsRecordRegions) GetSA() (ret DistributionStatisticsRecordRegionsGetSARetType) { + ret, _ = o.GetSAOk() + return ret +} + +// GetSAOk returns a tuple with the SA field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordRegions) GetSAOk() (ret DistributionStatisticsRecordRegionsGetSARetType, ok bool) { + return getDistributionStatisticsRecordRegionsGetSAAttributeTypeOk(o.SA) +} + +// SetSA sets field value +func (o *DistributionStatisticsRecordRegions) SetSA(v DistributionStatisticsRecordRegionsGetSARetType) { + setDistributionStatisticsRecordRegionsGetSAAttributeType(&o.SA, v) +} + +// GetUS returns the US field value +func (o *DistributionStatisticsRecordRegions) GetUS() (ret DistributionStatisticsRecordRegionsGetUSRetType) { + ret, _ = o.GetUSOk() + return ret +} + +// GetUSOk returns a tuple with the US field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordRegions) GetUSOk() (ret DistributionStatisticsRecordRegionsGetUSRetType, ok bool) { + return getDistributionStatisticsRecordRegionsGetUSAttributeTypeOk(o.US) +} + +// SetUS sets field value +func (o *DistributionStatisticsRecordRegions) SetUS(v DistributionStatisticsRecordRegionsGetUSRetType) { + setDistributionStatisticsRecordRegionsGetUSAttributeType(&o.US, v) +} + +func (o DistributionStatisticsRecordRegions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDistributionStatisticsRecordRegionsGetAFAttributeTypeOk(o.AF); ok { + toSerialize["AF"] = val + } + if val, ok := getDistributionStatisticsRecordRegionsGetASIAAttributeTypeOk(o.ASIA); ok { + toSerialize["ASIA"] = val + } + if val, ok := getDistributionStatisticsRecordRegionsGetEUAttributeTypeOk(o.EU); ok { + toSerialize["EU"] = val + } + if val, ok := getDistributionStatisticsRecordRegionsGetSAAttributeTypeOk(o.SA); ok { + toSerialize["SA"] = val + } + if val, ok := getDistributionStatisticsRecordRegionsGetUSAttributeTypeOk(o.US); ok { + toSerialize["US"] = val + } + return toSerialize, nil +} + +type NullableDistributionStatisticsRecordRegions struct { + value *DistributionStatisticsRecordRegions + isSet bool +} + +func (v NullableDistributionStatisticsRecordRegions) Get() *DistributionStatisticsRecordRegions { + return v.value +} + +func (v *NullableDistributionStatisticsRecordRegions) Set(val *DistributionStatisticsRecordRegions) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionStatisticsRecordRegions) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionStatisticsRecordRegions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionStatisticsRecordRegions(val *DistributionStatisticsRecordRegions) *NullableDistributionStatisticsRecordRegions { + return &NullableDistributionStatisticsRecordRegions{value: val, isSet: true} +} + +func (v NullableDistributionStatisticsRecordRegions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionStatisticsRecordRegions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_distribution_statistics_record_regions_test.go b/pkg/cdnbeta/model_distribution_statistics_record_regions_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_statistics_record_regions_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_distribution_statistics_record_test.go b/pkg/cdnbeta/model_distribution_statistics_record_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_statistics_record_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_distribution_test.go b/pkg/cdnbeta/model_distribution_test.go new file mode 100644 index 00000000..1cce2a46 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_test.go @@ -0,0 +1,79 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "testing" +) + +// isEnum + +func TestDistributionStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"CREATING"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"ACTIVE"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"UPDATING"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"DELETING"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 5`, + args: args{ + src: []byte(`"ERROR"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := DistributionStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/cdnbeta/model_distribution_waf.go b/pkg/cdnbeta/model_distribution_waf.go new file mode 100644 index 00000000..bfef0b82 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_waf.go @@ -0,0 +1,211 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the DistributionWaf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DistributionWaf{} + +/* + types and functions for disabledRules +*/ + +// isArray +type DistributionWafGetDisabledRulesAttributeType = *[]WafStatusRuleBlock +type DistributionWafGetDisabledRulesArgType = []WafStatusRuleBlock +type DistributionWafGetDisabledRulesRetType = []WafStatusRuleBlock + +func getDistributionWafGetDisabledRulesAttributeTypeOk(arg DistributionWafGetDisabledRulesAttributeType) (ret DistributionWafGetDisabledRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionWafGetDisabledRulesAttributeType(arg *DistributionWafGetDisabledRulesAttributeType, val DistributionWafGetDisabledRulesRetType) { + *arg = &val +} + +/* + types and functions for enabledRules +*/ + +// isArray +type DistributionWafGetEnabledRulesAttributeType = *[]WafStatusRuleBlock +type DistributionWafGetEnabledRulesArgType = []WafStatusRuleBlock +type DistributionWafGetEnabledRulesRetType = []WafStatusRuleBlock + +func getDistributionWafGetEnabledRulesAttributeTypeOk(arg DistributionWafGetEnabledRulesAttributeType) (ret DistributionWafGetEnabledRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionWafGetEnabledRulesAttributeType(arg *DistributionWafGetEnabledRulesAttributeType, val DistributionWafGetEnabledRulesRetType) { + *arg = &val +} + +/* + types and functions for logOnlyRules +*/ + +// isArray +type DistributionWafGetLogOnlyRulesAttributeType = *[]WafStatusRuleBlock +type DistributionWafGetLogOnlyRulesArgType = []WafStatusRuleBlock +type DistributionWafGetLogOnlyRulesRetType = []WafStatusRuleBlock + +func getDistributionWafGetLogOnlyRulesAttributeTypeOk(arg DistributionWafGetLogOnlyRulesAttributeType) (ret DistributionWafGetLogOnlyRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDistributionWafGetLogOnlyRulesAttributeType(arg *DistributionWafGetLogOnlyRulesAttributeType, val DistributionWafGetLogOnlyRulesRetType) { + *arg = &val +} + +// DistributionWaf For this property to be present two pre-conditions must be met: - the WAF was enabled at least once - the query parameter ?withWafStatus is truthy This property contains the waf Status. At this point in time, this contains all resolved rules. Rules are split into 3 groups: - enabledRules - logOnlyRules - disabledRules **Do note that the global waf mode (Disabled, LogOnly, Enabled) is *NOT* reflected in this list!** +type DistributionWaf struct { + // REQUIRED + DisabledRules DistributionWafGetDisabledRulesAttributeType `json:"disabledRules" required:"true"` + // REQUIRED + EnabledRules DistributionWafGetEnabledRulesAttributeType `json:"enabledRules" required:"true"` + // REQUIRED + LogOnlyRules DistributionWafGetLogOnlyRulesAttributeType `json:"logOnlyRules" required:"true"` +} + +type _DistributionWaf DistributionWaf + +// NewDistributionWaf instantiates a new DistributionWaf 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 NewDistributionWaf(disabledRules DistributionWafGetDisabledRulesArgType, enabledRules DistributionWafGetEnabledRulesArgType, logOnlyRules DistributionWafGetLogOnlyRulesArgType) *DistributionWaf { + this := DistributionWaf{} + setDistributionWafGetDisabledRulesAttributeType(&this.DisabledRules, disabledRules) + setDistributionWafGetEnabledRulesAttributeType(&this.EnabledRules, enabledRules) + setDistributionWafGetLogOnlyRulesAttributeType(&this.LogOnlyRules, logOnlyRules) + return &this +} + +// NewDistributionWafWithDefaults instantiates a new DistributionWaf 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 NewDistributionWafWithDefaults() *DistributionWaf { + this := DistributionWaf{} + return &this +} + +// GetDisabledRules returns the DisabledRules field value +func (o *DistributionWaf) GetDisabledRules() (ret DistributionWafGetDisabledRulesRetType) { + ret, _ = o.GetDisabledRulesOk() + return ret +} + +// GetDisabledRulesOk returns a tuple with the DisabledRules field value +// and a boolean to check if the value has been set. +func (o *DistributionWaf) GetDisabledRulesOk() (ret DistributionWafGetDisabledRulesRetType, ok bool) { + return getDistributionWafGetDisabledRulesAttributeTypeOk(o.DisabledRules) +} + +// SetDisabledRules sets field value +func (o *DistributionWaf) SetDisabledRules(v DistributionWafGetDisabledRulesRetType) { + setDistributionWafGetDisabledRulesAttributeType(&o.DisabledRules, v) +} + +// GetEnabledRules returns the EnabledRules field value +func (o *DistributionWaf) GetEnabledRules() (ret DistributionWafGetEnabledRulesRetType) { + ret, _ = o.GetEnabledRulesOk() + return ret +} + +// GetEnabledRulesOk returns a tuple with the EnabledRules field value +// and a boolean to check if the value has been set. +func (o *DistributionWaf) GetEnabledRulesOk() (ret DistributionWafGetEnabledRulesRetType, ok bool) { + return getDistributionWafGetEnabledRulesAttributeTypeOk(o.EnabledRules) +} + +// SetEnabledRules sets field value +func (o *DistributionWaf) SetEnabledRules(v DistributionWafGetEnabledRulesRetType) { + setDistributionWafGetEnabledRulesAttributeType(&o.EnabledRules, v) +} + +// GetLogOnlyRules returns the LogOnlyRules field value +func (o *DistributionWaf) GetLogOnlyRules() (ret DistributionWafGetLogOnlyRulesRetType) { + ret, _ = o.GetLogOnlyRulesOk() + return ret +} + +// GetLogOnlyRulesOk returns a tuple with the LogOnlyRules field value +// and a boolean to check if the value has been set. +func (o *DistributionWaf) GetLogOnlyRulesOk() (ret DistributionWafGetLogOnlyRulesRetType, ok bool) { + return getDistributionWafGetLogOnlyRulesAttributeTypeOk(o.LogOnlyRules) +} + +// SetLogOnlyRules sets field value +func (o *DistributionWaf) SetLogOnlyRules(v DistributionWafGetLogOnlyRulesRetType) { + setDistributionWafGetLogOnlyRulesAttributeType(&o.LogOnlyRules, v) +} + +func (o DistributionWaf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDistributionWafGetDisabledRulesAttributeTypeOk(o.DisabledRules); ok { + toSerialize["DisabledRules"] = val + } + if val, ok := getDistributionWafGetEnabledRulesAttributeTypeOk(o.EnabledRules); ok { + toSerialize["EnabledRules"] = val + } + if val, ok := getDistributionWafGetLogOnlyRulesAttributeTypeOk(o.LogOnlyRules); ok { + toSerialize["LogOnlyRules"] = val + } + return toSerialize, nil +} + +type NullableDistributionWaf struct { + value *DistributionWaf + isSet bool +} + +func (v NullableDistributionWaf) Get() *DistributionWaf { + return v.value +} + +func (v *NullableDistributionWaf) Set(val *DistributionWaf) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionWaf) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionWaf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionWaf(val *DistributionWaf) *NullableDistributionWaf { + return &NullableDistributionWaf{value: val, isSet: true} +} + +func (v NullableDistributionWaf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionWaf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_distribution_waf_test.go b/pkg/cdnbeta/model_distribution_waf_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_distribution_waf_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_domain.go b/pkg/cdnbeta/model_domain.go new file mode 100644 index 00000000..f4e21542 --- /dev/null +++ b/pkg/cdnbeta/model_domain.go @@ -0,0 +1,367 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the Domain type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Domain{} + +/* + types and functions for errors +*/ + +// isArray +type DomainGetErrorsAttributeType = *[]StatusError +type DomainGetErrorsArgType = []StatusError +type DomainGetErrorsRetType = []StatusError + +func getDomainGetErrorsAttributeTypeOk(arg DomainGetErrorsAttributeType) (ret DomainGetErrorsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDomainGetErrorsAttributeType(arg *DomainGetErrorsAttributeType, val DomainGetErrorsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type DomainGetNameAttributeType = *string + +func getDomainGetNameAttributeTypeOk(arg DomainGetNameAttributeType) (ret DomainGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDomainGetNameAttributeType(arg *DomainGetNameAttributeType, val DomainGetNameRetType) { + *arg = &val +} + +type DomainGetNameArgType = string +type DomainGetNameRetType = string + +/* + types and functions for status +*/ + +// isEnumRef +type DomainGetStatusAttributeType = *DomainStatus +type DomainGetStatusArgType = DomainStatus +type DomainGetStatusRetType = DomainStatus + +func getDomainGetStatusAttributeTypeOk(arg DomainGetStatusAttributeType) (ret DomainGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDomainGetStatusAttributeType(arg *DomainGetStatusAttributeType, val DomainGetStatusRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isEnum + +// DomainTypes Specifies the type of this Domain. Custom Domain can be further queries using the GetCustomDomain Endpoint +// value type for enums +type DomainTypes string + +// List of Type +const ( + DOMAINTYPE_MANAGED DomainTypes = "managed" + DOMAINTYPE_CUSTOM DomainTypes = "custom" +) + +// All allowed values of Domain enum +var AllowedDomainTypesEnumValues = []DomainTypes{ + "managed", + "custom", +} + +func (v *DomainTypes) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson DomainTypes + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := DomainTypes(value) + for _, existing := range AllowedDomainTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Domain", value) +} + +// NewDomainTypesFromValue returns a pointer to a valid DomainTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDomainTypesFromValue(v DomainTypes) (*DomainTypes, error) { + ev := DomainTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DomainTypes: valid values are %v", v, AllowedDomainTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DomainTypes) IsValid() bool { + for _, existing := range AllowedDomainTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v DomainTypes) Ptr() *DomainTypes { + return &v +} + +type NullableDomainTypes struct { + value *DomainTypes + isSet bool +} + +func (v NullableDomainTypes) Get() *DomainTypes { + return v.value +} + +func (v *NullableDomainTypes) Set(val *DomainTypes) { + v.value = val + v.isSet = true +} + +func (v NullableDomainTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableDomainTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDomainTypes(val *DomainTypes) *NullableDomainTypes { + return &NullableDomainTypes{value: val, isSet: true} +} + +func (v NullableDomainTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDomainTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type DomainGetTypeAttributeType = *DomainTypes +type DomainGetTypeArgType = DomainTypes +type DomainGetTypeRetType = DomainTypes + +func getDomainGetTypeAttributeTypeOk(arg DomainGetTypeAttributeType) (ret DomainGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDomainGetTypeAttributeType(arg *DomainGetTypeAttributeType, val DomainGetTypeRetType) { + *arg = &val +} + +// Domain Definition of a custom or managed domain without any certificates or keys +type Domain struct { + // This object is present if the custom domain has errors. + Errors DomainGetErrorsAttributeType `json:"errors,omitempty"` + // The domain. If this is a custom domain, you can call the GetCustomDomain Endpoint + // REQUIRED + Name DomainGetNameAttributeType `json:"name" required:"true"` + // REQUIRED + Status DomainGetStatusAttributeType `json:"status" required:"true"` + // Specifies the type of this Domain. Custom Domain can be further queries using the GetCustomDomain Endpoint + // REQUIRED + Type DomainGetTypeAttributeType `json:"type" required:"true"` +} + +type _Domain Domain + +// NewDomain instantiates a new Domain 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 NewDomain(name DomainGetNameArgType, status DomainGetStatusArgType, types DomainGetTypeArgType) *Domain { + this := Domain{} + setDomainGetNameAttributeType(&this.Name, name) + setDomainGetStatusAttributeType(&this.Status, status) + setDomainGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewDomainWithDefaults instantiates a new Domain 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 NewDomainWithDefaults() *Domain { + this := Domain{} + return &this +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *Domain) GetErrors() (res DomainGetErrorsRetType) { + res, _ = o.GetErrorsOk() + return +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Domain) GetErrorsOk() (ret DomainGetErrorsRetType, ok bool) { + return getDomainGetErrorsAttributeTypeOk(o.Errors) +} + +// HasErrors returns a boolean if a field has been set. +func (o *Domain) HasErrors() bool { + _, ok := o.GetErrorsOk() + return ok +} + +// SetErrors gets a reference to the given []StatusError and assigns it to the Errors field. +func (o *Domain) SetErrors(v DomainGetErrorsRetType) { + setDomainGetErrorsAttributeType(&o.Errors, v) +} + +// GetName returns the Name field value +func (o *Domain) GetName() (ret DomainGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Domain) GetNameOk() (ret DomainGetNameRetType, ok bool) { + return getDomainGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Domain) SetName(v DomainGetNameRetType) { + setDomainGetNameAttributeType(&o.Name, v) +} + +// GetStatus returns the Status field value +func (o *Domain) GetStatus() (ret DomainGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Domain) GetStatusOk() (ret DomainGetStatusRetType, ok bool) { + return getDomainGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Domain) SetStatus(v DomainGetStatusRetType) { + setDomainGetStatusAttributeType(&o.Status, v) +} + +// GetType returns the Type field value +func (o *Domain) GetType() (ret DomainGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *Domain) GetTypeOk() (ret DomainGetTypeRetType, ok bool) { + return getDomainGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *Domain) SetType(v DomainGetTypeRetType) { + setDomainGetTypeAttributeType(&o.Type, v) +} + +func (o Domain) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDomainGetErrorsAttributeTypeOk(o.Errors); ok { + toSerialize["Errors"] = val + } + if val, ok := getDomainGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getDomainGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getDomainGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableDomain struct { + value *Domain + isSet bool +} + +func (v NullableDomain) Get() *Domain { + return v.value +} + +func (v *NullableDomain) Set(val *Domain) { + v.value = val + v.isSet = true +} + +func (v NullableDomain) IsSet() bool { + return v.isSet +} + +func (v *NullableDomain) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDomain(val *Domain) *NullableDomain { + return &NullableDomain{value: val, isSet: true} +} + +func (v NullableDomain) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDomain) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_domain_status.go b/pkg/cdnbeta/model_domain_status.go new file mode 100644 index 00000000..1560ca13 --- /dev/null +++ b/pkg/cdnbeta/model_domain_status.go @@ -0,0 +1,121 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// DomainStatus The status of the domain: CREATING indicates that the custom domain is being set up. UPDATING means that requested changes are being applied to the custom domain. ACTIVE means the custom domain is currently configured and active. DELETING means that the domain is in the process of being removed from the distribution. In case the domain has the ERROR state, more information will be available in the errors list. +type DomainStatus string + +// List of DomainStatus +const ( + DOMAINSTATUS_CREATING DomainStatus = "CREATING" + DOMAINSTATUS_ACTIVE DomainStatus = "ACTIVE" + DOMAINSTATUS_UPDATING DomainStatus = "UPDATING" + DOMAINSTATUS_DELETING DomainStatus = "DELETING" + DOMAINSTATUS_ERROR DomainStatus = "ERROR" +) + +// All allowed values of DomainStatus enum +var AllowedDomainStatusEnumValues = []DomainStatus{ + "CREATING", + "ACTIVE", + "UPDATING", + "DELETING", + "ERROR", +} + +func (v *DomainStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := DomainStatus(value) + for _, existing := range AllowedDomainStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid DomainStatus", value) +} + +// NewDomainStatusFromValue returns a pointer to a valid DomainStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDomainStatusFromValue(v string) (*DomainStatus, error) { + ev := DomainStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DomainStatus: valid values are %v", v, AllowedDomainStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DomainStatus) IsValid() bool { + for _, existing := range AllowedDomainStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DomainStatus value +func (v DomainStatus) Ptr() *DomainStatus { + return &v +} + +type NullableDomainStatus struct { + value *DomainStatus + isSet bool +} + +func (v NullableDomainStatus) Get() *DomainStatus { + return v.value +} + +func (v *NullableDomainStatus) Set(val *DomainStatus) { + v.value = val + v.isSet = true +} + +func (v NullableDomainStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableDomainStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDomainStatus(val *DomainStatus) *NullableDomainStatus { + return &NullableDomainStatus{value: val, isSet: true} +} + +func (v NullableDomainStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDomainStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_domain_status_test.go b/pkg/cdnbeta/model_domain_status_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_domain_status_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_domain_test.go b/pkg/cdnbeta/model_domain_test.go new file mode 100644 index 00000000..d5f8dae6 --- /dev/null +++ b/pkg/cdnbeta/model_domain_test.go @@ -0,0 +1,58 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "testing" +) + +// isEnum + +func TestDomainTypes_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"managed"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"custom"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := DomainTypes("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/cdnbeta/model_error_details.go b/pkg/cdnbeta/model_error_details.go new file mode 100644 index 00000000..4f55f2c1 --- /dev/null +++ b/pkg/cdnbeta/model_error_details.go @@ -0,0 +1,375 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the ErrorDetails type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorDetails{} + +/* + types and functions for de +*/ + +// isNotNullableString +type ErrorDetailsGetDeAttributeType = *string + +func getErrorDetailsGetDeAttributeTypeOk(arg ErrorDetailsGetDeAttributeType) (ret ErrorDetailsGetDeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorDetailsGetDeAttributeType(arg *ErrorDetailsGetDeAttributeType, val ErrorDetailsGetDeRetType) { + *arg = &val +} + +type ErrorDetailsGetDeArgType = string +type ErrorDetailsGetDeRetType = string + +/* + types and functions for en +*/ + +// isNotNullableString +type ErrorDetailsGetEnAttributeType = *string + +func getErrorDetailsGetEnAttributeTypeOk(arg ErrorDetailsGetEnAttributeType) (ret ErrorDetailsGetEnRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorDetailsGetEnAttributeType(arg *ErrorDetailsGetEnAttributeType, val ErrorDetailsGetEnRetType) { + *arg = &val +} + +type ErrorDetailsGetEnArgType = string +type ErrorDetailsGetEnRetType = string + +/* + types and functions for field +*/ + +// isNotNullableString +type ErrorDetailsGetFieldAttributeType = *string + +func getErrorDetailsGetFieldAttributeTypeOk(arg ErrorDetailsGetFieldAttributeType) (ret ErrorDetailsGetFieldRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorDetailsGetFieldAttributeType(arg *ErrorDetailsGetFieldAttributeType, val ErrorDetailsGetFieldRetType) { + *arg = &val +} + +type ErrorDetailsGetFieldArgType = string +type ErrorDetailsGetFieldRetType = string + +/* + types and functions for key +*/ + +// isEnum + +// ErrorDetailsKey the model 'ErrorDetails' +// value type for enums +type ErrorDetailsKey string + +// List of Key +const ( + ERRORDETAILSKEY_UNKNOWN ErrorDetailsKey = "UNKNOWN" + ERRORDETAILSKEY_CUSTOM_DOMAIN_CNAME_MISSING ErrorDetailsKey = "CUSTOM_DOMAIN_CNAME_MISSING" + ERRORDETAILSKEY_INVALID_ARGUMENT ErrorDetailsKey = "INVALID_ARGUMENT" +) + +// All allowed values of ErrorDetails enum +var AllowedErrorDetailsKeyEnumValues = []ErrorDetailsKey{ + "UNKNOWN", + "CUSTOM_DOMAIN_CNAME_MISSING", + "INVALID_ARGUMENT", +} + +func (v *ErrorDetailsKey) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson ErrorDetailsKey + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := ErrorDetailsKey(value) + for _, existing := range AllowedErrorDetailsKeyEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ErrorDetails", value) +} + +// NewErrorDetailsKeyFromValue returns a pointer to a valid ErrorDetailsKey +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewErrorDetailsKeyFromValue(v ErrorDetailsKey) (*ErrorDetailsKey, error) { + ev := ErrorDetailsKey(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ErrorDetailsKey: valid values are %v", v, AllowedErrorDetailsKeyEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ErrorDetailsKey) IsValid() bool { + for _, existing := range AllowedErrorDetailsKeyEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyKey value +func (v ErrorDetailsKey) Ptr() *ErrorDetailsKey { + return &v +} + +type NullableErrorDetailsKey struct { + value *ErrorDetailsKey + isSet bool +} + +func (v NullableErrorDetailsKey) Get() *ErrorDetailsKey { + return v.value +} + +func (v *NullableErrorDetailsKey) Set(val *ErrorDetailsKey) { + v.value = val + v.isSet = true +} + +func (v NullableErrorDetailsKey) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorDetailsKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorDetailsKey(val *ErrorDetailsKey) *NullableErrorDetailsKey { + return &NullableErrorDetailsKey{value: val, isSet: true} +} + +func (v NullableErrorDetailsKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorDetailsKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type ErrorDetailsGetKeyAttributeType = *ErrorDetailsKey +type ErrorDetailsGetKeyArgType = ErrorDetailsKey +type ErrorDetailsGetKeyRetType = ErrorDetailsKey + +func getErrorDetailsGetKeyAttributeTypeOk(arg ErrorDetailsGetKeyAttributeType) (ret ErrorDetailsGetKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorDetailsGetKeyAttributeType(arg *ErrorDetailsGetKeyAttributeType, val ErrorDetailsGetKeyRetType) { + *arg = &val +} + +// ErrorDetails struct for ErrorDetails +type ErrorDetails struct { + // German description of the error + De ErrorDetailsGetDeAttributeType `json:"de,omitempty"` + // English description of the error + // REQUIRED + En ErrorDetailsGetEnAttributeType `json:"en" required:"true"` + // Optional field in the request this error detail refers to + Field ErrorDetailsGetFieldAttributeType `json:"field,omitempty"` + // REQUIRED + Key ErrorDetailsGetKeyAttributeType `json:"key" required:"true"` +} + +type _ErrorDetails ErrorDetails + +// NewErrorDetails instantiates a new ErrorDetails 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 NewErrorDetails(en ErrorDetailsGetEnArgType, key ErrorDetailsGetKeyArgType) *ErrorDetails { + this := ErrorDetails{} + setErrorDetailsGetEnAttributeType(&this.En, en) + setErrorDetailsGetKeyAttributeType(&this.Key, key) + return &this +} + +// NewErrorDetailsWithDefaults instantiates a new ErrorDetails 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 NewErrorDetailsWithDefaults() *ErrorDetails { + this := ErrorDetails{} + return &this +} + +// GetDe returns the De field value if set, zero value otherwise. +func (o *ErrorDetails) GetDe() (res ErrorDetailsGetDeRetType) { + res, _ = o.GetDeOk() + return +} + +// GetDeOk returns a tuple with the De field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorDetails) GetDeOk() (ret ErrorDetailsGetDeRetType, ok bool) { + return getErrorDetailsGetDeAttributeTypeOk(o.De) +} + +// HasDe returns a boolean if a field has been set. +func (o *ErrorDetails) HasDe() bool { + _, ok := o.GetDeOk() + return ok +} + +// SetDe gets a reference to the given string and assigns it to the De field. +func (o *ErrorDetails) SetDe(v ErrorDetailsGetDeRetType) { + setErrorDetailsGetDeAttributeType(&o.De, v) +} + +// GetEn returns the En field value +func (o *ErrorDetails) GetEn() (ret ErrorDetailsGetEnRetType) { + ret, _ = o.GetEnOk() + return ret +} + +// GetEnOk returns a tuple with the En field value +// and a boolean to check if the value has been set. +func (o *ErrorDetails) GetEnOk() (ret ErrorDetailsGetEnRetType, ok bool) { + return getErrorDetailsGetEnAttributeTypeOk(o.En) +} + +// SetEn sets field value +func (o *ErrorDetails) SetEn(v ErrorDetailsGetEnRetType) { + setErrorDetailsGetEnAttributeType(&o.En, v) +} + +// GetField returns the Field field value if set, zero value otherwise. +func (o *ErrorDetails) GetField() (res ErrorDetailsGetFieldRetType) { + res, _ = o.GetFieldOk() + return +} + +// GetFieldOk returns a tuple with the Field field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorDetails) GetFieldOk() (ret ErrorDetailsGetFieldRetType, ok bool) { + return getErrorDetailsGetFieldAttributeTypeOk(o.Field) +} + +// HasField returns a boolean if a field has been set. +func (o *ErrorDetails) HasField() bool { + _, ok := o.GetFieldOk() + return ok +} + +// SetField gets a reference to the given string and assigns it to the Field field. +func (o *ErrorDetails) SetField(v ErrorDetailsGetFieldRetType) { + setErrorDetailsGetFieldAttributeType(&o.Field, v) +} + +// GetKey returns the Key field value +func (o *ErrorDetails) GetKey() (ret ErrorDetailsGetKeyRetType) { + ret, _ = o.GetKeyOk() + return ret +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +func (o *ErrorDetails) GetKeyOk() (ret ErrorDetailsGetKeyRetType, ok bool) { + return getErrorDetailsGetKeyAttributeTypeOk(o.Key) +} + +// SetKey sets field value +func (o *ErrorDetails) SetKey(v ErrorDetailsGetKeyRetType) { + setErrorDetailsGetKeyAttributeType(&o.Key, v) +} + +func (o ErrorDetails) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getErrorDetailsGetDeAttributeTypeOk(o.De); ok { + toSerialize["De"] = val + } + if val, ok := getErrorDetailsGetEnAttributeTypeOk(o.En); ok { + toSerialize["En"] = val + } + if val, ok := getErrorDetailsGetFieldAttributeTypeOk(o.Field); ok { + toSerialize["Field"] = val + } + if val, ok := getErrorDetailsGetKeyAttributeTypeOk(o.Key); ok { + toSerialize["Key"] = val + } + return toSerialize, nil +} + +type NullableErrorDetails struct { + value *ErrorDetails + isSet bool +} + +func (v NullableErrorDetails) Get() *ErrorDetails { + return v.value +} + +func (v *NullableErrorDetails) Set(val *ErrorDetails) { + v.value = val + v.isSet = true +} + +func (v NullableErrorDetails) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorDetails) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorDetails(val *ErrorDetails) *NullableErrorDetails { + return &NullableErrorDetails{value: val, isSet: true} +} + +func (v NullableErrorDetails) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorDetails) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_error_details_test.go b/pkg/cdnbeta/model_error_details_test.go new file mode 100644 index 00000000..d3504fc1 --- /dev/null +++ b/pkg/cdnbeta/model_error_details_test.go @@ -0,0 +1,65 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "testing" +) + +// isEnum + +func TestErrorDetailsKey_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"UNKNOWN"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"CUSTOM_DOMAIN_CNAME_MISSING"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"INVALID_ARGUMENT"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := ErrorDetailsKey("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/cdnbeta/model_find_cache_paths_response.go b/pkg/cdnbeta/model_find_cache_paths_response.go new file mode 100644 index 00000000..510fc8c9 --- /dev/null +++ b/pkg/cdnbeta/model_find_cache_paths_response.go @@ -0,0 +1,125 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the FindCachePathsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FindCachePathsResponse{} + +/* + types and functions for response +*/ + +// isArray +type FindCachePathsResponseGetResponseAttributeType = *[]FindCachePathsResponseEntry +type FindCachePathsResponseGetResponseArgType = []FindCachePathsResponseEntry +type FindCachePathsResponseGetResponseRetType = []FindCachePathsResponseEntry + +func getFindCachePathsResponseGetResponseAttributeTypeOk(arg FindCachePathsResponseGetResponseAttributeType) (ret FindCachePathsResponseGetResponseRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFindCachePathsResponseGetResponseAttributeType(arg *FindCachePathsResponseGetResponseAttributeType, val FindCachePathsResponseGetResponseRetType) { + *arg = &val +} + +// FindCachePathsResponse struct for FindCachePathsResponse +type FindCachePathsResponse struct { + // REQUIRED + Response FindCachePathsResponseGetResponseAttributeType `json:"response" required:"true"` +} + +type _FindCachePathsResponse FindCachePathsResponse + +// NewFindCachePathsResponse instantiates a new FindCachePathsResponse 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 NewFindCachePathsResponse(response FindCachePathsResponseGetResponseArgType) *FindCachePathsResponse { + this := FindCachePathsResponse{} + setFindCachePathsResponseGetResponseAttributeType(&this.Response, response) + return &this +} + +// NewFindCachePathsResponseWithDefaults instantiates a new FindCachePathsResponse 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 NewFindCachePathsResponseWithDefaults() *FindCachePathsResponse { + this := FindCachePathsResponse{} + return &this +} + +// GetResponse returns the Response field value +func (o *FindCachePathsResponse) GetResponse() (ret FindCachePathsResponseGetResponseRetType) { + ret, _ = o.GetResponseOk() + return ret +} + +// GetResponseOk returns a tuple with the Response field value +// and a boolean to check if the value has been set. +func (o *FindCachePathsResponse) GetResponseOk() (ret FindCachePathsResponseGetResponseRetType, ok bool) { + return getFindCachePathsResponseGetResponseAttributeTypeOk(o.Response) +} + +// SetResponse sets field value +func (o *FindCachePathsResponse) SetResponse(v FindCachePathsResponseGetResponseRetType) { + setFindCachePathsResponseGetResponseAttributeType(&o.Response, v) +} + +func (o FindCachePathsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getFindCachePathsResponseGetResponseAttributeTypeOk(o.Response); ok { + toSerialize["Response"] = val + } + return toSerialize, nil +} + +type NullableFindCachePathsResponse struct { + value *FindCachePathsResponse + isSet bool +} + +func (v NullableFindCachePathsResponse) Get() *FindCachePathsResponse { + return v.value +} + +func (v *NullableFindCachePathsResponse) Set(val *FindCachePathsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableFindCachePathsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableFindCachePathsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindCachePathsResponse(val *FindCachePathsResponse) *NullableFindCachePathsResponse { + return &NullableFindCachePathsResponse{value: val, isSet: true} +} + +func (v NullableFindCachePathsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindCachePathsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_find_cache_paths_response_entry.go b/pkg/cdnbeta/model_find_cache_paths_response_entry.go new file mode 100644 index 00000000..7adfc4df --- /dev/null +++ b/pkg/cdnbeta/model_find_cache_paths_response_entry.go @@ -0,0 +1,127 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the FindCachePathsResponseEntry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FindCachePathsResponseEntry{} + +/* + types and functions for path +*/ + +// isNotNullableString +type FindCachePathsResponseEntryGetPathAttributeType = *string + +func getFindCachePathsResponseEntryGetPathAttributeTypeOk(arg FindCachePathsResponseEntryGetPathAttributeType) (ret FindCachePathsResponseEntryGetPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFindCachePathsResponseEntryGetPathAttributeType(arg *FindCachePathsResponseEntryGetPathAttributeType, val FindCachePathsResponseEntryGetPathRetType) { + *arg = &val +} + +type FindCachePathsResponseEntryGetPathArgType = string +type FindCachePathsResponseEntryGetPathRetType = string + +// FindCachePathsResponseEntry struct for FindCachePathsResponseEntry +type FindCachePathsResponseEntry struct { + // Defines one path that was previously used as part of a granular purge + // REQUIRED + Path FindCachePathsResponseEntryGetPathAttributeType `json:"path" required:"true"` +} + +type _FindCachePathsResponseEntry FindCachePathsResponseEntry + +// NewFindCachePathsResponseEntry instantiates a new FindCachePathsResponseEntry 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 NewFindCachePathsResponseEntry(path FindCachePathsResponseEntryGetPathArgType) *FindCachePathsResponseEntry { + this := FindCachePathsResponseEntry{} + setFindCachePathsResponseEntryGetPathAttributeType(&this.Path, path) + return &this +} + +// NewFindCachePathsResponseEntryWithDefaults instantiates a new FindCachePathsResponseEntry 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 NewFindCachePathsResponseEntryWithDefaults() *FindCachePathsResponseEntry { + this := FindCachePathsResponseEntry{} + return &this +} + +// GetPath returns the Path field value +func (o *FindCachePathsResponseEntry) GetPath() (ret FindCachePathsResponseEntryGetPathRetType) { + ret, _ = o.GetPathOk() + return ret +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *FindCachePathsResponseEntry) GetPathOk() (ret FindCachePathsResponseEntryGetPathRetType, ok bool) { + return getFindCachePathsResponseEntryGetPathAttributeTypeOk(o.Path) +} + +// SetPath sets field value +func (o *FindCachePathsResponseEntry) SetPath(v FindCachePathsResponseEntryGetPathRetType) { + setFindCachePathsResponseEntryGetPathAttributeType(&o.Path, v) +} + +func (o FindCachePathsResponseEntry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getFindCachePathsResponseEntryGetPathAttributeTypeOk(o.Path); ok { + toSerialize["Path"] = val + } + return toSerialize, nil +} + +type NullableFindCachePathsResponseEntry struct { + value *FindCachePathsResponseEntry + isSet bool +} + +func (v NullableFindCachePathsResponseEntry) Get() *FindCachePathsResponseEntry { + return v.value +} + +func (v *NullableFindCachePathsResponseEntry) Set(val *FindCachePathsResponseEntry) { + v.value = val + v.isSet = true +} + +func (v NullableFindCachePathsResponseEntry) IsSet() bool { + return v.isSet +} + +func (v *NullableFindCachePathsResponseEntry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindCachePathsResponseEntry(val *FindCachePathsResponseEntry) *NullableFindCachePathsResponseEntry { + return &NullableFindCachePathsResponseEntry{value: val, isSet: true} +} + +func (v NullableFindCachePathsResponseEntry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindCachePathsResponseEntry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_find_cache_paths_response_entry_test.go b/pkg/cdnbeta/model_find_cache_paths_response_entry_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_find_cache_paths_response_entry_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_find_cache_paths_response_test.go b/pkg/cdnbeta/model_find_cache_paths_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_find_cache_paths_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_generic_json_response.go b/pkg/cdnbeta/model_generic_json_response.go new file mode 100644 index 00000000..72ffe1dc --- /dev/null +++ b/pkg/cdnbeta/model_generic_json_response.go @@ -0,0 +1,174 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the GenericJsonResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GenericJsonResponse{} + +/* + types and functions for details +*/ + +// isArray +type GenericJsonResponseGetDetailsAttributeType = *[]ErrorDetails +type GenericJsonResponseGetDetailsArgType = []ErrorDetails +type GenericJsonResponseGetDetailsRetType = []ErrorDetails + +func getGenericJsonResponseGetDetailsAttributeTypeOk(arg GenericJsonResponseGetDetailsAttributeType) (ret GenericJsonResponseGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGenericJsonResponseGetDetailsAttributeType(arg *GenericJsonResponseGetDetailsAttributeType, val GenericJsonResponseGetDetailsRetType) { + *arg = &val +} + +/* + types and functions for message +*/ + +// isNotNullableString +type GenericJsonResponseGetMessageAttributeType = *string + +func getGenericJsonResponseGetMessageAttributeTypeOk(arg GenericJsonResponseGetMessageAttributeType) (ret GenericJsonResponseGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGenericJsonResponseGetMessageAttributeType(arg *GenericJsonResponseGetMessageAttributeType, val GenericJsonResponseGetMessageRetType) { + *arg = &val +} + +type GenericJsonResponseGetMessageArgType = string +type GenericJsonResponseGetMessageRetType = string + +// GenericJsonResponse struct for GenericJsonResponse +type GenericJsonResponse struct { + // Listing of issues with your request + Details GenericJsonResponseGetDetailsAttributeType `json:"details,omitempty"` + // REQUIRED + Message GenericJsonResponseGetMessageAttributeType `json:"message" required:"true"` +} + +type _GenericJsonResponse GenericJsonResponse + +// NewGenericJsonResponse instantiates a new GenericJsonResponse 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 NewGenericJsonResponse(message GenericJsonResponseGetMessageArgType) *GenericJsonResponse { + this := GenericJsonResponse{} + setGenericJsonResponseGetMessageAttributeType(&this.Message, message) + return &this +} + +// NewGenericJsonResponseWithDefaults instantiates a new GenericJsonResponse 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 NewGenericJsonResponseWithDefaults() *GenericJsonResponse { + this := GenericJsonResponse{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *GenericJsonResponse) GetDetails() (res GenericJsonResponseGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GenericJsonResponse) GetDetailsOk() (ret GenericJsonResponseGetDetailsRetType, ok bool) { + return getGenericJsonResponseGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *GenericJsonResponse) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given []ErrorDetails and assigns it to the Details field. +func (o *GenericJsonResponse) SetDetails(v GenericJsonResponseGetDetailsRetType) { + setGenericJsonResponseGetDetailsAttributeType(&o.Details, v) +} + +// GetMessage returns the Message field value +func (o *GenericJsonResponse) GetMessage() (ret GenericJsonResponseGetMessageRetType) { + ret, _ = o.GetMessageOk() + return ret +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *GenericJsonResponse) GetMessageOk() (ret GenericJsonResponseGetMessageRetType, ok bool) { + return getGenericJsonResponseGetMessageAttributeTypeOk(o.Message) +} + +// SetMessage sets field value +func (o *GenericJsonResponse) SetMessage(v GenericJsonResponseGetMessageRetType) { + setGenericJsonResponseGetMessageAttributeType(&o.Message, v) +} + +func (o GenericJsonResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGenericJsonResponseGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getGenericJsonResponseGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableGenericJsonResponse struct { + value *GenericJsonResponse + isSet bool +} + +func (v NullableGenericJsonResponse) Get() *GenericJsonResponse { + return v.value +} + +func (v *NullableGenericJsonResponse) Set(val *GenericJsonResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGenericJsonResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGenericJsonResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGenericJsonResponse(val *GenericJsonResponse) *NullableGenericJsonResponse { + return &NullableGenericJsonResponse{value: val, isSet: true} +} + +func (v NullableGenericJsonResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGenericJsonResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_generic_json_response_test.go b/pkg/cdnbeta/model_generic_json_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_generic_json_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_get_cache_info_response.go b/pkg/cdnbeta/model_get_cache_info_response.go new file mode 100644 index 00000000..fcd173a6 --- /dev/null +++ b/pkg/cdnbeta/model_get_cache_info_response.go @@ -0,0 +1,172 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "time" +) + +// checks if the GetCacheInfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCacheInfoResponse{} + +/* + types and functions for history +*/ + +// isArray +type GetCacheInfoResponseGetHistoryAttributeType = *[]GetCacheInfoResponseHistoryEntry +type GetCacheInfoResponseGetHistoryArgType = []GetCacheInfoResponseHistoryEntry +type GetCacheInfoResponseGetHistoryRetType = []GetCacheInfoResponseHistoryEntry + +func getGetCacheInfoResponseGetHistoryAttributeTypeOk(arg GetCacheInfoResponseGetHistoryAttributeType) (ret GetCacheInfoResponseGetHistoryRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCacheInfoResponseGetHistoryAttributeType(arg *GetCacheInfoResponseGetHistoryAttributeType, val GetCacheInfoResponseGetHistoryRetType) { + *arg = &val +} + +/* + types and functions for lastPurgeTime +*/ + +// isDateTime +type GetCacheInfoResponseGetLastPurgeTimeAttributeType = *time.Time +type GetCacheInfoResponseGetLastPurgeTimeArgType = *time.Time +type GetCacheInfoResponseGetLastPurgeTimeRetType = *time.Time + +func getGetCacheInfoResponseGetLastPurgeTimeAttributeTypeOk(arg GetCacheInfoResponseGetLastPurgeTimeAttributeType) (ret GetCacheInfoResponseGetLastPurgeTimeRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setGetCacheInfoResponseGetLastPurgeTimeAttributeType(arg *GetCacheInfoResponseGetLastPurgeTimeAttributeType, val GetCacheInfoResponseGetLastPurgeTimeRetType) { + *arg = val +} + +// GetCacheInfoResponse struct for GetCacheInfoResponse +type GetCacheInfoResponse struct { + // REQUIRED + History GetCacheInfoResponseGetHistoryAttributeType `json:"history" required:"true"` + // Returns the last time the cache was purged by calling the PurgeCache endpoint. Time represented as RFC3339 compliant string. If the cache was never purged, this returns `null` + // REQUIRED + LastPurgeTime GetCacheInfoResponseGetLastPurgeTimeAttributeType `json:"lastPurgeTime" required:"true"` +} + +type _GetCacheInfoResponse GetCacheInfoResponse + +// NewGetCacheInfoResponse instantiates a new GetCacheInfoResponse 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 NewGetCacheInfoResponse(history GetCacheInfoResponseGetHistoryArgType, lastPurgeTime GetCacheInfoResponseGetLastPurgeTimeArgType) *GetCacheInfoResponse { + this := GetCacheInfoResponse{} + setGetCacheInfoResponseGetHistoryAttributeType(&this.History, history) + setGetCacheInfoResponseGetLastPurgeTimeAttributeType(&this.LastPurgeTime, lastPurgeTime) + return &this +} + +// NewGetCacheInfoResponseWithDefaults instantiates a new GetCacheInfoResponse 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 NewGetCacheInfoResponseWithDefaults() *GetCacheInfoResponse { + this := GetCacheInfoResponse{} + return &this +} + +// GetHistory returns the History field value +func (o *GetCacheInfoResponse) GetHistory() (ret GetCacheInfoResponseGetHistoryRetType) { + ret, _ = o.GetHistoryOk() + return ret +} + +// GetHistoryOk returns a tuple with the History field value +// and a boolean to check if the value has been set. +func (o *GetCacheInfoResponse) GetHistoryOk() (ret GetCacheInfoResponseGetHistoryRetType, ok bool) { + return getGetCacheInfoResponseGetHistoryAttributeTypeOk(o.History) +} + +// SetHistory sets field value +func (o *GetCacheInfoResponse) SetHistory(v GetCacheInfoResponseGetHistoryRetType) { + setGetCacheInfoResponseGetHistoryAttributeType(&o.History, v) +} + +// GetLastPurgeTime returns the LastPurgeTime field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *GetCacheInfoResponse) GetLastPurgeTime() (ret GetCacheInfoResponseGetLastPurgeTimeRetType) { + ret, _ = o.GetLastPurgeTimeOk() + return ret +} + +// GetLastPurgeTimeOk returns a tuple with the LastPurgeTime 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 *GetCacheInfoResponse) GetLastPurgeTimeOk() (ret GetCacheInfoResponseGetLastPurgeTimeRetType, ok bool) { + return getGetCacheInfoResponseGetLastPurgeTimeAttributeTypeOk(o.LastPurgeTime) +} + +// SetLastPurgeTime sets field value +func (o *GetCacheInfoResponse) SetLastPurgeTime(v GetCacheInfoResponseGetLastPurgeTimeRetType) { + setGetCacheInfoResponseGetLastPurgeTimeAttributeType(&o.LastPurgeTime, v) +} + +func (o GetCacheInfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCacheInfoResponseGetHistoryAttributeTypeOk(o.History); ok { + toSerialize["History"] = val + } + if val, ok := getGetCacheInfoResponseGetLastPurgeTimeAttributeTypeOk(o.LastPurgeTime); ok { + toSerialize["LastPurgeTime"] = val + } + return toSerialize, nil +} + +type NullableGetCacheInfoResponse struct { + value *GetCacheInfoResponse + isSet bool +} + +func (v NullableGetCacheInfoResponse) Get() *GetCacheInfoResponse { + return v.value +} + +func (v *NullableGetCacheInfoResponse) Set(val *GetCacheInfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetCacheInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCacheInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCacheInfoResponse(val *GetCacheInfoResponse) *NullableGetCacheInfoResponse { + return &NullableGetCacheInfoResponse{value: val, isSet: true} +} + +func (v NullableGetCacheInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCacheInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_get_cache_info_response_history_entry.go b/pkg/cdnbeta/model_get_cache_info_response_history_entry.go new file mode 100644 index 00000000..4ed7ce8c --- /dev/null +++ b/pkg/cdnbeta/model_get_cache_info_response_history_entry.go @@ -0,0 +1,274 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the GetCacheInfoResponseHistoryEntry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCacheInfoResponseHistoryEntry{} + +/* + types and functions for occurredAt +*/ + +// isDateTime +type GetCacheInfoResponseHistoryEntryGetOccurredAtAttributeType = *time.Time +type GetCacheInfoResponseHistoryEntryGetOccurredAtArgType = time.Time +type GetCacheInfoResponseHistoryEntryGetOccurredAtRetType = time.Time + +func getGetCacheInfoResponseHistoryEntryGetOccurredAtAttributeTypeOk(arg GetCacheInfoResponseHistoryEntryGetOccurredAtAttributeType) (ret GetCacheInfoResponseHistoryEntryGetOccurredAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCacheInfoResponseHistoryEntryGetOccurredAtAttributeType(arg *GetCacheInfoResponseHistoryEntryGetOccurredAtAttributeType, val GetCacheInfoResponseHistoryEntryGetOccurredAtRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isEnum + +// GetCacheInfoResponseHistoryEntryTypes the model 'GetCacheInfoResponseHistoryEntry' +// value type for enums +type GetCacheInfoResponseHistoryEntryTypes string + +// List of Type +const ( + GETCACHEINFORESPONSEHISTORYENTRYTYPE_FULL GetCacheInfoResponseHistoryEntryTypes = "full" + GETCACHEINFORESPONSEHISTORYENTRYTYPE_GRANULAR GetCacheInfoResponseHistoryEntryTypes = "granular" +) + +// All allowed values of GetCacheInfoResponseHistoryEntry enum +var AllowedGetCacheInfoResponseHistoryEntryTypesEnumValues = []GetCacheInfoResponseHistoryEntryTypes{ + "full", + "granular", +} + +func (v *GetCacheInfoResponseHistoryEntryTypes) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson GetCacheInfoResponseHistoryEntryTypes + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := GetCacheInfoResponseHistoryEntryTypes(value) + for _, existing := range AllowedGetCacheInfoResponseHistoryEntryTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid GetCacheInfoResponseHistoryEntry", value) +} + +// NewGetCacheInfoResponseHistoryEntryTypesFromValue returns a pointer to a valid GetCacheInfoResponseHistoryEntryTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGetCacheInfoResponseHistoryEntryTypesFromValue(v GetCacheInfoResponseHistoryEntryTypes) (*GetCacheInfoResponseHistoryEntryTypes, error) { + ev := GetCacheInfoResponseHistoryEntryTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GetCacheInfoResponseHistoryEntryTypes: valid values are %v", v, AllowedGetCacheInfoResponseHistoryEntryTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GetCacheInfoResponseHistoryEntryTypes) IsValid() bool { + for _, existing := range AllowedGetCacheInfoResponseHistoryEntryTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v GetCacheInfoResponseHistoryEntryTypes) Ptr() *GetCacheInfoResponseHistoryEntryTypes { + return &v +} + +type NullableGetCacheInfoResponseHistoryEntryTypes struct { + value *GetCacheInfoResponseHistoryEntryTypes + isSet bool +} + +func (v NullableGetCacheInfoResponseHistoryEntryTypes) Get() *GetCacheInfoResponseHistoryEntryTypes { + return v.value +} + +func (v *NullableGetCacheInfoResponseHistoryEntryTypes) Set(val *GetCacheInfoResponseHistoryEntryTypes) { + v.value = val + v.isSet = true +} + +func (v NullableGetCacheInfoResponseHistoryEntryTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCacheInfoResponseHistoryEntryTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCacheInfoResponseHistoryEntryTypes(val *GetCacheInfoResponseHistoryEntryTypes) *NullableGetCacheInfoResponseHistoryEntryTypes { + return &NullableGetCacheInfoResponseHistoryEntryTypes{value: val, isSet: true} +} + +func (v NullableGetCacheInfoResponseHistoryEntryTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCacheInfoResponseHistoryEntryTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type GetCacheInfoResponseHistoryEntryGetTypeAttributeType = *GetCacheInfoResponseHistoryEntryTypes +type GetCacheInfoResponseHistoryEntryGetTypeArgType = GetCacheInfoResponseHistoryEntryTypes +type GetCacheInfoResponseHistoryEntryGetTypeRetType = GetCacheInfoResponseHistoryEntryTypes + +func getGetCacheInfoResponseHistoryEntryGetTypeAttributeTypeOk(arg GetCacheInfoResponseHistoryEntryGetTypeAttributeType) (ret GetCacheInfoResponseHistoryEntryGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCacheInfoResponseHistoryEntryGetTypeAttributeType(arg *GetCacheInfoResponseHistoryEntryGetTypeAttributeType, val GetCacheInfoResponseHistoryEntryGetTypeRetType) { + *arg = &val +} + +// GetCacheInfoResponseHistoryEntry struct for GetCacheInfoResponseHistoryEntry +type GetCacheInfoResponseHistoryEntry struct { + // REQUIRED + OccurredAt GetCacheInfoResponseHistoryEntryGetOccurredAtAttributeType `json:"occurredAt" required:"true"` + // REQUIRED + Type GetCacheInfoResponseHistoryEntryGetTypeAttributeType `json:"type" required:"true"` +} + +type _GetCacheInfoResponseHistoryEntry GetCacheInfoResponseHistoryEntry + +// NewGetCacheInfoResponseHistoryEntry instantiates a new GetCacheInfoResponseHistoryEntry 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 NewGetCacheInfoResponseHistoryEntry(occurredAt GetCacheInfoResponseHistoryEntryGetOccurredAtArgType, types GetCacheInfoResponseHistoryEntryGetTypeArgType) *GetCacheInfoResponseHistoryEntry { + this := GetCacheInfoResponseHistoryEntry{} + setGetCacheInfoResponseHistoryEntryGetOccurredAtAttributeType(&this.OccurredAt, occurredAt) + setGetCacheInfoResponseHistoryEntryGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewGetCacheInfoResponseHistoryEntryWithDefaults instantiates a new GetCacheInfoResponseHistoryEntry 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 NewGetCacheInfoResponseHistoryEntryWithDefaults() *GetCacheInfoResponseHistoryEntry { + this := GetCacheInfoResponseHistoryEntry{} + return &this +} + +// GetOccurredAt returns the OccurredAt field value +func (o *GetCacheInfoResponseHistoryEntry) GetOccurredAt() (ret GetCacheInfoResponseHistoryEntryGetOccurredAtRetType) { + ret, _ = o.GetOccurredAtOk() + return ret +} + +// GetOccurredAtOk returns a tuple with the OccurredAt field value +// and a boolean to check if the value has been set. +func (o *GetCacheInfoResponseHistoryEntry) GetOccurredAtOk() (ret GetCacheInfoResponseHistoryEntryGetOccurredAtRetType, ok bool) { + return getGetCacheInfoResponseHistoryEntryGetOccurredAtAttributeTypeOk(o.OccurredAt) +} + +// SetOccurredAt sets field value +func (o *GetCacheInfoResponseHistoryEntry) SetOccurredAt(v GetCacheInfoResponseHistoryEntryGetOccurredAtRetType) { + setGetCacheInfoResponseHistoryEntryGetOccurredAtAttributeType(&o.OccurredAt, v) +} + +// GetType returns the Type field value +func (o *GetCacheInfoResponseHistoryEntry) GetType() (ret GetCacheInfoResponseHistoryEntryGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *GetCacheInfoResponseHistoryEntry) GetTypeOk() (ret GetCacheInfoResponseHistoryEntryGetTypeRetType, ok bool) { + return getGetCacheInfoResponseHistoryEntryGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *GetCacheInfoResponseHistoryEntry) SetType(v GetCacheInfoResponseHistoryEntryGetTypeRetType) { + setGetCacheInfoResponseHistoryEntryGetTypeAttributeType(&o.Type, v) +} + +func (o GetCacheInfoResponseHistoryEntry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCacheInfoResponseHistoryEntryGetOccurredAtAttributeTypeOk(o.OccurredAt); ok { + toSerialize["OccurredAt"] = val + } + if val, ok := getGetCacheInfoResponseHistoryEntryGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableGetCacheInfoResponseHistoryEntry struct { + value *GetCacheInfoResponseHistoryEntry + isSet bool +} + +func (v NullableGetCacheInfoResponseHistoryEntry) Get() *GetCacheInfoResponseHistoryEntry { + return v.value +} + +func (v *NullableGetCacheInfoResponseHistoryEntry) Set(val *GetCacheInfoResponseHistoryEntry) { + v.value = val + v.isSet = true +} + +func (v NullableGetCacheInfoResponseHistoryEntry) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCacheInfoResponseHistoryEntry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCacheInfoResponseHistoryEntry(val *GetCacheInfoResponseHistoryEntry) *NullableGetCacheInfoResponseHistoryEntry { + return &NullableGetCacheInfoResponseHistoryEntry{value: val, isSet: true} +} + +func (v NullableGetCacheInfoResponseHistoryEntry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCacheInfoResponseHistoryEntry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_get_cache_info_response_history_entry_test.go b/pkg/cdnbeta/model_get_cache_info_response_history_entry_test.go new file mode 100644 index 00000000..01fbc1f8 --- /dev/null +++ b/pkg/cdnbeta/model_get_cache_info_response_history_entry_test.go @@ -0,0 +1,58 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "testing" +) + +// isEnum + +func TestGetCacheInfoResponseHistoryEntryTypes_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"full"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"granular"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := GetCacheInfoResponseHistoryEntryTypes("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/cdnbeta/model_get_cache_info_response_test.go b/pkg/cdnbeta/model_get_cache_info_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_get_cache_info_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_get_custom_domain_custom_certificate.go b/pkg/cdnbeta/model_get_custom_domain_custom_certificate.go new file mode 100644 index 00000000..11da1ea1 --- /dev/null +++ b/pkg/cdnbeta/model_get_custom_domain_custom_certificate.go @@ -0,0 +1,171 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the GetCustomDomainCustomCertificate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCustomDomainCustomCertificate{} + +/* + types and functions for type +*/ + +// isNotNullableString +type GetCustomDomainCustomCertificateGetTypeAttributeType = *string + +func getGetCustomDomainCustomCertificateGetTypeAttributeTypeOk(arg GetCustomDomainCustomCertificateGetTypeAttributeType) (ret GetCustomDomainCustomCertificateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCustomDomainCustomCertificateGetTypeAttributeType(arg *GetCustomDomainCustomCertificateGetTypeAttributeType, val GetCustomDomainCustomCertificateGetTypeRetType) { + *arg = &val +} + +type GetCustomDomainCustomCertificateGetTypeArgType = string +type GetCustomDomainCustomCertificateGetTypeRetType = string + +/* + types and functions for version +*/ + +// isInteger +type GetCustomDomainCustomCertificateGetVersionAttributeType = *int64 +type GetCustomDomainCustomCertificateGetVersionArgType = int64 +type GetCustomDomainCustomCertificateGetVersionRetType = int64 + +func getGetCustomDomainCustomCertificateGetVersionAttributeTypeOk(arg GetCustomDomainCustomCertificateGetVersionAttributeType) (ret GetCustomDomainCustomCertificateGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCustomDomainCustomCertificateGetVersionAttributeType(arg *GetCustomDomainCustomCertificateGetVersionAttributeType, val GetCustomDomainCustomCertificateGetVersionRetType) { + *arg = &val +} + +// GetCustomDomainCustomCertificate Returned if a custom certificate is used. Response does not contain the certificate or key. +type GetCustomDomainCustomCertificate struct { + // REQUIRED + Type GetCustomDomainCustomCertificateGetTypeAttributeType `json:"type" required:"true"` + // Whenever a new custom certificate is added the version is increased by 1. + // Can be cast to int32 without loss of precision. + // REQUIRED + Version GetCustomDomainCustomCertificateGetVersionAttributeType `json:"version" required:"true"` +} + +type _GetCustomDomainCustomCertificate GetCustomDomainCustomCertificate + +// NewGetCustomDomainCustomCertificate instantiates a new GetCustomDomainCustomCertificate 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 NewGetCustomDomainCustomCertificate(types GetCustomDomainCustomCertificateGetTypeArgType, version GetCustomDomainCustomCertificateGetVersionArgType) *GetCustomDomainCustomCertificate { + this := GetCustomDomainCustomCertificate{} + setGetCustomDomainCustomCertificateGetTypeAttributeType(&this.Type, types) + setGetCustomDomainCustomCertificateGetVersionAttributeType(&this.Version, version) + return &this +} + +// NewGetCustomDomainCustomCertificateWithDefaults instantiates a new GetCustomDomainCustomCertificate 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 NewGetCustomDomainCustomCertificateWithDefaults() *GetCustomDomainCustomCertificate { + this := GetCustomDomainCustomCertificate{} + return &this +} + +// GetType returns the Type field value +func (o *GetCustomDomainCustomCertificate) GetType() (ret GetCustomDomainCustomCertificateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *GetCustomDomainCustomCertificate) GetTypeOk() (ret GetCustomDomainCustomCertificateGetTypeRetType, ok bool) { + return getGetCustomDomainCustomCertificateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *GetCustomDomainCustomCertificate) SetType(v GetCustomDomainCustomCertificateGetTypeRetType) { + setGetCustomDomainCustomCertificateGetTypeAttributeType(&o.Type, v) +} + +// GetVersion returns the Version field value +func (o *GetCustomDomainCustomCertificate) GetVersion() (ret GetCustomDomainCustomCertificateGetVersionRetType) { + ret, _ = o.GetVersionOk() + return ret +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *GetCustomDomainCustomCertificate) GetVersionOk() (ret GetCustomDomainCustomCertificateGetVersionRetType, ok bool) { + return getGetCustomDomainCustomCertificateGetVersionAttributeTypeOk(o.Version) +} + +// SetVersion sets field value +func (o *GetCustomDomainCustomCertificate) SetVersion(v GetCustomDomainCustomCertificateGetVersionRetType) { + setGetCustomDomainCustomCertificateGetVersionAttributeType(&o.Version, v) +} + +func (o GetCustomDomainCustomCertificate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCustomDomainCustomCertificateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getGetCustomDomainCustomCertificateGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +type NullableGetCustomDomainCustomCertificate struct { + value *GetCustomDomainCustomCertificate + isSet bool +} + +func (v NullableGetCustomDomainCustomCertificate) Get() *GetCustomDomainCustomCertificate { + return v.value +} + +func (v *NullableGetCustomDomainCustomCertificate) Set(val *GetCustomDomainCustomCertificate) { + v.value = val + v.isSet = true +} + +func (v NullableGetCustomDomainCustomCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCustomDomainCustomCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCustomDomainCustomCertificate(val *GetCustomDomainCustomCertificate) *NullableGetCustomDomainCustomCertificate { + return &NullableGetCustomDomainCustomCertificate{value: val, isSet: true} +} + +func (v NullableGetCustomDomainCustomCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCustomDomainCustomCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_get_custom_domain_custom_certificate_test.go b/pkg/cdnbeta/model_get_custom_domain_custom_certificate_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_get_custom_domain_custom_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_get_custom_domain_managed_certificate.go b/pkg/cdnbeta/model_get_custom_domain_managed_certificate.go new file mode 100644 index 00000000..68dd0834 --- /dev/null +++ b/pkg/cdnbeta/model_get_custom_domain_managed_certificate.go @@ -0,0 +1,126 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the GetCustomDomainManagedCertificate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCustomDomainManagedCertificate{} + +/* + types and functions for type +*/ + +// isNotNullableString +type GetCustomDomainManagedCertificateGetTypeAttributeType = *string + +func getGetCustomDomainManagedCertificateGetTypeAttributeTypeOk(arg GetCustomDomainManagedCertificateGetTypeAttributeType) (ret GetCustomDomainManagedCertificateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCustomDomainManagedCertificateGetTypeAttributeType(arg *GetCustomDomainManagedCertificateGetTypeAttributeType, val GetCustomDomainManagedCertificateGetTypeRetType) { + *arg = &val +} + +type GetCustomDomainManagedCertificateGetTypeArgType = string +type GetCustomDomainManagedCertificateGetTypeRetType = string + +// GetCustomDomainManagedCertificate This is returned when no custom certificate is used. We provision and manage a Let's Encrypt Certificate for you +type GetCustomDomainManagedCertificate struct { + // REQUIRED + Type GetCustomDomainManagedCertificateGetTypeAttributeType `json:"type" required:"true"` +} + +type _GetCustomDomainManagedCertificate GetCustomDomainManagedCertificate + +// NewGetCustomDomainManagedCertificate instantiates a new GetCustomDomainManagedCertificate 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 NewGetCustomDomainManagedCertificate(types GetCustomDomainManagedCertificateGetTypeArgType) *GetCustomDomainManagedCertificate { + this := GetCustomDomainManagedCertificate{} + setGetCustomDomainManagedCertificateGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewGetCustomDomainManagedCertificateWithDefaults instantiates a new GetCustomDomainManagedCertificate 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 NewGetCustomDomainManagedCertificateWithDefaults() *GetCustomDomainManagedCertificate { + this := GetCustomDomainManagedCertificate{} + return &this +} + +// GetType returns the Type field value +func (o *GetCustomDomainManagedCertificate) GetType() (ret GetCustomDomainManagedCertificateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *GetCustomDomainManagedCertificate) GetTypeOk() (ret GetCustomDomainManagedCertificateGetTypeRetType, ok bool) { + return getGetCustomDomainManagedCertificateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *GetCustomDomainManagedCertificate) SetType(v GetCustomDomainManagedCertificateGetTypeRetType) { + setGetCustomDomainManagedCertificateGetTypeAttributeType(&o.Type, v) +} + +func (o GetCustomDomainManagedCertificate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCustomDomainManagedCertificateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableGetCustomDomainManagedCertificate struct { + value *GetCustomDomainManagedCertificate + isSet bool +} + +func (v NullableGetCustomDomainManagedCertificate) Get() *GetCustomDomainManagedCertificate { + return v.value +} + +func (v *NullableGetCustomDomainManagedCertificate) Set(val *GetCustomDomainManagedCertificate) { + v.value = val + v.isSet = true +} + +func (v NullableGetCustomDomainManagedCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCustomDomainManagedCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCustomDomainManagedCertificate(val *GetCustomDomainManagedCertificate) *NullableGetCustomDomainManagedCertificate { + return &NullableGetCustomDomainManagedCertificate{value: val, isSet: true} +} + +func (v NullableGetCustomDomainManagedCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCustomDomainManagedCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_get_custom_domain_managed_certificate_test.go b/pkg/cdnbeta/model_get_custom_domain_managed_certificate_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_get_custom_domain_managed_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_get_custom_domain_response.go b/pkg/cdnbeta/model_get_custom_domain_response.go new file mode 100644 index 00000000..bb055557 --- /dev/null +++ b/pkg/cdnbeta/model_get_custom_domain_response.go @@ -0,0 +1,168 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the GetCustomDomainResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCustomDomainResponse{} + +/* + types and functions for certificate +*/ + +// isModel +type GetCustomDomainResponseGetCertificateAttributeType = *GetCustomDomainResponseCertificate +type GetCustomDomainResponseGetCertificateArgType = GetCustomDomainResponseCertificate +type GetCustomDomainResponseGetCertificateRetType = GetCustomDomainResponseCertificate + +func getGetCustomDomainResponseGetCertificateAttributeTypeOk(arg GetCustomDomainResponseGetCertificateAttributeType) (ret GetCustomDomainResponseGetCertificateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCustomDomainResponseGetCertificateAttributeType(arg *GetCustomDomainResponseGetCertificateAttributeType, val GetCustomDomainResponseGetCertificateRetType) { + *arg = &val +} + +/* + types and functions for customDomain +*/ + +// isModel +type GetCustomDomainResponseGetCustomDomainAttributeType = *CustomDomain +type GetCustomDomainResponseGetCustomDomainArgType = CustomDomain +type GetCustomDomainResponseGetCustomDomainRetType = CustomDomain + +func getGetCustomDomainResponseGetCustomDomainAttributeTypeOk(arg GetCustomDomainResponseGetCustomDomainAttributeType) (ret GetCustomDomainResponseGetCustomDomainRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCustomDomainResponseGetCustomDomainAttributeType(arg *GetCustomDomainResponseGetCustomDomainAttributeType, val GetCustomDomainResponseGetCustomDomainRetType) { + *arg = &val +} + +// GetCustomDomainResponse struct for GetCustomDomainResponse +type GetCustomDomainResponse struct { + // REQUIRED + Certificate GetCustomDomainResponseGetCertificateAttributeType `json:"certificate" required:"true"` + // REQUIRED + CustomDomain GetCustomDomainResponseGetCustomDomainAttributeType `json:"customDomain" required:"true"` +} + +type _GetCustomDomainResponse GetCustomDomainResponse + +// NewGetCustomDomainResponse instantiates a new GetCustomDomainResponse 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 NewGetCustomDomainResponse(certificate GetCustomDomainResponseGetCertificateArgType, customDomain GetCustomDomainResponseGetCustomDomainArgType) *GetCustomDomainResponse { + this := GetCustomDomainResponse{} + setGetCustomDomainResponseGetCertificateAttributeType(&this.Certificate, certificate) + setGetCustomDomainResponseGetCustomDomainAttributeType(&this.CustomDomain, customDomain) + return &this +} + +// NewGetCustomDomainResponseWithDefaults instantiates a new GetCustomDomainResponse 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 NewGetCustomDomainResponseWithDefaults() *GetCustomDomainResponse { + this := GetCustomDomainResponse{} + return &this +} + +// GetCertificate returns the Certificate field value +func (o *GetCustomDomainResponse) GetCertificate() (ret GetCustomDomainResponseGetCertificateRetType) { + ret, _ = o.GetCertificateOk() + return ret +} + +// GetCertificateOk returns a tuple with the Certificate field value +// and a boolean to check if the value has been set. +func (o *GetCustomDomainResponse) GetCertificateOk() (ret GetCustomDomainResponseGetCertificateRetType, ok bool) { + return getGetCustomDomainResponseGetCertificateAttributeTypeOk(o.Certificate) +} + +// SetCertificate sets field value +func (o *GetCustomDomainResponse) SetCertificate(v GetCustomDomainResponseGetCertificateRetType) { + setGetCustomDomainResponseGetCertificateAttributeType(&o.Certificate, v) +} + +// GetCustomDomain returns the CustomDomain field value +func (o *GetCustomDomainResponse) GetCustomDomain() (ret GetCustomDomainResponseGetCustomDomainRetType) { + ret, _ = o.GetCustomDomainOk() + return ret +} + +// GetCustomDomainOk returns a tuple with the CustomDomain field value +// and a boolean to check if the value has been set. +func (o *GetCustomDomainResponse) GetCustomDomainOk() (ret GetCustomDomainResponseGetCustomDomainRetType, ok bool) { + return getGetCustomDomainResponseGetCustomDomainAttributeTypeOk(o.CustomDomain) +} + +// SetCustomDomain sets field value +func (o *GetCustomDomainResponse) SetCustomDomain(v GetCustomDomainResponseGetCustomDomainRetType) { + setGetCustomDomainResponseGetCustomDomainAttributeType(&o.CustomDomain, v) +} + +func (o GetCustomDomainResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCustomDomainResponseGetCertificateAttributeTypeOk(o.Certificate); ok { + toSerialize["Certificate"] = val + } + if val, ok := getGetCustomDomainResponseGetCustomDomainAttributeTypeOk(o.CustomDomain); ok { + toSerialize["CustomDomain"] = val + } + return toSerialize, nil +} + +type NullableGetCustomDomainResponse struct { + value *GetCustomDomainResponse + isSet bool +} + +func (v NullableGetCustomDomainResponse) Get() *GetCustomDomainResponse { + return v.value +} + +func (v *NullableGetCustomDomainResponse) Set(val *GetCustomDomainResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetCustomDomainResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCustomDomainResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCustomDomainResponse(val *GetCustomDomainResponse) *NullableGetCustomDomainResponse { + return &NullableGetCustomDomainResponse{value: val, isSet: true} +} + +func (v NullableGetCustomDomainResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCustomDomainResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_get_custom_domain_response_certificate.go b/pkg/cdnbeta/model_get_custom_domain_response_certificate.go new file mode 100644 index 00000000..58267c23 --- /dev/null +++ b/pkg/cdnbeta/model_get_custom_domain_response_certificate.go @@ -0,0 +1,163 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// GetCustomDomainResponseCertificate - struct for GetCustomDomainResponseCertificate +type GetCustomDomainResponseCertificate struct { + GetCustomDomainCustomCertificate *GetCustomDomainCustomCertificate + GetCustomDomainManagedCertificate *GetCustomDomainManagedCertificate +} + +// GetCustomDomainCustomCertificateAsGetCustomDomainResponseCertificate is a convenience function that returns GetCustomDomainCustomCertificate wrapped in GetCustomDomainResponseCertificate +func GetCustomDomainCustomCertificateAsGetCustomDomainResponseCertificate(v *GetCustomDomainCustomCertificate) GetCustomDomainResponseCertificate { + return GetCustomDomainResponseCertificate{ + GetCustomDomainCustomCertificate: v, + } +} + +// GetCustomDomainManagedCertificateAsGetCustomDomainResponseCertificate is a convenience function that returns GetCustomDomainManagedCertificate wrapped in GetCustomDomainResponseCertificate +func GetCustomDomainManagedCertificateAsGetCustomDomainResponseCertificate(v *GetCustomDomainManagedCertificate) GetCustomDomainResponseCertificate { + return GetCustomDomainResponseCertificate{ + GetCustomDomainManagedCertificate: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *GetCustomDomainResponseCertificate) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'GetCustomDomainCustomCertificate' + if jsonDict["type"] == "GetCustomDomainCustomCertificate" { + // try to unmarshal JSON data into GetCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainCustomCertificate, return on the first match + } else { + dst.GetCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal GetCustomDomainResponseCertificate as GetCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'GetCustomDomainManagedCertificate' + if jsonDict["type"] == "GetCustomDomainManagedCertificate" { + // try to unmarshal JSON data into GetCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainManagedCertificate, return on the first match + } else { + dst.GetCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal GetCustomDomainResponseCertificate as GetCustomDomainManagedCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'custom' + if jsonDict["type"] == "custom" { + // try to unmarshal JSON data into GetCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainCustomCertificate, return on the first match + } else { + dst.GetCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal GetCustomDomainResponseCertificate as GetCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'managed' + if jsonDict["type"] == "managed" { + // try to unmarshal JSON data into GetCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainManagedCertificate, return on the first match + } else { + dst.GetCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal GetCustomDomainResponseCertificate as GetCustomDomainManagedCertificate: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src GetCustomDomainResponseCertificate) MarshalJSON() ([]byte, error) { + if src.GetCustomDomainCustomCertificate != nil { + return json.Marshal(&src.GetCustomDomainCustomCertificate) + } + + if src.GetCustomDomainManagedCertificate != nil { + return json.Marshal(&src.GetCustomDomainManagedCertificate) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *GetCustomDomainResponseCertificate) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.GetCustomDomainCustomCertificate != nil { + return obj.GetCustomDomainCustomCertificate + } + + if obj.GetCustomDomainManagedCertificate != nil { + return obj.GetCustomDomainManagedCertificate + } + + // all schemas are nil + return nil +} + +type NullableGetCustomDomainResponseCertificate struct { + value *GetCustomDomainResponseCertificate + isSet bool +} + +func (v NullableGetCustomDomainResponseCertificate) Get() *GetCustomDomainResponseCertificate { + return v.value +} + +func (v *NullableGetCustomDomainResponseCertificate) Set(val *GetCustomDomainResponseCertificate) { + v.value = val + v.isSet = true +} + +func (v NullableGetCustomDomainResponseCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCustomDomainResponseCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCustomDomainResponseCertificate(val *GetCustomDomainResponseCertificate) *NullableGetCustomDomainResponseCertificate { + return &NullableGetCustomDomainResponseCertificate{value: val, isSet: true} +} + +func (v NullableGetCustomDomainResponseCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCustomDomainResponseCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_get_custom_domain_response_certificate_test.go b/pkg/cdnbeta/model_get_custom_domain_response_certificate_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_get_custom_domain_response_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_get_custom_domain_response_test.go b/pkg/cdnbeta/model_get_custom_domain_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_get_custom_domain_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_get_distribution_response.go b/pkg/cdnbeta/model_get_distribution_response.go new file mode 100644 index 00000000..28d310a0 --- /dev/null +++ b/pkg/cdnbeta/model_get_distribution_response.go @@ -0,0 +1,125 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the GetDistributionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDistributionResponse{} + +/* + types and functions for distribution +*/ + +// isModel +type GetDistributionResponseGetDistributionAttributeType = *Distribution +type GetDistributionResponseGetDistributionArgType = Distribution +type GetDistributionResponseGetDistributionRetType = Distribution + +func getGetDistributionResponseGetDistributionAttributeTypeOk(arg GetDistributionResponseGetDistributionAttributeType) (ret GetDistributionResponseGetDistributionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetDistributionResponseGetDistributionAttributeType(arg *GetDistributionResponseGetDistributionAttributeType, val GetDistributionResponseGetDistributionRetType) { + *arg = &val +} + +// GetDistributionResponse struct for GetDistributionResponse +type GetDistributionResponse struct { + // REQUIRED + Distribution GetDistributionResponseGetDistributionAttributeType `json:"distribution" required:"true"` +} + +type _GetDistributionResponse GetDistributionResponse + +// NewGetDistributionResponse instantiates a new GetDistributionResponse 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 NewGetDistributionResponse(distribution GetDistributionResponseGetDistributionArgType) *GetDistributionResponse { + this := GetDistributionResponse{} + setGetDistributionResponseGetDistributionAttributeType(&this.Distribution, distribution) + return &this +} + +// NewGetDistributionResponseWithDefaults instantiates a new GetDistributionResponse 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 NewGetDistributionResponseWithDefaults() *GetDistributionResponse { + this := GetDistributionResponse{} + return &this +} + +// GetDistribution returns the Distribution field value +func (o *GetDistributionResponse) GetDistribution() (ret GetDistributionResponseGetDistributionRetType) { + ret, _ = o.GetDistributionOk() + return ret +} + +// GetDistributionOk returns a tuple with the Distribution field value +// and a boolean to check if the value has been set. +func (o *GetDistributionResponse) GetDistributionOk() (ret GetDistributionResponseGetDistributionRetType, ok bool) { + return getGetDistributionResponseGetDistributionAttributeTypeOk(o.Distribution) +} + +// SetDistribution sets field value +func (o *GetDistributionResponse) SetDistribution(v GetDistributionResponseGetDistributionRetType) { + setGetDistributionResponseGetDistributionAttributeType(&o.Distribution, v) +} + +func (o GetDistributionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetDistributionResponseGetDistributionAttributeTypeOk(o.Distribution); ok { + toSerialize["Distribution"] = val + } + return toSerialize, nil +} + +type NullableGetDistributionResponse struct { + value *GetDistributionResponse + isSet bool +} + +func (v NullableGetDistributionResponse) Get() *GetDistributionResponse { + return v.value +} + +func (v *NullableGetDistributionResponse) Set(val *GetDistributionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetDistributionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDistributionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDistributionResponse(val *GetDistributionResponse) *NullableGetDistributionResponse { + return &NullableGetDistributionResponse{value: val, isSet: true} +} + +func (v NullableGetDistributionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDistributionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_get_distribution_response_test.go b/pkg/cdnbeta/model_get_distribution_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_get_distribution_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_get_logs_response.go b/pkg/cdnbeta/model_get_logs_response.go new file mode 100644 index 00000000..844b4dc9 --- /dev/null +++ b/pkg/cdnbeta/model_get_logs_response.go @@ -0,0 +1,173 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the GetLogsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetLogsResponse{} + +/* + types and functions for logs +*/ + +// isArray +type GetLogsResponseGetLogsAttributeType = *[]DistributionLogsRecord +type GetLogsResponseGetLogsArgType = []DistributionLogsRecord +type GetLogsResponseGetLogsRetType = []DistributionLogsRecord + +func getGetLogsResponseGetLogsAttributeTypeOk(arg GetLogsResponseGetLogsAttributeType) (ret GetLogsResponseGetLogsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetLogsResponseGetLogsAttributeType(arg *GetLogsResponseGetLogsAttributeType, val GetLogsResponseGetLogsRetType) { + *arg = &val +} + +/* + types and functions for nextPageIdentifier +*/ + +// isNotNullableString +type GetLogsResponseGetNextPageIdentifierAttributeType = *string + +func getGetLogsResponseGetNextPageIdentifierAttributeTypeOk(arg GetLogsResponseGetNextPageIdentifierAttributeType) (ret GetLogsResponseGetNextPageIdentifierRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetLogsResponseGetNextPageIdentifierAttributeType(arg *GetLogsResponseGetNextPageIdentifierAttributeType, val GetLogsResponseGetNextPageIdentifierRetType) { + *arg = &val +} + +type GetLogsResponseGetNextPageIdentifierArgType = string +type GetLogsResponseGetNextPageIdentifierRetType = string + +// GetLogsResponse struct for GetLogsResponse +type GetLogsResponse struct { + // REQUIRED + Logs GetLogsResponseGetLogsAttributeType `json:"logs" required:"true"` + NextPageIdentifier GetLogsResponseGetNextPageIdentifierAttributeType `json:"nextPageIdentifier,omitempty"` +} + +type _GetLogsResponse GetLogsResponse + +// NewGetLogsResponse instantiates a new GetLogsResponse 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 NewGetLogsResponse(logs GetLogsResponseGetLogsArgType) *GetLogsResponse { + this := GetLogsResponse{} + setGetLogsResponseGetLogsAttributeType(&this.Logs, logs) + return &this +} + +// NewGetLogsResponseWithDefaults instantiates a new GetLogsResponse 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 NewGetLogsResponseWithDefaults() *GetLogsResponse { + this := GetLogsResponse{} + return &this +} + +// GetLogs returns the Logs field value +func (o *GetLogsResponse) GetLogs() (ret GetLogsResponseGetLogsRetType) { + ret, _ = o.GetLogsOk() + return ret +} + +// GetLogsOk returns a tuple with the Logs field value +// and a boolean to check if the value has been set. +func (o *GetLogsResponse) GetLogsOk() (ret GetLogsResponseGetLogsRetType, ok bool) { + return getGetLogsResponseGetLogsAttributeTypeOk(o.Logs) +} + +// SetLogs sets field value +func (o *GetLogsResponse) SetLogs(v GetLogsResponseGetLogsRetType) { + setGetLogsResponseGetLogsAttributeType(&o.Logs, v) +} + +// GetNextPageIdentifier returns the NextPageIdentifier field value if set, zero value otherwise. +func (o *GetLogsResponse) GetNextPageIdentifier() (res GetLogsResponseGetNextPageIdentifierRetType) { + res, _ = o.GetNextPageIdentifierOk() + return +} + +// GetNextPageIdentifierOk returns a tuple with the NextPageIdentifier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetLogsResponse) GetNextPageIdentifierOk() (ret GetLogsResponseGetNextPageIdentifierRetType, ok bool) { + return getGetLogsResponseGetNextPageIdentifierAttributeTypeOk(o.NextPageIdentifier) +} + +// HasNextPageIdentifier returns a boolean if a field has been set. +func (o *GetLogsResponse) HasNextPageIdentifier() bool { + _, ok := o.GetNextPageIdentifierOk() + return ok +} + +// SetNextPageIdentifier gets a reference to the given string and assigns it to the NextPageIdentifier field. +func (o *GetLogsResponse) SetNextPageIdentifier(v GetLogsResponseGetNextPageIdentifierRetType) { + setGetLogsResponseGetNextPageIdentifierAttributeType(&o.NextPageIdentifier, v) +} + +func (o GetLogsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetLogsResponseGetLogsAttributeTypeOk(o.Logs); ok { + toSerialize["Logs"] = val + } + if val, ok := getGetLogsResponseGetNextPageIdentifierAttributeTypeOk(o.NextPageIdentifier); ok { + toSerialize["NextPageIdentifier"] = val + } + return toSerialize, nil +} + +type NullableGetLogsResponse struct { + value *GetLogsResponse + isSet bool +} + +func (v NullableGetLogsResponse) Get() *GetLogsResponse { + return v.value +} + +func (v *NullableGetLogsResponse) Set(val *GetLogsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetLogsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetLogsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetLogsResponse(val *GetLogsResponse) *NullableGetLogsResponse { + return &NullableGetLogsResponse{value: val, isSet: true} +} + +func (v NullableGetLogsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetLogsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_get_logs_response_test.go b/pkg/cdnbeta/model_get_logs_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_get_logs_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_get_statistics_response.go b/pkg/cdnbeta/model_get_statistics_response.go new file mode 100644 index 00000000..6e27a4ac --- /dev/null +++ b/pkg/cdnbeta/model_get_statistics_response.go @@ -0,0 +1,125 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the GetStatisticsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetStatisticsResponse{} + +/* + types and functions for records +*/ + +// isArray +type GetStatisticsResponseGetRecordsAttributeType = *[]DistributionStatisticsRecord +type GetStatisticsResponseGetRecordsArgType = []DistributionStatisticsRecord +type GetStatisticsResponseGetRecordsRetType = []DistributionStatisticsRecord + +func getGetStatisticsResponseGetRecordsAttributeTypeOk(arg GetStatisticsResponseGetRecordsAttributeType) (ret GetStatisticsResponseGetRecordsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetStatisticsResponseGetRecordsAttributeType(arg *GetStatisticsResponseGetRecordsAttributeType, val GetStatisticsResponseGetRecordsRetType) { + *arg = &val +} + +// GetStatisticsResponse struct for GetStatisticsResponse +type GetStatisticsResponse struct { + // REQUIRED + Records GetStatisticsResponseGetRecordsAttributeType `json:"records" required:"true"` +} + +type _GetStatisticsResponse GetStatisticsResponse + +// NewGetStatisticsResponse instantiates a new GetStatisticsResponse 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 NewGetStatisticsResponse(records GetStatisticsResponseGetRecordsArgType) *GetStatisticsResponse { + this := GetStatisticsResponse{} + setGetStatisticsResponseGetRecordsAttributeType(&this.Records, records) + return &this +} + +// NewGetStatisticsResponseWithDefaults instantiates a new GetStatisticsResponse 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 NewGetStatisticsResponseWithDefaults() *GetStatisticsResponse { + this := GetStatisticsResponse{} + return &this +} + +// GetRecords returns the Records field value +func (o *GetStatisticsResponse) GetRecords() (ret GetStatisticsResponseGetRecordsRetType) { + ret, _ = o.GetRecordsOk() + return ret +} + +// GetRecordsOk returns a tuple with the Records field value +// and a boolean to check if the value has been set. +func (o *GetStatisticsResponse) GetRecordsOk() (ret GetStatisticsResponseGetRecordsRetType, ok bool) { + return getGetStatisticsResponseGetRecordsAttributeTypeOk(o.Records) +} + +// SetRecords sets field value +func (o *GetStatisticsResponse) SetRecords(v GetStatisticsResponseGetRecordsRetType) { + setGetStatisticsResponseGetRecordsAttributeType(&o.Records, v) +} + +func (o GetStatisticsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetStatisticsResponseGetRecordsAttributeTypeOk(o.Records); ok { + toSerialize["Records"] = val + } + return toSerialize, nil +} + +type NullableGetStatisticsResponse struct { + value *GetStatisticsResponse + isSet bool +} + +func (v NullableGetStatisticsResponse) Get() *GetStatisticsResponse { + return v.value +} + +func (v *NullableGetStatisticsResponse) Set(val *GetStatisticsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetStatisticsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetStatisticsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetStatisticsResponse(val *GetStatisticsResponse) *NullableGetStatisticsResponse { + return &NullableGetStatisticsResponse{value: val, isSet: true} +} + +func (v NullableGetStatisticsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetStatisticsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_get_statistics_response_test.go b/pkg/cdnbeta/model_get_statistics_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_get_statistics_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_http_backend.go b/pkg/cdnbeta/model_http_backend.go new file mode 100644 index 00000000..4c38a8c6 --- /dev/null +++ b/pkg/cdnbeta/model_http_backend.go @@ -0,0 +1,259 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the HttpBackend type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HttpBackend{} + +/* + types and functions for geofencing +*/ + +// isContainer +type HttpBackendGetGeofencingAttributeType = *map[string][]string +type HttpBackendGetGeofencingArgType = map[string][]string +type HttpBackendGetGeofencingRetType = map[string][]string + +func getHttpBackendGetGeofencingAttributeTypeOk(arg HttpBackendGetGeofencingAttributeType) (ret HttpBackendGetGeofencingRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendGetGeofencingAttributeType(arg *HttpBackendGetGeofencingAttributeType, val HttpBackendGetGeofencingRetType) { + *arg = &val +} + +/* + types and functions for originRequestHeaders +*/ + +// isContainer +type HttpBackendGetOriginRequestHeadersAttributeType = *map[string]string +type HttpBackendGetOriginRequestHeadersArgType = map[string]string +type HttpBackendGetOriginRequestHeadersRetType = map[string]string + +func getHttpBackendGetOriginRequestHeadersAttributeTypeOk(arg HttpBackendGetOriginRequestHeadersAttributeType) (ret HttpBackendGetOriginRequestHeadersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendGetOriginRequestHeadersAttributeType(arg *HttpBackendGetOriginRequestHeadersAttributeType, val HttpBackendGetOriginRequestHeadersRetType) { + *arg = &val +} + +/* + types and functions for originUrl +*/ + +// isNotNullableString +type HttpBackendGetOriginUrlAttributeType = *string + +func getHttpBackendGetOriginUrlAttributeTypeOk(arg HttpBackendGetOriginUrlAttributeType) (ret HttpBackendGetOriginUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendGetOriginUrlAttributeType(arg *HttpBackendGetOriginUrlAttributeType, val HttpBackendGetOriginUrlRetType) { + *arg = &val +} + +type HttpBackendGetOriginUrlArgType = string +type HttpBackendGetOriginUrlRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type HttpBackendGetTypeAttributeType = *string + +func getHttpBackendGetTypeAttributeTypeOk(arg HttpBackendGetTypeAttributeType) (ret HttpBackendGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendGetTypeAttributeType(arg *HttpBackendGetTypeAttributeType, val HttpBackendGetTypeRetType) { + *arg = &val +} + +type HttpBackendGetTypeArgType = string +type HttpBackendGetTypeRetType = string + +// HttpBackend struct for HttpBackend +type HttpBackend struct { + // An object mapping multiple alternative origins to country codes. Any request from one of those country codes will route to the alternative origin. Do note that country codes may only be used once. You cannot have a country be assigned to multiple alternative origins. + // REQUIRED + Geofencing HttpBackendGetGeofencingAttributeType `json:"geofencing" required:"true"` + // Headers that will be sent with every request to the configured origin. **WARNING**: Do not store sensitive values in the headers. The configuration is stored as plain text. + // REQUIRED + OriginRequestHeaders HttpBackendGetOriginRequestHeadersAttributeType `json:"originRequestHeaders" required:"true"` + // The origin of the content that should be made available through the CDN. Note that the path and query parameters are ignored. Ports are allowed. If no protocol is provided, `https` is assumed. So `www.example.com:1234/somePath?q=123` is normalized to `https://www.example.com:1234` + // REQUIRED + OriginUrl HttpBackendGetOriginUrlAttributeType `json:"originUrl" required:"true"` + // REQUIRED + Type HttpBackendGetTypeAttributeType `json:"type" required:"true"` +} + +type _HttpBackend HttpBackend + +// NewHttpBackend instantiates a new HttpBackend 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 NewHttpBackend(geofencing HttpBackendGetGeofencingArgType, originRequestHeaders HttpBackendGetOriginRequestHeadersArgType, originUrl HttpBackendGetOriginUrlArgType, types HttpBackendGetTypeArgType) *HttpBackend { + this := HttpBackend{} + setHttpBackendGetGeofencingAttributeType(&this.Geofencing, geofencing) + setHttpBackendGetOriginRequestHeadersAttributeType(&this.OriginRequestHeaders, originRequestHeaders) + setHttpBackendGetOriginUrlAttributeType(&this.OriginUrl, originUrl) + setHttpBackendGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewHttpBackendWithDefaults instantiates a new HttpBackend 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 NewHttpBackendWithDefaults() *HttpBackend { + this := HttpBackend{} + return &this +} + +// GetGeofencing returns the Geofencing field value +func (o *HttpBackend) GetGeofencing() (ret HttpBackendGetGeofencingRetType) { + ret, _ = o.GetGeofencingOk() + return ret +} + +// GetGeofencingOk returns a tuple with the Geofencing field value +// and a boolean to check if the value has been set. +func (o *HttpBackend) GetGeofencingOk() (ret HttpBackendGetGeofencingRetType, ok bool) { + return getHttpBackendGetGeofencingAttributeTypeOk(o.Geofencing) +} + +// SetGeofencing sets field value +func (o *HttpBackend) SetGeofencing(v HttpBackendGetGeofencingRetType) { + setHttpBackendGetGeofencingAttributeType(&o.Geofencing, v) +} + +// GetOriginRequestHeaders returns the OriginRequestHeaders field value +func (o *HttpBackend) GetOriginRequestHeaders() (ret HttpBackendGetOriginRequestHeadersRetType) { + ret, _ = o.GetOriginRequestHeadersOk() + return ret +} + +// GetOriginRequestHeadersOk returns a tuple with the OriginRequestHeaders field value +// and a boolean to check if the value has been set. +func (o *HttpBackend) GetOriginRequestHeadersOk() (ret HttpBackendGetOriginRequestHeadersRetType, ok bool) { + return getHttpBackendGetOriginRequestHeadersAttributeTypeOk(o.OriginRequestHeaders) +} + +// SetOriginRequestHeaders sets field value +func (o *HttpBackend) SetOriginRequestHeaders(v HttpBackendGetOriginRequestHeadersRetType) { + setHttpBackendGetOriginRequestHeadersAttributeType(&o.OriginRequestHeaders, v) +} + +// GetOriginUrl returns the OriginUrl field value +func (o *HttpBackend) GetOriginUrl() (ret HttpBackendGetOriginUrlRetType) { + ret, _ = o.GetOriginUrlOk() + return ret +} + +// GetOriginUrlOk returns a tuple with the OriginUrl field value +// and a boolean to check if the value has been set. +func (o *HttpBackend) GetOriginUrlOk() (ret HttpBackendGetOriginUrlRetType, ok bool) { + return getHttpBackendGetOriginUrlAttributeTypeOk(o.OriginUrl) +} + +// SetOriginUrl sets field value +func (o *HttpBackend) SetOriginUrl(v HttpBackendGetOriginUrlRetType) { + setHttpBackendGetOriginUrlAttributeType(&o.OriginUrl, v) +} + +// GetType returns the Type field value +func (o *HttpBackend) GetType() (ret HttpBackendGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *HttpBackend) GetTypeOk() (ret HttpBackendGetTypeRetType, ok bool) { + return getHttpBackendGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *HttpBackend) SetType(v HttpBackendGetTypeRetType) { + setHttpBackendGetTypeAttributeType(&o.Type, v) +} + +func (o HttpBackend) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getHttpBackendGetGeofencingAttributeTypeOk(o.Geofencing); ok { + toSerialize["Geofencing"] = val + } + if val, ok := getHttpBackendGetOriginRequestHeadersAttributeTypeOk(o.OriginRequestHeaders); ok { + toSerialize["OriginRequestHeaders"] = val + } + if val, ok := getHttpBackendGetOriginUrlAttributeTypeOk(o.OriginUrl); ok { + toSerialize["OriginUrl"] = val + } + if val, ok := getHttpBackendGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableHttpBackend struct { + value *HttpBackend + isSet bool +} + +func (v NullableHttpBackend) Get() *HttpBackend { + return v.value +} + +func (v *NullableHttpBackend) Set(val *HttpBackend) { + v.value = val + v.isSet = true +} + +func (v NullableHttpBackend) IsSet() bool { + return v.isSet +} + +func (v *NullableHttpBackend) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHttpBackend(val *HttpBackend) *NullableHttpBackend { + return &NullableHttpBackend{value: val, isSet: true} +} + +func (v NullableHttpBackend) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHttpBackend) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_http_backend_create.go b/pkg/cdnbeta/model_http_backend_create.go new file mode 100644 index 00000000..ad812dcb --- /dev/null +++ b/pkg/cdnbeta/model_http_backend_create.go @@ -0,0 +1,267 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the HttpBackendCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HttpBackendCreate{} + +/* + types and functions for geofencing +*/ + +// isContainer +type HttpBackendCreateGetGeofencingAttributeType = *map[string][]string +type HttpBackendCreateGetGeofencingArgType = map[string][]string +type HttpBackendCreateGetGeofencingRetType = map[string][]string + +func getHttpBackendCreateGetGeofencingAttributeTypeOk(arg HttpBackendCreateGetGeofencingAttributeType) (ret HttpBackendCreateGetGeofencingRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendCreateGetGeofencingAttributeType(arg *HttpBackendCreateGetGeofencingAttributeType, val HttpBackendCreateGetGeofencingRetType) { + *arg = &val +} + +/* + types and functions for originRequestHeaders +*/ + +// isContainer +type HttpBackendCreateGetOriginRequestHeadersAttributeType = *map[string]string +type HttpBackendCreateGetOriginRequestHeadersArgType = map[string]string +type HttpBackendCreateGetOriginRequestHeadersRetType = map[string]string + +func getHttpBackendCreateGetOriginRequestHeadersAttributeTypeOk(arg HttpBackendCreateGetOriginRequestHeadersAttributeType) (ret HttpBackendCreateGetOriginRequestHeadersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendCreateGetOriginRequestHeadersAttributeType(arg *HttpBackendCreateGetOriginRequestHeadersAttributeType, val HttpBackendCreateGetOriginRequestHeadersRetType) { + *arg = &val +} + +/* + types and functions for originUrl +*/ + +// isNotNullableString +type HttpBackendCreateGetOriginUrlAttributeType = *string + +func getHttpBackendCreateGetOriginUrlAttributeTypeOk(arg HttpBackendCreateGetOriginUrlAttributeType) (ret HttpBackendCreateGetOriginUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendCreateGetOriginUrlAttributeType(arg *HttpBackendCreateGetOriginUrlAttributeType, val HttpBackendCreateGetOriginUrlRetType) { + *arg = &val +} + +type HttpBackendCreateGetOriginUrlArgType = string +type HttpBackendCreateGetOriginUrlRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type HttpBackendCreateGetTypeAttributeType = *string + +func getHttpBackendCreateGetTypeAttributeTypeOk(arg HttpBackendCreateGetTypeAttributeType) (ret HttpBackendCreateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendCreateGetTypeAttributeType(arg *HttpBackendCreateGetTypeAttributeType, val HttpBackendCreateGetTypeRetType) { + *arg = &val +} + +type HttpBackendCreateGetTypeArgType = string +type HttpBackendCreateGetTypeRetType = string + +// HttpBackendCreate struct for HttpBackendCreate +type HttpBackendCreate struct { + // An object mapping multiple alternative origins to country codes. Any request from one of those country codes will route to the alternative origin. Do note that country codes may only be used once. You cannot have a country be assigned to multiple alternative origins. + Geofencing HttpBackendCreateGetGeofencingAttributeType `json:"geofencing,omitempty"` + // Headers that will be sent with every request to the configured origin. **WARNING**: Do not store sensitive values in the headers. The configuration is stored as plain text. + OriginRequestHeaders HttpBackendCreateGetOriginRequestHeadersAttributeType `json:"originRequestHeaders,omitempty"` + // The origin of the content that should be made available through the CDN. Note that the path and query parameters are ignored. Ports are allowed. If no protocol is provided, `https` is assumed. So `www.example.com:1234/somePath?q=123` is normalized to `https://www.example.com:1234` + // REQUIRED + OriginUrl HttpBackendCreateGetOriginUrlAttributeType `json:"originUrl" required:"true"` + // REQUIRED + Type HttpBackendCreateGetTypeAttributeType `json:"type" required:"true"` +} + +type _HttpBackendCreate HttpBackendCreate + +// NewHttpBackendCreate instantiates a new HttpBackendCreate 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 NewHttpBackendCreate(originUrl HttpBackendCreateGetOriginUrlArgType, types HttpBackendCreateGetTypeArgType) *HttpBackendCreate { + this := HttpBackendCreate{} + setHttpBackendCreateGetOriginUrlAttributeType(&this.OriginUrl, originUrl) + setHttpBackendCreateGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewHttpBackendCreateWithDefaults instantiates a new HttpBackendCreate 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 NewHttpBackendCreateWithDefaults() *HttpBackendCreate { + this := HttpBackendCreate{} + return &this +} + +// GetGeofencing returns the Geofencing field value if set, zero value otherwise. +func (o *HttpBackendCreate) GetGeofencing() (res HttpBackendCreateGetGeofencingRetType) { + res, _ = o.GetGeofencingOk() + return +} + +// GetGeofencingOk returns a tuple with the Geofencing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpBackendCreate) GetGeofencingOk() (ret HttpBackendCreateGetGeofencingRetType, ok bool) { + return getHttpBackendCreateGetGeofencingAttributeTypeOk(o.Geofencing) +} + +// HasGeofencing returns a boolean if a field has been set. +func (o *HttpBackendCreate) HasGeofencing() bool { + _, ok := o.GetGeofencingOk() + return ok +} + +// SetGeofencing gets a reference to the given map[string][]string and assigns it to the Geofencing field. +func (o *HttpBackendCreate) SetGeofencing(v HttpBackendCreateGetGeofencingRetType) { + setHttpBackendCreateGetGeofencingAttributeType(&o.Geofencing, v) +} + +// GetOriginRequestHeaders returns the OriginRequestHeaders field value if set, zero value otherwise. +func (o *HttpBackendCreate) GetOriginRequestHeaders() (res HttpBackendCreateGetOriginRequestHeadersRetType) { + res, _ = o.GetOriginRequestHeadersOk() + return +} + +// GetOriginRequestHeadersOk returns a tuple with the OriginRequestHeaders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpBackendCreate) GetOriginRequestHeadersOk() (ret HttpBackendCreateGetOriginRequestHeadersRetType, ok bool) { + return getHttpBackendCreateGetOriginRequestHeadersAttributeTypeOk(o.OriginRequestHeaders) +} + +// HasOriginRequestHeaders returns a boolean if a field has been set. +func (o *HttpBackendCreate) HasOriginRequestHeaders() bool { + _, ok := o.GetOriginRequestHeadersOk() + return ok +} + +// SetOriginRequestHeaders gets a reference to the given map[string]string and assigns it to the OriginRequestHeaders field. +func (o *HttpBackendCreate) SetOriginRequestHeaders(v HttpBackendCreateGetOriginRequestHeadersRetType) { + setHttpBackendCreateGetOriginRequestHeadersAttributeType(&o.OriginRequestHeaders, v) +} + +// GetOriginUrl returns the OriginUrl field value +func (o *HttpBackendCreate) GetOriginUrl() (ret HttpBackendCreateGetOriginUrlRetType) { + ret, _ = o.GetOriginUrlOk() + return ret +} + +// GetOriginUrlOk returns a tuple with the OriginUrl field value +// and a boolean to check if the value has been set. +func (o *HttpBackendCreate) GetOriginUrlOk() (ret HttpBackendCreateGetOriginUrlRetType, ok bool) { + return getHttpBackendCreateGetOriginUrlAttributeTypeOk(o.OriginUrl) +} + +// SetOriginUrl sets field value +func (o *HttpBackendCreate) SetOriginUrl(v HttpBackendCreateGetOriginUrlRetType) { + setHttpBackendCreateGetOriginUrlAttributeType(&o.OriginUrl, v) +} + +// GetType returns the Type field value +func (o *HttpBackendCreate) GetType() (ret HttpBackendCreateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *HttpBackendCreate) GetTypeOk() (ret HttpBackendCreateGetTypeRetType, ok bool) { + return getHttpBackendCreateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *HttpBackendCreate) SetType(v HttpBackendCreateGetTypeRetType) { + setHttpBackendCreateGetTypeAttributeType(&o.Type, v) +} + +func (o HttpBackendCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getHttpBackendCreateGetGeofencingAttributeTypeOk(o.Geofencing); ok { + toSerialize["Geofencing"] = val + } + if val, ok := getHttpBackendCreateGetOriginRequestHeadersAttributeTypeOk(o.OriginRequestHeaders); ok { + toSerialize["OriginRequestHeaders"] = val + } + if val, ok := getHttpBackendCreateGetOriginUrlAttributeTypeOk(o.OriginUrl); ok { + toSerialize["OriginUrl"] = val + } + if val, ok := getHttpBackendCreateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableHttpBackendCreate struct { + value *HttpBackendCreate + isSet bool +} + +func (v NullableHttpBackendCreate) Get() *HttpBackendCreate { + return v.value +} + +func (v *NullableHttpBackendCreate) Set(val *HttpBackendCreate) { + v.value = val + v.isSet = true +} + +func (v NullableHttpBackendCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableHttpBackendCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHttpBackendCreate(val *HttpBackendCreate) *NullableHttpBackendCreate { + return &NullableHttpBackendCreate{value: val, isSet: true} +} + +func (v NullableHttpBackendCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHttpBackendCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_http_backend_create_test.go b/pkg/cdnbeta/model_http_backend_create_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_http_backend_create_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_http_backend_patch.go b/pkg/cdnbeta/model_http_backend_patch.go new file mode 100644 index 00000000..4c91e65f --- /dev/null +++ b/pkg/cdnbeta/model_http_backend_patch.go @@ -0,0 +1,271 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the HttpBackendPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HttpBackendPatch{} + +/* + types and functions for geofencing +*/ + +// isContainer +type HttpBackendPatchGetGeofencingAttributeType = *map[string][]string +type HttpBackendPatchGetGeofencingArgType = map[string][]string +type HttpBackendPatchGetGeofencingRetType = map[string][]string + +func getHttpBackendPatchGetGeofencingAttributeTypeOk(arg HttpBackendPatchGetGeofencingAttributeType) (ret HttpBackendPatchGetGeofencingRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendPatchGetGeofencingAttributeType(arg *HttpBackendPatchGetGeofencingAttributeType, val HttpBackendPatchGetGeofencingRetType) { + *arg = &val +} + +/* + types and functions for originRequestHeaders +*/ + +// isContainer +type HttpBackendPatchGetOriginRequestHeadersAttributeType = *map[string]string +type HttpBackendPatchGetOriginRequestHeadersArgType = map[string]string +type HttpBackendPatchGetOriginRequestHeadersRetType = map[string]string + +func getHttpBackendPatchGetOriginRequestHeadersAttributeTypeOk(arg HttpBackendPatchGetOriginRequestHeadersAttributeType) (ret HttpBackendPatchGetOriginRequestHeadersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendPatchGetOriginRequestHeadersAttributeType(arg *HttpBackendPatchGetOriginRequestHeadersAttributeType, val HttpBackendPatchGetOriginRequestHeadersRetType) { + *arg = &val +} + +/* + types and functions for originUrl +*/ + +// isNotNullableString +type HttpBackendPatchGetOriginUrlAttributeType = *string + +func getHttpBackendPatchGetOriginUrlAttributeTypeOk(arg HttpBackendPatchGetOriginUrlAttributeType) (ret HttpBackendPatchGetOriginUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendPatchGetOriginUrlAttributeType(arg *HttpBackendPatchGetOriginUrlAttributeType, val HttpBackendPatchGetOriginUrlRetType) { + *arg = &val +} + +type HttpBackendPatchGetOriginUrlArgType = string +type HttpBackendPatchGetOriginUrlRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type HttpBackendPatchGetTypeAttributeType = *string + +func getHttpBackendPatchGetTypeAttributeTypeOk(arg HttpBackendPatchGetTypeAttributeType) (ret HttpBackendPatchGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpBackendPatchGetTypeAttributeType(arg *HttpBackendPatchGetTypeAttributeType, val HttpBackendPatchGetTypeRetType) { + *arg = &val +} + +type HttpBackendPatchGetTypeArgType = string +type HttpBackendPatchGetTypeRetType = string + +// HttpBackendPatch A partial HTTP Backend +type HttpBackendPatch struct { + // An object mapping multiple alternative origins to country codes. Any request from one of those country codes will route to the alternative origin. Do note that country codes may only be used once. You cannot have a country be assigned to multiple alternative origins. + Geofencing HttpBackendPatchGetGeofencingAttributeType `json:"geofencing,omitempty"` + // Headers that will be sent with every request to the configured origin. **WARNING**: Do not store sensitive values in the headers. The configuration is stored as plain text. + OriginRequestHeaders HttpBackendPatchGetOriginRequestHeadersAttributeType `json:"originRequestHeaders,omitempty"` + OriginUrl HttpBackendPatchGetOriginUrlAttributeType `json:"originUrl,omitempty"` + // This property is required to determine the used backend type. + // REQUIRED + Type HttpBackendPatchGetTypeAttributeType `json:"type" required:"true"` +} + +type _HttpBackendPatch HttpBackendPatch + +// NewHttpBackendPatch instantiates a new HttpBackendPatch 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 NewHttpBackendPatch(types HttpBackendPatchGetTypeArgType) *HttpBackendPatch { + this := HttpBackendPatch{} + setHttpBackendPatchGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewHttpBackendPatchWithDefaults instantiates a new HttpBackendPatch 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 NewHttpBackendPatchWithDefaults() *HttpBackendPatch { + this := HttpBackendPatch{} + return &this +} + +// GetGeofencing returns the Geofencing field value if set, zero value otherwise. +func (o *HttpBackendPatch) GetGeofencing() (res HttpBackendPatchGetGeofencingRetType) { + res, _ = o.GetGeofencingOk() + return +} + +// GetGeofencingOk returns a tuple with the Geofencing field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpBackendPatch) GetGeofencingOk() (ret HttpBackendPatchGetGeofencingRetType, ok bool) { + return getHttpBackendPatchGetGeofencingAttributeTypeOk(o.Geofencing) +} + +// HasGeofencing returns a boolean if a field has been set. +func (o *HttpBackendPatch) HasGeofencing() bool { + _, ok := o.GetGeofencingOk() + return ok +} + +// SetGeofencing gets a reference to the given map[string][]string and assigns it to the Geofencing field. +func (o *HttpBackendPatch) SetGeofencing(v HttpBackendPatchGetGeofencingRetType) { + setHttpBackendPatchGetGeofencingAttributeType(&o.Geofencing, v) +} + +// GetOriginRequestHeaders returns the OriginRequestHeaders field value if set, zero value otherwise. +func (o *HttpBackendPatch) GetOriginRequestHeaders() (res HttpBackendPatchGetOriginRequestHeadersRetType) { + res, _ = o.GetOriginRequestHeadersOk() + return +} + +// GetOriginRequestHeadersOk returns a tuple with the OriginRequestHeaders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpBackendPatch) GetOriginRequestHeadersOk() (ret HttpBackendPatchGetOriginRequestHeadersRetType, ok bool) { + return getHttpBackendPatchGetOriginRequestHeadersAttributeTypeOk(o.OriginRequestHeaders) +} + +// HasOriginRequestHeaders returns a boolean if a field has been set. +func (o *HttpBackendPatch) HasOriginRequestHeaders() bool { + _, ok := o.GetOriginRequestHeadersOk() + return ok +} + +// SetOriginRequestHeaders gets a reference to the given map[string]string and assigns it to the OriginRequestHeaders field. +func (o *HttpBackendPatch) SetOriginRequestHeaders(v HttpBackendPatchGetOriginRequestHeadersRetType) { + setHttpBackendPatchGetOriginRequestHeadersAttributeType(&o.OriginRequestHeaders, v) +} + +// GetOriginUrl returns the OriginUrl field value if set, zero value otherwise. +func (o *HttpBackendPatch) GetOriginUrl() (res HttpBackendPatchGetOriginUrlRetType) { + res, _ = o.GetOriginUrlOk() + return +} + +// GetOriginUrlOk returns a tuple with the OriginUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpBackendPatch) GetOriginUrlOk() (ret HttpBackendPatchGetOriginUrlRetType, ok bool) { + return getHttpBackendPatchGetOriginUrlAttributeTypeOk(o.OriginUrl) +} + +// HasOriginUrl returns a boolean if a field has been set. +func (o *HttpBackendPatch) HasOriginUrl() bool { + _, ok := o.GetOriginUrlOk() + return ok +} + +// SetOriginUrl gets a reference to the given string and assigns it to the OriginUrl field. +func (o *HttpBackendPatch) SetOriginUrl(v HttpBackendPatchGetOriginUrlRetType) { + setHttpBackendPatchGetOriginUrlAttributeType(&o.OriginUrl, v) +} + +// GetType returns the Type field value +func (o *HttpBackendPatch) GetType() (ret HttpBackendPatchGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *HttpBackendPatch) GetTypeOk() (ret HttpBackendPatchGetTypeRetType, ok bool) { + return getHttpBackendPatchGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *HttpBackendPatch) SetType(v HttpBackendPatchGetTypeRetType) { + setHttpBackendPatchGetTypeAttributeType(&o.Type, v) +} + +func (o HttpBackendPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getHttpBackendPatchGetGeofencingAttributeTypeOk(o.Geofencing); ok { + toSerialize["Geofencing"] = val + } + if val, ok := getHttpBackendPatchGetOriginRequestHeadersAttributeTypeOk(o.OriginRequestHeaders); ok { + toSerialize["OriginRequestHeaders"] = val + } + if val, ok := getHttpBackendPatchGetOriginUrlAttributeTypeOk(o.OriginUrl); ok { + toSerialize["OriginUrl"] = val + } + if val, ok := getHttpBackendPatchGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableHttpBackendPatch struct { + value *HttpBackendPatch + isSet bool +} + +func (v NullableHttpBackendPatch) Get() *HttpBackendPatch { + return v.value +} + +func (v *NullableHttpBackendPatch) Set(val *HttpBackendPatch) { + v.value = val + v.isSet = true +} + +func (v NullableHttpBackendPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableHttpBackendPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHttpBackendPatch(val *HttpBackendPatch) *NullableHttpBackendPatch { + return &NullableHttpBackendPatch{value: val, isSet: true} +} + +func (v NullableHttpBackendPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHttpBackendPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_http_backend_patch_test.go b/pkg/cdnbeta/model_http_backend_patch_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_http_backend_patch_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_http_backend_test.go b/pkg/cdnbeta/model_http_backend_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_http_backend_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_list_distributions_response.go b/pkg/cdnbeta/model_list_distributions_response.go new file mode 100644 index 00000000..56b22fde --- /dev/null +++ b/pkg/cdnbeta/model_list_distributions_response.go @@ -0,0 +1,173 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the ListDistributionsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListDistributionsResponse{} + +/* + types and functions for distributions +*/ + +// isArray +type ListDistributionsResponseGetDistributionsAttributeType = *[]Distribution +type ListDistributionsResponseGetDistributionsArgType = []Distribution +type ListDistributionsResponseGetDistributionsRetType = []Distribution + +func getListDistributionsResponseGetDistributionsAttributeTypeOk(arg ListDistributionsResponseGetDistributionsAttributeType) (ret ListDistributionsResponseGetDistributionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListDistributionsResponseGetDistributionsAttributeType(arg *ListDistributionsResponseGetDistributionsAttributeType, val ListDistributionsResponseGetDistributionsRetType) { + *arg = &val +} + +/* + types and functions for nextPageIdentifier +*/ + +// isNotNullableString +type ListDistributionsResponseGetNextPageIdentifierAttributeType = *string + +func getListDistributionsResponseGetNextPageIdentifierAttributeTypeOk(arg ListDistributionsResponseGetNextPageIdentifierAttributeType) (ret ListDistributionsResponseGetNextPageIdentifierRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListDistributionsResponseGetNextPageIdentifierAttributeType(arg *ListDistributionsResponseGetNextPageIdentifierAttributeType, val ListDistributionsResponseGetNextPageIdentifierRetType) { + *arg = &val +} + +type ListDistributionsResponseGetNextPageIdentifierArgType = string +type ListDistributionsResponseGetNextPageIdentifierRetType = string + +// ListDistributionsResponse struct for ListDistributionsResponse +type ListDistributionsResponse struct { + // REQUIRED + Distributions ListDistributionsResponseGetDistributionsAttributeType `json:"distributions" required:"true"` + NextPageIdentifier ListDistributionsResponseGetNextPageIdentifierAttributeType `json:"nextPageIdentifier,omitempty"` +} + +type _ListDistributionsResponse ListDistributionsResponse + +// NewListDistributionsResponse instantiates a new ListDistributionsResponse 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 NewListDistributionsResponse(distributions ListDistributionsResponseGetDistributionsArgType) *ListDistributionsResponse { + this := ListDistributionsResponse{} + setListDistributionsResponseGetDistributionsAttributeType(&this.Distributions, distributions) + return &this +} + +// NewListDistributionsResponseWithDefaults instantiates a new ListDistributionsResponse 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 NewListDistributionsResponseWithDefaults() *ListDistributionsResponse { + this := ListDistributionsResponse{} + return &this +} + +// GetDistributions returns the Distributions field value +func (o *ListDistributionsResponse) GetDistributions() (ret ListDistributionsResponseGetDistributionsRetType) { + ret, _ = o.GetDistributionsOk() + return ret +} + +// GetDistributionsOk returns a tuple with the Distributions field value +// and a boolean to check if the value has been set. +func (o *ListDistributionsResponse) GetDistributionsOk() (ret ListDistributionsResponseGetDistributionsRetType, ok bool) { + return getListDistributionsResponseGetDistributionsAttributeTypeOk(o.Distributions) +} + +// SetDistributions sets field value +func (o *ListDistributionsResponse) SetDistributions(v ListDistributionsResponseGetDistributionsRetType) { + setListDistributionsResponseGetDistributionsAttributeType(&o.Distributions, v) +} + +// GetNextPageIdentifier returns the NextPageIdentifier field value if set, zero value otherwise. +func (o *ListDistributionsResponse) GetNextPageIdentifier() (res ListDistributionsResponseGetNextPageIdentifierRetType) { + res, _ = o.GetNextPageIdentifierOk() + return +} + +// GetNextPageIdentifierOk returns a tuple with the NextPageIdentifier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListDistributionsResponse) GetNextPageIdentifierOk() (ret ListDistributionsResponseGetNextPageIdentifierRetType, ok bool) { + return getListDistributionsResponseGetNextPageIdentifierAttributeTypeOk(o.NextPageIdentifier) +} + +// HasNextPageIdentifier returns a boolean if a field has been set. +func (o *ListDistributionsResponse) HasNextPageIdentifier() bool { + _, ok := o.GetNextPageIdentifierOk() + return ok +} + +// SetNextPageIdentifier gets a reference to the given string and assigns it to the NextPageIdentifier field. +func (o *ListDistributionsResponse) SetNextPageIdentifier(v ListDistributionsResponseGetNextPageIdentifierRetType) { + setListDistributionsResponseGetNextPageIdentifierAttributeType(&o.NextPageIdentifier, v) +} + +func (o ListDistributionsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListDistributionsResponseGetDistributionsAttributeTypeOk(o.Distributions); ok { + toSerialize["Distributions"] = val + } + if val, ok := getListDistributionsResponseGetNextPageIdentifierAttributeTypeOk(o.NextPageIdentifier); ok { + toSerialize["NextPageIdentifier"] = val + } + return toSerialize, nil +} + +type NullableListDistributionsResponse struct { + value *ListDistributionsResponse + isSet bool +} + +func (v NullableListDistributionsResponse) Get() *ListDistributionsResponse { + return v.value +} + +func (v *NullableListDistributionsResponse) Set(val *ListDistributionsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListDistributionsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListDistributionsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListDistributionsResponse(val *ListDistributionsResponse) *NullableListDistributionsResponse { + return &NullableListDistributionsResponse{value: val, isSet: true} +} + +func (v NullableListDistributionsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListDistributionsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_list_distributions_response_test.go b/pkg/cdnbeta/model_list_distributions_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_list_distributions_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_list_waf_collections_response.go b/pkg/cdnbeta/model_list_waf_collections_response.go new file mode 100644 index 00000000..6f9a6d6d --- /dev/null +++ b/pkg/cdnbeta/model_list_waf_collections_response.go @@ -0,0 +1,125 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the ListWafCollectionsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListWafCollectionsResponse{} + +/* + types and functions for collections +*/ + +// isArray +type ListWafCollectionsResponseGetCollectionsAttributeType = *[]WafRuleCollection +type ListWafCollectionsResponseGetCollectionsArgType = []WafRuleCollection +type ListWafCollectionsResponseGetCollectionsRetType = []WafRuleCollection + +func getListWafCollectionsResponseGetCollectionsAttributeTypeOk(arg ListWafCollectionsResponseGetCollectionsAttributeType) (ret ListWafCollectionsResponseGetCollectionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListWafCollectionsResponseGetCollectionsAttributeType(arg *ListWafCollectionsResponseGetCollectionsAttributeType, val ListWafCollectionsResponseGetCollectionsRetType) { + *arg = &val +} + +// ListWafCollectionsResponse struct for ListWafCollectionsResponse +type ListWafCollectionsResponse struct { + // REQUIRED + Collections ListWafCollectionsResponseGetCollectionsAttributeType `json:"collections" required:"true"` +} + +type _ListWafCollectionsResponse ListWafCollectionsResponse + +// NewListWafCollectionsResponse instantiates a new ListWafCollectionsResponse 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 NewListWafCollectionsResponse(collections ListWafCollectionsResponseGetCollectionsArgType) *ListWafCollectionsResponse { + this := ListWafCollectionsResponse{} + setListWafCollectionsResponseGetCollectionsAttributeType(&this.Collections, collections) + return &this +} + +// NewListWafCollectionsResponseWithDefaults instantiates a new ListWafCollectionsResponse 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 NewListWafCollectionsResponseWithDefaults() *ListWafCollectionsResponse { + this := ListWafCollectionsResponse{} + return &this +} + +// GetCollections returns the Collections field value +func (o *ListWafCollectionsResponse) GetCollections() (ret ListWafCollectionsResponseGetCollectionsRetType) { + ret, _ = o.GetCollectionsOk() + return ret +} + +// GetCollectionsOk returns a tuple with the Collections field value +// and a boolean to check if the value has been set. +func (o *ListWafCollectionsResponse) GetCollectionsOk() (ret ListWafCollectionsResponseGetCollectionsRetType, ok bool) { + return getListWafCollectionsResponseGetCollectionsAttributeTypeOk(o.Collections) +} + +// SetCollections sets field value +func (o *ListWafCollectionsResponse) SetCollections(v ListWafCollectionsResponseGetCollectionsRetType) { + setListWafCollectionsResponseGetCollectionsAttributeType(&o.Collections, v) +} + +func (o ListWafCollectionsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListWafCollectionsResponseGetCollectionsAttributeTypeOk(o.Collections); ok { + toSerialize["Collections"] = val + } + return toSerialize, nil +} + +type NullableListWafCollectionsResponse struct { + value *ListWafCollectionsResponse + isSet bool +} + +func (v NullableListWafCollectionsResponse) Get() *ListWafCollectionsResponse { + return v.value +} + +func (v *NullableListWafCollectionsResponse) Set(val *ListWafCollectionsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListWafCollectionsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListWafCollectionsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListWafCollectionsResponse(val *ListWafCollectionsResponse) *NullableListWafCollectionsResponse { + return &NullableListWafCollectionsResponse{value: val, isSet: true} +} + +func (v NullableListWafCollectionsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListWafCollectionsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_list_waf_collections_response_test.go b/pkg/cdnbeta/model_list_waf_collections_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_list_waf_collections_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_loki_log_sink.go b/pkg/cdnbeta/model_loki_log_sink.go new file mode 100644 index 00000000..621e85b4 --- /dev/null +++ b/pkg/cdnbeta/model_loki_log_sink.go @@ -0,0 +1,170 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the LokiLogSink type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LokiLogSink{} + +/* + types and functions for pushUrl +*/ + +// isNotNullableString +type LokiLogSinkGetPushUrlAttributeType = *string + +func getLokiLogSinkGetPushUrlAttributeTypeOk(arg LokiLogSinkGetPushUrlAttributeType) (ret LokiLogSinkGetPushUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkGetPushUrlAttributeType(arg *LokiLogSinkGetPushUrlAttributeType, val LokiLogSinkGetPushUrlRetType) { + *arg = &val +} + +type LokiLogSinkGetPushUrlArgType = string +type LokiLogSinkGetPushUrlRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type LokiLogSinkGetTypeAttributeType = *string + +func getLokiLogSinkGetTypeAttributeTypeOk(arg LokiLogSinkGetTypeAttributeType) (ret LokiLogSinkGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkGetTypeAttributeType(arg *LokiLogSinkGetTypeAttributeType, val LokiLogSinkGetTypeRetType) { + *arg = &val +} + +type LokiLogSinkGetTypeArgType = string +type LokiLogSinkGetTypeRetType = string + +// LokiLogSink struct for LokiLogSink +type LokiLogSink struct { + // REQUIRED + PushUrl LokiLogSinkGetPushUrlAttributeType `json:"pushUrl" required:"true"` + // REQUIRED + Type LokiLogSinkGetTypeAttributeType `json:"type" required:"true"` +} + +type _LokiLogSink LokiLogSink + +// NewLokiLogSink instantiates a new LokiLogSink 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 NewLokiLogSink(pushUrl LokiLogSinkGetPushUrlArgType, types LokiLogSinkGetTypeArgType) *LokiLogSink { + this := LokiLogSink{} + setLokiLogSinkGetPushUrlAttributeType(&this.PushUrl, pushUrl) + setLokiLogSinkGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewLokiLogSinkWithDefaults instantiates a new LokiLogSink 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 NewLokiLogSinkWithDefaults() *LokiLogSink { + this := LokiLogSink{} + return &this +} + +// GetPushUrl returns the PushUrl field value +func (o *LokiLogSink) GetPushUrl() (ret LokiLogSinkGetPushUrlRetType) { + ret, _ = o.GetPushUrlOk() + return ret +} + +// GetPushUrlOk returns a tuple with the PushUrl field value +// and a boolean to check if the value has been set. +func (o *LokiLogSink) GetPushUrlOk() (ret LokiLogSinkGetPushUrlRetType, ok bool) { + return getLokiLogSinkGetPushUrlAttributeTypeOk(o.PushUrl) +} + +// SetPushUrl sets field value +func (o *LokiLogSink) SetPushUrl(v LokiLogSinkGetPushUrlRetType) { + setLokiLogSinkGetPushUrlAttributeType(&o.PushUrl, v) +} + +// GetType returns the Type field value +func (o *LokiLogSink) GetType() (ret LokiLogSinkGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *LokiLogSink) GetTypeOk() (ret LokiLogSinkGetTypeRetType, ok bool) { + return getLokiLogSinkGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *LokiLogSink) SetType(v LokiLogSinkGetTypeRetType) { + setLokiLogSinkGetTypeAttributeType(&o.Type, v) +} + +func (o LokiLogSink) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLokiLogSinkGetPushUrlAttributeTypeOk(o.PushUrl); ok { + toSerialize["PushUrl"] = val + } + if val, ok := getLokiLogSinkGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableLokiLogSink struct { + value *LokiLogSink + isSet bool +} + +func (v NullableLokiLogSink) Get() *LokiLogSink { + return v.value +} + +func (v *NullableLokiLogSink) Set(val *LokiLogSink) { + v.value = val + v.isSet = true +} + +func (v NullableLokiLogSink) IsSet() bool { + return v.isSet +} + +func (v *NullableLokiLogSink) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLokiLogSink(val *LokiLogSink) *NullableLokiLogSink { + return &NullableLokiLogSink{value: val, isSet: true} +} + +func (v NullableLokiLogSink) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLokiLogSink) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_loki_log_sink_create.go b/pkg/cdnbeta/model_loki_log_sink_create.go new file mode 100644 index 00000000..ec81b4ba --- /dev/null +++ b/pkg/cdnbeta/model_loki_log_sink_create.go @@ -0,0 +1,213 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the LokiLogSinkCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LokiLogSinkCreate{} + +/* + types and functions for credentials +*/ + +// isModel +type LokiLogSinkCreateGetCredentialsAttributeType = *LokiLogSinkCredentials +type LokiLogSinkCreateGetCredentialsArgType = LokiLogSinkCredentials +type LokiLogSinkCreateGetCredentialsRetType = LokiLogSinkCredentials + +func getLokiLogSinkCreateGetCredentialsAttributeTypeOk(arg LokiLogSinkCreateGetCredentialsAttributeType) (ret LokiLogSinkCreateGetCredentialsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkCreateGetCredentialsAttributeType(arg *LokiLogSinkCreateGetCredentialsAttributeType, val LokiLogSinkCreateGetCredentialsRetType) { + *arg = &val +} + +/* + types and functions for pushUrl +*/ + +// isNotNullableString +type LokiLogSinkCreateGetPushUrlAttributeType = *string + +func getLokiLogSinkCreateGetPushUrlAttributeTypeOk(arg LokiLogSinkCreateGetPushUrlAttributeType) (ret LokiLogSinkCreateGetPushUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkCreateGetPushUrlAttributeType(arg *LokiLogSinkCreateGetPushUrlAttributeType, val LokiLogSinkCreateGetPushUrlRetType) { + *arg = &val +} + +type LokiLogSinkCreateGetPushUrlArgType = string +type LokiLogSinkCreateGetPushUrlRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type LokiLogSinkCreateGetTypeAttributeType = *string + +func getLokiLogSinkCreateGetTypeAttributeTypeOk(arg LokiLogSinkCreateGetTypeAttributeType) (ret LokiLogSinkCreateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkCreateGetTypeAttributeType(arg *LokiLogSinkCreateGetTypeAttributeType, val LokiLogSinkCreateGetTypeRetType) { + *arg = &val +} + +type LokiLogSinkCreateGetTypeArgType = string +type LokiLogSinkCreateGetTypeRetType = string + +// LokiLogSinkCreate struct for LokiLogSinkCreate +type LokiLogSinkCreate struct { + // REQUIRED + Credentials LokiLogSinkCreateGetCredentialsAttributeType `json:"credentials" required:"true"` + // REQUIRED + PushUrl LokiLogSinkCreateGetPushUrlAttributeType `json:"pushUrl" required:"true"` + // REQUIRED + Type LokiLogSinkCreateGetTypeAttributeType `json:"type" required:"true"` +} + +type _LokiLogSinkCreate LokiLogSinkCreate + +// NewLokiLogSinkCreate instantiates a new LokiLogSinkCreate 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 NewLokiLogSinkCreate(credentials LokiLogSinkCreateGetCredentialsArgType, pushUrl LokiLogSinkCreateGetPushUrlArgType, types LokiLogSinkCreateGetTypeArgType) *LokiLogSinkCreate { + this := LokiLogSinkCreate{} + setLokiLogSinkCreateGetCredentialsAttributeType(&this.Credentials, credentials) + setLokiLogSinkCreateGetPushUrlAttributeType(&this.PushUrl, pushUrl) + setLokiLogSinkCreateGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewLokiLogSinkCreateWithDefaults instantiates a new LokiLogSinkCreate 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 NewLokiLogSinkCreateWithDefaults() *LokiLogSinkCreate { + this := LokiLogSinkCreate{} + return &this +} + +// GetCredentials returns the Credentials field value +func (o *LokiLogSinkCreate) GetCredentials() (ret LokiLogSinkCreateGetCredentialsRetType) { + ret, _ = o.GetCredentialsOk() + return ret +} + +// GetCredentialsOk returns a tuple with the Credentials field value +// and a boolean to check if the value has been set. +func (o *LokiLogSinkCreate) GetCredentialsOk() (ret LokiLogSinkCreateGetCredentialsRetType, ok bool) { + return getLokiLogSinkCreateGetCredentialsAttributeTypeOk(o.Credentials) +} + +// SetCredentials sets field value +func (o *LokiLogSinkCreate) SetCredentials(v LokiLogSinkCreateGetCredentialsRetType) { + setLokiLogSinkCreateGetCredentialsAttributeType(&o.Credentials, v) +} + +// GetPushUrl returns the PushUrl field value +func (o *LokiLogSinkCreate) GetPushUrl() (ret LokiLogSinkCreateGetPushUrlRetType) { + ret, _ = o.GetPushUrlOk() + return ret +} + +// GetPushUrlOk returns a tuple with the PushUrl field value +// and a boolean to check if the value has been set. +func (o *LokiLogSinkCreate) GetPushUrlOk() (ret LokiLogSinkCreateGetPushUrlRetType, ok bool) { + return getLokiLogSinkCreateGetPushUrlAttributeTypeOk(o.PushUrl) +} + +// SetPushUrl sets field value +func (o *LokiLogSinkCreate) SetPushUrl(v LokiLogSinkCreateGetPushUrlRetType) { + setLokiLogSinkCreateGetPushUrlAttributeType(&o.PushUrl, v) +} + +// GetType returns the Type field value +func (o *LokiLogSinkCreate) GetType() (ret LokiLogSinkCreateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *LokiLogSinkCreate) GetTypeOk() (ret LokiLogSinkCreateGetTypeRetType, ok bool) { + return getLokiLogSinkCreateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *LokiLogSinkCreate) SetType(v LokiLogSinkCreateGetTypeRetType) { + setLokiLogSinkCreateGetTypeAttributeType(&o.Type, v) +} + +func (o LokiLogSinkCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLokiLogSinkCreateGetCredentialsAttributeTypeOk(o.Credentials); ok { + toSerialize["Credentials"] = val + } + if val, ok := getLokiLogSinkCreateGetPushUrlAttributeTypeOk(o.PushUrl); ok { + toSerialize["PushUrl"] = val + } + if val, ok := getLokiLogSinkCreateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableLokiLogSinkCreate struct { + value *LokiLogSinkCreate + isSet bool +} + +func (v NullableLokiLogSinkCreate) Get() *LokiLogSinkCreate { + return v.value +} + +func (v *NullableLokiLogSinkCreate) Set(val *LokiLogSinkCreate) { + v.value = val + v.isSet = true +} + +func (v NullableLokiLogSinkCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableLokiLogSinkCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLokiLogSinkCreate(val *LokiLogSinkCreate) *NullableLokiLogSinkCreate { + return &NullableLokiLogSinkCreate{value: val, isSet: true} +} + +func (v NullableLokiLogSinkCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLokiLogSinkCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_loki_log_sink_create_test.go b/pkg/cdnbeta/model_loki_log_sink_create_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_loki_log_sink_create_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_loki_log_sink_credentials.go b/pkg/cdnbeta/model_loki_log_sink_credentials.go new file mode 100644 index 00000000..6f7d530d --- /dev/null +++ b/pkg/cdnbeta/model_loki_log_sink_credentials.go @@ -0,0 +1,170 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the LokiLogSinkCredentials type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LokiLogSinkCredentials{} + +/* + types and functions for password +*/ + +// isNotNullableString +type LokiLogSinkCredentialsGetPasswordAttributeType = *string + +func getLokiLogSinkCredentialsGetPasswordAttributeTypeOk(arg LokiLogSinkCredentialsGetPasswordAttributeType) (ret LokiLogSinkCredentialsGetPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkCredentialsGetPasswordAttributeType(arg *LokiLogSinkCredentialsGetPasswordAttributeType, val LokiLogSinkCredentialsGetPasswordRetType) { + *arg = &val +} + +type LokiLogSinkCredentialsGetPasswordArgType = string +type LokiLogSinkCredentialsGetPasswordRetType = string + +/* + types and functions for username +*/ + +// isNotNullableString +type LokiLogSinkCredentialsGetUsernameAttributeType = *string + +func getLokiLogSinkCredentialsGetUsernameAttributeTypeOk(arg LokiLogSinkCredentialsGetUsernameAttributeType) (ret LokiLogSinkCredentialsGetUsernameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkCredentialsGetUsernameAttributeType(arg *LokiLogSinkCredentialsGetUsernameAttributeType, val LokiLogSinkCredentialsGetUsernameRetType) { + *arg = &val +} + +type LokiLogSinkCredentialsGetUsernameArgType = string +type LokiLogSinkCredentialsGetUsernameRetType = string + +// LokiLogSinkCredentials struct for LokiLogSinkCredentials +type LokiLogSinkCredentials struct { + // REQUIRED + Password LokiLogSinkCredentialsGetPasswordAttributeType `json:"password" required:"true"` + // REQUIRED + Username LokiLogSinkCredentialsGetUsernameAttributeType `json:"username" required:"true"` +} + +type _LokiLogSinkCredentials LokiLogSinkCredentials + +// NewLokiLogSinkCredentials instantiates a new LokiLogSinkCredentials 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 NewLokiLogSinkCredentials(password LokiLogSinkCredentialsGetPasswordArgType, username LokiLogSinkCredentialsGetUsernameArgType) *LokiLogSinkCredentials { + this := LokiLogSinkCredentials{} + setLokiLogSinkCredentialsGetPasswordAttributeType(&this.Password, password) + setLokiLogSinkCredentialsGetUsernameAttributeType(&this.Username, username) + return &this +} + +// NewLokiLogSinkCredentialsWithDefaults instantiates a new LokiLogSinkCredentials 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 NewLokiLogSinkCredentialsWithDefaults() *LokiLogSinkCredentials { + this := LokiLogSinkCredentials{} + return &this +} + +// GetPassword returns the Password field value +func (o *LokiLogSinkCredentials) GetPassword() (ret LokiLogSinkCredentialsGetPasswordRetType) { + ret, _ = o.GetPasswordOk() + return ret +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *LokiLogSinkCredentials) GetPasswordOk() (ret LokiLogSinkCredentialsGetPasswordRetType, ok bool) { + return getLokiLogSinkCredentialsGetPasswordAttributeTypeOk(o.Password) +} + +// SetPassword sets field value +func (o *LokiLogSinkCredentials) SetPassword(v LokiLogSinkCredentialsGetPasswordRetType) { + setLokiLogSinkCredentialsGetPasswordAttributeType(&o.Password, v) +} + +// GetUsername returns the Username field value +func (o *LokiLogSinkCredentials) GetUsername() (ret LokiLogSinkCredentialsGetUsernameRetType) { + ret, _ = o.GetUsernameOk() + return ret +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *LokiLogSinkCredentials) GetUsernameOk() (ret LokiLogSinkCredentialsGetUsernameRetType, ok bool) { + return getLokiLogSinkCredentialsGetUsernameAttributeTypeOk(o.Username) +} + +// SetUsername sets field value +func (o *LokiLogSinkCredentials) SetUsername(v LokiLogSinkCredentialsGetUsernameRetType) { + setLokiLogSinkCredentialsGetUsernameAttributeType(&o.Username, v) +} + +func (o LokiLogSinkCredentials) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLokiLogSinkCredentialsGetPasswordAttributeTypeOk(o.Password); ok { + toSerialize["Password"] = val + } + if val, ok := getLokiLogSinkCredentialsGetUsernameAttributeTypeOk(o.Username); ok { + toSerialize["Username"] = val + } + return toSerialize, nil +} + +type NullableLokiLogSinkCredentials struct { + value *LokiLogSinkCredentials + isSet bool +} + +func (v NullableLokiLogSinkCredentials) Get() *LokiLogSinkCredentials { + return v.value +} + +func (v *NullableLokiLogSinkCredentials) Set(val *LokiLogSinkCredentials) { + v.value = val + v.isSet = true +} + +func (v NullableLokiLogSinkCredentials) IsSet() bool { + return v.isSet +} + +func (v *NullableLokiLogSinkCredentials) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLokiLogSinkCredentials(val *LokiLogSinkCredentials) *NullableLokiLogSinkCredentials { + return &NullableLokiLogSinkCredentials{value: val, isSet: true} +} + +func (v NullableLokiLogSinkCredentials) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLokiLogSinkCredentials) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_loki_log_sink_credentials_test.go b/pkg/cdnbeta/model_loki_log_sink_credentials_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_loki_log_sink_credentials_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_loki_log_sink_patch.go b/pkg/cdnbeta/model_loki_log_sink_patch.go new file mode 100644 index 00000000..24505a26 --- /dev/null +++ b/pkg/cdnbeta/model_loki_log_sink_patch.go @@ -0,0 +1,221 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the LokiLogSinkPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LokiLogSinkPatch{} + +/* + types and functions for credentials +*/ + +// isModel +type LokiLogSinkPatchGetCredentialsAttributeType = *LokiLogSinkCredentials +type LokiLogSinkPatchGetCredentialsArgType = LokiLogSinkCredentials +type LokiLogSinkPatchGetCredentialsRetType = LokiLogSinkCredentials + +func getLokiLogSinkPatchGetCredentialsAttributeTypeOk(arg LokiLogSinkPatchGetCredentialsAttributeType) (ret LokiLogSinkPatchGetCredentialsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkPatchGetCredentialsAttributeType(arg *LokiLogSinkPatchGetCredentialsAttributeType, val LokiLogSinkPatchGetCredentialsRetType) { + *arg = &val +} + +/* + types and functions for pushUrl +*/ + +// isNotNullableString +type LokiLogSinkPatchGetPushUrlAttributeType = *string + +func getLokiLogSinkPatchGetPushUrlAttributeTypeOk(arg LokiLogSinkPatchGetPushUrlAttributeType) (ret LokiLogSinkPatchGetPushUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkPatchGetPushUrlAttributeType(arg *LokiLogSinkPatchGetPushUrlAttributeType, val LokiLogSinkPatchGetPushUrlRetType) { + *arg = &val +} + +type LokiLogSinkPatchGetPushUrlArgType = string +type LokiLogSinkPatchGetPushUrlRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type LokiLogSinkPatchGetTypeAttributeType = *string + +func getLokiLogSinkPatchGetTypeAttributeTypeOk(arg LokiLogSinkPatchGetTypeAttributeType) (ret LokiLogSinkPatchGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLokiLogSinkPatchGetTypeAttributeType(arg *LokiLogSinkPatchGetTypeAttributeType, val LokiLogSinkPatchGetTypeRetType) { + *arg = &val +} + +type LokiLogSinkPatchGetTypeArgType = string +type LokiLogSinkPatchGetTypeRetType = string + +// LokiLogSinkPatch struct for LokiLogSinkPatch +type LokiLogSinkPatch struct { + Credentials LokiLogSinkPatchGetCredentialsAttributeType `json:"credentials,omitempty"` + PushUrl LokiLogSinkPatchGetPushUrlAttributeType `json:"pushUrl,omitempty"` + // REQUIRED + Type LokiLogSinkPatchGetTypeAttributeType `json:"type" required:"true"` +} + +type _LokiLogSinkPatch LokiLogSinkPatch + +// NewLokiLogSinkPatch instantiates a new LokiLogSinkPatch 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 NewLokiLogSinkPatch(types LokiLogSinkPatchGetTypeArgType) *LokiLogSinkPatch { + this := LokiLogSinkPatch{} + setLokiLogSinkPatchGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewLokiLogSinkPatchWithDefaults instantiates a new LokiLogSinkPatch 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 NewLokiLogSinkPatchWithDefaults() *LokiLogSinkPatch { + this := LokiLogSinkPatch{} + return &this +} + +// GetCredentials returns the Credentials field value if set, zero value otherwise. +func (o *LokiLogSinkPatch) GetCredentials() (res LokiLogSinkPatchGetCredentialsRetType) { + res, _ = o.GetCredentialsOk() + return +} + +// GetCredentialsOk returns a tuple with the Credentials field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LokiLogSinkPatch) GetCredentialsOk() (ret LokiLogSinkPatchGetCredentialsRetType, ok bool) { + return getLokiLogSinkPatchGetCredentialsAttributeTypeOk(o.Credentials) +} + +// HasCredentials returns a boolean if a field has been set. +func (o *LokiLogSinkPatch) HasCredentials() bool { + _, ok := o.GetCredentialsOk() + return ok +} + +// SetCredentials gets a reference to the given LokiLogSinkCredentials and assigns it to the Credentials field. +func (o *LokiLogSinkPatch) SetCredentials(v LokiLogSinkPatchGetCredentialsRetType) { + setLokiLogSinkPatchGetCredentialsAttributeType(&o.Credentials, v) +} + +// GetPushUrl returns the PushUrl field value if set, zero value otherwise. +func (o *LokiLogSinkPatch) GetPushUrl() (res LokiLogSinkPatchGetPushUrlRetType) { + res, _ = o.GetPushUrlOk() + return +} + +// GetPushUrlOk returns a tuple with the PushUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LokiLogSinkPatch) GetPushUrlOk() (ret LokiLogSinkPatchGetPushUrlRetType, ok bool) { + return getLokiLogSinkPatchGetPushUrlAttributeTypeOk(o.PushUrl) +} + +// HasPushUrl returns a boolean if a field has been set. +func (o *LokiLogSinkPatch) HasPushUrl() bool { + _, ok := o.GetPushUrlOk() + return ok +} + +// SetPushUrl gets a reference to the given string and assigns it to the PushUrl field. +func (o *LokiLogSinkPatch) SetPushUrl(v LokiLogSinkPatchGetPushUrlRetType) { + setLokiLogSinkPatchGetPushUrlAttributeType(&o.PushUrl, v) +} + +// GetType returns the Type field value +func (o *LokiLogSinkPatch) GetType() (ret LokiLogSinkPatchGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *LokiLogSinkPatch) GetTypeOk() (ret LokiLogSinkPatchGetTypeRetType, ok bool) { + return getLokiLogSinkPatchGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *LokiLogSinkPatch) SetType(v LokiLogSinkPatchGetTypeRetType) { + setLokiLogSinkPatchGetTypeAttributeType(&o.Type, v) +} + +func (o LokiLogSinkPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLokiLogSinkPatchGetCredentialsAttributeTypeOk(o.Credentials); ok { + toSerialize["Credentials"] = val + } + if val, ok := getLokiLogSinkPatchGetPushUrlAttributeTypeOk(o.PushUrl); ok { + toSerialize["PushUrl"] = val + } + if val, ok := getLokiLogSinkPatchGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableLokiLogSinkPatch struct { + value *LokiLogSinkPatch + isSet bool +} + +func (v NullableLokiLogSinkPatch) Get() *LokiLogSinkPatch { + return v.value +} + +func (v *NullableLokiLogSinkPatch) Set(val *LokiLogSinkPatch) { + v.value = val + v.isSet = true +} + +func (v NullableLokiLogSinkPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableLokiLogSinkPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLokiLogSinkPatch(val *LokiLogSinkPatch) *NullableLokiLogSinkPatch { + return &NullableLokiLogSinkPatch{value: val, isSet: true} +} + +func (v NullableLokiLogSinkPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLokiLogSinkPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_loki_log_sink_patch_test.go b/pkg/cdnbeta/model_loki_log_sink_patch_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_loki_log_sink_patch_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_loki_log_sink_test.go b/pkg/cdnbeta/model_loki_log_sink_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_loki_log_sink_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_optimizer.go b/pkg/cdnbeta/model_optimizer.go new file mode 100644 index 00000000..b96bfc82 --- /dev/null +++ b/pkg/cdnbeta/model_optimizer.go @@ -0,0 +1,126 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the Optimizer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Optimizer{} + +/* + types and functions for enabled +*/ + +// isBoolean +type OptimizergetEnabledAttributeType = *bool +type OptimizergetEnabledArgType = bool +type OptimizergetEnabledRetType = bool + +func getOptimizergetEnabledAttributeTypeOk(arg OptimizergetEnabledAttributeType) (ret OptimizergetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setOptimizergetEnabledAttributeType(arg *OptimizergetEnabledAttributeType, val OptimizergetEnabledRetType) { + *arg = &val +} + +// Optimizer Optimizer is paid feature, a real-time on the fly image manipulation and optimization service that automatically optimizes your images for faster image delivery. +type Optimizer struct { + // Determines if the optimizer should be enabled for this distribution and incurs a monthly fee + // REQUIRED + Enabled OptimizergetEnabledAttributeType `json:"enabled" required:"true"` +} + +type _Optimizer Optimizer + +// NewOptimizer instantiates a new Optimizer 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 NewOptimizer(enabled OptimizergetEnabledArgType) *Optimizer { + this := Optimizer{} + setOptimizergetEnabledAttributeType(&this.Enabled, enabled) + return &this +} + +// NewOptimizerWithDefaults instantiates a new Optimizer 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 NewOptimizerWithDefaults() *Optimizer { + this := Optimizer{} + return &this +} + +// GetEnabled returns the Enabled field value +func (o *Optimizer) GetEnabled() (ret OptimizergetEnabledRetType) { + ret, _ = o.GetEnabledOk() + return ret +} + +// GetEnabledOk returns a tuple with the Enabled field value +// and a boolean to check if the value has been set. +func (o *Optimizer) GetEnabledOk() (ret OptimizergetEnabledRetType, ok bool) { + return getOptimizergetEnabledAttributeTypeOk(o.Enabled) +} + +// SetEnabled sets field value +func (o *Optimizer) SetEnabled(v OptimizergetEnabledRetType) { + setOptimizergetEnabledAttributeType(&o.Enabled, v) +} + +func (o Optimizer) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getOptimizergetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + return toSerialize, nil +} + +type NullableOptimizer struct { + value *Optimizer + isSet bool +} + +func (v NullableOptimizer) Get() *Optimizer { + return v.value +} + +func (v *NullableOptimizer) Set(val *Optimizer) { + v.value = val + v.isSet = true +} + +func (v NullableOptimizer) IsSet() bool { + return v.isSet +} + +func (v *NullableOptimizer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOptimizer(val *Optimizer) *NullableOptimizer { + return &NullableOptimizer{value: val, isSet: true} +} + +func (v NullableOptimizer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOptimizer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_optimizer_patch.go b/pkg/cdnbeta/model_optimizer_patch.go new file mode 100644 index 00000000..d867c5c4 --- /dev/null +++ b/pkg/cdnbeta/model_optimizer_patch.go @@ -0,0 +1,127 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the OptimizerPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OptimizerPatch{} + +/* + types and functions for enabled +*/ + +// isBoolean +type OptimizerPatchgetEnabledAttributeType = *bool +type OptimizerPatchgetEnabledArgType = bool +type OptimizerPatchgetEnabledRetType = bool + +func getOptimizerPatchgetEnabledAttributeTypeOk(arg OptimizerPatchgetEnabledAttributeType) (ret OptimizerPatchgetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setOptimizerPatchgetEnabledAttributeType(arg *OptimizerPatchgetEnabledAttributeType, val OptimizerPatchgetEnabledRetType) { + *arg = &val +} + +// OptimizerPatch struct for OptimizerPatch +type OptimizerPatch struct { + Enabled OptimizerPatchgetEnabledAttributeType `json:"enabled,omitempty"` +} + +// NewOptimizerPatch instantiates a new OptimizerPatch 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 NewOptimizerPatch() *OptimizerPatch { + this := OptimizerPatch{} + return &this +} + +// NewOptimizerPatchWithDefaults instantiates a new OptimizerPatch 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 NewOptimizerPatchWithDefaults() *OptimizerPatch { + this := OptimizerPatch{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *OptimizerPatch) GetEnabled() (res OptimizerPatchgetEnabledRetType) { + res, _ = o.GetEnabledOk() + return +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OptimizerPatch) GetEnabledOk() (ret OptimizerPatchgetEnabledRetType, ok bool) { + return getOptimizerPatchgetEnabledAttributeTypeOk(o.Enabled) +} + +// HasEnabled returns a boolean if a field has been set. +func (o *OptimizerPatch) HasEnabled() bool { + _, ok := o.GetEnabledOk() + return ok +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *OptimizerPatch) SetEnabled(v OptimizerPatchgetEnabledRetType) { + setOptimizerPatchgetEnabledAttributeType(&o.Enabled, v) +} + +func (o OptimizerPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getOptimizerPatchgetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + return toSerialize, nil +} + +type NullableOptimizerPatch struct { + value *OptimizerPatch + isSet bool +} + +func (v NullableOptimizerPatch) Get() *OptimizerPatch { + return v.value +} + +func (v *NullableOptimizerPatch) Set(val *OptimizerPatch) { + v.value = val + v.isSet = true +} + +func (v NullableOptimizerPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableOptimizerPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOptimizerPatch(val *OptimizerPatch) *NullableOptimizerPatch { + return &NullableOptimizerPatch{value: val, isSet: true} +} + +func (v NullableOptimizerPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOptimizerPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_optimizer_patch_test.go b/pkg/cdnbeta/model_optimizer_patch_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_optimizer_patch_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_optimizer_test.go b/pkg/cdnbeta/model_optimizer_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_optimizer_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_patch_distribution_payload.go b/pkg/cdnbeta/model_patch_distribution_payload.go new file mode 100644 index 00000000..965963f0 --- /dev/null +++ b/pkg/cdnbeta/model_patch_distribution_payload.go @@ -0,0 +1,176 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the PatchDistributionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchDistributionPayload{} + +/* + types and functions for config +*/ + +// isModel +type PatchDistributionPayloadGetConfigAttributeType = *ConfigPatch +type PatchDistributionPayloadGetConfigArgType = ConfigPatch +type PatchDistributionPayloadGetConfigRetType = ConfigPatch + +func getPatchDistributionPayloadGetConfigAttributeTypeOk(arg PatchDistributionPayloadGetConfigAttributeType) (ret PatchDistributionPayloadGetConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchDistributionPayloadGetConfigAttributeType(arg *PatchDistributionPayloadGetConfigAttributeType, val PatchDistributionPayloadGetConfigRetType) { + *arg = &val +} + +/* + types and functions for intentId +*/ + +// isNotNullableString +type PatchDistributionPayloadGetIntentIdAttributeType = *string + +func getPatchDistributionPayloadGetIntentIdAttributeTypeOk(arg PatchDistributionPayloadGetIntentIdAttributeType) (ret PatchDistributionPayloadGetIntentIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchDistributionPayloadGetIntentIdAttributeType(arg *PatchDistributionPayloadGetIntentIdAttributeType, val PatchDistributionPayloadGetIntentIdRetType) { + *arg = &val +} + +type PatchDistributionPayloadGetIntentIdArgType = string +type PatchDistributionPayloadGetIntentIdRetType = string + +// PatchDistributionPayload Defines a partial distribution. Set values +type PatchDistributionPayload struct { + Config PatchDistributionPayloadGetConfigAttributeType `json:"config,omitempty"` + // While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple modifying requests with the same `intentId` for a given `projectId` are received, all but the first request are dropped. + IntentId PatchDistributionPayloadGetIntentIdAttributeType `json:"intentId,omitempty"` +} + +// NewPatchDistributionPayload instantiates a new PatchDistributionPayload 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 NewPatchDistributionPayload() *PatchDistributionPayload { + this := PatchDistributionPayload{} + return &this +} + +// NewPatchDistributionPayloadWithDefaults instantiates a new PatchDistributionPayload 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 NewPatchDistributionPayloadWithDefaults() *PatchDistributionPayload { + this := PatchDistributionPayload{} + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *PatchDistributionPayload) GetConfig() (res PatchDistributionPayloadGetConfigRetType) { + res, _ = o.GetConfigOk() + return +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchDistributionPayload) GetConfigOk() (ret PatchDistributionPayloadGetConfigRetType, ok bool) { + return getPatchDistributionPayloadGetConfigAttributeTypeOk(o.Config) +} + +// HasConfig returns a boolean if a field has been set. +func (o *PatchDistributionPayload) HasConfig() bool { + _, ok := o.GetConfigOk() + return ok +} + +// SetConfig gets a reference to the given ConfigPatch and assigns it to the Config field. +func (o *PatchDistributionPayload) SetConfig(v PatchDistributionPayloadGetConfigRetType) { + setPatchDistributionPayloadGetConfigAttributeType(&o.Config, v) +} + +// GetIntentId returns the IntentId field value if set, zero value otherwise. +func (o *PatchDistributionPayload) GetIntentId() (res PatchDistributionPayloadGetIntentIdRetType) { + res, _ = o.GetIntentIdOk() + return +} + +// GetIntentIdOk returns a tuple with the IntentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchDistributionPayload) GetIntentIdOk() (ret PatchDistributionPayloadGetIntentIdRetType, ok bool) { + return getPatchDistributionPayloadGetIntentIdAttributeTypeOk(o.IntentId) +} + +// HasIntentId returns a boolean if a field has been set. +func (o *PatchDistributionPayload) HasIntentId() bool { + _, ok := o.GetIntentIdOk() + return ok +} + +// SetIntentId gets a reference to the given string and assigns it to the IntentId field. +func (o *PatchDistributionPayload) SetIntentId(v PatchDistributionPayloadGetIntentIdRetType) { + setPatchDistributionPayloadGetIntentIdAttributeType(&o.IntentId, v) +} + +func (o PatchDistributionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPatchDistributionPayloadGetConfigAttributeTypeOk(o.Config); ok { + toSerialize["Config"] = val + } + if val, ok := getPatchDistributionPayloadGetIntentIdAttributeTypeOk(o.IntentId); ok { + toSerialize["IntentId"] = val + } + return toSerialize, nil +} + +type NullablePatchDistributionPayload struct { + value *PatchDistributionPayload + isSet bool +} + +func (v NullablePatchDistributionPayload) Get() *PatchDistributionPayload { + return v.value +} + +func (v *NullablePatchDistributionPayload) Set(val *PatchDistributionPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePatchDistributionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchDistributionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchDistributionPayload(val *PatchDistributionPayload) *NullablePatchDistributionPayload { + return &NullablePatchDistributionPayload{value: val, isSet: true} +} + +func (v NullablePatchDistributionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchDistributionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_patch_distribution_payload_test.go b/pkg/cdnbeta/model_patch_distribution_payload_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_patch_distribution_payload_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_patch_distribution_response.go b/pkg/cdnbeta/model_patch_distribution_response.go new file mode 100644 index 00000000..8bb8f096 --- /dev/null +++ b/pkg/cdnbeta/model_patch_distribution_response.go @@ -0,0 +1,125 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the PatchDistributionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchDistributionResponse{} + +/* + types and functions for distribution +*/ + +// isModel +type PatchDistributionResponseGetDistributionAttributeType = *Distribution +type PatchDistributionResponseGetDistributionArgType = Distribution +type PatchDistributionResponseGetDistributionRetType = Distribution + +func getPatchDistributionResponseGetDistributionAttributeTypeOk(arg PatchDistributionResponseGetDistributionAttributeType) (ret PatchDistributionResponseGetDistributionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchDistributionResponseGetDistributionAttributeType(arg *PatchDistributionResponseGetDistributionAttributeType, val PatchDistributionResponseGetDistributionRetType) { + *arg = &val +} + +// PatchDistributionResponse struct for PatchDistributionResponse +type PatchDistributionResponse struct { + // REQUIRED + Distribution PatchDistributionResponseGetDistributionAttributeType `json:"distribution" required:"true"` +} + +type _PatchDistributionResponse PatchDistributionResponse + +// NewPatchDistributionResponse instantiates a new PatchDistributionResponse 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 NewPatchDistributionResponse(distribution PatchDistributionResponseGetDistributionArgType) *PatchDistributionResponse { + this := PatchDistributionResponse{} + setPatchDistributionResponseGetDistributionAttributeType(&this.Distribution, distribution) + return &this +} + +// NewPatchDistributionResponseWithDefaults instantiates a new PatchDistributionResponse 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 NewPatchDistributionResponseWithDefaults() *PatchDistributionResponse { + this := PatchDistributionResponse{} + return &this +} + +// GetDistribution returns the Distribution field value +func (o *PatchDistributionResponse) GetDistribution() (ret PatchDistributionResponseGetDistributionRetType) { + ret, _ = o.GetDistributionOk() + return ret +} + +// GetDistributionOk returns a tuple with the Distribution field value +// and a boolean to check if the value has been set. +func (o *PatchDistributionResponse) GetDistributionOk() (ret PatchDistributionResponseGetDistributionRetType, ok bool) { + return getPatchDistributionResponseGetDistributionAttributeTypeOk(o.Distribution) +} + +// SetDistribution sets field value +func (o *PatchDistributionResponse) SetDistribution(v PatchDistributionResponseGetDistributionRetType) { + setPatchDistributionResponseGetDistributionAttributeType(&o.Distribution, v) +} + +func (o PatchDistributionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPatchDistributionResponseGetDistributionAttributeTypeOk(o.Distribution); ok { + toSerialize["Distribution"] = val + } + return toSerialize, nil +} + +type NullablePatchDistributionResponse struct { + value *PatchDistributionResponse + isSet bool +} + +func (v NullablePatchDistributionResponse) Get() *PatchDistributionResponse { + return v.value +} + +func (v *NullablePatchDistributionResponse) Set(val *PatchDistributionResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePatchDistributionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchDistributionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchDistributionResponse(val *PatchDistributionResponse) *NullablePatchDistributionResponse { + return &NullablePatchDistributionResponse{value: val, isSet: true} +} + +func (v NullablePatchDistributionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchDistributionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_patch_distribution_response_test.go b/pkg/cdnbeta/model_patch_distribution_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_patch_distribution_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_purge_cache_payload.go b/pkg/cdnbeta/model_purge_cache_payload.go new file mode 100644 index 00000000..500a9cc9 --- /dev/null +++ b/pkg/cdnbeta/model_purge_cache_payload.go @@ -0,0 +1,129 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the PurgeCachePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PurgeCachePayload{} + +/* + types and functions for path +*/ + +// isNotNullableString +type PurgeCachePayloadGetPathAttributeType = *string + +func getPurgeCachePayloadGetPathAttributeTypeOk(arg PurgeCachePayloadGetPathAttributeType) (ret PurgeCachePayloadGetPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPurgeCachePayloadGetPathAttributeType(arg *PurgeCachePayloadGetPathAttributeType, val PurgeCachePayloadGetPathRetType) { + *arg = &val +} + +type PurgeCachePayloadGetPathArgType = string +type PurgeCachePayloadGetPathRetType = string + +// PurgeCachePayload struct for PurgeCachePayload +type PurgeCachePayload struct { + // Defines an optional path. If this is set, a granular purge is done. If missing, the entire cache is invalidated. During a granular cache purge, only the provided path is purged. Please do not that for example `/some/path` and `/some/path.txt` are considered different paths. + Path PurgeCachePayloadGetPathAttributeType `json:"path,omitempty"` +} + +// NewPurgeCachePayload instantiates a new PurgeCachePayload 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 NewPurgeCachePayload() *PurgeCachePayload { + this := PurgeCachePayload{} + return &this +} + +// NewPurgeCachePayloadWithDefaults instantiates a new PurgeCachePayload 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 NewPurgeCachePayloadWithDefaults() *PurgeCachePayload { + this := PurgeCachePayload{} + return &this +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *PurgeCachePayload) GetPath() (res PurgeCachePayloadGetPathRetType) { + res, _ = o.GetPathOk() + return +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PurgeCachePayload) GetPathOk() (ret PurgeCachePayloadGetPathRetType, ok bool) { + return getPurgeCachePayloadGetPathAttributeTypeOk(o.Path) +} + +// HasPath returns a boolean if a field has been set. +func (o *PurgeCachePayload) HasPath() bool { + _, ok := o.GetPathOk() + return ok +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *PurgeCachePayload) SetPath(v PurgeCachePayloadGetPathRetType) { + setPurgeCachePayloadGetPathAttributeType(&o.Path, v) +} + +func (o PurgeCachePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPurgeCachePayloadGetPathAttributeTypeOk(o.Path); ok { + toSerialize["Path"] = val + } + return toSerialize, nil +} + +type NullablePurgeCachePayload struct { + value *PurgeCachePayload + isSet bool +} + +func (v NullablePurgeCachePayload) Get() *PurgeCachePayload { + return v.value +} + +func (v *NullablePurgeCachePayload) Set(val *PurgeCachePayload) { + v.value = val + v.isSet = true +} + +func (v NullablePurgeCachePayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePurgeCachePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePurgeCachePayload(val *PurgeCachePayload) *NullablePurgeCachePayload { + return &NullablePurgeCachePayload{value: val, isSet: true} +} + +func (v NullablePurgeCachePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePurgeCachePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_purge_cache_payload_test.go b/pkg/cdnbeta/model_purge_cache_payload_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_purge_cache_payload_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_put_custom_domain_custom_certificate.go b/pkg/cdnbeta/model_put_custom_domain_custom_certificate.go new file mode 100644 index 00000000..bab7d2ef --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_custom_certificate.go @@ -0,0 +1,216 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the PutCustomDomainCustomCertificate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PutCustomDomainCustomCertificate{} + +/* + types and functions for certificate +*/ + +// isNotNullableString +type PutCustomDomainCustomCertificateGetCertificateAttributeType = *string + +func getPutCustomDomainCustomCertificateGetCertificateAttributeTypeOk(arg PutCustomDomainCustomCertificateGetCertificateAttributeType) (ret PutCustomDomainCustomCertificateGetCertificateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainCustomCertificateGetCertificateAttributeType(arg *PutCustomDomainCustomCertificateGetCertificateAttributeType, val PutCustomDomainCustomCertificateGetCertificateRetType) { + *arg = &val +} + +type PutCustomDomainCustomCertificateGetCertificateArgType = string +type PutCustomDomainCustomCertificateGetCertificateRetType = string + +/* + types and functions for key +*/ + +// isNotNullableString +type PutCustomDomainCustomCertificateGetKeyAttributeType = *string + +func getPutCustomDomainCustomCertificateGetKeyAttributeTypeOk(arg PutCustomDomainCustomCertificateGetKeyAttributeType) (ret PutCustomDomainCustomCertificateGetKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainCustomCertificateGetKeyAttributeType(arg *PutCustomDomainCustomCertificateGetKeyAttributeType, val PutCustomDomainCustomCertificateGetKeyRetType) { + *arg = &val +} + +type PutCustomDomainCustomCertificateGetKeyArgType = string +type PutCustomDomainCustomCertificateGetKeyRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type PutCustomDomainCustomCertificateGetTypeAttributeType = *string + +func getPutCustomDomainCustomCertificateGetTypeAttributeTypeOk(arg PutCustomDomainCustomCertificateGetTypeAttributeType) (ret PutCustomDomainCustomCertificateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainCustomCertificateGetTypeAttributeType(arg *PutCustomDomainCustomCertificateGetTypeAttributeType, val PutCustomDomainCustomCertificateGetTypeRetType) { + *arg = &val +} + +type PutCustomDomainCustomCertificateGetTypeArgType = string +type PutCustomDomainCustomCertificateGetTypeRetType = string + +// PutCustomDomainCustomCertificate Returned if a custom certificate is used. Response does not contain the certificate or key. +type PutCustomDomainCustomCertificate struct { + // base64-encoded PEM-encoded certificate + // REQUIRED + Certificate PutCustomDomainCustomCertificateGetCertificateAttributeType `json:"certificate" required:"true"` + // base64-encoded PEM encoded key + // REQUIRED + Key PutCustomDomainCustomCertificateGetKeyAttributeType `json:"key" required:"true"` + // REQUIRED + Type PutCustomDomainCustomCertificateGetTypeAttributeType `json:"type" required:"true"` +} + +type _PutCustomDomainCustomCertificate PutCustomDomainCustomCertificate + +// NewPutCustomDomainCustomCertificate instantiates a new PutCustomDomainCustomCertificate 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 NewPutCustomDomainCustomCertificate(certificate PutCustomDomainCustomCertificateGetCertificateArgType, key PutCustomDomainCustomCertificateGetKeyArgType, types PutCustomDomainCustomCertificateGetTypeArgType) *PutCustomDomainCustomCertificate { + this := PutCustomDomainCustomCertificate{} + setPutCustomDomainCustomCertificateGetCertificateAttributeType(&this.Certificate, certificate) + setPutCustomDomainCustomCertificateGetKeyAttributeType(&this.Key, key) + setPutCustomDomainCustomCertificateGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewPutCustomDomainCustomCertificateWithDefaults instantiates a new PutCustomDomainCustomCertificate 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 NewPutCustomDomainCustomCertificateWithDefaults() *PutCustomDomainCustomCertificate { + this := PutCustomDomainCustomCertificate{} + return &this +} + +// GetCertificate returns the Certificate field value +func (o *PutCustomDomainCustomCertificate) GetCertificate() (ret PutCustomDomainCustomCertificateGetCertificateRetType) { + ret, _ = o.GetCertificateOk() + return ret +} + +// GetCertificateOk returns a tuple with the Certificate field value +// and a boolean to check if the value has been set. +func (o *PutCustomDomainCustomCertificate) GetCertificateOk() (ret PutCustomDomainCustomCertificateGetCertificateRetType, ok bool) { + return getPutCustomDomainCustomCertificateGetCertificateAttributeTypeOk(o.Certificate) +} + +// SetCertificate sets field value +func (o *PutCustomDomainCustomCertificate) SetCertificate(v PutCustomDomainCustomCertificateGetCertificateRetType) { + setPutCustomDomainCustomCertificateGetCertificateAttributeType(&o.Certificate, v) +} + +// GetKey returns the Key field value +func (o *PutCustomDomainCustomCertificate) GetKey() (ret PutCustomDomainCustomCertificateGetKeyRetType) { + ret, _ = o.GetKeyOk() + return ret +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +func (o *PutCustomDomainCustomCertificate) GetKeyOk() (ret PutCustomDomainCustomCertificateGetKeyRetType, ok bool) { + return getPutCustomDomainCustomCertificateGetKeyAttributeTypeOk(o.Key) +} + +// SetKey sets field value +func (o *PutCustomDomainCustomCertificate) SetKey(v PutCustomDomainCustomCertificateGetKeyRetType) { + setPutCustomDomainCustomCertificateGetKeyAttributeType(&o.Key, v) +} + +// GetType returns the Type field value +func (o *PutCustomDomainCustomCertificate) GetType() (ret PutCustomDomainCustomCertificateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *PutCustomDomainCustomCertificate) GetTypeOk() (ret PutCustomDomainCustomCertificateGetTypeRetType, ok bool) { + return getPutCustomDomainCustomCertificateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *PutCustomDomainCustomCertificate) SetType(v PutCustomDomainCustomCertificateGetTypeRetType) { + setPutCustomDomainCustomCertificateGetTypeAttributeType(&o.Type, v) +} + +func (o PutCustomDomainCustomCertificate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPutCustomDomainCustomCertificateGetCertificateAttributeTypeOk(o.Certificate); ok { + toSerialize["Certificate"] = val + } + if val, ok := getPutCustomDomainCustomCertificateGetKeyAttributeTypeOk(o.Key); ok { + toSerialize["Key"] = val + } + if val, ok := getPutCustomDomainCustomCertificateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullablePutCustomDomainCustomCertificate struct { + value *PutCustomDomainCustomCertificate + isSet bool +} + +func (v NullablePutCustomDomainCustomCertificate) Get() *PutCustomDomainCustomCertificate { + return v.value +} + +func (v *NullablePutCustomDomainCustomCertificate) Set(val *PutCustomDomainCustomCertificate) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainCustomCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainCustomCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainCustomCertificate(val *PutCustomDomainCustomCertificate) *NullablePutCustomDomainCustomCertificate { + return &NullablePutCustomDomainCustomCertificate{value: val, isSet: true} +} + +func (v NullablePutCustomDomainCustomCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainCustomCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_put_custom_domain_custom_certificate_test.go b/pkg/cdnbeta/model_put_custom_domain_custom_certificate_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_custom_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_put_custom_domain_managed_certificate.go b/pkg/cdnbeta/model_put_custom_domain_managed_certificate.go new file mode 100644 index 00000000..2bc9b43f --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_managed_certificate.go @@ -0,0 +1,126 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the PutCustomDomainManagedCertificate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PutCustomDomainManagedCertificate{} + +/* + types and functions for type +*/ + +// isNotNullableString +type PutCustomDomainManagedCertificateGetTypeAttributeType = *string + +func getPutCustomDomainManagedCertificateGetTypeAttributeTypeOk(arg PutCustomDomainManagedCertificateGetTypeAttributeType) (ret PutCustomDomainManagedCertificateGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainManagedCertificateGetTypeAttributeType(arg *PutCustomDomainManagedCertificateGetTypeAttributeType, val PutCustomDomainManagedCertificateGetTypeRetType) { + *arg = &val +} + +type PutCustomDomainManagedCertificateGetTypeArgType = string +type PutCustomDomainManagedCertificateGetTypeRetType = string + +// PutCustomDomainManagedCertificate This is returned when no custom certificate is used. We provision and manage a Let's Encrypt Certificate for you +type PutCustomDomainManagedCertificate struct { + // REQUIRED + Type PutCustomDomainManagedCertificateGetTypeAttributeType `json:"type" required:"true"` +} + +type _PutCustomDomainManagedCertificate PutCustomDomainManagedCertificate + +// NewPutCustomDomainManagedCertificate instantiates a new PutCustomDomainManagedCertificate 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 NewPutCustomDomainManagedCertificate(types PutCustomDomainManagedCertificateGetTypeArgType) *PutCustomDomainManagedCertificate { + this := PutCustomDomainManagedCertificate{} + setPutCustomDomainManagedCertificateGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewPutCustomDomainManagedCertificateWithDefaults instantiates a new PutCustomDomainManagedCertificate 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 NewPutCustomDomainManagedCertificateWithDefaults() *PutCustomDomainManagedCertificate { + this := PutCustomDomainManagedCertificate{} + return &this +} + +// GetType returns the Type field value +func (o *PutCustomDomainManagedCertificate) GetType() (ret PutCustomDomainManagedCertificateGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *PutCustomDomainManagedCertificate) GetTypeOk() (ret PutCustomDomainManagedCertificateGetTypeRetType, ok bool) { + return getPutCustomDomainManagedCertificateGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *PutCustomDomainManagedCertificate) SetType(v PutCustomDomainManagedCertificateGetTypeRetType) { + setPutCustomDomainManagedCertificateGetTypeAttributeType(&o.Type, v) +} + +func (o PutCustomDomainManagedCertificate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPutCustomDomainManagedCertificateGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullablePutCustomDomainManagedCertificate struct { + value *PutCustomDomainManagedCertificate + isSet bool +} + +func (v NullablePutCustomDomainManagedCertificate) Get() *PutCustomDomainManagedCertificate { + return v.value +} + +func (v *NullablePutCustomDomainManagedCertificate) Set(val *PutCustomDomainManagedCertificate) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainManagedCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainManagedCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainManagedCertificate(val *PutCustomDomainManagedCertificate) *NullablePutCustomDomainManagedCertificate { + return &NullablePutCustomDomainManagedCertificate{value: val, isSet: true} +} + +func (v NullablePutCustomDomainManagedCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainManagedCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_put_custom_domain_managed_certificate_test.go b/pkg/cdnbeta/model_put_custom_domain_managed_certificate_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_managed_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_put_custom_domain_payload.go b/pkg/cdnbeta/model_put_custom_domain_payload.go new file mode 100644 index 00000000..e764fa2f --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_payload.go @@ -0,0 +1,176 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the PutCustomDomainPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PutCustomDomainPayload{} + +/* + types and functions for certificate +*/ + +// isModel +type PutCustomDomainPayloadGetCertificateAttributeType = *PutCustomDomainPayloadCertificate +type PutCustomDomainPayloadGetCertificateArgType = PutCustomDomainPayloadCertificate +type PutCustomDomainPayloadGetCertificateRetType = PutCustomDomainPayloadCertificate + +func getPutCustomDomainPayloadGetCertificateAttributeTypeOk(arg PutCustomDomainPayloadGetCertificateAttributeType) (ret PutCustomDomainPayloadGetCertificateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainPayloadGetCertificateAttributeType(arg *PutCustomDomainPayloadGetCertificateAttributeType, val PutCustomDomainPayloadGetCertificateRetType) { + *arg = &val +} + +/* + types and functions for intentId +*/ + +// isNotNullableString +type PutCustomDomainPayloadGetIntentIdAttributeType = *string + +func getPutCustomDomainPayloadGetIntentIdAttributeTypeOk(arg PutCustomDomainPayloadGetIntentIdAttributeType) (ret PutCustomDomainPayloadGetIntentIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainPayloadGetIntentIdAttributeType(arg *PutCustomDomainPayloadGetIntentIdAttributeType, val PutCustomDomainPayloadGetIntentIdRetType) { + *arg = &val +} + +type PutCustomDomainPayloadGetIntentIdArgType = string +type PutCustomDomainPayloadGetIntentIdRetType = string + +// PutCustomDomainPayload struct for PutCustomDomainPayload +type PutCustomDomainPayload struct { + Certificate PutCustomDomainPayloadGetCertificateAttributeType `json:"certificate,omitempty"` + // While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple modifying Requests with the same `intentId` for a given `projectId` are received, all but the first request are dropped. + IntentId PutCustomDomainPayloadGetIntentIdAttributeType `json:"intentId,omitempty"` +} + +// NewPutCustomDomainPayload instantiates a new PutCustomDomainPayload 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 NewPutCustomDomainPayload() *PutCustomDomainPayload { + this := PutCustomDomainPayload{} + return &this +} + +// NewPutCustomDomainPayloadWithDefaults instantiates a new PutCustomDomainPayload 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 NewPutCustomDomainPayloadWithDefaults() *PutCustomDomainPayload { + this := PutCustomDomainPayload{} + return &this +} + +// GetCertificate returns the Certificate field value if set, zero value otherwise. +func (o *PutCustomDomainPayload) GetCertificate() (res PutCustomDomainPayloadGetCertificateRetType) { + res, _ = o.GetCertificateOk() + return +} + +// GetCertificateOk returns a tuple with the Certificate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PutCustomDomainPayload) GetCertificateOk() (ret PutCustomDomainPayloadGetCertificateRetType, ok bool) { + return getPutCustomDomainPayloadGetCertificateAttributeTypeOk(o.Certificate) +} + +// HasCertificate returns a boolean if a field has been set. +func (o *PutCustomDomainPayload) HasCertificate() bool { + _, ok := o.GetCertificateOk() + return ok +} + +// SetCertificate gets a reference to the given PutCustomDomainPayloadCertificate and assigns it to the Certificate field. +func (o *PutCustomDomainPayload) SetCertificate(v PutCustomDomainPayloadGetCertificateRetType) { + setPutCustomDomainPayloadGetCertificateAttributeType(&o.Certificate, v) +} + +// GetIntentId returns the IntentId field value if set, zero value otherwise. +func (o *PutCustomDomainPayload) GetIntentId() (res PutCustomDomainPayloadGetIntentIdRetType) { + res, _ = o.GetIntentIdOk() + return +} + +// GetIntentIdOk returns a tuple with the IntentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PutCustomDomainPayload) GetIntentIdOk() (ret PutCustomDomainPayloadGetIntentIdRetType, ok bool) { + return getPutCustomDomainPayloadGetIntentIdAttributeTypeOk(o.IntentId) +} + +// HasIntentId returns a boolean if a field has been set. +func (o *PutCustomDomainPayload) HasIntentId() bool { + _, ok := o.GetIntentIdOk() + return ok +} + +// SetIntentId gets a reference to the given string and assigns it to the IntentId field. +func (o *PutCustomDomainPayload) SetIntentId(v PutCustomDomainPayloadGetIntentIdRetType) { + setPutCustomDomainPayloadGetIntentIdAttributeType(&o.IntentId, v) +} + +func (o PutCustomDomainPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPutCustomDomainPayloadGetCertificateAttributeTypeOk(o.Certificate); ok { + toSerialize["Certificate"] = val + } + if val, ok := getPutCustomDomainPayloadGetIntentIdAttributeTypeOk(o.IntentId); ok { + toSerialize["IntentId"] = val + } + return toSerialize, nil +} + +type NullablePutCustomDomainPayload struct { + value *PutCustomDomainPayload + isSet bool +} + +func (v NullablePutCustomDomainPayload) Get() *PutCustomDomainPayload { + return v.value +} + +func (v *NullablePutCustomDomainPayload) Set(val *PutCustomDomainPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainPayload(val *PutCustomDomainPayload) *NullablePutCustomDomainPayload { + return &NullablePutCustomDomainPayload{value: val, isSet: true} +} + +func (v NullablePutCustomDomainPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_put_custom_domain_payload_certificate.go b/pkg/cdnbeta/model_put_custom_domain_payload_certificate.go new file mode 100644 index 00000000..648bdb99 --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_payload_certificate.go @@ -0,0 +1,163 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// PutCustomDomainPayloadCertificate - Pass a custom certificate to be served by the CDN when calling the custom domain. Will use a managed certificate when omitted +type PutCustomDomainPayloadCertificate struct { + PutCustomDomainCustomCertificate *PutCustomDomainCustomCertificate + PutCustomDomainManagedCertificate *PutCustomDomainManagedCertificate +} + +// PutCustomDomainCustomCertificateAsPutCustomDomainPayloadCertificate is a convenience function that returns PutCustomDomainCustomCertificate wrapped in PutCustomDomainPayloadCertificate +func PutCustomDomainCustomCertificateAsPutCustomDomainPayloadCertificate(v *PutCustomDomainCustomCertificate) PutCustomDomainPayloadCertificate { + return PutCustomDomainPayloadCertificate{ + PutCustomDomainCustomCertificate: v, + } +} + +// PutCustomDomainManagedCertificateAsPutCustomDomainPayloadCertificate is a convenience function that returns PutCustomDomainManagedCertificate wrapped in PutCustomDomainPayloadCertificate +func PutCustomDomainManagedCertificateAsPutCustomDomainPayloadCertificate(v *PutCustomDomainManagedCertificate) PutCustomDomainPayloadCertificate { + return PutCustomDomainPayloadCertificate{ + PutCustomDomainManagedCertificate: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *PutCustomDomainPayloadCertificate) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'PutCustomDomainCustomCertificate' + if jsonDict["type"] == "PutCustomDomainCustomCertificate" { + // try to unmarshal JSON data into PutCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.PutCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.PutCustomDomainCustomCertificate, return on the first match + } else { + dst.PutCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainPayloadCertificate as PutCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'PutCustomDomainManagedCertificate' + if jsonDict["type"] == "PutCustomDomainManagedCertificate" { + // try to unmarshal JSON data into PutCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.PutCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.PutCustomDomainManagedCertificate, return on the first match + } else { + dst.PutCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainPayloadCertificate as PutCustomDomainManagedCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'custom' + if jsonDict["type"] == "custom" { + // try to unmarshal JSON data into PutCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.PutCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.PutCustomDomainCustomCertificate, return on the first match + } else { + dst.PutCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainPayloadCertificate as PutCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'managed' + if jsonDict["type"] == "managed" { + // try to unmarshal JSON data into PutCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.PutCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.PutCustomDomainManagedCertificate, return on the first match + } else { + dst.PutCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainPayloadCertificate as PutCustomDomainManagedCertificate: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src PutCustomDomainPayloadCertificate) MarshalJSON() ([]byte, error) { + if src.PutCustomDomainCustomCertificate != nil { + return json.Marshal(&src.PutCustomDomainCustomCertificate) + } + + if src.PutCustomDomainManagedCertificate != nil { + return json.Marshal(&src.PutCustomDomainManagedCertificate) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *PutCustomDomainPayloadCertificate) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.PutCustomDomainCustomCertificate != nil { + return obj.PutCustomDomainCustomCertificate + } + + if obj.PutCustomDomainManagedCertificate != nil { + return obj.PutCustomDomainManagedCertificate + } + + // all schemas are nil + return nil +} + +type NullablePutCustomDomainPayloadCertificate struct { + value *PutCustomDomainPayloadCertificate + isSet bool +} + +func (v NullablePutCustomDomainPayloadCertificate) Get() *PutCustomDomainPayloadCertificate { + return v.value +} + +func (v *NullablePutCustomDomainPayloadCertificate) Set(val *PutCustomDomainPayloadCertificate) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainPayloadCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainPayloadCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainPayloadCertificate(val *PutCustomDomainPayloadCertificate) *NullablePutCustomDomainPayloadCertificate { + return &NullablePutCustomDomainPayloadCertificate{value: val, isSet: true} +} + +func (v NullablePutCustomDomainPayloadCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainPayloadCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_put_custom_domain_payload_certificate_test.go b/pkg/cdnbeta/model_put_custom_domain_payload_certificate_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_payload_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_put_custom_domain_payload_test.go b/pkg/cdnbeta/model_put_custom_domain_payload_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_payload_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_put_custom_domain_response.go b/pkg/cdnbeta/model_put_custom_domain_response.go new file mode 100644 index 00000000..81bb99e6 --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_response.go @@ -0,0 +1,172 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the PutCustomDomainResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PutCustomDomainResponse{} + +/* + types and functions for certificate +*/ + +// isModel +type PutCustomDomainResponseGetCertificateAttributeType = *PutCustomDomainResponseCertificate +type PutCustomDomainResponseGetCertificateArgType = PutCustomDomainResponseCertificate +type PutCustomDomainResponseGetCertificateRetType = PutCustomDomainResponseCertificate + +func getPutCustomDomainResponseGetCertificateAttributeTypeOk(arg PutCustomDomainResponseGetCertificateAttributeType) (ret PutCustomDomainResponseGetCertificateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainResponseGetCertificateAttributeType(arg *PutCustomDomainResponseGetCertificateAttributeType, val PutCustomDomainResponseGetCertificateRetType) { + *arg = &val +} + +/* + types and functions for customDomain +*/ + +// isModel +type PutCustomDomainResponseGetCustomDomainAttributeType = *CustomDomain +type PutCustomDomainResponseGetCustomDomainArgType = CustomDomain +type PutCustomDomainResponseGetCustomDomainRetType = CustomDomain + +func getPutCustomDomainResponseGetCustomDomainAttributeTypeOk(arg PutCustomDomainResponseGetCustomDomainAttributeType) (ret PutCustomDomainResponseGetCustomDomainRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPutCustomDomainResponseGetCustomDomainAttributeType(arg *PutCustomDomainResponseGetCustomDomainAttributeType, val PutCustomDomainResponseGetCustomDomainRetType) { + *arg = &val +} + +// PutCustomDomainResponse struct for PutCustomDomainResponse +type PutCustomDomainResponse struct { + Certificate PutCustomDomainResponseGetCertificateAttributeType `json:"certificate,omitempty"` + // REQUIRED + CustomDomain PutCustomDomainResponseGetCustomDomainAttributeType `json:"customDomain" required:"true"` +} + +type _PutCustomDomainResponse PutCustomDomainResponse + +// NewPutCustomDomainResponse instantiates a new PutCustomDomainResponse 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 NewPutCustomDomainResponse(customDomain PutCustomDomainResponseGetCustomDomainArgType) *PutCustomDomainResponse { + this := PutCustomDomainResponse{} + setPutCustomDomainResponseGetCustomDomainAttributeType(&this.CustomDomain, customDomain) + return &this +} + +// NewPutCustomDomainResponseWithDefaults instantiates a new PutCustomDomainResponse 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 NewPutCustomDomainResponseWithDefaults() *PutCustomDomainResponse { + this := PutCustomDomainResponse{} + return &this +} + +// GetCertificate returns the Certificate field value if set, zero value otherwise. +func (o *PutCustomDomainResponse) GetCertificate() (res PutCustomDomainResponseGetCertificateRetType) { + res, _ = o.GetCertificateOk() + return +} + +// GetCertificateOk returns a tuple with the Certificate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PutCustomDomainResponse) GetCertificateOk() (ret PutCustomDomainResponseGetCertificateRetType, ok bool) { + return getPutCustomDomainResponseGetCertificateAttributeTypeOk(o.Certificate) +} + +// HasCertificate returns a boolean if a field has been set. +func (o *PutCustomDomainResponse) HasCertificate() bool { + _, ok := o.GetCertificateOk() + return ok +} + +// SetCertificate gets a reference to the given PutCustomDomainResponseCertificate and assigns it to the Certificate field. +func (o *PutCustomDomainResponse) SetCertificate(v PutCustomDomainResponseGetCertificateRetType) { + setPutCustomDomainResponseGetCertificateAttributeType(&o.Certificate, v) +} + +// GetCustomDomain returns the CustomDomain field value +func (o *PutCustomDomainResponse) GetCustomDomain() (ret PutCustomDomainResponseGetCustomDomainRetType) { + ret, _ = o.GetCustomDomainOk() + return ret +} + +// GetCustomDomainOk returns a tuple with the CustomDomain field value +// and a boolean to check if the value has been set. +func (o *PutCustomDomainResponse) GetCustomDomainOk() (ret PutCustomDomainResponseGetCustomDomainRetType, ok bool) { + return getPutCustomDomainResponseGetCustomDomainAttributeTypeOk(o.CustomDomain) +} + +// SetCustomDomain sets field value +func (o *PutCustomDomainResponse) SetCustomDomain(v PutCustomDomainResponseGetCustomDomainRetType) { + setPutCustomDomainResponseGetCustomDomainAttributeType(&o.CustomDomain, v) +} + +func (o PutCustomDomainResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPutCustomDomainResponseGetCertificateAttributeTypeOk(o.Certificate); ok { + toSerialize["Certificate"] = val + } + if val, ok := getPutCustomDomainResponseGetCustomDomainAttributeTypeOk(o.CustomDomain); ok { + toSerialize["CustomDomain"] = val + } + return toSerialize, nil +} + +type NullablePutCustomDomainResponse struct { + value *PutCustomDomainResponse + isSet bool +} + +func (v NullablePutCustomDomainResponse) Get() *PutCustomDomainResponse { + return v.value +} + +func (v *NullablePutCustomDomainResponse) Set(val *PutCustomDomainResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainResponse(val *PutCustomDomainResponse) *NullablePutCustomDomainResponse { + return &NullablePutCustomDomainResponse{value: val, isSet: true} +} + +func (v NullablePutCustomDomainResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_put_custom_domain_response_certificate.go b/pkg/cdnbeta/model_put_custom_domain_response_certificate.go new file mode 100644 index 00000000..63266e45 --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_response_certificate.go @@ -0,0 +1,163 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// PutCustomDomainResponseCertificate - Pass a custom certificate to be served by the CDN when calling the custom domain. Will use a managed certificate when omitted +type PutCustomDomainResponseCertificate struct { + GetCustomDomainCustomCertificate *GetCustomDomainCustomCertificate + GetCustomDomainManagedCertificate *GetCustomDomainManagedCertificate +} + +// GetCustomDomainCustomCertificateAsPutCustomDomainResponseCertificate is a convenience function that returns GetCustomDomainCustomCertificate wrapped in PutCustomDomainResponseCertificate +func GetCustomDomainCustomCertificateAsPutCustomDomainResponseCertificate(v *GetCustomDomainCustomCertificate) PutCustomDomainResponseCertificate { + return PutCustomDomainResponseCertificate{ + GetCustomDomainCustomCertificate: v, + } +} + +// GetCustomDomainManagedCertificateAsPutCustomDomainResponseCertificate is a convenience function that returns GetCustomDomainManagedCertificate wrapped in PutCustomDomainResponseCertificate +func GetCustomDomainManagedCertificateAsPutCustomDomainResponseCertificate(v *GetCustomDomainManagedCertificate) PutCustomDomainResponseCertificate { + return PutCustomDomainResponseCertificate{ + GetCustomDomainManagedCertificate: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *PutCustomDomainResponseCertificate) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'GetCustomDomainCustomCertificate' + if jsonDict["type"] == "GetCustomDomainCustomCertificate" { + // try to unmarshal JSON data into GetCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainCustomCertificate, return on the first match + } else { + dst.GetCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainResponseCertificate as GetCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'GetCustomDomainManagedCertificate' + if jsonDict["type"] == "GetCustomDomainManagedCertificate" { + // try to unmarshal JSON data into GetCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainManagedCertificate, return on the first match + } else { + dst.GetCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainResponseCertificate as GetCustomDomainManagedCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'custom' + if jsonDict["type"] == "custom" { + // try to unmarshal JSON data into GetCustomDomainCustomCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainCustomCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainCustomCertificate, return on the first match + } else { + dst.GetCustomDomainCustomCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainResponseCertificate as GetCustomDomainCustomCertificate: %s", err.Error()) + } + } + + // check if the discriminator value is 'managed' + if jsonDict["type"] == "managed" { + // try to unmarshal JSON data into GetCustomDomainManagedCertificate + err = json.Unmarshal(data, &dst.GetCustomDomainManagedCertificate) + if err == nil { + return nil // data stored in dst.GetCustomDomainManagedCertificate, return on the first match + } else { + dst.GetCustomDomainManagedCertificate = nil + return fmt.Errorf("failed to unmarshal PutCustomDomainResponseCertificate as GetCustomDomainManagedCertificate: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src PutCustomDomainResponseCertificate) MarshalJSON() ([]byte, error) { + if src.GetCustomDomainCustomCertificate != nil { + return json.Marshal(&src.GetCustomDomainCustomCertificate) + } + + if src.GetCustomDomainManagedCertificate != nil { + return json.Marshal(&src.GetCustomDomainManagedCertificate) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *PutCustomDomainResponseCertificate) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.GetCustomDomainCustomCertificate != nil { + return obj.GetCustomDomainCustomCertificate + } + + if obj.GetCustomDomainManagedCertificate != nil { + return obj.GetCustomDomainManagedCertificate + } + + // all schemas are nil + return nil +} + +type NullablePutCustomDomainResponseCertificate struct { + value *PutCustomDomainResponseCertificate + isSet bool +} + +func (v NullablePutCustomDomainResponseCertificate) Get() *PutCustomDomainResponseCertificate { + return v.value +} + +func (v *NullablePutCustomDomainResponseCertificate) Set(val *PutCustomDomainResponseCertificate) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainResponseCertificate) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainResponseCertificate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainResponseCertificate(val *PutCustomDomainResponseCertificate) *NullablePutCustomDomainResponseCertificate { + return &NullablePutCustomDomainResponseCertificate{value: val, isSet: true} +} + +func (v NullablePutCustomDomainResponseCertificate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainResponseCertificate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_put_custom_domain_response_certificate_test.go b/pkg/cdnbeta/model_put_custom_domain_response_certificate_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_response_certificate_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_put_custom_domain_response_test.go b/pkg/cdnbeta/model_put_custom_domain_response_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_put_custom_domain_response_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_region.go b/pkg/cdnbeta/model_region.go new file mode 100644 index 00000000..42499885 --- /dev/null +++ b/pkg/cdnbeta/model_region.go @@ -0,0 +1,121 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// Region The following regions exist: - `EU` - Europe - `US` - United States / North America - `AF` - Africa - `SA` - South America - `ASIA` - Asia and Oceania +type Region string + +// List of Region +const ( + REGION_EU Region = "EU" + REGION_US Region = "US" + REGION_AF Region = "AF" + REGION_SA Region = "SA" + REGION_ASIA Region = "ASIA" +) + +// All allowed values of Region enum +var AllowedRegionEnumValues = []Region{ + "EU", + "US", + "AF", + "SA", + "ASIA", +} + +func (v *Region) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := Region(value) + for _, existing := range AllowedRegionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Region", value) +} + +// NewRegionFromValue returns a pointer to a valid Region +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRegionFromValue(v string) (*Region, error) { + ev := Region(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Region: valid values are %v", v, AllowedRegionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Region) IsValid() bool { + for _, existing := range AllowedRegionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Region value +func (v Region) Ptr() *Region { + return &v +} + +type NullableRegion struct { + value *Region + isSet bool +} + +func (v NullableRegion) Get() *Region { + return v.value +} + +func (v *NullableRegion) Set(val *Region) { + v.value = val + v.isSet = true +} + +func (v NullableRegion) IsSet() bool { + return v.isSet +} + +func (v *NullableRegion) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegion(val *Region) *NullableRegion { + return &NullableRegion{value: val, isSet: true} +} + +func (v NullableRegion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_region_test.go b/pkg/cdnbeta/model_region_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_region_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_status_error.go b/pkg/cdnbeta/model_status_error.go new file mode 100644 index 00000000..754e1bf9 --- /dev/null +++ b/pkg/cdnbeta/model_status_error.go @@ -0,0 +1,329 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the StatusError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &StatusError{} + +/* + types and functions for de +*/ + +// isNotNullableString +type StatusErrorGetDeAttributeType = *string + +func getStatusErrorGetDeAttributeTypeOk(arg StatusErrorGetDeAttributeType) (ret StatusErrorGetDeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusErrorGetDeAttributeType(arg *StatusErrorGetDeAttributeType, val StatusErrorGetDeRetType) { + *arg = &val +} + +type StatusErrorGetDeArgType = string +type StatusErrorGetDeRetType = string + +/* + types and functions for en +*/ + +// isNotNullableString +type StatusErrorGetEnAttributeType = *string + +func getStatusErrorGetEnAttributeTypeOk(arg StatusErrorGetEnAttributeType) (ret StatusErrorGetEnRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusErrorGetEnAttributeType(arg *StatusErrorGetEnAttributeType, val StatusErrorGetEnRetType) { + *arg = &val +} + +type StatusErrorGetEnArgType = string +type StatusErrorGetEnRetType = string + +/* + types and functions for key +*/ + +// isEnum + +// StatusErrorKey An enum value that describes a Status Error. +// value type for enums +type StatusErrorKey string + +// List of Key +const ( + STATUSERRORKEY_UNKNOWN StatusErrorKey = "UNKNOWN" + STATUSERRORKEY_CUSTOM_DOMAIN_CNAME_MISSING StatusErrorKey = "CUSTOM_DOMAIN_CNAME_MISSING" + STATUSERRORKEY_CUSTOM_DOMAIN_ALREADY_IN_USE StatusErrorKey = "CUSTOM_DOMAIN_ALREADY_IN_USE" + STATUSERRORKEY_PUBLIC_BETA_QUOTA_REACHED StatusErrorKey = "PUBLIC_BETA_QUOTA_REACHED" +) + +// All allowed values of StatusError enum +var AllowedStatusErrorKeyEnumValues = []StatusErrorKey{ + "UNKNOWN", + "CUSTOM_DOMAIN_CNAME_MISSING", + "CUSTOM_DOMAIN_ALREADY_IN_USE", + "PUBLIC_BETA_QUOTA_REACHED", +} + +func (v *StatusErrorKey) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson StatusErrorKey + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := StatusErrorKey(value) + for _, existing := range AllowedStatusErrorKeyEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid StatusError", value) +} + +// NewStatusErrorKeyFromValue returns a pointer to a valid StatusErrorKey +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewStatusErrorKeyFromValue(v StatusErrorKey) (*StatusErrorKey, error) { + ev := StatusErrorKey(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for StatusErrorKey: valid values are %v", v, AllowedStatusErrorKeyEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v StatusErrorKey) IsValid() bool { + for _, existing := range AllowedStatusErrorKeyEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to KeyKey value +func (v StatusErrorKey) Ptr() *StatusErrorKey { + return &v +} + +type NullableStatusErrorKey struct { + value *StatusErrorKey + isSet bool +} + +func (v NullableStatusErrorKey) Get() *StatusErrorKey { + return v.value +} + +func (v *NullableStatusErrorKey) Set(val *StatusErrorKey) { + v.value = val + v.isSet = true +} + +func (v NullableStatusErrorKey) IsSet() bool { + return v.isSet +} + +func (v *NullableStatusErrorKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStatusErrorKey(val *StatusErrorKey) *NullableStatusErrorKey { + return &NullableStatusErrorKey{value: val, isSet: true} +} + +func (v NullableStatusErrorKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStatusErrorKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type StatusErrorGetKeyAttributeType = *StatusErrorKey +type StatusErrorGetKeyArgType = StatusErrorKey +type StatusErrorGetKeyRetType = StatusErrorKey + +func getStatusErrorGetKeyAttributeTypeOk(arg StatusErrorGetKeyAttributeType) (ret StatusErrorGetKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusErrorGetKeyAttributeType(arg *StatusErrorGetKeyAttributeType, val StatusErrorGetKeyRetType) { + *arg = &val +} + +// StatusError struct for StatusError +type StatusError struct { + // A german translation string corresponding to the error key. Note that we do not guarantee german translations are present. + De StatusErrorGetDeAttributeType `json:"de,omitempty"` + // An english translation string corresponding to the error key. An english translation key is always present. + // REQUIRED + En StatusErrorGetEnAttributeType `json:"en" required:"true"` + // An enum value that describes a Status Error. + // REQUIRED + Key StatusErrorGetKeyAttributeType `json:"key" required:"true"` +} + +type _StatusError StatusError + +// NewStatusError instantiates a new StatusError 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 NewStatusError(en StatusErrorGetEnArgType, key StatusErrorGetKeyArgType) *StatusError { + this := StatusError{} + setStatusErrorGetEnAttributeType(&this.En, en) + setStatusErrorGetKeyAttributeType(&this.Key, key) + return &this +} + +// NewStatusErrorWithDefaults instantiates a new StatusError 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 NewStatusErrorWithDefaults() *StatusError { + this := StatusError{} + return &this +} + +// GetDe returns the De field value if set, zero value otherwise. +func (o *StatusError) GetDe() (res StatusErrorGetDeRetType) { + res, _ = o.GetDeOk() + return +} + +// GetDeOk returns a tuple with the De field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StatusError) GetDeOk() (ret StatusErrorGetDeRetType, ok bool) { + return getStatusErrorGetDeAttributeTypeOk(o.De) +} + +// HasDe returns a boolean if a field has been set. +func (o *StatusError) HasDe() bool { + _, ok := o.GetDeOk() + return ok +} + +// SetDe gets a reference to the given string and assigns it to the De field. +func (o *StatusError) SetDe(v StatusErrorGetDeRetType) { + setStatusErrorGetDeAttributeType(&o.De, v) +} + +// GetEn returns the En field value +func (o *StatusError) GetEn() (ret StatusErrorGetEnRetType) { + ret, _ = o.GetEnOk() + return ret +} + +// GetEnOk returns a tuple with the En field value +// and a boolean to check if the value has been set. +func (o *StatusError) GetEnOk() (ret StatusErrorGetEnRetType, ok bool) { + return getStatusErrorGetEnAttributeTypeOk(o.En) +} + +// SetEn sets field value +func (o *StatusError) SetEn(v StatusErrorGetEnRetType) { + setStatusErrorGetEnAttributeType(&o.En, v) +} + +// GetKey returns the Key field value +func (o *StatusError) GetKey() (ret StatusErrorGetKeyRetType) { + ret, _ = o.GetKeyOk() + return ret +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +func (o *StatusError) GetKeyOk() (ret StatusErrorGetKeyRetType, ok bool) { + return getStatusErrorGetKeyAttributeTypeOk(o.Key) +} + +// SetKey sets field value +func (o *StatusError) SetKey(v StatusErrorGetKeyRetType) { + setStatusErrorGetKeyAttributeType(&o.Key, v) +} + +func (o StatusError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getStatusErrorGetDeAttributeTypeOk(o.De); ok { + toSerialize["De"] = val + } + if val, ok := getStatusErrorGetEnAttributeTypeOk(o.En); ok { + toSerialize["En"] = val + } + if val, ok := getStatusErrorGetKeyAttributeTypeOk(o.Key); ok { + toSerialize["Key"] = val + } + return toSerialize, nil +} + +type NullableStatusError struct { + value *StatusError + isSet bool +} + +func (v NullableStatusError) Get() *StatusError { + return v.value +} + +func (v *NullableStatusError) Set(val *StatusError) { + v.value = val + v.isSet = true +} + +func (v NullableStatusError) IsSet() bool { + return v.isSet +} + +func (v *NullableStatusError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStatusError(val *StatusError) *NullableStatusError { + return &NullableStatusError{value: val, isSet: true} +} + +func (v NullableStatusError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStatusError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_status_error_test.go b/pkg/cdnbeta/model_status_error_test.go new file mode 100644 index 00000000..e2837b28 --- /dev/null +++ b/pkg/cdnbeta/model_status_error_test.go @@ -0,0 +1,72 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "testing" +) + +// isEnum + +func TestStatusErrorKey_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"UNKNOWN"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"CUSTOM_DOMAIN_CNAME_MISSING"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"CUSTOM_DOMAIN_ALREADY_IN_USE"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"PUBLIC_BETA_QUOTA_REACHED"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := StatusErrorKey("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/cdnbeta/model_waf_config.go b/pkg/cdnbeta/model_waf_config.go new file mode 100644 index 00000000..b546afc7 --- /dev/null +++ b/pkg/cdnbeta/model_waf_config.go @@ -0,0 +1,212 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the WafConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WafConfig{} + +/* + types and functions for enabledRuleIds +*/ + +// isArray +type WafConfigGetEnabledRuleIdsAttributeType = *[]string +type WafConfigGetEnabledRuleIdsArgType = []string +type WafConfigGetEnabledRuleIdsRetType = []string + +func getWafConfigGetEnabledRuleIdsAttributeTypeOk(arg WafConfigGetEnabledRuleIdsAttributeType) (ret WafConfigGetEnabledRuleIdsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafConfigGetEnabledRuleIdsAttributeType(arg *WafConfigGetEnabledRuleIdsAttributeType, val WafConfigGetEnabledRuleIdsRetType) { + *arg = &val +} + +/* + types and functions for mode +*/ + +// isEnumRef +type WafConfigGetModeAttributeType = *WafMode +type WafConfigGetModeArgType = WafMode +type WafConfigGetModeRetType = WafMode + +func getWafConfigGetModeAttributeTypeOk(arg WafConfigGetModeAttributeType) (ret WafConfigGetModeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafConfigGetModeAttributeType(arg *WafConfigGetModeAttributeType, val WafConfigGetModeRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isEnumRef +type WafConfigGetTypeAttributeType = *WafType +type WafConfigGetTypeArgType = WafType +type WafConfigGetTypeRetType = WafType + +func getWafConfigGetTypeAttributeTypeOk(arg WafConfigGetTypeAttributeType) (ret WafConfigGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafConfigGetTypeAttributeType(arg *WafConfigGetTypeAttributeType, val WafConfigGetTypeRetType) { + *arg = &val +} + +// WafConfig Configuration of the WAF of a distribution +type WafConfig struct { + // Ids of the WAF rules that are **explicitly** enabled for this distribution. If this rule is in a disabled / log Only RuleGroup or Collection, it will be enabled regardless as `enabledRuleIds` overrides those in specificity. Do note that rules can also be enabled because a Rulegroup or Collection is enabled. **DO NOT** use this property to find all active rules. Instead, pass `?withWafStatus=true` as a query parameter to `GetDistribution` or `ListDistributions`. This will expose the `waf` Property on distribution Level. From there you can `$.waf.enabledRules.map(e => e.id)` to get a list of all enabled rules. + // REQUIRED + EnabledRuleIds WafConfigGetEnabledRuleIdsAttributeType `json:"enabledRuleIds" required:"true"` + // REQUIRED + Mode WafConfigGetModeAttributeType `json:"mode" required:"true"` + // REQUIRED + Type WafConfigGetTypeAttributeType `json:"type" required:"true"` +} + +type _WafConfig WafConfig + +// NewWafConfig instantiates a new WafConfig 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 NewWafConfig(enabledRuleIds WafConfigGetEnabledRuleIdsArgType, mode WafConfigGetModeArgType, types WafConfigGetTypeArgType) *WafConfig { + this := WafConfig{} + setWafConfigGetEnabledRuleIdsAttributeType(&this.EnabledRuleIds, enabledRuleIds) + setWafConfigGetModeAttributeType(&this.Mode, mode) + setWafConfigGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewWafConfigWithDefaults instantiates a new WafConfig 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 NewWafConfigWithDefaults() *WafConfig { + this := WafConfig{} + return &this +} + +// GetEnabledRuleIds returns the EnabledRuleIds field value +func (o *WafConfig) GetEnabledRuleIds() (ret WafConfigGetEnabledRuleIdsRetType) { + ret, _ = o.GetEnabledRuleIdsOk() + return ret +} + +// GetEnabledRuleIdsOk returns a tuple with the EnabledRuleIds field value +// and a boolean to check if the value has been set. +func (o *WafConfig) GetEnabledRuleIdsOk() (ret WafConfigGetEnabledRuleIdsRetType, ok bool) { + return getWafConfigGetEnabledRuleIdsAttributeTypeOk(o.EnabledRuleIds) +} + +// SetEnabledRuleIds sets field value +func (o *WafConfig) SetEnabledRuleIds(v WafConfigGetEnabledRuleIdsRetType) { + setWafConfigGetEnabledRuleIdsAttributeType(&o.EnabledRuleIds, v) +} + +// GetMode returns the Mode field value +func (o *WafConfig) GetMode() (ret WafConfigGetModeRetType) { + ret, _ = o.GetModeOk() + return ret +} + +// GetModeOk returns a tuple with the Mode field value +// and a boolean to check if the value has been set. +func (o *WafConfig) GetModeOk() (ret WafConfigGetModeRetType, ok bool) { + return getWafConfigGetModeAttributeTypeOk(o.Mode) +} + +// SetMode sets field value +func (o *WafConfig) SetMode(v WafConfigGetModeRetType) { + setWafConfigGetModeAttributeType(&o.Mode, v) +} + +// GetType returns the Type field value +func (o *WafConfig) GetType() (ret WafConfigGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *WafConfig) GetTypeOk() (ret WafConfigGetTypeRetType, ok bool) { + return getWafConfigGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *WafConfig) SetType(v WafConfigGetTypeRetType) { + setWafConfigGetTypeAttributeType(&o.Type, v) +} + +func (o WafConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getWafConfigGetEnabledRuleIdsAttributeTypeOk(o.EnabledRuleIds); ok { + toSerialize["EnabledRuleIds"] = val + } + if val, ok := getWafConfigGetModeAttributeTypeOk(o.Mode); ok { + toSerialize["Mode"] = val + } + if val, ok := getWafConfigGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableWafConfig struct { + value *WafConfig + isSet bool +} + +func (v NullableWafConfig) Get() *WafConfig { + return v.value +} + +func (v *NullableWafConfig) Set(val *WafConfig) { + v.value = val + v.isSet = true +} + +func (v NullableWafConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableWafConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWafConfig(val *WafConfig) *NullableWafConfig { + return &NullableWafConfig{value: val, isSet: true} +} + +func (v NullableWafConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWafConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_waf_config_patch.go b/pkg/cdnbeta/model_waf_config_patch.go new file mode 100644 index 00000000..8ce6d1e3 --- /dev/null +++ b/pkg/cdnbeta/model_waf_config_patch.go @@ -0,0 +1,174 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the WafConfigPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WafConfigPatch{} + +/* + types and functions for mode +*/ + +// isEnumRef +type WafConfigPatchGetModeAttributeType = *WafMode +type WafConfigPatchGetModeArgType = WafMode +type WafConfigPatchGetModeRetType = WafMode + +func getWafConfigPatchGetModeAttributeTypeOk(arg WafConfigPatchGetModeAttributeType) (ret WafConfigPatchGetModeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafConfigPatchGetModeAttributeType(arg *WafConfigPatchGetModeAttributeType, val WafConfigPatchGetModeRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isEnumRef +type WafConfigPatchGetTypeAttributeType = *WafType +type WafConfigPatchGetTypeArgType = WafType +type WafConfigPatchGetTypeRetType = WafType + +func getWafConfigPatchGetTypeAttributeTypeOk(arg WafConfigPatchGetTypeAttributeType) (ret WafConfigPatchGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafConfigPatchGetTypeAttributeType(arg *WafConfigPatchGetTypeAttributeType, val WafConfigPatchGetTypeRetType) { + *arg = &val +} + +// WafConfigPatch struct for WafConfigPatch +type WafConfigPatch struct { + Mode WafConfigPatchGetModeAttributeType `json:"mode,omitempty"` + Type WafConfigPatchGetTypeAttributeType `json:"type,omitempty"` +} + +// NewWafConfigPatch instantiates a new WafConfigPatch 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 NewWafConfigPatch() *WafConfigPatch { + this := WafConfigPatch{} + return &this +} + +// NewWafConfigPatchWithDefaults instantiates a new WafConfigPatch 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 NewWafConfigPatchWithDefaults() *WafConfigPatch { + this := WafConfigPatch{} + return &this +} + +// GetMode returns the Mode field value if set, zero value otherwise. +func (o *WafConfigPatch) GetMode() (res WafConfigPatchGetModeRetType) { + res, _ = o.GetModeOk() + return +} + +// GetModeOk returns a tuple with the Mode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WafConfigPatch) GetModeOk() (ret WafConfigPatchGetModeRetType, ok bool) { + return getWafConfigPatchGetModeAttributeTypeOk(o.Mode) +} + +// HasMode returns a boolean if a field has been set. +func (o *WafConfigPatch) HasMode() bool { + _, ok := o.GetModeOk() + return ok +} + +// SetMode gets a reference to the given WafMode and assigns it to the Mode field. +func (o *WafConfigPatch) SetMode(v WafConfigPatchGetModeRetType) { + setWafConfigPatchGetModeAttributeType(&o.Mode, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *WafConfigPatch) GetType() (res WafConfigPatchGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WafConfigPatch) GetTypeOk() (ret WafConfigPatchGetTypeRetType, ok bool) { + return getWafConfigPatchGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *WafConfigPatch) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given WafType and assigns it to the Type field. +func (o *WafConfigPatch) SetType(v WafConfigPatchGetTypeRetType) { + setWafConfigPatchGetTypeAttributeType(&o.Type, v) +} + +func (o WafConfigPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getWafConfigPatchGetModeAttributeTypeOk(o.Mode); ok { + toSerialize["Mode"] = val + } + if val, ok := getWafConfigPatchGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableWafConfigPatch struct { + value *WafConfigPatch + isSet bool +} + +func (v NullableWafConfigPatch) Get() *WafConfigPatch { + return v.value +} + +func (v *NullableWafConfigPatch) Set(val *WafConfigPatch) { + v.value = val + v.isSet = true +} + +func (v NullableWafConfigPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableWafConfigPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWafConfigPatch(val *WafConfigPatch) *NullableWafConfigPatch { + return &NullableWafConfigPatch{value: val, isSet: true} +} + +func (v NullableWafConfigPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWafConfigPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_waf_config_patch_test.go b/pkg/cdnbeta/model_waf_config_patch_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_waf_config_patch_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_waf_config_test.go b/pkg/cdnbeta/model_waf_config_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_waf_config_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_waf_mode.go b/pkg/cdnbeta/model_waf_mode.go new file mode 100644 index 00000000..ec13e737 --- /dev/null +++ b/pkg/cdnbeta/model_waf_mode.go @@ -0,0 +1,117 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// WafMode the model 'WafMode' +type WafMode string + +// List of WafMode +const ( + WAFMODE_DISABLED WafMode = "DISABLED" + WAFMODE_ENABLED WafMode = "ENABLED" + WAFMODE_LOG_ONLY WafMode = "LOG_ONLY" +) + +// All allowed values of WafMode enum +var AllowedWafModeEnumValues = []WafMode{ + "DISABLED", + "ENABLED", + "LOG_ONLY", +} + +func (v *WafMode) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := WafMode(value) + for _, existing := range AllowedWafModeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid WafMode", value) +} + +// NewWafModeFromValue returns a pointer to a valid WafMode +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewWafModeFromValue(v string) (*WafMode, error) { + ev := WafMode(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for WafMode: valid values are %v", v, AllowedWafModeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v WafMode) IsValid() bool { + for _, existing := range AllowedWafModeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WafMode value +func (v WafMode) Ptr() *WafMode { + return &v +} + +type NullableWafMode struct { + value *WafMode + isSet bool +} + +func (v NullableWafMode) Get() *WafMode { + return v.value +} + +func (v *NullableWafMode) Set(val *WafMode) { + v.value = val + v.isSet = true +} + +func (v NullableWafMode) IsSet() bool { + return v.isSet +} + +func (v *NullableWafMode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWafMode(val *WafMode) *NullableWafMode { + return &NullableWafMode{value: val, isSet: true} +} + +func (v NullableWafMode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWafMode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_waf_mode_test.go b/pkg/cdnbeta/model_waf_mode_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_waf_mode_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_waf_rule.go b/pkg/cdnbeta/model_waf_rule.go new file mode 100644 index 00000000..06fecd60 --- /dev/null +++ b/pkg/cdnbeta/model_waf_rule.go @@ -0,0 +1,219 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the WafRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WafRule{} + +/* + types and functions for code +*/ + +// isNotNullableString +type WafRuleGetCodeAttributeType = *string + +func getWafRuleGetCodeAttributeTypeOk(arg WafRuleGetCodeAttributeType) (ret WafRuleGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafRuleGetCodeAttributeType(arg *WafRuleGetCodeAttributeType, val WafRuleGetCodeRetType) { + *arg = &val +} + +type WafRuleGetCodeArgType = string +type WafRuleGetCodeRetType = string + +/* + types and functions for description +*/ + +// isContainer +type WafRuleGetDescriptionAttributeType = *map[string]string +type WafRuleGetDescriptionArgType = map[string]string +type WafRuleGetDescriptionRetType = map[string]string + +func getWafRuleGetDescriptionAttributeTypeOk(arg WafRuleGetDescriptionAttributeType) (ret WafRuleGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafRuleGetDescriptionAttributeType(arg *WafRuleGetDescriptionAttributeType, val WafRuleGetDescriptionRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type WafRuleGetIdAttributeType = *string + +func getWafRuleGetIdAttributeTypeOk(arg WafRuleGetIdAttributeType) (ret WafRuleGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafRuleGetIdAttributeType(arg *WafRuleGetIdAttributeType, val WafRuleGetIdRetType) { + *arg = &val +} + +type WafRuleGetIdArgType = string +type WafRuleGetIdRetType = string + +// WafRule struct for WafRule +type WafRule struct { + // Optional CoreRuleSet rule Id in case this is a CRS rule + Code WafRuleGetCodeAttributeType `json:"code,omitempty"` + // LocalizedString is a map from language to string value + // REQUIRED + Description WafRuleGetDescriptionAttributeType `json:"description" required:"true"` + // REQUIRED + Id WafRuleGetIdAttributeType `json:"id" required:"true"` +} + +type _WafRule WafRule + +// NewWafRule instantiates a new WafRule 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 NewWafRule(description WafRuleGetDescriptionArgType, id WafRuleGetIdArgType) *WafRule { + this := WafRule{} + setWafRuleGetDescriptionAttributeType(&this.Description, description) + setWafRuleGetIdAttributeType(&this.Id, id) + return &this +} + +// NewWafRuleWithDefaults instantiates a new WafRule 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 NewWafRuleWithDefaults() *WafRule { + this := WafRule{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *WafRule) GetCode() (res WafRuleGetCodeRetType) { + res, _ = o.GetCodeOk() + return +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WafRule) GetCodeOk() (ret WafRuleGetCodeRetType, ok bool) { + return getWafRuleGetCodeAttributeTypeOk(o.Code) +} + +// HasCode returns a boolean if a field has been set. +func (o *WafRule) HasCode() bool { + _, ok := o.GetCodeOk() + return ok +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *WafRule) SetCode(v WafRuleGetCodeRetType) { + setWafRuleGetCodeAttributeType(&o.Code, v) +} + +// GetDescription returns the Description field value +func (o *WafRule) GetDescription() (ret WafRuleGetDescriptionRetType) { + ret, _ = o.GetDescriptionOk() + return ret +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *WafRule) GetDescriptionOk() (ret WafRuleGetDescriptionRetType, ok bool) { + return getWafRuleGetDescriptionAttributeTypeOk(o.Description) +} + +// SetDescription sets field value +func (o *WafRule) SetDescription(v WafRuleGetDescriptionRetType) { + setWafRuleGetDescriptionAttributeType(&o.Description, v) +} + +// GetId returns the Id field value +func (o *WafRule) GetId() (ret WafRuleGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *WafRule) GetIdOk() (ret WafRuleGetIdRetType, ok bool) { + return getWafRuleGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *WafRule) SetId(v WafRuleGetIdRetType) { + setWafRuleGetIdAttributeType(&o.Id, v) +} + +func (o WafRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getWafRuleGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getWafRuleGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getWafRuleGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + return toSerialize, nil +} + +type NullableWafRule struct { + value *WafRule + isSet bool +} + +func (v NullableWafRule) Get() *WafRule { + return v.value +} + +func (v *NullableWafRule) Set(val *WafRule) { + v.value = val + v.isSet = true +} + +func (v NullableWafRule) IsSet() bool { + return v.isSet +} + +func (v *NullableWafRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWafRule(val *WafRule) *NullableWafRule { + return &NullableWafRule{value: val, isSet: true} +} + +func (v NullableWafRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWafRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_waf_rule_collection.go b/pkg/cdnbeta/model_waf_rule_collection.go new file mode 100644 index 00000000..b6db0313 --- /dev/null +++ b/pkg/cdnbeta/model_waf_rule_collection.go @@ -0,0 +1,213 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the WafRuleCollection type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WafRuleCollection{} + +/* + types and functions for groups +*/ + +// isArray +type WafRuleCollectionGetGroupsAttributeType = *[]WafRuleGroup +type WafRuleCollectionGetGroupsArgType = []WafRuleGroup +type WafRuleCollectionGetGroupsRetType = []WafRuleGroup + +func getWafRuleCollectionGetGroupsAttributeTypeOk(arg WafRuleCollectionGetGroupsAttributeType) (ret WafRuleCollectionGetGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafRuleCollectionGetGroupsAttributeType(arg *WafRuleCollectionGetGroupsAttributeType, val WafRuleCollectionGetGroupsRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type WafRuleCollectionGetIdAttributeType = *string + +func getWafRuleCollectionGetIdAttributeTypeOk(arg WafRuleCollectionGetIdAttributeType) (ret WafRuleCollectionGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafRuleCollectionGetIdAttributeType(arg *WafRuleCollectionGetIdAttributeType, val WafRuleCollectionGetIdRetType) { + *arg = &val +} + +type WafRuleCollectionGetIdArgType = string +type WafRuleCollectionGetIdRetType = string + +/* + types and functions for name +*/ + +// isContainer +type WafRuleCollectionGetNameAttributeType = *map[string]string +type WafRuleCollectionGetNameArgType = map[string]string +type WafRuleCollectionGetNameRetType = map[string]string + +func getWafRuleCollectionGetNameAttributeTypeOk(arg WafRuleCollectionGetNameAttributeType) (ret WafRuleCollectionGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafRuleCollectionGetNameAttributeType(arg *WafRuleCollectionGetNameAttributeType, val WafRuleCollectionGetNameRetType) { + *arg = &val +} + +// WafRuleCollection struct for WafRuleCollection +type WafRuleCollection struct { + // REQUIRED + Groups WafRuleCollectionGetGroupsAttributeType `json:"groups" required:"true"` + // REQUIRED + Id WafRuleCollectionGetIdAttributeType `json:"id" required:"true"` + // LocalizedString is a map from language to string value + // REQUIRED + Name WafRuleCollectionGetNameAttributeType `json:"name" required:"true"` +} + +type _WafRuleCollection WafRuleCollection + +// NewWafRuleCollection instantiates a new WafRuleCollection 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 NewWafRuleCollection(groups WafRuleCollectionGetGroupsArgType, id WafRuleCollectionGetIdArgType, name WafRuleCollectionGetNameArgType) *WafRuleCollection { + this := WafRuleCollection{} + setWafRuleCollectionGetGroupsAttributeType(&this.Groups, groups) + setWafRuleCollectionGetIdAttributeType(&this.Id, id) + setWafRuleCollectionGetNameAttributeType(&this.Name, name) + return &this +} + +// NewWafRuleCollectionWithDefaults instantiates a new WafRuleCollection 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 NewWafRuleCollectionWithDefaults() *WafRuleCollection { + this := WafRuleCollection{} + return &this +} + +// GetGroups returns the Groups field value +func (o *WafRuleCollection) GetGroups() (ret WafRuleCollectionGetGroupsRetType) { + ret, _ = o.GetGroupsOk() + return ret +} + +// GetGroupsOk returns a tuple with the Groups field value +// and a boolean to check if the value has been set. +func (o *WafRuleCollection) GetGroupsOk() (ret WafRuleCollectionGetGroupsRetType, ok bool) { + return getWafRuleCollectionGetGroupsAttributeTypeOk(o.Groups) +} + +// SetGroups sets field value +func (o *WafRuleCollection) SetGroups(v WafRuleCollectionGetGroupsRetType) { + setWafRuleCollectionGetGroupsAttributeType(&o.Groups, v) +} + +// GetId returns the Id field value +func (o *WafRuleCollection) GetId() (ret WafRuleCollectionGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *WafRuleCollection) GetIdOk() (ret WafRuleCollectionGetIdRetType, ok bool) { + return getWafRuleCollectionGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *WafRuleCollection) SetId(v WafRuleCollectionGetIdRetType) { + setWafRuleCollectionGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value +func (o *WafRuleCollection) GetName() (ret WafRuleCollectionGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *WafRuleCollection) GetNameOk() (ret WafRuleCollectionGetNameRetType, ok bool) { + return getWafRuleCollectionGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *WafRuleCollection) SetName(v WafRuleCollectionGetNameRetType) { + setWafRuleCollectionGetNameAttributeType(&o.Name, v) +} + +func (o WafRuleCollection) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getWafRuleCollectionGetGroupsAttributeTypeOk(o.Groups); ok { + toSerialize["Groups"] = val + } + if val, ok := getWafRuleCollectionGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getWafRuleCollectionGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableWafRuleCollection struct { + value *WafRuleCollection + isSet bool +} + +func (v NullableWafRuleCollection) Get() *WafRuleCollection { + return v.value +} + +func (v *NullableWafRuleCollection) Set(val *WafRuleCollection) { + v.value = val + v.isSet = true +} + +func (v NullableWafRuleCollection) IsSet() bool { + return v.isSet +} + +func (v *NullableWafRuleCollection) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWafRuleCollection(val *WafRuleCollection) *NullableWafRuleCollection { + return &NullableWafRuleCollection{value: val, isSet: true} +} + +func (v NullableWafRuleCollection) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWafRuleCollection) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_waf_rule_collection_test.go b/pkg/cdnbeta/model_waf_rule_collection_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_waf_rule_collection_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_waf_rule_group.go b/pkg/cdnbeta/model_waf_rule_group.go new file mode 100644 index 00000000..11cde5aa --- /dev/null +++ b/pkg/cdnbeta/model_waf_rule_group.go @@ -0,0 +1,213 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the WafRuleGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WafRuleGroup{} + +/* + types and functions for description +*/ + +// isContainer +type WafRuleGroupGetDescriptionAttributeType = *map[string]string +type WafRuleGroupGetDescriptionArgType = map[string]string +type WafRuleGroupGetDescriptionRetType = map[string]string + +func getWafRuleGroupGetDescriptionAttributeTypeOk(arg WafRuleGroupGetDescriptionAttributeType) (ret WafRuleGroupGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafRuleGroupGetDescriptionAttributeType(arg *WafRuleGroupGetDescriptionAttributeType, val WafRuleGroupGetDescriptionRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isContainer +type WafRuleGroupGetNameAttributeType = *map[string]string +type WafRuleGroupGetNameArgType = map[string]string +type WafRuleGroupGetNameRetType = map[string]string + +func getWafRuleGroupGetNameAttributeTypeOk(arg WafRuleGroupGetNameAttributeType) (ret WafRuleGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafRuleGroupGetNameAttributeType(arg *WafRuleGroupGetNameAttributeType, val WafRuleGroupGetNameRetType) { + *arg = &val +} + +/* + types and functions for rules +*/ + +// isArray +type WafRuleGroupGetRulesAttributeType = *[]WafRule +type WafRuleGroupGetRulesArgType = []WafRule +type WafRuleGroupGetRulesRetType = []WafRule + +func getWafRuleGroupGetRulesAttributeTypeOk(arg WafRuleGroupGetRulesAttributeType) (ret WafRuleGroupGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafRuleGroupGetRulesAttributeType(arg *WafRuleGroupGetRulesAttributeType, val WafRuleGroupGetRulesRetType) { + *arg = &val +} + +// WafRuleGroup struct for WafRuleGroup +type WafRuleGroup struct { + // LocalizedString is a map from language to string value + // REQUIRED + Description WafRuleGroupGetDescriptionAttributeType `json:"description" required:"true"` + // LocalizedString is a map from language to string value + // REQUIRED + Name WafRuleGroupGetNameAttributeType `json:"name" required:"true"` + // REQUIRED + Rules WafRuleGroupGetRulesAttributeType `json:"rules" required:"true"` +} + +type _WafRuleGroup WafRuleGroup + +// NewWafRuleGroup instantiates a new WafRuleGroup 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 NewWafRuleGroup(description WafRuleGroupGetDescriptionArgType, name WafRuleGroupGetNameArgType, rules WafRuleGroupGetRulesArgType) *WafRuleGroup { + this := WafRuleGroup{} + setWafRuleGroupGetDescriptionAttributeType(&this.Description, description) + setWafRuleGroupGetNameAttributeType(&this.Name, name) + setWafRuleGroupGetRulesAttributeType(&this.Rules, rules) + return &this +} + +// NewWafRuleGroupWithDefaults instantiates a new WafRuleGroup 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 NewWafRuleGroupWithDefaults() *WafRuleGroup { + this := WafRuleGroup{} + return &this +} + +// GetDescription returns the Description field value +func (o *WafRuleGroup) GetDescription() (ret WafRuleGroupGetDescriptionRetType) { + ret, _ = o.GetDescriptionOk() + return ret +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *WafRuleGroup) GetDescriptionOk() (ret WafRuleGroupGetDescriptionRetType, ok bool) { + return getWafRuleGroupGetDescriptionAttributeTypeOk(o.Description) +} + +// SetDescription sets field value +func (o *WafRuleGroup) SetDescription(v WafRuleGroupGetDescriptionRetType) { + setWafRuleGroupGetDescriptionAttributeType(&o.Description, v) +} + +// GetName returns the Name field value +func (o *WafRuleGroup) GetName() (ret WafRuleGroupGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *WafRuleGroup) GetNameOk() (ret WafRuleGroupGetNameRetType, ok bool) { + return getWafRuleGroupGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *WafRuleGroup) SetName(v WafRuleGroupGetNameRetType) { + setWafRuleGroupGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value +func (o *WafRuleGroup) GetRules() (ret WafRuleGroupGetRulesRetType) { + ret, _ = o.GetRulesOk() + return ret +} + +// GetRulesOk returns a tuple with the Rules field value +// and a boolean to check if the value has been set. +func (o *WafRuleGroup) GetRulesOk() (ret WafRuleGroupGetRulesRetType, ok bool) { + return getWafRuleGroupGetRulesAttributeTypeOk(o.Rules) +} + +// SetRules sets field value +func (o *WafRuleGroup) SetRules(v WafRuleGroupGetRulesRetType) { + setWafRuleGroupGetRulesAttributeType(&o.Rules, v) +} + +func (o WafRuleGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getWafRuleGroupGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getWafRuleGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getWafRuleGroupGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableWafRuleGroup struct { + value *WafRuleGroup + isSet bool +} + +func (v NullableWafRuleGroup) Get() *WafRuleGroup { + return v.value +} + +func (v *NullableWafRuleGroup) Set(val *WafRuleGroup) { + v.value = val + v.isSet = true +} + +func (v NullableWafRuleGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableWafRuleGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWafRuleGroup(val *WafRuleGroup) *NullableWafRuleGroup { + return &NullableWafRuleGroup{value: val, isSet: true} +} + +func (v NullableWafRuleGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWafRuleGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_waf_rule_group_test.go b/pkg/cdnbeta/model_waf_rule_group_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_waf_rule_group_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_waf_rule_test.go b/pkg/cdnbeta/model_waf_rule_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_waf_rule_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_waf_status_rule_block.go b/pkg/cdnbeta/model_waf_status_rule_block.go new file mode 100644 index 00000000..e55ccf27 --- /dev/null +++ b/pkg/cdnbeta/model_waf_status_rule_block.go @@ -0,0 +1,127 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" +) + +// checks if the WafStatusRuleBlock type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WafStatusRuleBlock{} + +/* + types and functions for id +*/ + +// isNotNullableString +type WafStatusRuleBlockGetIdAttributeType = *string + +func getWafStatusRuleBlockGetIdAttributeTypeOk(arg WafStatusRuleBlockGetIdAttributeType) (ret WafStatusRuleBlockGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWafStatusRuleBlockGetIdAttributeType(arg *WafStatusRuleBlockGetIdAttributeType, val WafStatusRuleBlockGetIdRetType) { + *arg = &val +} + +type WafStatusRuleBlockGetIdArgType = string +type WafStatusRuleBlockGetIdRetType = string + +// WafStatusRuleBlock struct for WafStatusRuleBlock +type WafStatusRuleBlock struct { + // Specifies the Id of the Rule. + // REQUIRED + Id WafStatusRuleBlockGetIdAttributeType `json:"id" required:"true"` +} + +type _WafStatusRuleBlock WafStatusRuleBlock + +// NewWafStatusRuleBlock instantiates a new WafStatusRuleBlock 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 NewWafStatusRuleBlock(id WafStatusRuleBlockGetIdArgType) *WafStatusRuleBlock { + this := WafStatusRuleBlock{} + setWafStatusRuleBlockGetIdAttributeType(&this.Id, id) + return &this +} + +// NewWafStatusRuleBlockWithDefaults instantiates a new WafStatusRuleBlock 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 NewWafStatusRuleBlockWithDefaults() *WafStatusRuleBlock { + this := WafStatusRuleBlock{} + return &this +} + +// GetId returns the Id field value +func (o *WafStatusRuleBlock) GetId() (ret WafStatusRuleBlockGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *WafStatusRuleBlock) GetIdOk() (ret WafStatusRuleBlockGetIdRetType, ok bool) { + return getWafStatusRuleBlockGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *WafStatusRuleBlock) SetId(v WafStatusRuleBlockGetIdRetType) { + setWafStatusRuleBlockGetIdAttributeType(&o.Id, v) +} + +func (o WafStatusRuleBlock) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getWafStatusRuleBlockGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + return toSerialize, nil +} + +type NullableWafStatusRuleBlock struct { + value *WafStatusRuleBlock + isSet bool +} + +func (v NullableWafStatusRuleBlock) Get() *WafStatusRuleBlock { + return v.value +} + +func (v *NullableWafStatusRuleBlock) Set(val *WafStatusRuleBlock) { + v.value = val + v.isSet = true +} + +func (v NullableWafStatusRuleBlock) IsSet() bool { + return v.isSet +} + +func (v *NullableWafStatusRuleBlock) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWafStatusRuleBlock(val *WafStatusRuleBlock) *NullableWafStatusRuleBlock { + return &NullableWafStatusRuleBlock{value: val, isSet: true} +} + +func (v NullableWafStatusRuleBlock) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWafStatusRuleBlock) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_waf_status_rule_block_test.go b/pkg/cdnbeta/model_waf_status_rule_block_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_waf_status_rule_block_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/model_waf_type.go b/pkg/cdnbeta/model_waf_type.go new file mode 100644 index 00000000..40b51aba --- /dev/null +++ b/pkg/cdnbeta/model_waf_type.go @@ -0,0 +1,115 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "fmt" +) + +// WafType Enable or disable the Premium WAF. Do note that enabling the Premium WAF will cause additional fees. Some features are gated behind the Premium WAF, like additional, **premium-only rules** and the ability to create **custom rules** (not yet implemented) +type WafType string + +// List of WafType +const ( + WAFTYPE_FREE WafType = "FREE" + WAFTYPE_PREMIUM WafType = "PREMIUM" +) + +// All allowed values of WafType enum +var AllowedWafTypeEnumValues = []WafType{ + "FREE", + "PREMIUM", +} + +func (v *WafType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := WafType(value) + for _, existing := range AllowedWafTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid WafType", value) +} + +// NewWafTypeFromValue returns a pointer to a valid WafType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewWafTypeFromValue(v string) (*WafType, error) { + ev := WafType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for WafType: valid values are %v", v, AllowedWafTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v WafType) IsValid() bool { + for _, existing := range AllowedWafTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WafType value +func (v WafType) Ptr() *WafType { + return &v +} + +type NullableWafType struct { + value *WafType + isSet bool +} + +func (v NullableWafType) Get() *WafType { + return v.value +} + +func (v *NullableWafType) Set(val *WafType) { + v.value = val + v.isSet = true +} + +func (v NullableWafType) IsSet() bool { + return v.isSet +} + +func (v *NullableWafType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWafType(val *WafType) *NullableWafType { + return &NullableWafType{value: val, isSet: true} +} + +func (v NullableWafType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWafType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/cdnbeta/model_waf_type_test.go b/pkg/cdnbeta/model_waf_type_test.go new file mode 100644 index 00000000..f0ab9be5 --- /dev/null +++ b/pkg/cdnbeta/model_waf_type_test.go @@ -0,0 +1,11 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta diff --git a/pkg/cdnbeta/utils.go b/pkg/cdnbeta/utils.go new file mode 100644 index 00000000..c6af1b05 --- /dev/null +++ b/pkg/cdnbeta/utils.go @@ -0,0 +1,385 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta2.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdnbeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/certificatesbeta/.openapi-generator/VERSION b/pkg/certificatesbeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/certificatesbeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/certificatesbeta/api_default.go b/pkg/certificatesbeta/api_default.go new file mode 100644 index 00000000..b2624008 --- /dev/null +++ b/pkg/certificatesbeta/api_default.go @@ -0,0 +1,758 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateCertificate Store a TLS certificate in a project. + CreateCertificate will store a TLS certificate in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateCertificateRequest + */ + CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest + /* + CreateCertificateExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return CreateCertificateResponse + + */ + CreateCertificateExecute(ctx context.Context, projectId string, region string) (*CreateCertificateResponse, error) + /* + DeleteCertificate Delete a stored TLS certificate in a project. + DeleteCertificate will delete the stored TLS certificate. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param id + @return ApiDeleteCertificateRequest + */ + DeleteCertificate(ctx context.Context, projectId string, region string, id string) ApiDeleteCertificateRequest + /* + DeleteCertificateExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param id + @return map[string]interface{} + + */ + DeleteCertificateExecute(ctx context.Context, projectId string, region string, id string) (map[string]interface{}, error) + /* + GetCertificate Retrieve the public parts of a stored TLS certificate. + GetCertificate will return the public parts of a stored TLS certificate. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param id + @return ApiGetCertificateRequest + */ + GetCertificate(ctx context.Context, projectId string, region string, id string) ApiGetCertificateRequest + /* + GetCertificateExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param id + @return GetCertificateResponse + + */ + GetCertificateExecute(ctx context.Context, projectId string, region string, id string) (*GetCertificateResponse, error) + /* + ListCertificates Retrieve the list of TLS certificate stored in a project. + ListCertificates will return the list of TLS certificates in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListCertificatesRequest + */ + ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest + /* + ListCertificatesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ListCertificatesResponse + + */ + ListCertificatesExecute(ctx context.Context, projectId string, region string) (*ListCertificatesResponse, error) +} + +type ApiCreateCertificateRequest interface { + CreateCertificatePayload(createCertificatePayload CreateCertificatePayload) ApiCreateCertificateRequest + Execute() (*CreateCertificateResponse, error) +} + +type ApiDeleteCertificateRequest interface { + Execute() (map[string]interface{}, error) +} + +type ApiGetCertificateRequest interface { + Execute() (*GetCertificateResponse, error) +} + +type ApiListCertificatesRequest interface { + // page_size specifies how many certificates should be returned on this page. Must be a positive number <= 1000 + PageSize(pageSize string) ApiListCertificatesRequest + // page_id is a page identifier returned by the previous response and is used to request the next page + PageId(pageId string) ApiListCertificatesRequest + Execute() (*ListCertificatesResponse, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateCertificateRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createCertificatePayload *CreateCertificatePayload +} + +func (r CreateCertificateRequest) CreateCertificatePayload(createCertificatePayload CreateCertificatePayload) ApiCreateCertificateRequest { + r.createCertificatePayload = &createCertificatePayload + return r +} + +func (r CreateCertificateRequest) Execute() (*CreateCertificateResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateCertificateResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateCertificate") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/certificates" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createCertificatePayload == nil { + return localVarReturnValue, fmt.Errorf("createCertificatePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createCertificatePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateCertificate: Store a TLS certificate in a project. + +CreateCertificate will store a TLS certificate in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateCertificateRequest +*/ +func (a *APIClient) CreateCertificate(ctx context.Context, projectId string, region string) ApiCreateCertificateRequest { + return CreateCertificateRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateCertificateExecute(ctx context.Context, projectId string, region string) (*CreateCertificateResponse, error) { + r := CreateCertificateRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type DeleteCertificateRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + id string +} + +func (r DeleteCertificateRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteCertificate") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/certificates/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(ParameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteCertificate: Delete a stored TLS certificate in a project. + +DeleteCertificate will delete the stored TLS certificate. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param id + @return ApiDeleteCertificateRequest +*/ +func (a *APIClient) DeleteCertificate(ctx context.Context, projectId string, region string, id string) ApiDeleteCertificateRequest { + return DeleteCertificateRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + id: id, + } +} + +func (a *APIClient) DeleteCertificateExecute(ctx context.Context, projectId string, region string, id string) (map[string]interface{}, error) { + r := DeleteCertificateRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + id: id, + } + return r.Execute() +} + +type GetCertificateRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + id string +} + +func (r GetCertificateRequest) Execute() (*GetCertificateResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCertificateResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCertificate") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/certificates/{id}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(ParameterValueToString(r.id, "id")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCertificate: Retrieve the public parts of a stored TLS certificate. + +GetCertificate will return the public parts of a stored TLS certificate. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param id + @return ApiGetCertificateRequest +*/ +func (a *APIClient) GetCertificate(ctx context.Context, projectId string, region string, id string) ApiGetCertificateRequest { + return GetCertificateRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + id: id, + } +} + +func (a *APIClient) GetCertificateExecute(ctx context.Context, projectId string, region string, id string) (*GetCertificateResponse, error) { + r := GetCertificateRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + id: id, + } + return r.Execute() +} + +type ListCertificatesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + pageSize *string + pageId *string +} + +// page_size specifies how many certificates should be returned on this page. Must be a positive number <= 1000 + +func (r ListCertificatesRequest) PageSize(pageSize string) ApiListCertificatesRequest { + r.pageSize = &pageSize + return r +} + +// page_id is a page identifier returned by the previous response and is used to request the next page + +func (r ListCertificatesRequest) PageId(pageId string) ApiListCertificatesRequest { + r.pageId = &pageId + return r +} + +func (r ListCertificatesRequest) Execute() (*ListCertificatesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListCertificatesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListCertificates") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/certificates" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.pageId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageId", r.pageId, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "*/*"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v Status + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListCertificates: Retrieve the list of TLS certificate stored in a project. + +ListCertificates will return the list of TLS certificates in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListCertificatesRequest +*/ +func (a *APIClient) ListCertificates(ctx context.Context, projectId string, region string) ApiListCertificatesRequest { + return ListCertificatesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListCertificatesExecute(ctx context.Context, projectId string, region string) (*ListCertificatesResponse, error) { + r := ListCertificatesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} diff --git a/pkg/certificatesbeta/api_default_test.go b/pkg/certificatesbeta/api_default_test.go new file mode 100644 index 00000000..c0617d09 --- /dev/null +++ b/pkg/certificatesbeta/api_default_test.go @@ -0,0 +1,253 @@ +/* +STACKIT Application Load Balancer Certificates API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package certificatesbeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_certificatesbeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateCertificate", func(t *testing.T) { + _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateCertificateResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for certificatesbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createCertificatePayload := CreateCertificatePayload{} + + resp, reqErr := apiClient.CreateCertificate(context.Background(), projectId, region).CreateCertificatePayload(createCertificatePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteCertificate", func(t *testing.T) { + _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates/{id}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + idValue := "id-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"id"+"}", url.PathEscape(ParameterValueToString(idValue, "id")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for certificatesbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + id := idValue + + resp, reqErr := apiClient.DeleteCertificate(context.Background(), projectId, region, id).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetCertificate", func(t *testing.T) { + _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates/{id}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + idValue := "id-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"id"+"}", url.PathEscape(ParameterValueToString(idValue, "id")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetCertificateResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for certificatesbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + id := idValue + + resp, reqErr := apiClient.GetCertificate(context.Background(), projectId, region, id).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListCertificates", func(t *testing.T) { + _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/certificates" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListCertificatesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for certificatesbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListCertificates(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/certificatesbeta/client.go b/pkg/certificatesbeta/client.go new file mode 100644 index 00000000..56be2ebb --- /dev/null +++ b/pkg/certificatesbeta/client.go @@ -0,0 +1,628 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Application Load Balancer Certificates API API v2beta.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/certificatesbeta/configuration.go b/pkg/certificatesbeta/configuration.go new file mode 100644 index 00000000..94c1e0d6 --- /dev/null +++ b/pkg/certificatesbeta/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/certificatesbeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://certificates.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/certificatesbeta/model_create_certificate_payload.go b/pkg/certificatesbeta/model_create_certificate_payload.go new file mode 100644 index 00000000..84335ac5 --- /dev/null +++ b/pkg/certificatesbeta/model_create_certificate_payload.go @@ -0,0 +1,325 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta + +import ( + "encoding/json" +) + +// checks if the CreateCertificatePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCertificatePayload{} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateCertificatePayloadGetNameAttributeType = *string + +func getCreateCertificatePayloadGetNameAttributeTypeOk(arg CreateCertificatePayloadGetNameAttributeType) (ret CreateCertificatePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCertificatePayloadGetNameAttributeType(arg *CreateCertificatePayloadGetNameAttributeType, val CreateCertificatePayloadGetNameRetType) { + *arg = &val +} + +type CreateCertificatePayloadGetNameArgType = string +type CreateCertificatePayloadGetNameRetType = string + +/* + types and functions for privateKey +*/ + +// isNotNullableString +type CreateCertificatePayloadGetPrivateKeyAttributeType = *string + +func getCreateCertificatePayloadGetPrivateKeyAttributeTypeOk(arg CreateCertificatePayloadGetPrivateKeyAttributeType) (ret CreateCertificatePayloadGetPrivateKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCertificatePayloadGetPrivateKeyAttributeType(arg *CreateCertificatePayloadGetPrivateKeyAttributeType, val CreateCertificatePayloadGetPrivateKeyRetType) { + *arg = &val +} + +type CreateCertificatePayloadGetPrivateKeyArgType = string +type CreateCertificatePayloadGetPrivateKeyRetType = string + +/* + types and functions for projectId +*/ + +// isNotNullableString +type CreateCertificatePayloadGetProjectIdAttributeType = *string + +func getCreateCertificatePayloadGetProjectIdAttributeTypeOk(arg CreateCertificatePayloadGetProjectIdAttributeType) (ret CreateCertificatePayloadGetProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCertificatePayloadGetProjectIdAttributeType(arg *CreateCertificatePayloadGetProjectIdAttributeType, val CreateCertificatePayloadGetProjectIdRetType) { + *arg = &val +} + +type CreateCertificatePayloadGetProjectIdArgType = string +type CreateCertificatePayloadGetProjectIdRetType = string + +/* + types and functions for publicKey +*/ + +// isNotNullableString +type CreateCertificatePayloadGetPublicKeyAttributeType = *string + +func getCreateCertificatePayloadGetPublicKeyAttributeTypeOk(arg CreateCertificatePayloadGetPublicKeyAttributeType) (ret CreateCertificatePayloadGetPublicKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCertificatePayloadGetPublicKeyAttributeType(arg *CreateCertificatePayloadGetPublicKeyAttributeType, val CreateCertificatePayloadGetPublicKeyRetType) { + *arg = &val +} + +type CreateCertificatePayloadGetPublicKeyArgType = string +type CreateCertificatePayloadGetPublicKeyRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type CreateCertificatePayloadGetRegionAttributeType = *string + +func getCreateCertificatePayloadGetRegionAttributeTypeOk(arg CreateCertificatePayloadGetRegionAttributeType) (ret CreateCertificatePayloadGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCertificatePayloadGetRegionAttributeType(arg *CreateCertificatePayloadGetRegionAttributeType, val CreateCertificatePayloadGetRegionRetType) { + *arg = &val +} + +type CreateCertificatePayloadGetRegionArgType = string +type CreateCertificatePayloadGetRegionRetType = string + +// CreateCertificatePayload Uploads a PEM encoded X509 public/private key pair +type CreateCertificatePayload struct { + // TLS certificate name + Name CreateCertificatePayloadGetNameAttributeType `json:"name,omitempty"` + // The PEM encoded private key part + PrivateKey CreateCertificatePayloadGetPrivateKeyAttributeType `json:"privateKey,omitempty"` + // Project identifier + ProjectId CreateCertificatePayloadGetProjectIdAttributeType `json:"projectId,omitempty"` + // The PEM encoded public key part + PublicKey CreateCertificatePayloadGetPublicKeyAttributeType `json:"publicKey,omitempty"` + // Region + Region CreateCertificatePayloadGetRegionAttributeType `json:"region,omitempty"` +} + +// NewCreateCertificatePayload instantiates a new CreateCertificatePayload 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 NewCreateCertificatePayload() *CreateCertificatePayload { + this := CreateCertificatePayload{} + return &this +} + +// NewCreateCertificatePayloadWithDefaults instantiates a new CreateCertificatePayload 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 NewCreateCertificatePayloadWithDefaults() *CreateCertificatePayload { + this := CreateCertificatePayload{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateCertificatePayload) GetName() (res CreateCertificatePayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCertificatePayload) GetNameOk() (ret CreateCertificatePayloadGetNameRetType, ok bool) { + return getCreateCertificatePayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateCertificatePayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateCertificatePayload) SetName(v CreateCertificatePayloadGetNameRetType) { + setCreateCertificatePayloadGetNameAttributeType(&o.Name, v) +} + +// GetPrivateKey returns the PrivateKey field value if set, zero value otherwise. +func (o *CreateCertificatePayload) GetPrivateKey() (res CreateCertificatePayloadGetPrivateKeyRetType) { + res, _ = o.GetPrivateKeyOk() + return +} + +// GetPrivateKeyOk returns a tuple with the PrivateKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCertificatePayload) GetPrivateKeyOk() (ret CreateCertificatePayloadGetPrivateKeyRetType, ok bool) { + return getCreateCertificatePayloadGetPrivateKeyAttributeTypeOk(o.PrivateKey) +} + +// HasPrivateKey returns a boolean if a field has been set. +func (o *CreateCertificatePayload) HasPrivateKey() bool { + _, ok := o.GetPrivateKeyOk() + return ok +} + +// SetPrivateKey gets a reference to the given string and assigns it to the PrivateKey field. +func (o *CreateCertificatePayload) SetPrivateKey(v CreateCertificatePayloadGetPrivateKeyRetType) { + setCreateCertificatePayloadGetPrivateKeyAttributeType(&o.PrivateKey, v) +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *CreateCertificatePayload) GetProjectId() (res CreateCertificatePayloadGetProjectIdRetType) { + res, _ = o.GetProjectIdOk() + return +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCertificatePayload) GetProjectIdOk() (ret CreateCertificatePayloadGetProjectIdRetType, ok bool) { + return getCreateCertificatePayloadGetProjectIdAttributeTypeOk(o.ProjectId) +} + +// HasProjectId returns a boolean if a field has been set. +func (o *CreateCertificatePayload) HasProjectId() bool { + _, ok := o.GetProjectIdOk() + return ok +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *CreateCertificatePayload) SetProjectId(v CreateCertificatePayloadGetProjectIdRetType) { + setCreateCertificatePayloadGetProjectIdAttributeType(&o.ProjectId, v) +} + +// GetPublicKey returns the PublicKey field value if set, zero value otherwise. +func (o *CreateCertificatePayload) GetPublicKey() (res CreateCertificatePayloadGetPublicKeyRetType) { + res, _ = o.GetPublicKeyOk() + return +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCertificatePayload) GetPublicKeyOk() (ret CreateCertificatePayloadGetPublicKeyRetType, ok bool) { + return getCreateCertificatePayloadGetPublicKeyAttributeTypeOk(o.PublicKey) +} + +// HasPublicKey returns a boolean if a field has been set. +func (o *CreateCertificatePayload) HasPublicKey() bool { + _, ok := o.GetPublicKeyOk() + return ok +} + +// SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. +func (o *CreateCertificatePayload) SetPublicKey(v CreateCertificatePayloadGetPublicKeyRetType) { + setCreateCertificatePayloadGetPublicKeyAttributeType(&o.PublicKey, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *CreateCertificatePayload) GetRegion() (res CreateCertificatePayloadGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCertificatePayload) GetRegionOk() (ret CreateCertificatePayloadGetRegionRetType, ok bool) { + return getCreateCertificatePayloadGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *CreateCertificatePayload) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *CreateCertificatePayload) SetRegion(v CreateCertificatePayloadGetRegionRetType) { + setCreateCertificatePayloadGetRegionAttributeType(&o.Region, v) +} + +func (o CreateCertificatePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateCertificatePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateCertificatePayloadGetPrivateKeyAttributeTypeOk(o.PrivateKey); ok { + toSerialize["PrivateKey"] = val + } + if val, ok := getCreateCertificatePayloadGetProjectIdAttributeTypeOk(o.ProjectId); ok { + toSerialize["ProjectId"] = val + } + if val, ok := getCreateCertificatePayloadGetPublicKeyAttributeTypeOk(o.PublicKey); ok { + toSerialize["PublicKey"] = val + } + if val, ok := getCreateCertificatePayloadGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullableCreateCertificatePayload struct { + value *CreateCertificatePayload + isSet bool +} + +func (v NullableCreateCertificatePayload) Get() *CreateCertificatePayload { + return v.value +} + +func (v *NullableCreateCertificatePayload) Set(val *CreateCertificatePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateCertificatePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateCertificatePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateCertificatePayload(val *CreateCertificatePayload) *NullableCreateCertificatePayload { + return &NullableCreateCertificatePayload{value: val, isSet: true} +} + +func (v NullableCreateCertificatePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateCertificatePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/certificatesbeta/model_create_certificate_payload_test.go b/pkg/certificatesbeta/model_create_certificate_payload_test.go new file mode 100644 index 00000000..b4532224 --- /dev/null +++ b/pkg/certificatesbeta/model_create_certificate_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta diff --git a/pkg/certificatesbeta/model_create_certificate_response.go b/pkg/certificatesbeta/model_create_certificate_response.go new file mode 100644 index 00000000..89182106 --- /dev/null +++ b/pkg/certificatesbeta/model_create_certificate_response.go @@ -0,0 +1,178 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta + +import ( + "encoding/json" +) + +// checks if the CreateCertificateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCertificateResponse{} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateCertificateResponseGetIdAttributeType = *string + +func getCreateCertificateResponseGetIdAttributeTypeOk(arg CreateCertificateResponseGetIdAttributeType) (ret CreateCertificateResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCertificateResponseGetIdAttributeType(arg *CreateCertificateResponseGetIdAttributeType, val CreateCertificateResponseGetIdRetType) { + *arg = &val +} + +type CreateCertificateResponseGetIdArgType = string +type CreateCertificateResponseGetIdRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type CreateCertificateResponseGetRegionAttributeType = *string + +func getCreateCertificateResponseGetRegionAttributeTypeOk(arg CreateCertificateResponseGetRegionAttributeType) (ret CreateCertificateResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCertificateResponseGetRegionAttributeType(arg *CreateCertificateResponseGetRegionAttributeType, val CreateCertificateResponseGetRegionRetType) { + *arg = &val +} + +type CreateCertificateResponseGetRegionArgType = string +type CreateCertificateResponseGetRegionRetType = string + +// CreateCertificateResponse CreateCertificateResponse returns unique resource id +type CreateCertificateResponse struct { + // The certificates resource id + Id CreateCertificateResponseGetIdAttributeType `json:"id,omitempty"` + // Region + Region CreateCertificateResponseGetRegionAttributeType `json:"region,omitempty"` +} + +// NewCreateCertificateResponse instantiates a new CreateCertificateResponse 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 NewCreateCertificateResponse() *CreateCertificateResponse { + this := CreateCertificateResponse{} + return &this +} + +// NewCreateCertificateResponseWithDefaults instantiates a new CreateCertificateResponse 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 NewCreateCertificateResponseWithDefaults() *CreateCertificateResponse { + this := CreateCertificateResponse{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateCertificateResponse) GetId() (res CreateCertificateResponseGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCertificateResponse) GetIdOk() (ret CreateCertificateResponseGetIdRetType, ok bool) { + return getCreateCertificateResponseGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateCertificateResponse) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateCertificateResponse) SetId(v CreateCertificateResponseGetIdRetType) { + setCreateCertificateResponseGetIdAttributeType(&o.Id, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *CreateCertificateResponse) GetRegion() (res CreateCertificateResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCertificateResponse) GetRegionOk() (ret CreateCertificateResponseGetRegionRetType, ok bool) { + return getCreateCertificateResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *CreateCertificateResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *CreateCertificateResponse) SetRegion(v CreateCertificateResponseGetRegionRetType) { + setCreateCertificateResponseGetRegionAttributeType(&o.Region, v) +} + +func (o CreateCertificateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateCertificateResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateCertificateResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullableCreateCertificateResponse struct { + value *CreateCertificateResponse + isSet bool +} + +func (v NullableCreateCertificateResponse) Get() *CreateCertificateResponse { + return v.value +} + +func (v *NullableCreateCertificateResponse) Set(val *CreateCertificateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateCertificateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateCertificateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateCertificateResponse(val *CreateCertificateResponse) *NullableCreateCertificateResponse { + return &NullableCreateCertificateResponse{value: val, isSet: true} +} + +func (v NullableCreateCertificateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateCertificateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/certificatesbeta/model_create_certificate_response_test.go b/pkg/certificatesbeta/model_create_certificate_response_test.go new file mode 100644 index 00000000..b4532224 --- /dev/null +++ b/pkg/certificatesbeta/model_create_certificate_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta diff --git a/pkg/certificatesbeta/model_get_certificate_response.go b/pkg/certificatesbeta/model_get_certificate_response.go new file mode 100644 index 00000000..0e1a7894 --- /dev/null +++ b/pkg/certificatesbeta/model_get_certificate_response.go @@ -0,0 +1,276 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta + +import ( + "encoding/json" +) + +// checks if the GetCertificateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCertificateResponse{} + +/* + types and functions for id +*/ + +// isNotNullableString +type GetCertificateResponseGetIdAttributeType = *string + +func getGetCertificateResponseGetIdAttributeTypeOk(arg GetCertificateResponseGetIdAttributeType) (ret GetCertificateResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCertificateResponseGetIdAttributeType(arg *GetCertificateResponseGetIdAttributeType, val GetCertificateResponseGetIdRetType) { + *arg = &val +} + +type GetCertificateResponseGetIdArgType = string +type GetCertificateResponseGetIdRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type GetCertificateResponseGetNameAttributeType = *string + +func getGetCertificateResponseGetNameAttributeTypeOk(arg GetCertificateResponseGetNameAttributeType) (ret GetCertificateResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCertificateResponseGetNameAttributeType(arg *GetCertificateResponseGetNameAttributeType, val GetCertificateResponseGetNameRetType) { + *arg = &val +} + +type GetCertificateResponseGetNameArgType = string +type GetCertificateResponseGetNameRetType = string + +/* + types and functions for publicKey +*/ + +// isNotNullableString +type GetCertificateResponseGetPublicKeyAttributeType = *string + +func getGetCertificateResponseGetPublicKeyAttributeTypeOk(arg GetCertificateResponseGetPublicKeyAttributeType) (ret GetCertificateResponseGetPublicKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCertificateResponseGetPublicKeyAttributeType(arg *GetCertificateResponseGetPublicKeyAttributeType, val GetCertificateResponseGetPublicKeyRetType) { + *arg = &val +} + +type GetCertificateResponseGetPublicKeyArgType = string +type GetCertificateResponseGetPublicKeyRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type GetCertificateResponseGetRegionAttributeType = *string + +func getGetCertificateResponseGetRegionAttributeTypeOk(arg GetCertificateResponseGetRegionAttributeType) (ret GetCertificateResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCertificateResponseGetRegionAttributeType(arg *GetCertificateResponseGetRegionAttributeType, val GetCertificateResponseGetRegionRetType) { + *arg = &val +} + +type GetCertificateResponseGetRegionArgType = string +type GetCertificateResponseGetRegionRetType = string + +// GetCertificateResponse GetCertificateResponse returns name, id and public key +type GetCertificateResponse struct { + // The certificates resource id + Id GetCertificateResponseGetIdAttributeType `json:"id,omitempty"` + // TLS certificate name + Name GetCertificateResponseGetNameAttributeType `json:"name,omitempty"` + // The PEM encoded public key part + PublicKey GetCertificateResponseGetPublicKeyAttributeType `json:"publicKey,omitempty"` + // Region of the LoadBalancer + Region GetCertificateResponseGetRegionAttributeType `json:"region,omitempty"` +} + +// NewGetCertificateResponse instantiates a new GetCertificateResponse 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 NewGetCertificateResponse() *GetCertificateResponse { + this := GetCertificateResponse{} + return &this +} + +// NewGetCertificateResponseWithDefaults instantiates a new GetCertificateResponse 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 NewGetCertificateResponseWithDefaults() *GetCertificateResponse { + this := GetCertificateResponse{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetCertificateResponse) GetId() (res GetCertificateResponseGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCertificateResponse) GetIdOk() (ret GetCertificateResponseGetIdRetType, ok bool) { + return getGetCertificateResponseGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *GetCertificateResponse) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GetCertificateResponse) SetId(v GetCertificateResponseGetIdRetType) { + setGetCertificateResponseGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetCertificateResponse) GetName() (res GetCertificateResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCertificateResponse) GetNameOk() (ret GetCertificateResponseGetNameRetType, ok bool) { + return getGetCertificateResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *GetCertificateResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *GetCertificateResponse) SetName(v GetCertificateResponseGetNameRetType) { + setGetCertificateResponseGetNameAttributeType(&o.Name, v) +} + +// GetPublicKey returns the PublicKey field value if set, zero value otherwise. +func (o *GetCertificateResponse) GetPublicKey() (res GetCertificateResponseGetPublicKeyRetType) { + res, _ = o.GetPublicKeyOk() + return +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCertificateResponse) GetPublicKeyOk() (ret GetCertificateResponseGetPublicKeyRetType, ok bool) { + return getGetCertificateResponseGetPublicKeyAttributeTypeOk(o.PublicKey) +} + +// HasPublicKey returns a boolean if a field has been set. +func (o *GetCertificateResponse) HasPublicKey() bool { + _, ok := o.GetPublicKeyOk() + return ok +} + +// SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. +func (o *GetCertificateResponse) SetPublicKey(v GetCertificateResponseGetPublicKeyRetType) { + setGetCertificateResponseGetPublicKeyAttributeType(&o.PublicKey, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *GetCertificateResponse) GetRegion() (res GetCertificateResponseGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCertificateResponse) GetRegionOk() (ret GetCertificateResponseGetRegionRetType, ok bool) { + return getGetCertificateResponseGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *GetCertificateResponse) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *GetCertificateResponse) SetRegion(v GetCertificateResponseGetRegionRetType) { + setGetCertificateResponseGetRegionAttributeType(&o.Region, v) +} + +func (o GetCertificateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCertificateResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getGetCertificateResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGetCertificateResponseGetPublicKeyAttributeTypeOk(o.PublicKey); ok { + toSerialize["PublicKey"] = val + } + if val, ok := getGetCertificateResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullableGetCertificateResponse struct { + value *GetCertificateResponse + isSet bool +} + +func (v NullableGetCertificateResponse) Get() *GetCertificateResponse { + return v.value +} + +func (v *NullableGetCertificateResponse) Set(val *GetCertificateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetCertificateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCertificateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCertificateResponse(val *GetCertificateResponse) *NullableGetCertificateResponse { + return &NullableGetCertificateResponse{value: val, isSet: true} +} + +func (v NullableGetCertificateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCertificateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/certificatesbeta/model_get_certificate_response_test.go b/pkg/certificatesbeta/model_get_certificate_response_test.go new file mode 100644 index 00000000..b4532224 --- /dev/null +++ b/pkg/certificatesbeta/model_get_certificate_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta diff --git a/pkg/certificatesbeta/model_google_protobuf_any.go b/pkg/certificatesbeta/model_google_protobuf_any.go new file mode 100644 index 00000000..e99ab28b --- /dev/null +++ b/pkg/certificatesbeta/model_google_protobuf_any.go @@ -0,0 +1,137 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta + +import ( + "encoding/json" +) + +// checks if the GoogleProtobufAny type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GoogleProtobufAny{} + +/* + types and functions for @type +*/ + +// isNotNullableString +type GoogleProtobufAnyGetTypeAttributeType = *string + +func getGoogleProtobufAnyGetTypeAttributeTypeOk(arg GoogleProtobufAnyGetTypeAttributeType) (ret GoogleProtobufAnyGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGoogleProtobufAnyGetTypeAttributeType(arg *GoogleProtobufAnyGetTypeAttributeType, val GoogleProtobufAnyGetTypeRetType) { + *arg = &val +} + +type GoogleProtobufAnyGetTypeArgType = string +type GoogleProtobufAnyGetTypeRetType = string + +// GoogleProtobufAny Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. +type GoogleProtobufAny struct { + // The type of the serialized message. + Type GoogleProtobufAnyGetTypeAttributeType `json:"@type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GoogleProtobufAny GoogleProtobufAny + +// NewGoogleProtobufAny instantiates a new GoogleProtobufAny 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 NewGoogleProtobufAny() *GoogleProtobufAny { + this := GoogleProtobufAny{} + return &this +} + +// NewGoogleProtobufAnyWithDefaults instantiates a new GoogleProtobufAny 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 NewGoogleProtobufAnyWithDefaults() *GoogleProtobufAny { + this := GoogleProtobufAny{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *GoogleProtobufAny) GetType() (res GoogleProtobufAnyGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GoogleProtobufAny) GetTypeOk() (ret GoogleProtobufAnyGetTypeRetType, ok bool) { + return getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *GoogleProtobufAny) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *GoogleProtobufAny) SetType(v GoogleProtobufAnyGetTypeRetType) { + setGoogleProtobufAnyGetTypeAttributeType(&o.Type, v) +} + +func (o GoogleProtobufAny) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +type NullableGoogleProtobufAny struct { + value *GoogleProtobufAny + isSet bool +} + +func (v NullableGoogleProtobufAny) Get() *GoogleProtobufAny { + return v.value +} + +func (v *NullableGoogleProtobufAny) Set(val *GoogleProtobufAny) { + v.value = val + v.isSet = true +} + +func (v NullableGoogleProtobufAny) IsSet() bool { + return v.isSet +} + +func (v *NullableGoogleProtobufAny) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGoogleProtobufAny(val *GoogleProtobufAny) *NullableGoogleProtobufAny { + return &NullableGoogleProtobufAny{value: val, isSet: true} +} + +func (v NullableGoogleProtobufAny) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGoogleProtobufAny) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/certificatesbeta/model_google_protobuf_any_test.go b/pkg/certificatesbeta/model_google_protobuf_any_test.go new file mode 100644 index 00000000..b4532224 --- /dev/null +++ b/pkg/certificatesbeta/model_google_protobuf_any_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta diff --git a/pkg/certificatesbeta/model_list_certificates_response.go b/pkg/certificatesbeta/model_list_certificates_response.go new file mode 100644 index 00000000..6e4bd193 --- /dev/null +++ b/pkg/certificatesbeta/model_list_certificates_response.go @@ -0,0 +1,176 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta + +import ( + "encoding/json" +) + +// checks if the ListCertificatesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListCertificatesResponse{} + +/* + types and functions for items +*/ + +// isArray +type ListCertificatesResponseGetItemsAttributeType = *[]GetCertificateResponse +type ListCertificatesResponseGetItemsArgType = []GetCertificateResponse +type ListCertificatesResponseGetItemsRetType = []GetCertificateResponse + +func getListCertificatesResponseGetItemsAttributeTypeOk(arg ListCertificatesResponseGetItemsAttributeType) (ret ListCertificatesResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListCertificatesResponseGetItemsAttributeType(arg *ListCertificatesResponseGetItemsAttributeType, val ListCertificatesResponseGetItemsRetType) { + *arg = &val +} + +/* + types and functions for nextPageId +*/ + +// isNotNullableString +type ListCertificatesResponseGetNextPageIdAttributeType = *string + +func getListCertificatesResponseGetNextPageIdAttributeTypeOk(arg ListCertificatesResponseGetNextPageIdAttributeType) (ret ListCertificatesResponseGetNextPageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListCertificatesResponseGetNextPageIdAttributeType(arg *ListCertificatesResponseGetNextPageIdAttributeType, val ListCertificatesResponseGetNextPageIdRetType) { + *arg = &val +} + +type ListCertificatesResponseGetNextPageIdArgType = string +type ListCertificatesResponseGetNextPageIdRetType = string + +// ListCertificatesResponse ListCertificateResponse returns a list of certificate responses +type ListCertificatesResponse struct { + Items ListCertificatesResponseGetItemsAttributeType `json:"items,omitempty"` + // Continue token from the ListCertificatesResponse with Limit option + NextPageId ListCertificatesResponseGetNextPageIdAttributeType `json:"nextPageId,omitempty"` +} + +// NewListCertificatesResponse instantiates a new ListCertificatesResponse 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 NewListCertificatesResponse() *ListCertificatesResponse { + this := ListCertificatesResponse{} + return &this +} + +// NewListCertificatesResponseWithDefaults instantiates a new ListCertificatesResponse 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 NewListCertificatesResponseWithDefaults() *ListCertificatesResponse { + this := ListCertificatesResponse{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ListCertificatesResponse) GetItems() (res ListCertificatesResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListCertificatesResponse) GetItemsOk() (ret ListCertificatesResponseGetItemsRetType, ok bool) { + return getListCertificatesResponseGetItemsAttributeTypeOk(o.Items) +} + +// HasItems returns a boolean if a field has been set. +func (o *ListCertificatesResponse) HasItems() bool { + _, ok := o.GetItemsOk() + return ok +} + +// SetItems gets a reference to the given []GetCertificateResponse and assigns it to the Items field. +func (o *ListCertificatesResponse) SetItems(v ListCertificatesResponseGetItemsRetType) { + setListCertificatesResponseGetItemsAttributeType(&o.Items, v) +} + +// GetNextPageId returns the NextPageId field value if set, zero value otherwise. +func (o *ListCertificatesResponse) GetNextPageId() (res ListCertificatesResponseGetNextPageIdRetType) { + res, _ = o.GetNextPageIdOk() + return +} + +// GetNextPageIdOk returns a tuple with the NextPageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListCertificatesResponse) GetNextPageIdOk() (ret ListCertificatesResponseGetNextPageIdRetType, ok bool) { + return getListCertificatesResponseGetNextPageIdAttributeTypeOk(o.NextPageId) +} + +// HasNextPageId returns a boolean if a field has been set. +func (o *ListCertificatesResponse) HasNextPageId() bool { + _, ok := o.GetNextPageIdOk() + return ok +} + +// SetNextPageId gets a reference to the given string and assigns it to the NextPageId field. +func (o *ListCertificatesResponse) SetNextPageId(v ListCertificatesResponseGetNextPageIdRetType) { + setListCertificatesResponseGetNextPageIdAttributeType(&o.NextPageId, v) +} + +func (o ListCertificatesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListCertificatesResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + if val, ok := getListCertificatesResponseGetNextPageIdAttributeTypeOk(o.NextPageId); ok { + toSerialize["NextPageId"] = val + } + return toSerialize, nil +} + +type NullableListCertificatesResponse struct { + value *ListCertificatesResponse + isSet bool +} + +func (v NullableListCertificatesResponse) Get() *ListCertificatesResponse { + return v.value +} + +func (v *NullableListCertificatesResponse) Set(val *ListCertificatesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListCertificatesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListCertificatesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListCertificatesResponse(val *ListCertificatesResponse) *NullableListCertificatesResponse { + return &NullableListCertificatesResponse{value: val, isSet: true} +} + +func (v NullableListCertificatesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListCertificatesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/certificatesbeta/model_list_certificates_response_test.go b/pkg/certificatesbeta/model_list_certificates_response_test.go new file mode 100644 index 00000000..b4532224 --- /dev/null +++ b/pkg/certificatesbeta/model_list_certificates_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta diff --git a/pkg/certificatesbeta/model_status.go b/pkg/certificatesbeta/model_status.go new file mode 100644 index 00000000..c3b39d05 --- /dev/null +++ b/pkg/certificatesbeta/model_status.go @@ -0,0 +1,226 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta + +import ( + "encoding/json" +) + +// checks if the Status type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Status{} + +/* + types and functions for code +*/ + +// isInteger +type StatusGetCodeAttributeType = *int64 +type StatusGetCodeArgType = int64 +type StatusGetCodeRetType = int64 + +func getStatusGetCodeAttributeTypeOk(arg StatusGetCodeAttributeType) (ret StatusGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetCodeAttributeType(arg *StatusGetCodeAttributeType, val StatusGetCodeRetType) { + *arg = &val +} + +/* + types and functions for details +*/ + +// isArray +type StatusGetDetailsAttributeType = *[]GoogleProtobufAny +type StatusGetDetailsArgType = []GoogleProtobufAny +type StatusGetDetailsRetType = []GoogleProtobufAny + +func getStatusGetDetailsAttributeTypeOk(arg StatusGetDetailsAttributeType) (ret StatusGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetDetailsAttributeType(arg *StatusGetDetailsAttributeType, val StatusGetDetailsRetType) { + *arg = &val +} + +/* + types and functions for message +*/ + +// isNotNullableString +type StatusGetMessageAttributeType = *string + +func getStatusGetMessageAttributeTypeOk(arg StatusGetMessageAttributeType) (ret StatusGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetMessageAttributeType(arg *StatusGetMessageAttributeType, val StatusGetMessageRetType) { + *arg = &val +} + +type StatusGetMessageArgType = string +type StatusGetMessageRetType = string + +// Status The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). +type Status struct { + // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + // Can be cast to int32 without loss of precision. + Code StatusGetCodeAttributeType `json:"code,omitempty"` + // A list of messages that carry the error details. There is a common set of message types for APIs to use. + Details StatusGetDetailsAttributeType `json:"details,omitempty"` + // A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + Message StatusGetMessageAttributeType `json:"message,omitempty"` +} + +// NewStatus instantiates a new Status 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 NewStatus() *Status { + this := Status{} + return &this +} + +// NewStatusWithDefaults instantiates a new Status 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 NewStatusWithDefaults() *Status { + this := Status{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *Status) GetCode() (res StatusGetCodeRetType) { + res, _ = o.GetCodeOk() + return +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetCodeOk() (ret StatusGetCodeRetType, ok bool) { + return getStatusGetCodeAttributeTypeOk(o.Code) +} + +// HasCode returns a boolean if a field has been set. +func (o *Status) HasCode() bool { + _, ok := o.GetCodeOk() + return ok +} + +// SetCode gets a reference to the given int64 and assigns it to the Code field. +func (o *Status) SetCode(v StatusGetCodeRetType) { + setStatusGetCodeAttributeType(&o.Code, v) +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *Status) GetDetails() (res StatusGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetDetailsOk() (ret StatusGetDetailsRetType, ok bool) { + return getStatusGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *Status) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given []GoogleProtobufAny and assigns it to the Details field. +func (o *Status) SetDetails(v StatusGetDetailsRetType) { + setStatusGetDetailsAttributeType(&o.Details, v) +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *Status) GetMessage() (res StatusGetMessageRetType) { + res, _ = o.GetMessageOk() + return +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetMessageOk() (ret StatusGetMessageRetType, ok bool) { + return getStatusGetMessageAttributeTypeOk(o.Message) +} + +// HasMessage returns a boolean if a field has been set. +func (o *Status) HasMessage() bool { + _, ok := o.GetMessageOk() + return ok +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *Status) SetMessage(v StatusGetMessageRetType) { + setStatusGetMessageAttributeType(&o.Message, v) +} + +func (o Status) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getStatusGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getStatusGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getStatusGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableStatus struct { + value *Status + isSet bool +} + +func (v NullableStatus) Get() *Status { + return v.value +} + +func (v *NullableStatus) Set(val *Status) { + v.value = val + v.isSet = true +} + +func (v NullableStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStatus(val *Status) *NullableStatus { + return &NullableStatus{value: val, isSet: true} +} + +func (v NullableStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/certificatesbeta/model_status_test.go b/pkg/certificatesbeta/model_status_test.go new file mode 100644 index 00000000..b4532224 --- /dev/null +++ b/pkg/certificatesbeta/model_status_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta diff --git a/pkg/certificatesbeta/utils.go b/pkg/certificatesbeta/utils.go new file mode 100644 index 00000000..83928e80 --- /dev/null +++ b/pkg/certificatesbeta/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT Application Load Balancer Certificates API + +### DEPRECATED! This API offers the ability to store TLS certificates, which can be used by load balancing servers in STACKIT. They can be between consumer and load balancing server and/or between load balancing server and endpoint server. + +API version: 2beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package certificatesbeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/edgebeta/.openapi-generator/VERSION b/pkg/edgebeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/edgebeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/edgebeta/api_default.go b/pkg/edgebeta/api_default.go new file mode 100644 index 00000000..0a916921 --- /dev/null +++ b/pkg/edgebeta/api_default.go @@ -0,0 +1,2530 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateInstance Method for CreateInstance + Creates a new instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @return ApiCreateInstanceRequest + */ + CreateInstance(ctx context.Context, projectId string, regionId string) ApiCreateInstanceRequest + /* + CreateInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @return Instance + + */ + CreateInstanceExecute(ctx context.Context, projectId string, regionId string) (*Instance, error) + /* + DeleteInstance Method for DeleteInstance + Deletes the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The full ID of the instance, -. + @return ApiDeleteInstanceRequest + */ + DeleteInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteInstanceRequest + /* + DeleteInstanceExecute executes the request + + */ + DeleteInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) error + /* + DeleteInstanceByName Method for DeleteInstanceByName + Deletes the given instance by name. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return ApiDeleteInstanceByNameRequest + */ + DeleteInstanceByName(ctx context.Context, projectId string, regionId string, displayName string) ApiDeleteInstanceByNameRequest + /* + DeleteInstanceByNameExecute executes the request + + */ + DeleteInstanceByNameExecute(ctx context.Context, projectId string, regionId string, displayName string) error + /* + GetInstance Method for GetInstance + Returns the details for the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The full ID of the instance, -. + @return ApiGetInstanceRequest + */ + GetInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetInstanceRequest + /* + GetInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The full ID of the instance, -. + @return Instance + + */ + GetInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*Instance, error) + /* + GetInstanceByName Method for GetInstanceByName + Returns the details for the given instance by name. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return ApiGetInstanceByNameRequest + */ + GetInstanceByName(ctx context.Context, projectId string, regionId string, displayName string) ApiGetInstanceByNameRequest + /* + GetInstanceByNameExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return Instance + + */ + GetInstanceByNameExecute(ctx context.Context, projectId string, regionId string, displayName string) (*Instance, error) + /* + GetKubeconfigByInstanceId Method for GetKubeconfigByInstanceId + Returns the kubeconfig for the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The full ID of the instance, -. + @return ApiGetKubeconfigByInstanceIdRequest + */ + GetKubeconfigByInstanceId(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetKubeconfigByInstanceIdRequest + /* + GetKubeconfigByInstanceIdExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The full ID of the instance, -. + @return Kubeconfig + + */ + GetKubeconfigByInstanceIdExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*Kubeconfig, error) + /* + GetKubeconfigByInstanceName Method for GetKubeconfigByInstanceName + Returns the kubeconfig for the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return ApiGetKubeconfigByInstanceNameRequest + */ + GetKubeconfigByInstanceName(ctx context.Context, projectId string, regionId string, displayName string) ApiGetKubeconfigByInstanceNameRequest + /* + GetKubeconfigByInstanceNameExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return Kubeconfig + + */ + GetKubeconfigByInstanceNameExecute(ctx context.Context, projectId string, regionId string, displayName string) (*Kubeconfig, error) + /* + GetTokenByInstanceId Method for GetTokenByInstanceId + Returns an ServiceAccount token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The instance UUID. + @return ApiGetTokenByInstanceIdRequest + */ + GetTokenByInstanceId(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetTokenByInstanceIdRequest + /* + GetTokenByInstanceIdExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The instance UUID. + @return Token + + */ + GetTokenByInstanceIdExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*Token, error) + /* + GetTokenByInstanceName Method for GetTokenByInstanceName + Returns an ServiceAccount token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return ApiGetTokenByInstanceNameRequest + */ + GetTokenByInstanceName(ctx context.Context, projectId string, regionId string, displayName string) ApiGetTokenByInstanceNameRequest + /* + GetTokenByInstanceNameExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return Token + + */ + GetTokenByInstanceNameExecute(ctx context.Context, projectId string, regionId string, displayName string) (*Token, error) + /* + ListInstances Method for ListInstances + Returns a list of all instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @return ApiListInstancesRequest + */ + ListInstances(ctx context.Context, projectId string, regionId string) ApiListInstancesRequest + /* + ListInstancesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @return InstanceList + + */ + ListInstancesExecute(ctx context.Context, projectId string, regionId string) (*InstanceList, error) + /* + ListPlansGlobal Method for ListPlansGlobal + Deprecated: DEPRECATED: Will be removed at the 28 of february 2026. Use list-plans-project instead. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListPlansGlobalRequest + */ + ListPlansGlobal(ctx context.Context) ApiListPlansGlobalRequest + /* + ListPlansGlobalExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return PlanList + + Deprecated: DEPRECATED: Will be removed at the 28 of february 2026. Use list-plans-project instead. + */ + ListPlansGlobalExecute(ctx context.Context) (*PlanList, error) + /* + ListPlansProject Method for ListPlansProject + List all possible plans for the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the plan is part of. + @return ApiListPlansProjectRequest + */ + ListPlansProject(ctx context.Context, projectId string) ApiListPlansProjectRequest + /* + ListPlansProjectExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the plan is part of. + @return PlanList + + */ + ListPlansProjectExecute(ctx context.Context, projectId string) (*PlanList, error) + /* + UpdateInstance Method for UpdateInstance + Updates the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The full ID of the instance, -. + @return ApiUpdateInstanceRequest + */ + UpdateInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateInstanceRequest + /* + UpdateInstanceExecute executes the request + + */ + UpdateInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) error + /* + UpdateInstanceByName Method for UpdateInstanceByName + Updates the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return ApiUpdateInstanceByNameRequest + */ + UpdateInstanceByName(ctx context.Context, projectId string, regionId string, displayName string) ApiUpdateInstanceByNameRequest + /* + UpdateInstanceByNameExecute executes the request + + */ + UpdateInstanceByNameExecute(ctx context.Context, projectId string, regionId string, displayName string) error +} + +type ApiCreateInstanceRequest interface { + CreateInstancePayload(createInstancePayload CreateInstancePayload) ApiCreateInstanceRequest + Execute() (*Instance, error) +} + +type ApiDeleteInstanceRequest interface { + Execute() error +} + +type ApiDeleteInstanceByNameRequest interface { + Execute() error +} + +type ApiGetInstanceRequest interface { + Execute() (*Instance, error) +} + +type ApiGetInstanceByNameRequest interface { + Execute() (*Instance, error) +} + +type ApiGetKubeconfigByInstanceIdRequest interface { + // Expiration of the included token in seconds + ExpirationSeconds(expirationSeconds int64) ApiGetKubeconfigByInstanceIdRequest + Execute() (*Kubeconfig, error) +} + +type ApiGetKubeconfigByInstanceNameRequest interface { + // Expiration of the included token in seconds + ExpirationSeconds(expirationSeconds int64) ApiGetKubeconfigByInstanceNameRequest + Execute() (*Kubeconfig, error) +} + +type ApiGetTokenByInstanceIdRequest interface { + // Expiration of the token in seconds + ExpirationSeconds(expirationSeconds int64) ApiGetTokenByInstanceIdRequest + Execute() (*Token, error) +} + +type ApiGetTokenByInstanceNameRequest interface { + // Expiration of the included token in seconds + ExpirationSeconds(expirationSeconds int64) ApiGetTokenByInstanceNameRequest + Execute() (*Token, error) +} + +type ApiListInstancesRequest interface { + Execute() (*InstanceList, error) +} + +type ApiListPlansGlobalRequest interface { + Execute() (*PlanList, error) +} + +type ApiListPlansProjectRequest interface { + Execute() (*PlanList, error) +} + +type ApiUpdateInstanceRequest interface { + UpdateInstancePayload(updateInstancePayload UpdateInstancePayload) ApiUpdateInstanceRequest + Execute() error +} + +type ApiUpdateInstanceByNameRequest interface { + UpdateInstanceByNamePayload(updateInstanceByNamePayload UpdateInstanceByNamePayload) ApiUpdateInstanceByNameRequest + Execute() error +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + createInstancePayload *CreateInstancePayload +} + +func (r CreateInstanceRequest) CreateInstancePayload(createInstancePayload CreateInstancePayload) ApiCreateInstanceRequest { + r.createInstancePayload = &createInstancePayload + return r +} + +func (r CreateInstanceRequest) Execute() (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createInstancePayload == nil { + return localVarReturnValue, fmt.Errorf("createInstancePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createInstancePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateInstance: Method for CreateInstance + +Creates a new instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @return ApiCreateInstanceRequest +*/ +func (a *APIClient) CreateInstance(ctx context.Context, projectId string, regionId string) ApiCreateInstanceRequest { + return CreateInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +func (a *APIClient) CreateInstanceExecute(ctx context.Context, projectId string, regionId string) (*Instance, error) { + r := CreateInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type DeleteInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r DeleteInstanceRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteInstance") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.instanceId) > 16 { + return fmt.Errorf("instanceId must have less than 16 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + return newErr + } + + return nil +} + +/* +DeleteInstance: Method for DeleteInstance + +Deletes the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The full ID of the instance, -. + @return ApiDeleteInstanceRequest +*/ +func (a *APIClient) DeleteInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteInstanceRequest { + return DeleteInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) error { + r := DeleteInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type DeleteInstanceByNameRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + displayName string +} + +func (r DeleteInstanceByNameRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteInstanceByName") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(r.displayName, "displayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.displayName) > 8 { + return fmt.Errorf("displayName must have less than 8 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + return newErr + } + + return nil +} + +/* +DeleteInstanceByName: Method for DeleteInstanceByName + +Deletes the given instance by name. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return ApiDeleteInstanceByNameRequest +*/ +func (a *APIClient) DeleteInstanceByName(ctx context.Context, projectId string, regionId string, displayName string) ApiDeleteInstanceByNameRequest { + return DeleteInstanceByNameRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + displayName: displayName, + } +} + +func (a *APIClient) DeleteInstanceByNameExecute(ctx context.Context, projectId string, regionId string, displayName string) error { + r := DeleteInstanceByNameRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + displayName: displayName, + } + return r.Execute() +} + +type GetInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r GetInstanceRequest) Execute() (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.instanceId) > 16 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 16 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetInstance: Method for GetInstance + +Returns the details for the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The full ID of the instance, -. + @return ApiGetInstanceRequest +*/ +func (a *APIClient) GetInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetInstanceRequest { + return GetInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) GetInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*Instance, error) { + r := GetInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type GetInstanceByNameRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + displayName string +} + +func (r GetInstanceByNameRequest) Execute() (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetInstanceByName") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(r.displayName, "displayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.displayName) > 8 { + return localVarReturnValue, fmt.Errorf("displayName must have less than 8 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetInstanceByName: Method for GetInstanceByName + +Returns the details for the given instance by name. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return ApiGetInstanceByNameRequest +*/ +func (a *APIClient) GetInstanceByName(ctx context.Context, projectId string, regionId string, displayName string) ApiGetInstanceByNameRequest { + return GetInstanceByNameRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + displayName: displayName, + } +} + +func (a *APIClient) GetInstanceByNameExecute(ctx context.Context, projectId string, regionId string, displayName string) (*Instance, error) { + r := GetInstanceByNameRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + displayName: displayName, + } + return r.Execute() +} + +type GetKubeconfigByInstanceIdRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + expirationSeconds *int64 +} + +// Expiration of the included token in seconds + +func (r GetKubeconfigByInstanceIdRequest) ExpirationSeconds(expirationSeconds int64) ApiGetKubeconfigByInstanceIdRequest { + r.expirationSeconds = &expirationSeconds + return r +} + +func (r GetKubeconfigByInstanceIdRequest) Execute() (*Kubeconfig, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Kubeconfig + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetKubeconfigByInstanceId") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/kubeconfig" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.instanceId) > 16 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 16 elements") + } + + if r.expirationSeconds != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "expirationSeconds", r.expirationSeconds, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetKubeconfigByInstanceId: Method for GetKubeconfigByInstanceId + +Returns the kubeconfig for the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The full ID of the instance, -. + @return ApiGetKubeconfigByInstanceIdRequest +*/ +func (a *APIClient) GetKubeconfigByInstanceId(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetKubeconfigByInstanceIdRequest { + return GetKubeconfigByInstanceIdRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) GetKubeconfigByInstanceIdExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*Kubeconfig, error) { + r := GetKubeconfigByInstanceIdRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type GetKubeconfigByInstanceNameRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + displayName string + expirationSeconds *int64 +} + +// Expiration of the included token in seconds + +func (r GetKubeconfigByInstanceNameRequest) ExpirationSeconds(expirationSeconds int64) ApiGetKubeconfigByInstanceNameRequest { + r.expirationSeconds = &expirationSeconds + return r +} + +func (r GetKubeconfigByInstanceNameRequest) Execute() (*Kubeconfig, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Kubeconfig + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetKubeconfigByInstanceName") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}/kubeconfig" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(r.displayName, "displayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.displayName) > 8 { + return localVarReturnValue, fmt.Errorf("displayName must have less than 8 elements") + } + + if r.expirationSeconds != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "expirationSeconds", r.expirationSeconds, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetKubeconfigByInstanceName: Method for GetKubeconfigByInstanceName + +Returns the kubeconfig for the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return ApiGetKubeconfigByInstanceNameRequest +*/ +func (a *APIClient) GetKubeconfigByInstanceName(ctx context.Context, projectId string, regionId string, displayName string) ApiGetKubeconfigByInstanceNameRequest { + return GetKubeconfigByInstanceNameRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + displayName: displayName, + } +} + +func (a *APIClient) GetKubeconfigByInstanceNameExecute(ctx context.Context, projectId string, regionId string, displayName string) (*Kubeconfig, error) { + r := GetKubeconfigByInstanceNameRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + displayName: displayName, + } + return r.Execute() +} + +type GetTokenByInstanceIdRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + expirationSeconds *int64 +} + +// Expiration of the token in seconds + +func (r GetTokenByInstanceIdRequest) ExpirationSeconds(expirationSeconds int64) ApiGetTokenByInstanceIdRequest { + r.expirationSeconds = &expirationSeconds + return r +} + +func (r GetTokenByInstanceIdRequest) Execute() (*Token, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Token + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetTokenByInstanceId") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/token" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.instanceId) > 16 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 16 elements") + } + + if r.expirationSeconds != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "expirationSeconds", r.expirationSeconds, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetTokenByInstanceId: Method for GetTokenByInstanceId + +Returns an ServiceAccount token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The instance UUID. + @return ApiGetTokenByInstanceIdRequest +*/ +func (a *APIClient) GetTokenByInstanceId(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetTokenByInstanceIdRequest { + return GetTokenByInstanceIdRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) GetTokenByInstanceIdExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*Token, error) { + r := GetTokenByInstanceIdRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type GetTokenByInstanceNameRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + displayName string + expirationSeconds *int64 +} + +// Expiration of the included token in seconds + +func (r GetTokenByInstanceNameRequest) ExpirationSeconds(expirationSeconds int64) ApiGetTokenByInstanceNameRequest { + r.expirationSeconds = &expirationSeconds + return r +} + +func (r GetTokenByInstanceNameRequest) Execute() (*Token, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Token + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetTokenByInstanceName") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}/token" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(r.displayName, "displayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.displayName) > 8 { + return localVarReturnValue, fmt.Errorf("displayName must have less than 8 elements") + } + + if r.expirationSeconds != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "expirationSeconds", r.expirationSeconds, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetTokenByInstanceName: Method for GetTokenByInstanceName + +Returns an ServiceAccount token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return ApiGetTokenByInstanceNameRequest +*/ +func (a *APIClient) GetTokenByInstanceName(ctx context.Context, projectId string, regionId string, displayName string) ApiGetTokenByInstanceNameRequest { + return GetTokenByInstanceNameRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + displayName: displayName, + } +} + +func (a *APIClient) GetTokenByInstanceNameExecute(ctx context.Context, projectId string, regionId string, displayName string) (*Token, error) { + r := GetTokenByInstanceNameRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + displayName: displayName, + } + return r.Execute() +} + +type ListInstancesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string +} + +func (r ListInstancesRequest) Execute() (*InstanceList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InstanceList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListInstances") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListInstances: Method for ListInstances + +Returns a list of all instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @return ApiListInstancesRequest +*/ +func (a *APIClient) ListInstances(ctx context.Context, projectId string, regionId string) ApiListInstancesRequest { + return ListInstancesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +func (a *APIClient) ListInstancesExecute(ctx context.Context, projectId string, regionId string) (*InstanceList, error) { + r := ListInstancesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type ListPlansGlobalRequest struct { + ctx context.Context + apiService *DefaultApiService +} + +func (r ListPlansGlobalRequest) Execute() (*PlanList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PlanList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPlansGlobal") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/plans" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListPlansGlobal: Method for ListPlansGlobal + +Deprecated: DEPRECATED: Will be removed at the 28 of february 2026. Use list-plans-project instead. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListPlansGlobalRequest +*/ +func (a *APIClient) ListPlansGlobal(ctx context.Context) ApiListPlansGlobalRequest { + return ListPlansGlobalRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +/* +Deprecated: DEPRECATED: Will be removed at the 28 of february 2026. Use list-plans-project instead. +*/ +func (a *APIClient) ListPlansGlobalExecute(ctx context.Context) (*PlanList, error) { + r := ListPlansGlobalRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + +type ListPlansProjectRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r ListPlansProjectRequest) Execute() (*PlanList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PlanList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPlansProject") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/plans" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListPlansProject: Method for ListPlansProject + +List all possible plans for the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the plan is part of. + @return ApiListPlansProjectRequest +*/ +func (a *APIClient) ListPlansProject(ctx context.Context, projectId string) ApiListPlansProjectRequest { + return ListPlansProjectRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListPlansProjectExecute(ctx context.Context, projectId string) (*PlanList, error) { + r := ListPlansProjectRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type UpdateInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + updateInstancePayload *UpdateInstancePayload +} + +func (r UpdateInstanceRequest) UpdateInstancePayload(updateInstancePayload UpdateInstancePayload) ApiUpdateInstanceRequest { + r.updateInstancePayload = &updateInstancePayload + return r +} + +func (r UpdateInstanceRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateInstance") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.instanceId) > 16 { + return fmt.Errorf("instanceId must have less than 16 elements") + } + if r.updateInstancePayload == nil { + return fmt.Errorf("updateInstancePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateInstancePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + return newErr + } + + return nil +} + +/* +UpdateInstance: Method for UpdateInstance + +Updates the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param instanceId The full ID of the instance, -. + @return ApiUpdateInstanceRequest +*/ +func (a *APIClient) UpdateInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateInstanceRequest { + return UpdateInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) UpdateInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) error { + r := UpdateInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type UpdateInstanceByNameRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + displayName string + updateInstanceByNamePayload *UpdateInstanceByNamePayload +} + +func (r UpdateInstanceByNameRequest) UpdateInstanceByNamePayload(updateInstanceByNamePayload UpdateInstanceByNamePayload) ApiUpdateInstanceByNameRequest { + r.updateInstanceByNamePayload = &updateInstanceByNamePayload + return r +} + +func (r UpdateInstanceByNameRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateInstanceByName") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(r.displayName, "displayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.displayName) > 8 { + return fmt.Errorf("displayName must have less than 8 elements") + } + if r.updateInstanceByNamePayload == nil { + return fmt.Errorf("updateInstanceByNamePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateInstanceByNamePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v BadRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v UnauthorizedRequest + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + return newErr + } + + return nil +} + +/* +UpdateInstanceByName: Method for UpdateInstanceByName + +Updates the given instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the instance is part of. + @param regionId The STACKIT region the instance is part of. + @param displayName The instance display name. + @return ApiUpdateInstanceByNameRequest +*/ +func (a *APIClient) UpdateInstanceByName(ctx context.Context, projectId string, regionId string, displayName string) ApiUpdateInstanceByNameRequest { + return UpdateInstanceByNameRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + displayName: displayName, + } +} + +func (a *APIClient) UpdateInstanceByNameExecute(ctx context.Context, projectId string, regionId string, displayName string) error { + r := UpdateInstanceByNameRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + displayName: displayName, + } + return r.Execute() +} diff --git a/pkg/edgebeta/api_default_test.go b/pkg/edgebeta/api_default_test.go new file mode 100644 index 00000000..d5b03257 --- /dev/null +++ b/pkg/edgebeta/api_default_test.go @@ -0,0 +1,796 @@ +/* +STACKIT Edge Cloud API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package edgebeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_edgebeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instances" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Instance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + createInstancePayload := CreateInstancePayload{} + + resp, reqErr := apiClient.CreateInstance(context.Background(), projectId, regionId).CreateInstancePayload(createInstancePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := randString(16) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + reqErr := apiClient.DeleteInstance(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteInstanceByName", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + displayNameValue := randString(8) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(displayNameValue, "displayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + displayName := displayNameValue + + reqErr := apiClient.DeleteInstanceByName(context.Background(), projectId, regionId, displayName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := randString(16) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Instance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.GetInstance(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetInstanceByName", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + displayNameValue := randString(8) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(displayNameValue, "displayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Instance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + displayName := displayNameValue + + resp, reqErr := apiClient.GetInstanceByName(context.Background(), projectId, regionId, displayName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetKubeconfigByInstanceId", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/kubeconfig" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := randString(16) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Kubeconfig{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.GetKubeconfigByInstanceId(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetKubeconfigByInstanceName", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}/kubeconfig" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + displayNameValue := randString(8) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(displayNameValue, "displayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Kubeconfig{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + displayName := displayNameValue + + resp, reqErr := apiClient.GetKubeconfigByInstanceName(context.Background(), projectId, regionId, displayName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetTokenByInstanceId", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/token" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := randString(16) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Token{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.GetTokenByInstanceId(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetTokenByInstanceName", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}/token" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + displayNameValue := randString(8) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(displayNameValue, "displayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Token{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + displayName := displayNameValue + + resp, reqErr := apiClient.GetTokenByInstanceName(context.Background(), projectId, regionId, displayName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instances" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := InstanceList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + + resp, reqErr := apiClient.ListInstances(context.Background(), projectId, regionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListPlansGlobal", func(t *testing.T) { + _apiUrlPath := "/v1beta1/plans" + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := PlanList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + resp, reqErr := apiClient.ListPlansGlobal(context.Background()).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListPlansProject", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/plans" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := PlanList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + + resp, reqErr := apiClient.ListPlansProject(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := randString(16) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + updateInstancePayload := UpdateInstancePayload{} + + reqErr := apiClient.UpdateInstance(context.Background(), projectId, regionId, instanceId).UpdateInstancePayload(updateInstancePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService UpdateInstanceByName", func(t *testing.T) { + _apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + displayNameValue := randString(8) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(displayNameValue, "displayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for edgebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + displayName := displayNameValue + updateInstanceByNamePayload := UpdateInstanceByNamePayload{} + + reqErr := apiClient.UpdateInstanceByName(context.Background(), projectId, regionId, displayName).UpdateInstanceByNamePayload(updateInstanceByNamePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + +} diff --git a/pkg/edgebeta/client.go b/pkg/edgebeta/client.go new file mode 100644 index 00000000..0ad796cc --- /dev/null +++ b/pkg/edgebeta/client.go @@ -0,0 +1,628 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Edge Cloud API API v1beta1 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/edgebeta/configuration.go b/pkg/edgebeta/configuration.go new file mode 100644 index 00000000..bacde22c --- /dev/null +++ b/pkg/edgebeta/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/edgebeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://edge.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/edgebeta/model_bad_request.go b/pkg/edgebeta/model_bad_request.go new file mode 100644 index 00000000..ffc07e55 --- /dev/null +++ b/pkg/edgebeta/model_bad_request.go @@ -0,0 +1,176 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the BadRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BadRequest{} + +/* + types and functions for code +*/ + +// isNotNullableString +type BadRequestGetCodeAttributeType = *string + +func getBadRequestGetCodeAttributeTypeOk(arg BadRequestGetCodeAttributeType) (ret BadRequestGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBadRequestGetCodeAttributeType(arg *BadRequestGetCodeAttributeType, val BadRequestGetCodeRetType) { + *arg = &val +} + +type BadRequestGetCodeArgType = string +type BadRequestGetCodeRetType = string + +/* + types and functions for message +*/ + +// isNotNullableString +type BadRequestGetMessageAttributeType = *string + +func getBadRequestGetMessageAttributeTypeOk(arg BadRequestGetMessageAttributeType) (ret BadRequestGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBadRequestGetMessageAttributeType(arg *BadRequestGetMessageAttributeType, val BadRequestGetMessageRetType) { + *arg = &val +} + +type BadRequestGetMessageArgType = string +type BadRequestGetMessageRetType = string + +// BadRequest struct for BadRequest +type BadRequest struct { + Code BadRequestGetCodeAttributeType `json:"code,omitempty"` + Message BadRequestGetMessageAttributeType `json:"message,omitempty"` +} + +// NewBadRequest instantiates a new BadRequest 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 NewBadRequest() *BadRequest { + this := BadRequest{} + return &this +} + +// NewBadRequestWithDefaults instantiates a new BadRequest 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 NewBadRequestWithDefaults() *BadRequest { + this := BadRequest{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *BadRequest) GetCode() (res BadRequestGetCodeRetType) { + res, _ = o.GetCodeOk() + return +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BadRequest) GetCodeOk() (ret BadRequestGetCodeRetType, ok bool) { + return getBadRequestGetCodeAttributeTypeOk(o.Code) +} + +// HasCode returns a boolean if a field has been set. +func (o *BadRequest) HasCode() bool { + _, ok := o.GetCodeOk() + return ok +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *BadRequest) SetCode(v BadRequestGetCodeRetType) { + setBadRequestGetCodeAttributeType(&o.Code, v) +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *BadRequest) GetMessage() (res BadRequestGetMessageRetType) { + res, _ = o.GetMessageOk() + return +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BadRequest) GetMessageOk() (ret BadRequestGetMessageRetType, ok bool) { + return getBadRequestGetMessageAttributeTypeOk(o.Message) +} + +// HasMessage returns a boolean if a field has been set. +func (o *BadRequest) HasMessage() bool { + _, ok := o.GetMessageOk() + return ok +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *BadRequest) SetMessage(v BadRequestGetMessageRetType) { + setBadRequestGetMessageAttributeType(&o.Message, v) +} + +func (o BadRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBadRequestGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getBadRequestGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableBadRequest struct { + value *BadRequest + isSet bool +} + +func (v NullableBadRequest) Get() *BadRequest { + return v.value +} + +func (v *NullableBadRequest) Set(val *BadRequest) { + v.value = val + v.isSet = true +} + +func (v NullableBadRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableBadRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBadRequest(val *BadRequest) *NullableBadRequest { + return &NullableBadRequest{value: val, isSet: true} +} + +func (v NullableBadRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBadRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_bad_request_test.go b/pkg/edgebeta/model_bad_request_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_bad_request_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/model_create_instance_payload.go b/pkg/edgebeta/model_create_instance_payload.go new file mode 100644 index 00000000..9f20ea63 --- /dev/null +++ b/pkg/edgebeta/model_create_instance_payload.go @@ -0,0 +1,221 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the CreateInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateInstancePayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateInstancePayloadGetDescriptionAttributeType = *string + +func getCreateInstancePayloadGetDescriptionAttributeTypeOk(arg CreateInstancePayloadGetDescriptionAttributeType) (ret CreateInstancePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateInstancePayloadGetDescriptionAttributeType(arg *CreateInstancePayloadGetDescriptionAttributeType, val CreateInstancePayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateInstancePayloadGetDescriptionArgType = string +type CreateInstancePayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateInstancePayloadGetDisplayNameAttributeType = *string + +func getCreateInstancePayloadGetDisplayNameAttributeTypeOk(arg CreateInstancePayloadGetDisplayNameAttributeType) (ret CreateInstancePayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateInstancePayloadGetDisplayNameAttributeType(arg *CreateInstancePayloadGetDisplayNameAttributeType, val CreateInstancePayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateInstancePayloadGetDisplayNameArgType = string +type CreateInstancePayloadGetDisplayNameRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type CreateInstancePayloadGetPlanIdAttributeType = *string + +func getCreateInstancePayloadGetPlanIdAttributeTypeOk(arg CreateInstancePayloadGetPlanIdAttributeType) (ret CreateInstancePayloadGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateInstancePayloadGetPlanIdAttributeType(arg *CreateInstancePayloadGetPlanIdAttributeType, val CreateInstancePayloadGetPlanIdRetType) { + *arg = &val +} + +type CreateInstancePayloadGetPlanIdArgType = string +type CreateInstancePayloadGetPlanIdRetType = string + +// CreateInstancePayload struct for CreateInstancePayload +type CreateInstancePayload struct { + // A user chosen description to distinguish multiple instances. + Description CreateInstancePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name to distinguish multiple instances. + // REQUIRED + DisplayName CreateInstancePayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + // Service Plan configures the size of the Instance. + // REQUIRED + PlanId CreateInstancePayloadGetPlanIdAttributeType `json:"planId" required:"true"` +} + +type _CreateInstancePayload CreateInstancePayload + +// NewCreateInstancePayload instantiates a new CreateInstancePayload 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 NewCreateInstancePayload(displayName CreateInstancePayloadGetDisplayNameArgType, planId CreateInstancePayloadGetPlanIdArgType) *CreateInstancePayload { + this := CreateInstancePayload{} + setCreateInstancePayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + setCreateInstancePayloadGetPlanIdAttributeType(&this.PlanId, planId) + return &this +} + +// NewCreateInstancePayloadWithDefaults instantiates a new CreateInstancePayload 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 NewCreateInstancePayloadWithDefaults() *CreateInstancePayload { + this := CreateInstancePayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetDescription() (res CreateInstancePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetDescriptionOk() (ret CreateInstancePayloadGetDescriptionRetType, ok bool) { + return getCreateInstancePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateInstancePayload) SetDescription(v CreateInstancePayloadGetDescriptionRetType) { + setCreateInstancePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateInstancePayload) GetDisplayName() (ret CreateInstancePayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetDisplayNameOk() (ret CreateInstancePayloadGetDisplayNameRetType, ok bool) { + return getCreateInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateInstancePayload) SetDisplayName(v CreateInstancePayloadGetDisplayNameRetType) { + setCreateInstancePayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetPlanId returns the PlanId field value +func (o *CreateInstancePayload) GetPlanId() (ret CreateInstancePayloadGetPlanIdRetType) { + ret, _ = o.GetPlanIdOk() + return ret +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetPlanIdOk() (ret CreateInstancePayloadGetPlanIdRetType, ok bool) { + return getCreateInstancePayloadGetPlanIdAttributeTypeOk(o.PlanId) +} + +// SetPlanId sets field value +func (o *CreateInstancePayload) SetPlanId(v CreateInstancePayloadGetPlanIdRetType) { + setCreateInstancePayloadGetPlanIdAttributeType(&o.PlanId, v) +} + +func (o CreateInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateInstancePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateInstancePayloadGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + return toSerialize, nil +} + +type NullableCreateInstancePayload struct { + value *CreateInstancePayload + isSet bool +} + +func (v NullableCreateInstancePayload) Get() *CreateInstancePayload { + return v.value +} + +func (v *NullableCreateInstancePayload) Set(val *CreateInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateInstancePayload(val *CreateInstancePayload) *NullableCreateInstancePayload { + return &NullableCreateInstancePayload{value: val, isSet: true} +} + +func (v NullableCreateInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_create_instance_payload_test.go b/pkg/edgebeta/model_create_instance_payload_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_create_instance_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/model_instance.go b/pkg/edgebeta/model_instance.go new file mode 100644 index 00000000..d1e304ab --- /dev/null +++ b/pkg/edgebeta/model_instance.go @@ -0,0 +1,509 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Instance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Instance{} + +/* + types and functions for created +*/ + +// isDateTime +type InstanceGetCreatedAttributeType = *time.Time +type InstanceGetCreatedArgType = time.Time +type InstanceGetCreatedRetType = time.Time + +func getInstanceGetCreatedAttributeTypeOk(arg InstanceGetCreatedAttributeType) (ret InstanceGetCreatedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetCreatedAttributeType(arg *InstanceGetCreatedAttributeType, val InstanceGetCreatedRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type InstanceGetDescriptionAttributeType = *string + +func getInstanceGetDescriptionAttributeTypeOk(arg InstanceGetDescriptionAttributeType) (ret InstanceGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetDescriptionAttributeType(arg *InstanceGetDescriptionAttributeType, val InstanceGetDescriptionRetType) { + *arg = &val +} + +type InstanceGetDescriptionArgType = string +type InstanceGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type InstanceGetDisplayNameAttributeType = *string + +func getInstanceGetDisplayNameAttributeTypeOk(arg InstanceGetDisplayNameAttributeType) (ret InstanceGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetDisplayNameAttributeType(arg *InstanceGetDisplayNameAttributeType, val InstanceGetDisplayNameRetType) { + *arg = &val +} + +type InstanceGetDisplayNameArgType = string +type InstanceGetDisplayNameRetType = string + +/* + types and functions for frontendUrl +*/ + +// isNotNullableString +type InstanceGetFrontendUrlAttributeType = *string + +func getInstanceGetFrontendUrlAttributeTypeOk(arg InstanceGetFrontendUrlAttributeType) (ret InstanceGetFrontendUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetFrontendUrlAttributeType(arg *InstanceGetFrontendUrlAttributeType, val InstanceGetFrontendUrlRetType) { + *arg = &val +} + +type InstanceGetFrontendUrlArgType = string +type InstanceGetFrontendUrlRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type InstanceGetIdAttributeType = *string + +func getInstanceGetIdAttributeTypeOk(arg InstanceGetIdAttributeType) (ret InstanceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetIdAttributeType(arg *InstanceGetIdAttributeType, val InstanceGetIdRetType) { + *arg = &val +} + +type InstanceGetIdArgType = string +type InstanceGetIdRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type InstanceGetPlanIdAttributeType = *string + +func getInstanceGetPlanIdAttributeTypeOk(arg InstanceGetPlanIdAttributeType) (ret InstanceGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetPlanIdAttributeType(arg *InstanceGetPlanIdAttributeType, val InstanceGetPlanIdRetType) { + *arg = &val +} + +type InstanceGetPlanIdArgType = string +type InstanceGetPlanIdRetType = string + +/* + types and functions for status +*/ + +// isEnum + +// InstanceStatus The current status of the instance. +// value type for enums +type InstanceStatus string + +// List of Status +const ( + INSTANCESTATUS_ERROR InstanceStatus = "error" + INSTANCESTATUS_RECONCILING InstanceStatus = "reconciling" + INSTANCESTATUS_ACTIVE InstanceStatus = "active" + INSTANCESTATUS_DELETING InstanceStatus = "deleting" +) + +// All allowed values of Instance enum +var AllowedInstanceStatusEnumValues = []InstanceStatus{ + "error", + "reconciling", + "active", + "deleting", +} + +func (v *InstanceStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson InstanceStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := InstanceStatus(value) + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Instance", value) +} + +// NewInstanceStatusFromValue returns a pointer to a valid InstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStatusFromValue(v InstanceStatus) (*InstanceStatus, error) { + ev := InstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceStatus: valid values are %v", v, AllowedInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceStatus) IsValid() bool { + for _, existing := range AllowedInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v InstanceStatus) Ptr() *InstanceStatus { + return &v +} + +type NullableInstanceStatus struct { + value *InstanceStatus + isSet bool +} + +func (v NullableInstanceStatus) Get() *InstanceStatus { + return v.value +} + +func (v *NullableInstanceStatus) Set(val *InstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceStatus(val *InstanceStatus) *NullableInstanceStatus { + return &NullableInstanceStatus{value: val, isSet: true} +} + +func (v NullableInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceGetStatusAttributeType = *InstanceStatus +type InstanceGetStatusArgType = InstanceStatus +type InstanceGetStatusRetType = InstanceStatus + +func getInstanceGetStatusAttributeTypeOk(arg InstanceGetStatusAttributeType) (ret InstanceGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetStatusAttributeType(arg *InstanceGetStatusAttributeType, val InstanceGetStatusRetType) { + *arg = &val +} + +// Instance struct for Instance +type Instance struct { + // The date and time the creation of the instance was triggered. + // REQUIRED + Created InstanceGetCreatedAttributeType `json:"created" required:"true"` + // A user chosen description to distinguish multiple instances. + Description InstanceGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name of the instance. + // REQUIRED + DisplayName InstanceGetDisplayNameAttributeType `json:"displayName" required:"true"` + // URL to the Management UI of the Instance. + // REQUIRED + FrontendUrl InstanceGetFrontendUrlAttributeType `json:"frontendUrl" required:"true"` + // A auto generated unique id which identifies the instance. + // REQUIRED + Id InstanceGetIdAttributeType `json:"id" required:"true"` + // Service Plan configures the size of the Instance. + // REQUIRED + PlanId InstanceGetPlanIdAttributeType `json:"planId" required:"true"` + // The current status of the instance. + // REQUIRED + Status InstanceGetStatusAttributeType `json:"status" required:"true"` +} + +type _Instance Instance + +// NewInstance instantiates a new Instance 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 NewInstance(created InstanceGetCreatedArgType, displayName InstanceGetDisplayNameArgType, frontendUrl InstanceGetFrontendUrlArgType, id InstanceGetIdArgType, planId InstanceGetPlanIdArgType, status InstanceGetStatusArgType) *Instance { + this := Instance{} + setInstanceGetCreatedAttributeType(&this.Created, created) + setInstanceGetDisplayNameAttributeType(&this.DisplayName, displayName) + setInstanceGetFrontendUrlAttributeType(&this.FrontendUrl, frontendUrl) + setInstanceGetIdAttributeType(&this.Id, id) + setInstanceGetPlanIdAttributeType(&this.PlanId, planId) + setInstanceGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewInstanceWithDefaults instantiates a new Instance 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 NewInstanceWithDefaults() *Instance { + this := Instance{} + return &this +} + +// GetCreated returns the Created field value +func (o *Instance) GetCreated() (ret InstanceGetCreatedRetType) { + ret, _ = o.GetCreatedOk() + return ret +} + +// GetCreatedOk returns a tuple with the Created field value +// and a boolean to check if the value has been set. +func (o *Instance) GetCreatedOk() (ret InstanceGetCreatedRetType, ok bool) { + return getInstanceGetCreatedAttributeTypeOk(o.Created) +} + +// SetCreated sets field value +func (o *Instance) SetCreated(v InstanceGetCreatedRetType) { + setInstanceGetCreatedAttributeType(&o.Created, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Instance) GetDescription() (res InstanceGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Instance) GetDescriptionOk() (ret InstanceGetDescriptionRetType, ok bool) { + return getInstanceGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *Instance) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Instance) SetDescription(v InstanceGetDescriptionRetType) { + setInstanceGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *Instance) GetDisplayName() (ret InstanceGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *Instance) GetDisplayNameOk() (ret InstanceGetDisplayNameRetType, ok bool) { + return getInstanceGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *Instance) SetDisplayName(v InstanceGetDisplayNameRetType) { + setInstanceGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetFrontendUrl returns the FrontendUrl field value +func (o *Instance) GetFrontendUrl() (ret InstanceGetFrontendUrlRetType) { + ret, _ = o.GetFrontendUrlOk() + return ret +} + +// GetFrontendUrlOk returns a tuple with the FrontendUrl field value +// and a boolean to check if the value has been set. +func (o *Instance) GetFrontendUrlOk() (ret InstanceGetFrontendUrlRetType, ok bool) { + return getInstanceGetFrontendUrlAttributeTypeOk(o.FrontendUrl) +} + +// SetFrontendUrl sets field value +func (o *Instance) SetFrontendUrl(v InstanceGetFrontendUrlRetType) { + setInstanceGetFrontendUrlAttributeType(&o.FrontendUrl, v) +} + +// GetId returns the Id field value +func (o *Instance) GetId() (ret InstanceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Instance) GetIdOk() (ret InstanceGetIdRetType, ok bool) { + return getInstanceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Instance) SetId(v InstanceGetIdRetType) { + setInstanceGetIdAttributeType(&o.Id, v) +} + +// GetPlanId returns the PlanId field value +func (o *Instance) GetPlanId() (ret InstanceGetPlanIdRetType) { + ret, _ = o.GetPlanIdOk() + return ret +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *Instance) GetPlanIdOk() (ret InstanceGetPlanIdRetType, ok bool) { + return getInstanceGetPlanIdAttributeTypeOk(o.PlanId) +} + +// SetPlanId sets field value +func (o *Instance) SetPlanId(v InstanceGetPlanIdRetType) { + setInstanceGetPlanIdAttributeType(&o.PlanId, v) +} + +// GetStatus returns the Status field value +func (o *Instance) GetStatus() (ret InstanceGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Instance) GetStatusOk() (ret InstanceGetStatusRetType, ok bool) { + return getInstanceGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Instance) SetStatus(v InstanceGetStatusRetType) { + setInstanceGetStatusAttributeType(&o.Status, v) +} + +func (o Instance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getInstanceGetCreatedAttributeTypeOk(o.Created); ok { + toSerialize["Created"] = val + } + if val, ok := getInstanceGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getInstanceGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getInstanceGetFrontendUrlAttributeTypeOk(o.FrontendUrl); ok { + toSerialize["FrontendUrl"] = val + } + if val, ok := getInstanceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getInstanceGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + if val, ok := getInstanceGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableInstance struct { + value *Instance + isSet bool +} + +func (v NullableInstance) Get() *Instance { + return v.value +} + +func (v *NullableInstance) Set(val *Instance) { + v.value = val + v.isSet = true +} + +func (v NullableInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstance(val *Instance) *NullableInstance { + return &NullableInstance{value: val, isSet: true} +} + +func (v NullableInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_instance_list.go b/pkg/edgebeta/model_instance_list.go new file mode 100644 index 00000000..e2d17eac --- /dev/null +++ b/pkg/edgebeta/model_instance_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the InstanceList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceList{} + +/* + types and functions for instances +*/ + +// isArray +type InstanceListGetInstancesAttributeType = *[]Instance +type InstanceListGetInstancesArgType = []Instance +type InstanceListGetInstancesRetType = []Instance + +func getInstanceListGetInstancesAttributeTypeOk(arg InstanceListGetInstancesAttributeType) (ret InstanceListGetInstancesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceListGetInstancesAttributeType(arg *InstanceListGetInstancesAttributeType, val InstanceListGetInstancesRetType) { + *arg = &val +} + +// InstanceList struct for InstanceList +type InstanceList struct { + // REQUIRED + Instances InstanceListGetInstancesAttributeType `json:"instances" required:"true"` +} + +type _InstanceList InstanceList + +// NewInstanceList instantiates a new InstanceList 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 NewInstanceList(instances InstanceListGetInstancesArgType) *InstanceList { + this := InstanceList{} + setInstanceListGetInstancesAttributeType(&this.Instances, instances) + return &this +} + +// NewInstanceListWithDefaults instantiates a new InstanceList 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 NewInstanceListWithDefaults() *InstanceList { + this := InstanceList{} + return &this +} + +// GetInstances returns the Instances field value +func (o *InstanceList) GetInstances() (ret InstanceListGetInstancesRetType) { + ret, _ = o.GetInstancesOk() + return ret +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *InstanceList) GetInstancesOk() (ret InstanceListGetInstancesRetType, ok bool) { + return getInstanceListGetInstancesAttributeTypeOk(o.Instances) +} + +// SetInstances sets field value +func (o *InstanceList) SetInstances(v InstanceListGetInstancesRetType) { + setInstanceListGetInstancesAttributeType(&o.Instances, v) +} + +func (o InstanceList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getInstanceListGetInstancesAttributeTypeOk(o.Instances); ok { + toSerialize["Instances"] = val + } + return toSerialize, nil +} + +type NullableInstanceList struct { + value *InstanceList + isSet bool +} + +func (v NullableInstanceList) Get() *InstanceList { + return v.value +} + +func (v *NullableInstanceList) Set(val *InstanceList) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceList) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceList(val *InstanceList) *NullableInstanceList { + return &NullableInstanceList{value: val, isSet: true} +} + +func (v NullableInstanceList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_instance_list_test.go b/pkg/edgebeta/model_instance_list_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_instance_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/model_instance_test.go b/pkg/edgebeta/model_instance_test.go new file mode 100644 index 00000000..05084595 --- /dev/null +++ b/pkg/edgebeta/model_instance_test.go @@ -0,0 +1,72 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "testing" +) + +// isEnum + +func TestInstanceStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"error"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"reconciling"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"deleting"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := InstanceStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/edgebeta/model_kubeconfig.go b/pkg/edgebeta/model_kubeconfig.go new file mode 100644 index 00000000..468c936c --- /dev/null +++ b/pkg/edgebeta/model_kubeconfig.go @@ -0,0 +1,126 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the Kubeconfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Kubeconfig{} + +/* + types and functions for kubeconfig +*/ + +// isFreeform +type KubeconfigGetKubeconfigAttributeType = *map[string]interface{} +type KubeconfigGetKubeconfigArgType = map[string]interface{} +type KubeconfigGetKubeconfigRetType = map[string]interface{} + +func getKubeconfigGetKubeconfigAttributeTypeOk(arg KubeconfigGetKubeconfigAttributeType) (ret KubeconfigGetKubeconfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKubeconfigGetKubeconfigAttributeType(arg *KubeconfigGetKubeconfigAttributeType, val KubeconfigGetKubeconfigRetType) { + *arg = &val +} + +// Kubeconfig struct for Kubeconfig +type Kubeconfig struct { + // The kubeconfig for the instance. + // REQUIRED + Kubeconfig KubeconfigGetKubeconfigAttributeType `json:"kubeconfig" required:"true"` +} + +type _Kubeconfig Kubeconfig + +// NewKubeconfig instantiates a new Kubeconfig 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 NewKubeconfig(kubeconfig KubeconfigGetKubeconfigArgType) *Kubeconfig { + this := Kubeconfig{} + setKubeconfigGetKubeconfigAttributeType(&this.Kubeconfig, kubeconfig) + return &this +} + +// NewKubeconfigWithDefaults instantiates a new Kubeconfig 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 NewKubeconfigWithDefaults() *Kubeconfig { + this := Kubeconfig{} + return &this +} + +// GetKubeconfig returns the Kubeconfig field value +func (o *Kubeconfig) GetKubeconfig() (ret KubeconfigGetKubeconfigRetType) { + ret, _ = o.GetKubeconfigOk() + return ret +} + +// GetKubeconfigOk returns a tuple with the Kubeconfig field value +// and a boolean to check if the value has been set. +func (o *Kubeconfig) GetKubeconfigOk() (ret KubeconfigGetKubeconfigRetType, ok bool) { + return getKubeconfigGetKubeconfigAttributeTypeOk(o.Kubeconfig) +} + +// SetKubeconfig sets field value +func (o *Kubeconfig) SetKubeconfig(v KubeconfigGetKubeconfigRetType) { + setKubeconfigGetKubeconfigAttributeType(&o.Kubeconfig, v) +} + +func (o Kubeconfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKubeconfigGetKubeconfigAttributeTypeOk(o.Kubeconfig); ok { + toSerialize["Kubeconfig"] = val + } + return toSerialize, nil +} + +type NullableKubeconfig struct { + value *Kubeconfig + isSet bool +} + +func (v NullableKubeconfig) Get() *Kubeconfig { + return v.value +} + +func (v *NullableKubeconfig) Set(val *Kubeconfig) { + v.value = val + v.isSet = true +} + +func (v NullableKubeconfig) IsSet() bool { + return v.isSet +} + +func (v *NullableKubeconfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKubeconfig(val *Kubeconfig) *NullableKubeconfig { + return &NullableKubeconfig{value: val, isSet: true} +} + +func (v NullableKubeconfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKubeconfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_kubeconfig_test.go b/pkg/edgebeta/model_kubeconfig_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_kubeconfig_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/model_plan.go b/pkg/edgebeta/model_plan.go new file mode 100644 index 00000000..11bf1343 --- /dev/null +++ b/pkg/edgebeta/model_plan.go @@ -0,0 +1,276 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the Plan type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Plan{} + +/* + types and functions for description +*/ + +// isNotNullableString +type PlanGetDescriptionAttributeType = *string + +func getPlanGetDescriptionAttributeTypeOk(arg PlanGetDescriptionAttributeType) (ret PlanGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetDescriptionAttributeType(arg *PlanGetDescriptionAttributeType, val PlanGetDescriptionRetType) { + *arg = &val +} + +type PlanGetDescriptionArgType = string +type PlanGetDescriptionRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type PlanGetIdAttributeType = *string + +func getPlanGetIdAttributeTypeOk(arg PlanGetIdAttributeType) (ret PlanGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetIdAttributeType(arg *PlanGetIdAttributeType, val PlanGetIdRetType) { + *arg = &val +} + +type PlanGetIdArgType = string +type PlanGetIdRetType = string + +/* + types and functions for maxEdgeHosts +*/ + +// isInteger +type PlanGetMaxEdgeHostsAttributeType = *int64 +type PlanGetMaxEdgeHostsArgType = int64 +type PlanGetMaxEdgeHostsRetType = int64 + +func getPlanGetMaxEdgeHostsAttributeTypeOk(arg PlanGetMaxEdgeHostsAttributeType) (ret PlanGetMaxEdgeHostsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetMaxEdgeHostsAttributeType(arg *PlanGetMaxEdgeHostsAttributeType, val PlanGetMaxEdgeHostsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type PlanGetNameAttributeType = *string + +func getPlanGetNameAttributeTypeOk(arg PlanGetNameAttributeType) (ret PlanGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetNameAttributeType(arg *PlanGetNameAttributeType, val PlanGetNameRetType) { + *arg = &val +} + +type PlanGetNameArgType = string +type PlanGetNameRetType = string + +// Plan struct for Plan +type Plan struct { + // Description + Description PlanGetDescriptionAttributeType `json:"description,omitempty"` + // Service Plan Identifier + Id PlanGetIdAttributeType `json:"id,omitempty"` + // Maximum number of EdgeHosts + // Can be cast to int32 without loss of precision. + MaxEdgeHosts PlanGetMaxEdgeHostsAttributeType `json:"maxEdgeHosts,omitempty"` + // Service Plan Name + Name PlanGetNameAttributeType `json:"name,omitempty"` +} + +// NewPlan instantiates a new Plan object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlan() *Plan { + this := Plan{} + return &this +} + +// NewPlanWithDefaults instantiates a new Plan object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanWithDefaults() *Plan { + this := Plan{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Plan) GetDescription() (res PlanGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetDescriptionOk() (ret PlanGetDescriptionRetType, ok bool) { + return getPlanGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *Plan) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Plan) SetDescription(v PlanGetDescriptionRetType) { + setPlanGetDescriptionAttributeType(&o.Description, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Plan) GetId() (res PlanGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetIdOk() (ret PlanGetIdRetType, ok bool) { + return getPlanGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Plan) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Plan) SetId(v PlanGetIdRetType) { + setPlanGetIdAttributeType(&o.Id, v) +} + +// GetMaxEdgeHosts returns the MaxEdgeHosts field value if set, zero value otherwise. +func (o *Plan) GetMaxEdgeHosts() (res PlanGetMaxEdgeHostsRetType) { + res, _ = o.GetMaxEdgeHostsOk() + return +} + +// GetMaxEdgeHostsOk returns a tuple with the MaxEdgeHosts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetMaxEdgeHostsOk() (ret PlanGetMaxEdgeHostsRetType, ok bool) { + return getPlanGetMaxEdgeHostsAttributeTypeOk(o.MaxEdgeHosts) +} + +// HasMaxEdgeHosts returns a boolean if a field has been set. +func (o *Plan) HasMaxEdgeHosts() bool { + _, ok := o.GetMaxEdgeHostsOk() + return ok +} + +// SetMaxEdgeHosts gets a reference to the given int64 and assigns it to the MaxEdgeHosts field. +func (o *Plan) SetMaxEdgeHosts(v PlanGetMaxEdgeHostsRetType) { + setPlanGetMaxEdgeHostsAttributeType(&o.MaxEdgeHosts, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Plan) GetName() (res PlanGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetNameOk() (ret PlanGetNameRetType, ok bool) { + return getPlanGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Plan) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Plan) SetName(v PlanGetNameRetType) { + setPlanGetNameAttributeType(&o.Name, v) +} + +func (o Plan) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPlanGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getPlanGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getPlanGetMaxEdgeHostsAttributeTypeOk(o.MaxEdgeHosts); ok { + toSerialize["MaxEdgeHosts"] = val + } + if val, ok := getPlanGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullablePlan struct { + value *Plan + isSet bool +} + +func (v NullablePlan) Get() *Plan { + return v.value +} + +func (v *NullablePlan) Set(val *Plan) { + v.value = val + v.isSet = true +} + +func (v NullablePlan) IsSet() bool { + return v.isSet +} + +func (v *NullablePlan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlan(val *Plan) *NullablePlan { + return &NullablePlan{value: val, isSet: true} +} + +func (v NullablePlan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_plan_list.go b/pkg/edgebeta/model_plan_list.go new file mode 100644 index 00000000..5c33ab09 --- /dev/null +++ b/pkg/edgebeta/model_plan_list.go @@ -0,0 +1,127 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the PlanList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanList{} + +/* + types and functions for validPlans +*/ + +// isArray +type PlanListGetValidPlansAttributeType = *[]Plan +type PlanListGetValidPlansArgType = []Plan +type PlanListGetValidPlansRetType = []Plan + +func getPlanListGetValidPlansAttributeTypeOk(arg PlanListGetValidPlansAttributeType) (ret PlanListGetValidPlansRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanListGetValidPlansAttributeType(arg *PlanListGetValidPlansAttributeType, val PlanListGetValidPlansRetType) { + *arg = &val +} + +// PlanList struct for PlanList +type PlanList struct { + ValidPlans PlanListGetValidPlansAttributeType `json:"validPlans,omitempty"` +} + +// NewPlanList instantiates a new PlanList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanList() *PlanList { + this := PlanList{} + return &this +} + +// NewPlanListWithDefaults instantiates a new PlanList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanListWithDefaults() *PlanList { + this := PlanList{} + return &this +} + +// GetValidPlans returns the ValidPlans field value if set, zero value otherwise. +func (o *PlanList) GetValidPlans() (res PlanListGetValidPlansRetType) { + res, _ = o.GetValidPlansOk() + return +} + +// GetValidPlansOk returns a tuple with the ValidPlans field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanList) GetValidPlansOk() (ret PlanListGetValidPlansRetType, ok bool) { + return getPlanListGetValidPlansAttributeTypeOk(o.ValidPlans) +} + +// HasValidPlans returns a boolean if a field has been set. +func (o *PlanList) HasValidPlans() bool { + _, ok := o.GetValidPlansOk() + return ok +} + +// SetValidPlans gets a reference to the given []Plan and assigns it to the ValidPlans field. +func (o *PlanList) SetValidPlans(v PlanListGetValidPlansRetType) { + setPlanListGetValidPlansAttributeType(&o.ValidPlans, v) +} + +func (o PlanList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPlanListGetValidPlansAttributeTypeOk(o.ValidPlans); ok { + toSerialize["ValidPlans"] = val + } + return toSerialize, nil +} + +type NullablePlanList struct { + value *PlanList + isSet bool +} + +func (v NullablePlanList) Get() *PlanList { + return v.value +} + +func (v *NullablePlanList) Set(val *PlanList) { + v.value = val + v.isSet = true +} + +func (v NullablePlanList) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanList(val *PlanList) *NullablePlanList { + return &NullablePlanList{value: val, isSet: true} +} + +func (v NullablePlanList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_plan_list_test.go b/pkg/edgebeta/model_plan_list_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_plan_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/model_plan_test.go b/pkg/edgebeta/model_plan_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_plan_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/model_token.go b/pkg/edgebeta/model_token.go new file mode 100644 index 00000000..55fdd4e1 --- /dev/null +++ b/pkg/edgebeta/model_token.go @@ -0,0 +1,127 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the Token type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Token{} + +/* + types and functions for token +*/ + +// isNotNullableString +type TokenGetTokenAttributeType = *string + +func getTokenGetTokenAttributeTypeOk(arg TokenGetTokenAttributeType) (ret TokenGetTokenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTokenGetTokenAttributeType(arg *TokenGetTokenAttributeType, val TokenGetTokenRetType) { + *arg = &val +} + +type TokenGetTokenArgType = string +type TokenGetTokenRetType = string + +// Token struct for Token +type Token struct { + // The token for the instance. + // REQUIRED + Token TokenGetTokenAttributeType `json:"token" required:"true"` +} + +type _Token Token + +// NewToken instantiates a new Token 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 NewToken(token TokenGetTokenArgType) *Token { + this := Token{} + setTokenGetTokenAttributeType(&this.Token, token) + return &this +} + +// NewTokenWithDefaults instantiates a new Token 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 NewTokenWithDefaults() *Token { + this := Token{} + return &this +} + +// GetToken returns the Token field value +func (o *Token) GetToken() (ret TokenGetTokenRetType) { + ret, _ = o.GetTokenOk() + return ret +} + +// GetTokenOk returns a tuple with the Token field value +// and a boolean to check if the value has been set. +func (o *Token) GetTokenOk() (ret TokenGetTokenRetType, ok bool) { + return getTokenGetTokenAttributeTypeOk(o.Token) +} + +// SetToken sets field value +func (o *Token) SetToken(v TokenGetTokenRetType) { + setTokenGetTokenAttributeType(&o.Token, v) +} + +func (o Token) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTokenGetTokenAttributeTypeOk(o.Token); ok { + toSerialize["Token"] = val + } + return toSerialize, nil +} + +type NullableToken struct { + value *Token + isSet bool +} + +func (v NullableToken) Get() *Token { + return v.value +} + +func (v *NullableToken) Set(val *Token) { + v.value = val + v.isSet = true +} + +func (v NullableToken) IsSet() bool { + return v.isSet +} + +func (v *NullableToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableToken(val *Token) *NullableToken { + return &NullableToken{value: val, isSet: true} +} + +func (v NullableToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_token_test.go b/pkg/edgebeta/model_token_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_token_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/model_unauthorized_request.go b/pkg/edgebeta/model_unauthorized_request.go new file mode 100644 index 00000000..5e63a012 --- /dev/null +++ b/pkg/edgebeta/model_unauthorized_request.go @@ -0,0 +1,176 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the UnauthorizedRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UnauthorizedRequest{} + +/* + types and functions for code +*/ + +// isNotNullableString +type UnauthorizedRequestGetCodeAttributeType = *string + +func getUnauthorizedRequestGetCodeAttributeTypeOk(arg UnauthorizedRequestGetCodeAttributeType) (ret UnauthorizedRequestGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUnauthorizedRequestGetCodeAttributeType(arg *UnauthorizedRequestGetCodeAttributeType, val UnauthorizedRequestGetCodeRetType) { + *arg = &val +} + +type UnauthorizedRequestGetCodeArgType = string +type UnauthorizedRequestGetCodeRetType = string + +/* + types and functions for message +*/ + +// isNotNullableString +type UnauthorizedRequestGetMessageAttributeType = *string + +func getUnauthorizedRequestGetMessageAttributeTypeOk(arg UnauthorizedRequestGetMessageAttributeType) (ret UnauthorizedRequestGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUnauthorizedRequestGetMessageAttributeType(arg *UnauthorizedRequestGetMessageAttributeType, val UnauthorizedRequestGetMessageRetType) { + *arg = &val +} + +type UnauthorizedRequestGetMessageArgType = string +type UnauthorizedRequestGetMessageRetType = string + +// UnauthorizedRequest struct for UnauthorizedRequest +type UnauthorizedRequest struct { + Code UnauthorizedRequestGetCodeAttributeType `json:"code,omitempty"` + Message UnauthorizedRequestGetMessageAttributeType `json:"message,omitempty"` +} + +// NewUnauthorizedRequest instantiates a new UnauthorizedRequest 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 NewUnauthorizedRequest() *UnauthorizedRequest { + this := UnauthorizedRequest{} + return &this +} + +// NewUnauthorizedRequestWithDefaults instantiates a new UnauthorizedRequest 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 NewUnauthorizedRequestWithDefaults() *UnauthorizedRequest { + this := UnauthorizedRequest{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *UnauthorizedRequest) GetCode() (res UnauthorizedRequestGetCodeRetType) { + res, _ = o.GetCodeOk() + return +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnauthorizedRequest) GetCodeOk() (ret UnauthorizedRequestGetCodeRetType, ok bool) { + return getUnauthorizedRequestGetCodeAttributeTypeOk(o.Code) +} + +// HasCode returns a boolean if a field has been set. +func (o *UnauthorizedRequest) HasCode() bool { + _, ok := o.GetCodeOk() + return ok +} + +// SetCode gets a reference to the given string and assigns it to the Code field. +func (o *UnauthorizedRequest) SetCode(v UnauthorizedRequestGetCodeRetType) { + setUnauthorizedRequestGetCodeAttributeType(&o.Code, v) +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *UnauthorizedRequest) GetMessage() (res UnauthorizedRequestGetMessageRetType) { + res, _ = o.GetMessageOk() + return +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UnauthorizedRequest) GetMessageOk() (ret UnauthorizedRequestGetMessageRetType, ok bool) { + return getUnauthorizedRequestGetMessageAttributeTypeOk(o.Message) +} + +// HasMessage returns a boolean if a field has been set. +func (o *UnauthorizedRequest) HasMessage() bool { + _, ok := o.GetMessageOk() + return ok +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *UnauthorizedRequest) SetMessage(v UnauthorizedRequestGetMessageRetType) { + setUnauthorizedRequestGetMessageAttributeType(&o.Message, v) +} + +func (o UnauthorizedRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUnauthorizedRequestGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getUnauthorizedRequestGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableUnauthorizedRequest struct { + value *UnauthorizedRequest + isSet bool +} + +func (v NullableUnauthorizedRequest) Get() *UnauthorizedRequest { + return v.value +} + +func (v *NullableUnauthorizedRequest) Set(val *UnauthorizedRequest) { + v.value = val + v.isSet = true +} + +func (v NullableUnauthorizedRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableUnauthorizedRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUnauthorizedRequest(val *UnauthorizedRequest) *NullableUnauthorizedRequest { + return &NullableUnauthorizedRequest{value: val, isSet: true} +} + +func (v NullableUnauthorizedRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUnauthorizedRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_unauthorized_request_test.go b/pkg/edgebeta/model_unauthorized_request_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_unauthorized_request_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/model_update_instance_by_name_payload.go b/pkg/edgebeta/model_update_instance_by_name_payload.go new file mode 100644 index 00000000..fae0b799 --- /dev/null +++ b/pkg/edgebeta/model_update_instance_by_name_payload.go @@ -0,0 +1,178 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the UpdateInstanceByNamePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateInstanceByNamePayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateInstanceByNamePayloadGetDescriptionAttributeType = *string + +func getUpdateInstanceByNamePayloadGetDescriptionAttributeTypeOk(arg UpdateInstanceByNamePayloadGetDescriptionAttributeType) (ret UpdateInstanceByNamePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateInstanceByNamePayloadGetDescriptionAttributeType(arg *UpdateInstanceByNamePayloadGetDescriptionAttributeType, val UpdateInstanceByNamePayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateInstanceByNamePayloadGetDescriptionArgType = string +type UpdateInstanceByNamePayloadGetDescriptionRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type UpdateInstanceByNamePayloadGetPlanIdAttributeType = *string + +func getUpdateInstanceByNamePayloadGetPlanIdAttributeTypeOk(arg UpdateInstanceByNamePayloadGetPlanIdAttributeType) (ret UpdateInstanceByNamePayloadGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateInstanceByNamePayloadGetPlanIdAttributeType(arg *UpdateInstanceByNamePayloadGetPlanIdAttributeType, val UpdateInstanceByNamePayloadGetPlanIdRetType) { + *arg = &val +} + +type UpdateInstanceByNamePayloadGetPlanIdArgType = string +type UpdateInstanceByNamePayloadGetPlanIdRetType = string + +// UpdateInstanceByNamePayload struct for UpdateInstanceByNamePayload +type UpdateInstanceByNamePayload struct { + // A user chosen description to distinguish multiple instances. + Description UpdateInstanceByNamePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Service Plan configures the size of the Instance. + PlanId UpdateInstanceByNamePayloadGetPlanIdAttributeType `json:"planId,omitempty"` +} + +// NewUpdateInstanceByNamePayload instantiates a new UpdateInstanceByNamePayload 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 NewUpdateInstanceByNamePayload() *UpdateInstanceByNamePayload { + this := UpdateInstanceByNamePayload{} + return &this +} + +// NewUpdateInstanceByNamePayloadWithDefaults instantiates a new UpdateInstanceByNamePayload 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 NewUpdateInstanceByNamePayloadWithDefaults() *UpdateInstanceByNamePayload { + this := UpdateInstanceByNamePayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateInstanceByNamePayload) GetDescription() (res UpdateInstanceByNamePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstanceByNamePayload) GetDescriptionOk() (ret UpdateInstanceByNamePayloadGetDescriptionRetType, ok bool) { + return getUpdateInstanceByNamePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateInstanceByNamePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateInstanceByNamePayload) SetDescription(v UpdateInstanceByNamePayloadGetDescriptionRetType) { + setUpdateInstanceByNamePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetPlanId returns the PlanId field value if set, zero value otherwise. +func (o *UpdateInstanceByNamePayload) GetPlanId() (res UpdateInstanceByNamePayloadGetPlanIdRetType) { + res, _ = o.GetPlanIdOk() + return +} + +// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstanceByNamePayload) GetPlanIdOk() (ret UpdateInstanceByNamePayloadGetPlanIdRetType, ok bool) { + return getUpdateInstanceByNamePayloadGetPlanIdAttributeTypeOk(o.PlanId) +} + +// HasPlanId returns a boolean if a field has been set. +func (o *UpdateInstanceByNamePayload) HasPlanId() bool { + _, ok := o.GetPlanIdOk() + return ok +} + +// SetPlanId gets a reference to the given string and assigns it to the PlanId field. +func (o *UpdateInstanceByNamePayload) SetPlanId(v UpdateInstanceByNamePayloadGetPlanIdRetType) { + setUpdateInstanceByNamePayloadGetPlanIdAttributeType(&o.PlanId, v) +} + +func (o UpdateInstanceByNamePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateInstanceByNamePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateInstanceByNamePayloadGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + return toSerialize, nil +} + +type NullableUpdateInstanceByNamePayload struct { + value *UpdateInstanceByNamePayload + isSet bool +} + +func (v NullableUpdateInstanceByNamePayload) Get() *UpdateInstanceByNamePayload { + return v.value +} + +func (v *NullableUpdateInstanceByNamePayload) Set(val *UpdateInstanceByNamePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateInstanceByNamePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateInstanceByNamePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateInstanceByNamePayload(val *UpdateInstanceByNamePayload) *NullableUpdateInstanceByNamePayload { + return &NullableUpdateInstanceByNamePayload{value: val, isSet: true} +} + +func (v NullableUpdateInstanceByNamePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateInstanceByNamePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_update_instance_by_name_payload_test.go b/pkg/edgebeta/model_update_instance_by_name_payload_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_update_instance_by_name_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/model_update_instance_payload.go b/pkg/edgebeta/model_update_instance_payload.go new file mode 100644 index 00000000..16e92c4f --- /dev/null +++ b/pkg/edgebeta/model_update_instance_payload.go @@ -0,0 +1,178 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the UpdateInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateInstancePayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateInstancePayloadGetDescriptionAttributeType = *string + +func getUpdateInstancePayloadGetDescriptionAttributeTypeOk(arg UpdateInstancePayloadGetDescriptionAttributeType) (ret UpdateInstancePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateInstancePayloadGetDescriptionAttributeType(arg *UpdateInstancePayloadGetDescriptionAttributeType, val UpdateInstancePayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateInstancePayloadGetDescriptionArgType = string +type UpdateInstancePayloadGetDescriptionRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type UpdateInstancePayloadGetPlanIdAttributeType = *string + +func getUpdateInstancePayloadGetPlanIdAttributeTypeOk(arg UpdateInstancePayloadGetPlanIdAttributeType) (ret UpdateInstancePayloadGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateInstancePayloadGetPlanIdAttributeType(arg *UpdateInstancePayloadGetPlanIdAttributeType, val UpdateInstancePayloadGetPlanIdRetType) { + *arg = &val +} + +type UpdateInstancePayloadGetPlanIdArgType = string +type UpdateInstancePayloadGetPlanIdRetType = string + +// UpdateInstancePayload struct for UpdateInstancePayload +type UpdateInstancePayload struct { + // A user chosen description to distinguish multiple instances. + Description UpdateInstancePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Service Plan configures the size of the Instance. + PlanId UpdateInstancePayloadGetPlanIdAttributeType `json:"planId,omitempty"` +} + +// NewUpdateInstancePayload instantiates a new UpdateInstancePayload 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 NewUpdateInstancePayload() *UpdateInstancePayload { + this := UpdateInstancePayload{} + return &this +} + +// NewUpdateInstancePayloadWithDefaults instantiates a new UpdateInstancePayload 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 NewUpdateInstancePayloadWithDefaults() *UpdateInstancePayload { + this := UpdateInstancePayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateInstancePayload) GetDescription() (res UpdateInstancePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePayload) GetDescriptionOk() (ret UpdateInstancePayloadGetDescriptionRetType, ok bool) { + return getUpdateInstancePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateInstancePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateInstancePayload) SetDescription(v UpdateInstancePayloadGetDescriptionRetType) { + setUpdateInstancePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetPlanId returns the PlanId field value if set, zero value otherwise. +func (o *UpdateInstancePayload) GetPlanId() (res UpdateInstancePayloadGetPlanIdRetType) { + res, _ = o.GetPlanIdOk() + return +} + +// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePayload) GetPlanIdOk() (ret UpdateInstancePayloadGetPlanIdRetType, ok bool) { + return getUpdateInstancePayloadGetPlanIdAttributeTypeOk(o.PlanId) +} + +// HasPlanId returns a boolean if a field has been set. +func (o *UpdateInstancePayload) HasPlanId() bool { + _, ok := o.GetPlanIdOk() + return ok +} + +// SetPlanId gets a reference to the given string and assigns it to the PlanId field. +func (o *UpdateInstancePayload) SetPlanId(v UpdateInstancePayloadGetPlanIdRetType) { + setUpdateInstancePayloadGetPlanIdAttributeType(&o.PlanId, v) +} + +func (o UpdateInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateInstancePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateInstancePayloadGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + return toSerialize, nil +} + +type NullableUpdateInstancePayload struct { + value *UpdateInstancePayload + isSet bool +} + +func (v NullableUpdateInstancePayload) Get() *UpdateInstancePayload { + return v.value +} + +func (v *NullableUpdateInstancePayload) Set(val *UpdateInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateInstancePayload(val *UpdateInstancePayload) *NullableUpdateInstancePayload { + return &NullableUpdateInstancePayload{value: val, isSet: true} +} + +func (v NullableUpdateInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_update_instance_payload_test.go b/pkg/edgebeta/model_update_instance_payload_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_update_instance_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/model_user.go b/pkg/edgebeta/model_user.go new file mode 100644 index 00000000..c66bb6d3 --- /dev/null +++ b/pkg/edgebeta/model_user.go @@ -0,0 +1,172 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" +) + +// checks if the User type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &User{} + +/* + types and functions for email +*/ + +// isNotNullableString +type UserGetEmailAttributeType = *string + +func getUserGetEmailAttributeTypeOk(arg UserGetEmailAttributeType) (ret UserGetEmailRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUserGetEmailAttributeType(arg *UserGetEmailAttributeType, val UserGetEmailRetType) { + *arg = &val +} + +type UserGetEmailArgType = string +type UserGetEmailRetType = string + +/* + types and functions for internalId +*/ + +// isNotNullableString +type UserGetInternalIdAttributeType = *string + +func getUserGetInternalIdAttributeTypeOk(arg UserGetInternalIdAttributeType) (ret UserGetInternalIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUserGetInternalIdAttributeType(arg *UserGetInternalIdAttributeType, val UserGetInternalIdRetType) { + *arg = &val +} + +type UserGetInternalIdArgType = string +type UserGetInternalIdRetType = string + +// User struct for User +type User struct { + // The email of the user. + // REQUIRED + Email UserGetEmailAttributeType `json:"email" required:"true"` + // The UUID of the user. + // REQUIRED + InternalId UserGetInternalIdAttributeType `json:"internalId" required:"true"` +} + +type _User User + +// NewUser instantiates a new User object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUser(email UserGetEmailArgType, internalId UserGetInternalIdArgType) *User { + this := User{} + setUserGetEmailAttributeType(&this.Email, email) + setUserGetInternalIdAttributeType(&this.InternalId, internalId) + return &this +} + +// NewUserWithDefaults instantiates a new User object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserWithDefaults() *User { + this := User{} + return &this +} + +// GetEmail returns the Email field value +func (o *User) GetEmail() (ret UserGetEmailRetType) { + ret, _ = o.GetEmailOk() + return ret +} + +// GetEmailOk returns a tuple with the Email field value +// and a boolean to check if the value has been set. +func (o *User) GetEmailOk() (ret UserGetEmailRetType, ok bool) { + return getUserGetEmailAttributeTypeOk(o.Email) +} + +// SetEmail sets field value +func (o *User) SetEmail(v UserGetEmailRetType) { + setUserGetEmailAttributeType(&o.Email, v) +} + +// GetInternalId returns the InternalId field value +func (o *User) GetInternalId() (ret UserGetInternalIdRetType) { + ret, _ = o.GetInternalIdOk() + return ret +} + +// GetInternalIdOk returns a tuple with the InternalId field value +// and a boolean to check if the value has been set. +func (o *User) GetInternalIdOk() (ret UserGetInternalIdRetType, ok bool) { + return getUserGetInternalIdAttributeTypeOk(o.InternalId) +} + +// SetInternalId sets field value +func (o *User) SetInternalId(v UserGetInternalIdRetType) { + setUserGetInternalIdAttributeType(&o.InternalId, v) +} + +func (o User) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUserGetEmailAttributeTypeOk(o.Email); ok { + toSerialize["Email"] = val + } + if val, ok := getUserGetInternalIdAttributeTypeOk(o.InternalId); ok { + toSerialize["InternalId"] = val + } + return toSerialize, nil +} + +type NullableUser struct { + value *User + isSet bool +} + +func (v NullableUser) Get() *User { + return v.value +} + +func (v *NullableUser) Set(val *User) { + v.value = val + v.isSet = true +} + +func (v NullableUser) IsSet() bool { + return v.isSet +} + +func (v *NullableUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUser(val *User) *NullableUser { + return &NullableUser{value: val, isSet: true} +} + +func (v NullableUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/edgebeta/model_user_test.go b/pkg/edgebeta/model_user_test.go new file mode 100644 index 00000000..b645792b --- /dev/null +++ b/pkg/edgebeta/model_user_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta diff --git a/pkg/edgebeta/utils.go b/pkg/edgebeta/utils.go new file mode 100644 index 00000000..0791f086 --- /dev/null +++ b/pkg/edgebeta/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT Edge Cloud API + +This API provides endpoints for managing STACKIT Edge Cloud instances. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package edgebeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/gitbeta/.openapi-generator/VERSION b/pkg/gitbeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/gitbeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/gitbeta/api_default.go b/pkg/gitbeta/api_default.go new file mode 100644 index 00000000..551db2eb --- /dev/null +++ b/pkg/gitbeta/api_default.go @@ -0,0 +1,2918 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateAuthentication Creates an authentication source + Creates an authentication source for the corresponding STACKIT Git instance + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiCreateAuthenticationRequest + */ + CreateAuthentication(ctx context.Context, projectId string, instanceId string) ApiCreateAuthenticationRequest + /* + CreateAuthenticationExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return Authentication + + */ + CreateAuthenticationExecute(ctx context.Context, projectId string, instanceId string) (*Authentication, error) + /* + CreateInstance Create an Instance. + Creates a new STACKIT Git instance as a project resource. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return ApiCreateInstanceRequest + */ + CreateInstance(ctx context.Context, projectId string) ApiCreateInstanceRequest + /* + CreateInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return Instance + + */ + CreateInstanceExecute(ctx context.Context, projectId string) (*Instance, error) + /* + CreateRunner Create the runner associated to this instance. + Creates the runner associated to this STACKIT Git instance. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiCreateRunnerRequest + */ + CreateRunner(ctx context.Context, projectId string, instanceId string) ApiCreateRunnerRequest + /* + CreateRunnerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return Runner + + */ + CreateRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) + /* + DeleteAuthentication Delete Authentication Source + Deletes the authentication source associated to this STACKIT Git instance. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return ApiDeleteAuthenticationRequest + */ + DeleteAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiDeleteAuthenticationRequest + /* + DeleteAuthenticationExecute executes the request + + */ + DeleteAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) error + /* + DeleteInstance Delete Instance. + Deletes a STACKIT Git instance and destroys all associated data. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiDeleteInstanceRequest + */ + DeleteInstance(ctx context.Context, projectId string, instanceId string) ApiDeleteInstanceRequest + /* + DeleteInstanceExecute executes the request + + */ + DeleteInstanceExecute(ctx context.Context, projectId string, instanceId string) error + /* + DeleteRunner Delete Runner. + Deletes the runner associated to this STACKIT Git instance and destroys all associated data. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiDeleteRunnerRequest + */ + DeleteRunner(ctx context.Context, projectId string, instanceId string) ApiDeleteRunnerRequest + /* + DeleteRunnerExecute executes the request + + */ + DeleteRunnerExecute(ctx context.Context, projectId string, instanceId string) error + /* + GetAuthentication Get authentication provider + Get authentication provider + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return ApiGetAuthenticationRequest + */ + GetAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiGetAuthenticationRequest + /* + GetAuthenticationExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return Authentication + + */ + GetAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) (*Authentication, error) + /* + GetInstance Get Instance information. + Retrieves information about a STACKIT Git instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiGetInstanceRequest + */ + GetInstance(ctx context.Context, projectId string, instanceId string) ApiGetInstanceRequest + /* + GetInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return Instance + + */ + GetInstanceExecute(ctx context.Context, projectId string, instanceId string) (*Instance, error) + /* + GetInstances List Instances. + Lists all STACKIT Git instances within a project. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return ApiGetInstancesRequest + */ + GetInstances(ctx context.Context, projectId string) ApiGetInstancesRequest + /* + GetInstancesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return InstanceList + + */ + GetInstancesExecute(ctx context.Context, projectId string) (*InstanceList, error) + /* + GetRunner Get Runner information. + Retrieves information about a runner in a STACKIT Git instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiGetRunnerRequest + */ + GetRunner(ctx context.Context, projectId string, instanceId string) ApiGetRunnerRequest + /* + GetRunnerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return Runner + + */ + GetRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) + /* + ListAuthentication List authentication sources + Lists all authentication sources belonging to a specific instance + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiListAuthenticationRequest + */ + ListAuthentication(ctx context.Context, projectId string, instanceId string) ApiListAuthenticationRequest + /* + ListAuthenticationExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return AuthenticationList + + */ + ListAuthenticationExecute(ctx context.Context, projectId string, instanceId string) (*AuthenticationList, error) + /* + ListFlavors Returns the details for the given STACKIT Git flavors. + Provides detailed information about possible Git Flavors. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return ApiListFlavorsRequest + */ + ListFlavors(ctx context.Context, projectId string) ApiListFlavorsRequest + /* + ListFlavorsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return FlavorsList + + */ + ListFlavorsExecute(ctx context.Context, projectId string) (*FlavorsList, error) + /* + ListRunnerRuntimes Method for ListRunnerRuntimes + A list of runner runtimes that are available to be enabled for the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return ApiListRunnerRuntimesRequest + */ + ListRunnerRuntimes(ctx context.Context, projectId string) ApiListRunnerRuntimesRequest + /* + ListRunnerRuntimesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return RunnerRuntimeList + + */ + ListRunnerRuntimesExecute(ctx context.Context, projectId string) (*RunnerRuntimeList, error) + /* + PatchAuthentication Patch Authentication. + Patches the Authentication Provider. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return ApiPatchAuthenticationRequest + */ + PatchAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiPatchAuthenticationRequest + /* + PatchAuthenticationExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return Authentication + + */ + PatchAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) (*Authentication, error) + /* + PatchInstance Patch Instance. + Patches the Instance. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiPatchInstanceRequest + */ + PatchInstance(ctx context.Context, projectId string, instanceId string) ApiPatchInstanceRequest + /* + PatchInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return Instance + + */ + PatchInstanceExecute(ctx context.Context, projectId string, instanceId string) (*Instance, error) +} + +type ApiCreateAuthenticationRequest interface { + // Authentication Definition configuration data. + CreateAuthenticationPayload(createAuthenticationPayload CreateAuthenticationPayload) ApiCreateAuthenticationRequest + Execute() (*Authentication, error) +} + +type ApiCreateInstanceRequest interface { + // Instance configuration options. + CreateInstancePayload(createInstancePayload CreateInstancePayload) ApiCreateInstanceRequest + Execute() (*Instance, error) +} + +type ApiCreateRunnerRequest interface { + // Runner configuration options. + CreateRunnerPayload(createRunnerPayload CreateRunnerPayload) ApiCreateRunnerRequest + Execute() (*Runner, error) +} + +type ApiDeleteAuthenticationRequest interface { + Execute() error +} + +type ApiDeleteInstanceRequest interface { + Execute() error +} + +type ApiDeleteRunnerRequest interface { + Execute() error +} + +type ApiGetAuthenticationRequest interface { + Execute() (*Authentication, error) +} + +type ApiGetInstanceRequest interface { + Execute() (*Instance, error) +} + +type ApiGetInstancesRequest interface { + Execute() (*InstanceList, error) +} + +type ApiGetRunnerRequest interface { + Execute() (*Runner, error) +} + +type ApiListAuthenticationRequest interface { + Execute() (*AuthenticationList, error) +} + +type ApiListFlavorsRequest interface { + Execute() (*FlavorsList, error) +} + +type ApiListRunnerRuntimesRequest interface { + Execute() (*RunnerRuntimeList, error) +} + +type ApiPatchAuthenticationRequest interface { + // Authentication Definition configuration data. + PatchAuthenticationPayload(patchAuthenticationPayload PatchAuthenticationPayload) ApiPatchAuthenticationRequest + Execute() (*Authentication, error) +} + +type ApiPatchInstanceRequest interface { + PatchInstancePayload(patchInstancePayload PatchInstancePayload) ApiPatchInstanceRequest + Execute() (*Instance, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + createAuthenticationPayload *CreateAuthenticationPayload +} + +// Authentication Definition configuration data. + +func (r CreateAuthenticationRequest) CreateAuthenticationPayload(createAuthenticationPayload CreateAuthenticationPayload) ApiCreateAuthenticationRequest { + r.createAuthenticationPayload = &createAuthenticationPayload + return r +} + +func (r CreateAuthenticationRequest) Execute() (*Authentication, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Authentication + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateAuthentication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + if r.createAuthenticationPayload == nil { + return localVarReturnValue, fmt.Errorf("createAuthenticationPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createAuthenticationPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateAuthentication: Creates an authentication source + +# Creates an authentication source for the corresponding STACKIT Git instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiCreateAuthenticationRequest +*/ +func (a *APIClient) CreateAuthentication(ctx context.Context, projectId string, instanceId string) ApiCreateAuthenticationRequest { + return CreateAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) CreateAuthenticationExecute(ctx context.Context, projectId string, instanceId string) (*Authentication, error) { + r := CreateAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type CreateInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createInstancePayload *CreateInstancePayload +} + +// Instance configuration options. + +func (r CreateInstanceRequest) CreateInstancePayload(createInstancePayload CreateInstancePayload) ApiCreateInstanceRequest { + r.createInstancePayload = &createInstancePayload + return r +} + +func (r CreateInstanceRequest) Execute() (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createInstancePayload == nil { + return localVarReturnValue, fmt.Errorf("createInstancePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createInstancePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateInstance: Create an Instance. + +Creates a new STACKIT Git instance as a project resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return ApiCreateInstanceRequest +*/ +func (a *APIClient) CreateInstance(ctx context.Context, projectId string) ApiCreateInstanceRequest { + return CreateInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreateInstanceExecute(ctx context.Context, projectId string) (*Instance, error) { + r := CreateInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type CreateRunnerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + createRunnerPayload *CreateRunnerPayload +} + +// Runner configuration options. + +func (r CreateRunnerRequest) CreateRunnerPayload(createRunnerPayload CreateRunnerPayload) ApiCreateRunnerRequest { + r.createRunnerPayload = &createRunnerPayload + return r +} + +func (r CreateRunnerRequest) Execute() (*Runner, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Runner + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateRunner") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + if r.createRunnerPayload == nil { + return localVarReturnValue, fmt.Errorf("createRunnerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createRunnerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateRunner: Create the runner associated to this instance. + +Creates the runner associated to this STACKIT Git instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiCreateRunnerRequest +*/ +func (a *APIClient) CreateRunner(ctx context.Context, projectId string, instanceId string) ApiCreateRunnerRequest { + return CreateRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) CreateRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) { + r := CreateRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type DeleteAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + authenticationId string +} + +func (r DeleteAuthenticationRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAuthentication") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(r.authenticationId, "authenticationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return fmt.Errorf("instanceId must have less than 36 elements") + } + if strlen(r.authenticationId) < 36 { + return fmt.Errorf("authenticationId must have at least 36 elements") + } + if strlen(r.authenticationId) > 36 { + return fmt.Errorf("authenticationId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteAuthentication: Delete Authentication Source + +Deletes the authentication source associated to this STACKIT Git instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return ApiDeleteAuthenticationRequest +*/ +func (a *APIClient) DeleteAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiDeleteAuthenticationRequest { + return DeleteAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } +} + +func (a *APIClient) DeleteAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) error { + r := DeleteAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } + return r.Execute() +} + +type DeleteInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +func (r DeleteInstanceRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteInstance") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return fmt.Errorf("instanceId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteInstance: Delete Instance. + +Deletes a STACKIT Git instance and destroys all associated data. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiDeleteInstanceRequest +*/ +func (a *APIClient) DeleteInstance(ctx context.Context, projectId string, instanceId string) ApiDeleteInstanceRequest { + return DeleteInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteInstanceExecute(ctx context.Context, projectId string, instanceId string) error { + r := DeleteInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type DeleteRunnerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +func (r DeleteRunnerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteRunner") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return fmt.Errorf("instanceId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteRunner: Delete Runner. + +Deletes the runner associated to this STACKIT Git instance and destroys all associated data. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiDeleteRunnerRequest +*/ +func (a *APIClient) DeleteRunner(ctx context.Context, projectId string, instanceId string) ApiDeleteRunnerRequest { + return DeleteRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteRunnerExecute(ctx context.Context, projectId string, instanceId string) error { + r := DeleteRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type GetAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + authenticationId string +} + +func (r GetAuthenticationRequest) Execute() (*Authentication, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Authentication + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAuthentication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(r.authenticationId, "authenticationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + if strlen(r.authenticationId) < 36 { + return localVarReturnValue, fmt.Errorf("authenticationId must have at least 36 elements") + } + if strlen(r.authenticationId) > 36 { + return localVarReturnValue, fmt.Errorf("authenticationId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetAuthentication: Get authentication provider + +# Get authentication provider + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return ApiGetAuthenticationRequest +*/ +func (a *APIClient) GetAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiGetAuthenticationRequest { + return GetAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } +} + +func (a *APIClient) GetAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) (*Authentication, error) { + r := GetAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } + return r.Execute() +} + +type GetInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +func (r GetInstanceRequest) Execute() (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetInstance: Get Instance information. + +Retrieves information about a STACKIT Git instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiGetInstanceRequest +*/ +func (a *APIClient) GetInstance(ctx context.Context, projectId string, instanceId string) ApiGetInstanceRequest { + return GetInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) GetInstanceExecute(ctx context.Context, projectId string, instanceId string) (*Instance, error) { + r := GetInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type GetInstancesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r GetInstancesRequest) Execute() (*InstanceList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InstanceList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetInstances") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetInstances: List Instances. + +Lists all STACKIT Git instances within a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return ApiGetInstancesRequest +*/ +func (a *APIClient) GetInstances(ctx context.Context, projectId string) ApiGetInstancesRequest { + return GetInstancesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) GetInstancesExecute(ctx context.Context, projectId string) (*InstanceList, error) { + r := GetInstancesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type GetRunnerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +func (r GetRunnerRequest) Execute() (*Runner, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Runner + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRunner") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetRunner: Get Runner information. + +Retrieves information about a runner in a STACKIT Git instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiGetRunnerRequest +*/ +func (a *APIClient) GetRunner(ctx context.Context, projectId string, instanceId string) ApiGetRunnerRequest { + return GetRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) GetRunnerExecute(ctx context.Context, projectId string, instanceId string) (*Runner, error) { + r := GetRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type ListAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string +} + +func (r ListAuthenticationRequest) Execute() (*AuthenticationList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AuthenticationList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAuthentication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListAuthentication: List authentication sources + +# Lists all authentication sources belonging to a specific instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiListAuthenticationRequest +*/ +func (a *APIClient) ListAuthentication(ctx context.Context, projectId string, instanceId string) ApiListAuthenticationRequest { + return ListAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) ListAuthenticationExecute(ctx context.Context, projectId string, instanceId string) (*AuthenticationList, error) { + r := ListAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} + +type ListFlavorsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r ListFlavorsRequest) Execute() (*FlavorsList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FlavorsList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListFlavors") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/flavors" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListFlavors: Returns the details for the given STACKIT Git flavors. + +Provides detailed information about possible Git Flavors. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return ApiListFlavorsRequest +*/ +func (a *APIClient) ListFlavors(ctx context.Context, projectId string) ApiListFlavorsRequest { + return ListFlavorsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListFlavorsExecute(ctx context.Context, projectId string) (*FlavorsList, error) { + r := ListFlavorsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ListRunnerRuntimesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r ListRunnerRuntimesRequest) Execute() (*RunnerRuntimeList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RunnerRuntimeList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListRunnerRuntimes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/runner-runtimes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListRunnerRuntimes: Method for ListRunnerRuntimes + +A list of runner runtimes that are available to be enabled for the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @return ApiListRunnerRuntimesRequest +*/ +func (a *APIClient) ListRunnerRuntimes(ctx context.Context, projectId string) ApiListRunnerRuntimesRequest { + return ListRunnerRuntimesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListRunnerRuntimesExecute(ctx context.Context, projectId string) (*RunnerRuntimeList, error) { + r := ListRunnerRuntimesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type PatchAuthenticationRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + authenticationId string + patchAuthenticationPayload *PatchAuthenticationPayload +} + +// Authentication Definition configuration data. + +func (r PatchAuthenticationRequest) PatchAuthenticationPayload(patchAuthenticationPayload PatchAuthenticationPayload) ApiPatchAuthenticationRequest { + r.patchAuthenticationPayload = &patchAuthenticationPayload + return r +} + +func (r PatchAuthenticationRequest) Execute() (*Authentication, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Authentication + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PatchAuthentication") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(r.authenticationId, "authenticationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + if strlen(r.authenticationId) < 36 { + return localVarReturnValue, fmt.Errorf("authenticationId must have at least 36 elements") + } + if strlen(r.authenticationId) > 36 { + return localVarReturnValue, fmt.Errorf("authenticationId must have less than 36 elements") + } + if r.patchAuthenticationPayload == nil { + return localVarReturnValue, fmt.Errorf("patchAuthenticationPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.patchAuthenticationPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +PatchAuthentication: Patch Authentication. + +Patches the Authentication Provider. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @param authenticationId Authentication Source identifier. + @return ApiPatchAuthenticationRequest +*/ +func (a *APIClient) PatchAuthentication(ctx context.Context, projectId string, instanceId string, authenticationId string) ApiPatchAuthenticationRequest { + return PatchAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } +} + +func (a *APIClient) PatchAuthenticationExecute(ctx context.Context, projectId string, instanceId string, authenticationId string) (*Authentication, error) { + r := PatchAuthenticationRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + authenticationId: authenticationId, + } + return r.Execute() +} + +type PatchInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + instanceId string + patchInstancePayload *PatchInstancePayload +} + +func (r PatchInstanceRequest) PatchInstancePayload(patchInstancePayload PatchInstancePayload) ApiPatchInstanceRequest { + r.patchInstancePayload = &patchInstancePayload + return r +} + +func (r PatchInstanceRequest) Execute() (*Instance, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Instance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PatchInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.instanceId) < 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have at least 36 elements") + } + if strlen(r.instanceId) > 36 { + return localVarReturnValue, fmt.Errorf("instanceId must have less than 36 elements") + } + if r.patchInstancePayload == nil { + return localVarReturnValue, fmt.Errorf("patchInstancePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json", "application/json-patch+json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.patchInstancePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +PatchInstance: Patch Instance. + +Patches the Instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Project identifier. + @param instanceId Instance identifier. + @return ApiPatchInstanceRequest +*/ +func (a *APIClient) PatchInstance(ctx context.Context, projectId string, instanceId string) ApiPatchInstanceRequest { + return PatchInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } +} + +func (a *APIClient) PatchInstanceExecute(ctx context.Context, projectId string, instanceId string) (*Instance, error) { + r := PatchInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + instanceId: instanceId, + } + return r.Execute() +} diff --git a/pkg/gitbeta/api_default_test.go b/pkg/gitbeta/api_default_test.go new file mode 100644 index 00000000..9d6c106e --- /dev/null +++ b/pkg/gitbeta/api_default_test.go @@ -0,0 +1,835 @@ +/* +STACKIT Git API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package gitbeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_gitbeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateAuthentication", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Authentication{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + createAuthenticationPayload := CreateAuthenticationPayload{} + + resp, reqErr := apiClient.CreateAuthentication(context.Background(), projectId, instanceId).CreateAuthenticationPayload(createAuthenticationPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Instance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + createInstancePayload := CreateInstancePayload{} + + resp, reqErr := apiClient.CreateInstance(context.Background(), projectId).CreateInstancePayload(createInstancePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateRunner", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Runner{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + createRunnerPayload := CreateRunnerPayload{} + + resp, reqErr := apiClient.CreateRunner(context.Background(), projectId, instanceId).CreateRunnerPayload(createRunnerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAuthentication", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + authenticationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(authenticationIdValue, "authenticationId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + authenticationId := authenticationIdValue + + reqErr := apiClient.DeleteAuthentication(context.Background(), projectId, instanceId, authenticationId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + + reqErr := apiClient.DeleteInstance(context.Background(), projectId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteRunner", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + + reqErr := apiClient.DeleteRunner(context.Background(), projectId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetAuthentication", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + authenticationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(authenticationIdValue, "authenticationId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Authentication{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + authenticationId := authenticationIdValue + + resp, reqErr := apiClient.GetAuthentication(context.Background(), projectId, instanceId, authenticationId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Instance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.GetInstance(context.Background(), projectId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetInstances", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := InstanceList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + + resp, reqErr := apiClient.GetInstances(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetRunner", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/runner" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Runner{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.GetRunner(context.Background(), projectId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListAuthentication", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AuthenticationList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.ListAuthentication(context.Background(), projectId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListFlavors", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/flavors" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := FlavorsList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + + resp, reqErr := apiClient.ListFlavors(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListRunnerRuntimes", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/runner-runtimes" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RunnerRuntimeList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + + resp, reqErr := apiClient.ListRunnerRuntimes(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService PatchAuthentication", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + authenticationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"authenticationId"+"}", url.PathEscape(ParameterValueToString(authenticationIdValue, "authenticationId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Authentication{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + authenticationId := authenticationIdValue + patchAuthenticationPayload := PatchAuthenticationPayload{} + + resp, reqErr := apiClient.PatchAuthentication(context.Background(), projectId, instanceId, authenticationId).PatchAuthenticationPayload(patchAuthenticationPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService PatchInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/instances/{instanceId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + instanceIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Instance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for gitbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + instanceId := instanceIdValue + patchInstancePayload := PatchInstancePayload{} + + resp, reqErr := apiClient.PatchInstance(context.Background(), projectId, instanceId).PatchInstancePayload(patchInstancePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/gitbeta/client.go b/pkg/gitbeta/client.go new file mode 100644 index 00000000..fa9de508 --- /dev/null +++ b/pkg/gitbeta/client.go @@ -0,0 +1,628 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Git API API v1beta.0.4 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/gitbeta/configuration.go b/pkg/gitbeta/configuration.go new file mode 100644 index 00000000..0840c820 --- /dev/null +++ b/pkg/gitbeta/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/gitbeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://git.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/gitbeta/model_authentication.go b/pkg/gitbeta/model_authentication.go new file mode 100644 index 00000000..e3301e49 --- /dev/null +++ b/pkg/gitbeta/model_authentication.go @@ -0,0 +1,486 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Authentication type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Authentication{} + +/* + types and functions for auto_discover_url +*/ + +// isNotNullableString +type AuthenticationGetAutoDiscoverUrlAttributeType = *string + +func getAuthenticationGetAutoDiscoverUrlAttributeTypeOk(arg AuthenticationGetAutoDiscoverUrlAttributeType) (ret AuthenticationGetAutoDiscoverUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetAutoDiscoverUrlAttributeType(arg *AuthenticationGetAutoDiscoverUrlAttributeType, val AuthenticationGetAutoDiscoverUrlRetType) { + *arg = &val +} + +type AuthenticationGetAutoDiscoverUrlArgType = string +type AuthenticationGetAutoDiscoverUrlRetType = string + +/* + types and functions for client_id +*/ + +// isNotNullableString +type AuthenticationGetClientIdAttributeType = *string + +func getAuthenticationGetClientIdAttributeTypeOk(arg AuthenticationGetClientIdAttributeType) (ret AuthenticationGetClientIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetClientIdAttributeType(arg *AuthenticationGetClientIdAttributeType, val AuthenticationGetClientIdRetType) { + *arg = &val +} + +type AuthenticationGetClientIdArgType = string +type AuthenticationGetClientIdRetType = string + +/* + types and functions for created_at +*/ + +// isDateTime +type AuthenticationGetCreatedAtAttributeType = *time.Time +type AuthenticationGetCreatedAtArgType = time.Time +type AuthenticationGetCreatedAtRetType = time.Time + +func getAuthenticationGetCreatedAtAttributeTypeOk(arg AuthenticationGetCreatedAtAttributeType) (ret AuthenticationGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetCreatedAtAttributeType(arg *AuthenticationGetCreatedAtAttributeType, val AuthenticationGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for icon_url +*/ + +// isNotNullableString +type AuthenticationGetIconUrlAttributeType = *string + +func getAuthenticationGetIconUrlAttributeTypeOk(arg AuthenticationGetIconUrlAttributeType) (ret AuthenticationGetIconUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetIconUrlAttributeType(arg *AuthenticationGetIconUrlAttributeType, val AuthenticationGetIconUrlRetType) { + *arg = &val +} + +type AuthenticationGetIconUrlArgType = string +type AuthenticationGetIconUrlRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type AuthenticationGetIdAttributeType = *string + +func getAuthenticationGetIdAttributeTypeOk(arg AuthenticationGetIdAttributeType) (ret AuthenticationGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetIdAttributeType(arg *AuthenticationGetIdAttributeType, val AuthenticationGetIdRetType) { + *arg = &val +} + +type AuthenticationGetIdArgType = string +type AuthenticationGetIdRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type AuthenticationGetNameAttributeType = *string + +func getAuthenticationGetNameAttributeTypeOk(arg AuthenticationGetNameAttributeType) (ret AuthenticationGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetNameAttributeType(arg *AuthenticationGetNameAttributeType, val AuthenticationGetNameRetType) { + *arg = &val +} + +type AuthenticationGetNameArgType = string +type AuthenticationGetNameRetType = string + +/* + types and functions for provider +*/ + +// isNotNullableString +type AuthenticationGetProviderAttributeType = *string + +func getAuthenticationGetProviderAttributeTypeOk(arg AuthenticationGetProviderAttributeType) (ret AuthenticationGetProviderRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetProviderAttributeType(arg *AuthenticationGetProviderAttributeType, val AuthenticationGetProviderRetType) { + *arg = &val +} + +type AuthenticationGetProviderArgType = string +type AuthenticationGetProviderRetType = string + +/* + types and functions for scopes +*/ + +// isNotNullableString +type AuthenticationGetScopesAttributeType = *string + +func getAuthenticationGetScopesAttributeTypeOk(arg AuthenticationGetScopesAttributeType) (ret AuthenticationGetScopesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetScopesAttributeType(arg *AuthenticationGetScopesAttributeType, val AuthenticationGetScopesRetType) { + *arg = &val +} + +type AuthenticationGetScopesArgType = string +type AuthenticationGetScopesRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type AuthenticationGetStatusAttributeType = *string + +func getAuthenticationGetStatusAttributeTypeOk(arg AuthenticationGetStatusAttributeType) (ret AuthenticationGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationGetStatusAttributeType(arg *AuthenticationGetStatusAttributeType, val AuthenticationGetStatusRetType) { + *arg = &val +} + +type AuthenticationGetStatusArgType = string +type AuthenticationGetStatusRetType = string + +// Authentication Describes an authentication definition associated to a STACKIT Git instance. The provider type will be an openidConnect type. +type Authentication struct { + // The well-known configuration url to use for this authentication definition. + // REQUIRED + AutoDiscoverUrl AuthenticationGetAutoDiscoverUrlAttributeType `json:"auto_discover_url" required:"true"` + // The IDP client id to use. + // REQUIRED + ClientId AuthenticationGetClientIdAttributeType `json:"client_id" required:"true"` + // REQUIRED + CreatedAt AuthenticationGetCreatedAtAttributeType `json:"created_at" required:"true"` + // The url of the icon to use for this authentication definition. + // REQUIRED + IconUrl AuthenticationGetIconUrlAttributeType `json:"icon_url" required:"true"` + // An auto generated unique uuid which identifies the authentication definition in STACKIT Git instances. + // REQUIRED + Id AuthenticationGetIdAttributeType `json:"id" required:"true"` + // The name to identify an authentication definition associated with a STACKIT Git instance. + // REQUIRED + Name AuthenticationGetNameAttributeType `json:"name" required:"true"` + // The Oauth2 provider to use. + // REQUIRED + Provider AuthenticationGetProviderAttributeType `json:"provider" required:"true"` + // Scopes defines the OIDC scopes to request. + // REQUIRED + Scopes AuthenticationGetScopesAttributeType `json:"scopes" required:"true"` + // The current status of the authentication definition. + // REQUIRED + Status AuthenticationGetStatusAttributeType `json:"status" required:"true"` +} + +type _Authentication Authentication + +// NewAuthentication instantiates a new Authentication 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 NewAuthentication(autoDiscoverUrl AuthenticationGetAutoDiscoverUrlArgType, clientId AuthenticationGetClientIdArgType, createdAt AuthenticationGetCreatedAtArgType, iconUrl AuthenticationGetIconUrlArgType, id AuthenticationGetIdArgType, name AuthenticationGetNameArgType, provider AuthenticationGetProviderArgType, scopes AuthenticationGetScopesArgType, status AuthenticationGetStatusArgType) *Authentication { + this := Authentication{} + setAuthenticationGetAutoDiscoverUrlAttributeType(&this.AutoDiscoverUrl, autoDiscoverUrl) + setAuthenticationGetClientIdAttributeType(&this.ClientId, clientId) + setAuthenticationGetCreatedAtAttributeType(&this.CreatedAt, createdAt) + setAuthenticationGetIconUrlAttributeType(&this.IconUrl, iconUrl) + setAuthenticationGetIdAttributeType(&this.Id, id) + setAuthenticationGetNameAttributeType(&this.Name, name) + setAuthenticationGetProviderAttributeType(&this.Provider, provider) + setAuthenticationGetScopesAttributeType(&this.Scopes, scopes) + setAuthenticationGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewAuthenticationWithDefaults instantiates a new Authentication 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 NewAuthenticationWithDefaults() *Authentication { + this := Authentication{} + return &this +} + +// GetAutoDiscoverUrl returns the AutoDiscoverUrl field value +func (o *Authentication) GetAutoDiscoverUrl() (ret AuthenticationGetAutoDiscoverUrlRetType) { + ret, _ = o.GetAutoDiscoverUrlOk() + return ret +} + +// GetAutoDiscoverUrlOk returns a tuple with the AutoDiscoverUrl field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetAutoDiscoverUrlOk() (ret AuthenticationGetAutoDiscoverUrlRetType, ok bool) { + return getAuthenticationGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl) +} + +// SetAutoDiscoverUrl sets field value +func (o *Authentication) SetAutoDiscoverUrl(v AuthenticationGetAutoDiscoverUrlRetType) { + setAuthenticationGetAutoDiscoverUrlAttributeType(&o.AutoDiscoverUrl, v) +} + +// GetClientId returns the ClientId field value +func (o *Authentication) GetClientId() (ret AuthenticationGetClientIdRetType) { + ret, _ = o.GetClientIdOk() + return ret +} + +// GetClientIdOk returns a tuple with the ClientId field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetClientIdOk() (ret AuthenticationGetClientIdRetType, ok bool) { + return getAuthenticationGetClientIdAttributeTypeOk(o.ClientId) +} + +// SetClientId sets field value +func (o *Authentication) SetClientId(v AuthenticationGetClientIdRetType) { + setAuthenticationGetClientIdAttributeType(&o.ClientId, v) +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Authentication) GetCreatedAt() (ret AuthenticationGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() + return ret +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetCreatedAtOk() (ret AuthenticationGetCreatedAtRetType, ok bool) { + return getAuthenticationGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// SetCreatedAt sets field value +func (o *Authentication) SetCreatedAt(v AuthenticationGetCreatedAtRetType) { + setAuthenticationGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetIconUrl returns the IconUrl field value +func (o *Authentication) GetIconUrl() (ret AuthenticationGetIconUrlRetType) { + ret, _ = o.GetIconUrlOk() + return ret +} + +// GetIconUrlOk returns a tuple with the IconUrl field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetIconUrlOk() (ret AuthenticationGetIconUrlRetType, ok bool) { + return getAuthenticationGetIconUrlAttributeTypeOk(o.IconUrl) +} + +// SetIconUrl sets field value +func (o *Authentication) SetIconUrl(v AuthenticationGetIconUrlRetType) { + setAuthenticationGetIconUrlAttributeType(&o.IconUrl, v) +} + +// GetId returns the Id field value +func (o *Authentication) GetId() (ret AuthenticationGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetIdOk() (ret AuthenticationGetIdRetType, ok bool) { + return getAuthenticationGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Authentication) SetId(v AuthenticationGetIdRetType) { + setAuthenticationGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value +func (o *Authentication) GetName() (ret AuthenticationGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetNameOk() (ret AuthenticationGetNameRetType, ok bool) { + return getAuthenticationGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Authentication) SetName(v AuthenticationGetNameRetType) { + setAuthenticationGetNameAttributeType(&o.Name, v) +} + +// GetProvider returns the Provider field value +func (o *Authentication) GetProvider() (ret AuthenticationGetProviderRetType) { + ret, _ = o.GetProviderOk() + return ret +} + +// GetProviderOk returns a tuple with the Provider field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetProviderOk() (ret AuthenticationGetProviderRetType, ok bool) { + return getAuthenticationGetProviderAttributeTypeOk(o.Provider) +} + +// SetProvider sets field value +func (o *Authentication) SetProvider(v AuthenticationGetProviderRetType) { + setAuthenticationGetProviderAttributeType(&o.Provider, v) +} + +// GetScopes returns the Scopes field value +func (o *Authentication) GetScopes() (ret AuthenticationGetScopesRetType) { + ret, _ = o.GetScopesOk() + return ret +} + +// GetScopesOk returns a tuple with the Scopes field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetScopesOk() (ret AuthenticationGetScopesRetType, ok bool) { + return getAuthenticationGetScopesAttributeTypeOk(o.Scopes) +} + +// SetScopes sets field value +func (o *Authentication) SetScopes(v AuthenticationGetScopesRetType) { + setAuthenticationGetScopesAttributeType(&o.Scopes, v) +} + +// GetStatus returns the Status field value +func (o *Authentication) GetStatus() (ret AuthenticationGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Authentication) GetStatusOk() (ret AuthenticationGetStatusRetType, ok bool) { + return getAuthenticationGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Authentication) SetStatus(v AuthenticationGetStatusRetType) { + setAuthenticationGetStatusAttributeType(&o.Status, v) +} + +func (o Authentication) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAuthenticationGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl); ok { + toSerialize["AutoDiscoverUrl"] = val + } + if val, ok := getAuthenticationGetClientIdAttributeTypeOk(o.ClientId); ok { + toSerialize["ClientId"] = val + } + if val, ok := getAuthenticationGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getAuthenticationGetIconUrlAttributeTypeOk(o.IconUrl); ok { + toSerialize["IconUrl"] = val + } + if val, ok := getAuthenticationGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getAuthenticationGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getAuthenticationGetProviderAttributeTypeOk(o.Provider); ok { + toSerialize["Provider"] = val + } + if val, ok := getAuthenticationGetScopesAttributeTypeOk(o.Scopes); ok { + toSerialize["Scopes"] = val + } + if val, ok := getAuthenticationGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableAuthentication struct { + value *Authentication + isSet bool +} + +func (v NullableAuthentication) Get() *Authentication { + return v.value +} + +func (v *NullableAuthentication) Set(val *Authentication) { + v.value = val + v.isSet = true +} + +func (v NullableAuthentication) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthentication) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthentication(val *Authentication) *NullableAuthentication { + return &NullableAuthentication{value: val, isSet: true} +} + +func (v NullableAuthentication) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthentication) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_authentication_list.go b/pkg/gitbeta/model_authentication_list.go new file mode 100644 index 00000000..bdad1f6a --- /dev/null +++ b/pkg/gitbeta/model_authentication_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the AuthenticationList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuthenticationList{} + +/* + types and functions for authentication +*/ + +// isArray +type AuthenticationListGetAuthenticationAttributeType = *[]Authentication +type AuthenticationListGetAuthenticationArgType = []Authentication +type AuthenticationListGetAuthenticationRetType = []Authentication + +func getAuthenticationListGetAuthenticationAttributeTypeOk(arg AuthenticationListGetAuthenticationAttributeType) (ret AuthenticationListGetAuthenticationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuthenticationListGetAuthenticationAttributeType(arg *AuthenticationListGetAuthenticationAttributeType, val AuthenticationListGetAuthenticationRetType) { + *arg = &val +} + +// AuthenticationList A list of authentications belonging to an Instance. +type AuthenticationList struct { + // REQUIRED + Authentication AuthenticationListGetAuthenticationAttributeType `json:"authentication" required:"true"` +} + +type _AuthenticationList AuthenticationList + +// NewAuthenticationList instantiates a new AuthenticationList 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 NewAuthenticationList(authentication AuthenticationListGetAuthenticationArgType) *AuthenticationList { + this := AuthenticationList{} + setAuthenticationListGetAuthenticationAttributeType(&this.Authentication, authentication) + return &this +} + +// NewAuthenticationListWithDefaults instantiates a new AuthenticationList 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 NewAuthenticationListWithDefaults() *AuthenticationList { + this := AuthenticationList{} + return &this +} + +// GetAuthentication returns the Authentication field value +func (o *AuthenticationList) GetAuthentication() (ret AuthenticationListGetAuthenticationRetType) { + ret, _ = o.GetAuthenticationOk() + return ret +} + +// GetAuthenticationOk returns a tuple with the Authentication field value +// and a boolean to check if the value has been set. +func (o *AuthenticationList) GetAuthenticationOk() (ret AuthenticationListGetAuthenticationRetType, ok bool) { + return getAuthenticationListGetAuthenticationAttributeTypeOk(o.Authentication) +} + +// SetAuthentication sets field value +func (o *AuthenticationList) SetAuthentication(v AuthenticationListGetAuthenticationRetType) { + setAuthenticationListGetAuthenticationAttributeType(&o.Authentication, v) +} + +func (o AuthenticationList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAuthenticationListGetAuthenticationAttributeTypeOk(o.Authentication); ok { + toSerialize["Authentication"] = val + } + return toSerialize, nil +} + +type NullableAuthenticationList struct { + value *AuthenticationList + isSet bool +} + +func (v NullableAuthenticationList) Get() *AuthenticationList { + return v.value +} + +func (v *NullableAuthenticationList) Set(val *AuthenticationList) { + v.value = val + v.isSet = true +} + +func (v NullableAuthenticationList) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthenticationList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthenticationList(val *AuthenticationList) *NullableAuthenticationList { + return &NullableAuthenticationList{value: val, isSet: true} +} + +func (v NullableAuthenticationList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthenticationList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_authentication_list_test.go b/pkg/gitbeta/model_authentication_list_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_authentication_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_authentication_test.go b/pkg/gitbeta/model_authentication_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_authentication_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_create_authentication_payload.go b/pkg/gitbeta/model_create_authentication_payload.go new file mode 100644 index 00000000..89fd043f --- /dev/null +++ b/pkg/gitbeta/model_create_authentication_payload.go @@ -0,0 +1,413 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the CreateAuthenticationPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAuthenticationPayload{} + +/* + types and functions for auto_discover_url +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType = *string + +func getCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(arg CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType) (ret CreateAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType(arg *CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType, val CreateAuthenticationPayloadGetAutoDiscoverUrlRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetAutoDiscoverUrlArgType = string +type CreateAuthenticationPayloadGetAutoDiscoverUrlRetType = string + +/* + types and functions for client_id +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetClientIdAttributeType = *string + +func getCreateAuthenticationPayloadGetClientIdAttributeTypeOk(arg CreateAuthenticationPayloadGetClientIdAttributeType) (ret CreateAuthenticationPayloadGetClientIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetClientIdAttributeType(arg *CreateAuthenticationPayloadGetClientIdAttributeType, val CreateAuthenticationPayloadGetClientIdRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetClientIdArgType = string +type CreateAuthenticationPayloadGetClientIdRetType = string + +/* + types and functions for client_secret +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetClientSecretAttributeType = *string + +func getCreateAuthenticationPayloadGetClientSecretAttributeTypeOk(arg CreateAuthenticationPayloadGetClientSecretAttributeType) (ret CreateAuthenticationPayloadGetClientSecretRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetClientSecretAttributeType(arg *CreateAuthenticationPayloadGetClientSecretAttributeType, val CreateAuthenticationPayloadGetClientSecretRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetClientSecretArgType = string +type CreateAuthenticationPayloadGetClientSecretRetType = string + +/* + types and functions for icon_url +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetIconUrlAttributeType = *string + +func getCreateAuthenticationPayloadGetIconUrlAttributeTypeOk(arg CreateAuthenticationPayloadGetIconUrlAttributeType) (ret CreateAuthenticationPayloadGetIconUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetIconUrlAttributeType(arg *CreateAuthenticationPayloadGetIconUrlAttributeType, val CreateAuthenticationPayloadGetIconUrlRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetIconUrlArgType = string +type CreateAuthenticationPayloadGetIconUrlRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetNameAttributeType = *string + +func getCreateAuthenticationPayloadGetNameAttributeTypeOk(arg CreateAuthenticationPayloadGetNameAttributeType) (ret CreateAuthenticationPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetNameAttributeType(arg *CreateAuthenticationPayloadGetNameAttributeType, val CreateAuthenticationPayloadGetNameRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetNameArgType = string +type CreateAuthenticationPayloadGetNameRetType = string + +/* + types and functions for provider +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetProviderAttributeType = *string + +func getCreateAuthenticationPayloadGetProviderAttributeTypeOk(arg CreateAuthenticationPayloadGetProviderAttributeType) (ret CreateAuthenticationPayloadGetProviderRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetProviderAttributeType(arg *CreateAuthenticationPayloadGetProviderAttributeType, val CreateAuthenticationPayloadGetProviderRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetProviderArgType = string +type CreateAuthenticationPayloadGetProviderRetType = string + +/* + types and functions for scopes +*/ + +// isNotNullableString +type CreateAuthenticationPayloadGetScopesAttributeType = *string + +func getCreateAuthenticationPayloadGetScopesAttributeTypeOk(arg CreateAuthenticationPayloadGetScopesAttributeType) (ret CreateAuthenticationPayloadGetScopesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAuthenticationPayloadGetScopesAttributeType(arg *CreateAuthenticationPayloadGetScopesAttributeType, val CreateAuthenticationPayloadGetScopesRetType) { + *arg = &val +} + +type CreateAuthenticationPayloadGetScopesArgType = string +type CreateAuthenticationPayloadGetScopesRetType = string + +// CreateAuthenticationPayload Properties to patch on an authentication. All fields are optional. +type CreateAuthenticationPayload struct { + // The well-known configuration url to use for this authentication definition. + // REQUIRED + AutoDiscoverUrl CreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType `json:"auto_discover_url" required:"true"` + // The IDP client id to use. + // REQUIRED + ClientId CreateAuthenticationPayloadGetClientIdAttributeType `json:"client_id" required:"true"` + // The IDP client secret to use. + // REQUIRED + ClientSecret CreateAuthenticationPayloadGetClientSecretAttributeType `json:"client_secret" required:"true"` + // The url of the icon to use for this authentication definition. + IconUrl CreateAuthenticationPayloadGetIconUrlAttributeType `json:"icon_url,omitempty"` + // The name to identify an authentication definition associated with a STACKIT Git instance. + // REQUIRED + Name CreateAuthenticationPayloadGetNameAttributeType `json:"name" required:"true"` + // The Oauth2 provider to use. + Provider CreateAuthenticationPayloadGetProviderAttributeType `json:"provider,omitempty"` + // Scopes defines the OIDC scopes to request. + Scopes CreateAuthenticationPayloadGetScopesAttributeType `json:"scopes,omitempty"` +} + +type _CreateAuthenticationPayload CreateAuthenticationPayload + +// NewCreateAuthenticationPayload instantiates a new CreateAuthenticationPayload 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 NewCreateAuthenticationPayload(autoDiscoverUrl CreateAuthenticationPayloadGetAutoDiscoverUrlArgType, clientId CreateAuthenticationPayloadGetClientIdArgType, clientSecret CreateAuthenticationPayloadGetClientSecretArgType, name CreateAuthenticationPayloadGetNameArgType) *CreateAuthenticationPayload { + this := CreateAuthenticationPayload{} + setCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType(&this.AutoDiscoverUrl, autoDiscoverUrl) + setCreateAuthenticationPayloadGetClientIdAttributeType(&this.ClientId, clientId) + setCreateAuthenticationPayloadGetClientSecretAttributeType(&this.ClientSecret, clientSecret) + setCreateAuthenticationPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateAuthenticationPayloadWithDefaults instantiates a new CreateAuthenticationPayload 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 NewCreateAuthenticationPayloadWithDefaults() *CreateAuthenticationPayload { + this := CreateAuthenticationPayload{} + var provider string = "openidConnect" + this.Provider = &provider + var scopes string = "openid profile email" + this.Scopes = &scopes + return &this +} + +// GetAutoDiscoverUrl returns the AutoDiscoverUrl field value +func (o *CreateAuthenticationPayload) GetAutoDiscoverUrl() (ret CreateAuthenticationPayloadGetAutoDiscoverUrlRetType) { + ret, _ = o.GetAutoDiscoverUrlOk() + return ret +} + +// GetAutoDiscoverUrlOk returns a tuple with the AutoDiscoverUrl field value +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetAutoDiscoverUrlOk() (ret CreateAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) { + return getCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl) +} + +// SetAutoDiscoverUrl sets field value +func (o *CreateAuthenticationPayload) SetAutoDiscoverUrl(v CreateAuthenticationPayloadGetAutoDiscoverUrlRetType) { + setCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeType(&o.AutoDiscoverUrl, v) +} + +// GetClientId returns the ClientId field value +func (o *CreateAuthenticationPayload) GetClientId() (ret CreateAuthenticationPayloadGetClientIdRetType) { + ret, _ = o.GetClientIdOk() + return ret +} + +// GetClientIdOk returns a tuple with the ClientId field value +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetClientIdOk() (ret CreateAuthenticationPayloadGetClientIdRetType, ok bool) { + return getCreateAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId) +} + +// SetClientId sets field value +func (o *CreateAuthenticationPayload) SetClientId(v CreateAuthenticationPayloadGetClientIdRetType) { + setCreateAuthenticationPayloadGetClientIdAttributeType(&o.ClientId, v) +} + +// GetClientSecret returns the ClientSecret field value +func (o *CreateAuthenticationPayload) GetClientSecret() (ret CreateAuthenticationPayloadGetClientSecretRetType) { + ret, _ = o.GetClientSecretOk() + return ret +} + +// GetClientSecretOk returns a tuple with the ClientSecret field value +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetClientSecretOk() (ret CreateAuthenticationPayloadGetClientSecretRetType, ok bool) { + return getCreateAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret) +} + +// SetClientSecret sets field value +func (o *CreateAuthenticationPayload) SetClientSecret(v CreateAuthenticationPayloadGetClientSecretRetType) { + setCreateAuthenticationPayloadGetClientSecretAttributeType(&o.ClientSecret, v) +} + +// GetIconUrl returns the IconUrl field value if set, zero value otherwise. +func (o *CreateAuthenticationPayload) GetIconUrl() (res CreateAuthenticationPayloadGetIconUrlRetType) { + res, _ = o.GetIconUrlOk() + return +} + +// GetIconUrlOk returns a tuple with the IconUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetIconUrlOk() (ret CreateAuthenticationPayloadGetIconUrlRetType, ok bool) { + return getCreateAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl) +} + +// HasIconUrl returns a boolean if a field has been set. +func (o *CreateAuthenticationPayload) HasIconUrl() bool { + _, ok := o.GetIconUrlOk() + return ok +} + +// SetIconUrl gets a reference to the given string and assigns it to the IconUrl field. +func (o *CreateAuthenticationPayload) SetIconUrl(v CreateAuthenticationPayloadGetIconUrlRetType) { + setCreateAuthenticationPayloadGetIconUrlAttributeType(&o.IconUrl, v) +} + +// GetName returns the Name field value +func (o *CreateAuthenticationPayload) GetName() (ret CreateAuthenticationPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetNameOk() (ret CreateAuthenticationPayloadGetNameRetType, ok bool) { + return getCreateAuthenticationPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateAuthenticationPayload) SetName(v CreateAuthenticationPayloadGetNameRetType) { + setCreateAuthenticationPayloadGetNameAttributeType(&o.Name, v) +} + +// GetProvider returns the Provider field value if set, zero value otherwise. +func (o *CreateAuthenticationPayload) GetProvider() (res CreateAuthenticationPayloadGetProviderRetType) { + res, _ = o.GetProviderOk() + return +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetProviderOk() (ret CreateAuthenticationPayloadGetProviderRetType, ok bool) { + return getCreateAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider) +} + +// HasProvider returns a boolean if a field has been set. +func (o *CreateAuthenticationPayload) HasProvider() bool { + _, ok := o.GetProviderOk() + return ok +} + +// SetProvider gets a reference to the given string and assigns it to the Provider field. +func (o *CreateAuthenticationPayload) SetProvider(v CreateAuthenticationPayloadGetProviderRetType) { + setCreateAuthenticationPayloadGetProviderAttributeType(&o.Provider, v) +} + +// GetScopes returns the Scopes field value if set, zero value otherwise. +func (o *CreateAuthenticationPayload) GetScopes() (res CreateAuthenticationPayloadGetScopesRetType) { + res, _ = o.GetScopesOk() + return +} + +// GetScopesOk returns a tuple with the Scopes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAuthenticationPayload) GetScopesOk() (ret CreateAuthenticationPayloadGetScopesRetType, ok bool) { + return getCreateAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes) +} + +// HasScopes returns a boolean if a field has been set. +func (o *CreateAuthenticationPayload) HasScopes() bool { + _, ok := o.GetScopesOk() + return ok +} + +// SetScopes gets a reference to the given string and assigns it to the Scopes field. +func (o *CreateAuthenticationPayload) SetScopes(v CreateAuthenticationPayloadGetScopesRetType) { + setCreateAuthenticationPayloadGetScopesAttributeType(&o.Scopes, v) +} + +func (o CreateAuthenticationPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl); ok { + toSerialize["AutoDiscoverUrl"] = val + } + if val, ok := getCreateAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId); ok { + toSerialize["ClientId"] = val + } + if val, ok := getCreateAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret); ok { + toSerialize["ClientSecret"] = val + } + if val, ok := getCreateAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl); ok { + toSerialize["IconUrl"] = val + } + if val, ok := getCreateAuthenticationPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider); ok { + toSerialize["Provider"] = val + } + if val, ok := getCreateAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes); ok { + toSerialize["Scopes"] = val + } + return toSerialize, nil +} + +type NullableCreateAuthenticationPayload struct { + value *CreateAuthenticationPayload + isSet bool +} + +func (v NullableCreateAuthenticationPayload) Get() *CreateAuthenticationPayload { + return v.value +} + +func (v *NullableCreateAuthenticationPayload) Set(val *CreateAuthenticationPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAuthenticationPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAuthenticationPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAuthenticationPayload(val *CreateAuthenticationPayload) *NullableCreateAuthenticationPayload { + return &NullableCreateAuthenticationPayload{value: val, isSet: true} +} + +func (v NullableCreateAuthenticationPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAuthenticationPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_create_authentication_payload_test.go b/pkg/gitbeta/model_create_authentication_payload_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_create_authentication_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_create_instance_payload.go b/pkg/gitbeta/model_create_instance_payload.go new file mode 100644 index 00000000..ecede7d3 --- /dev/null +++ b/pkg/gitbeta/model_create_instance_payload.go @@ -0,0 +1,327 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateInstancePayload{} + +/* + types and functions for acl +*/ + +// isArray +type CreateInstancePayloadGetAclAttributeType = *[]string +type CreateInstancePayloadGetAclArgType = []string +type CreateInstancePayloadGetAclRetType = []string + +func getCreateInstancePayloadGetAclAttributeTypeOk(arg CreateInstancePayloadGetAclAttributeType) (ret CreateInstancePayloadGetAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateInstancePayloadGetAclAttributeType(arg *CreateInstancePayloadGetAclAttributeType, val CreateInstancePayloadGetAclRetType) { + *arg = &val +} + +/* + types and functions for flavor +*/ + +// isEnum + +// CreateInstancePayloadFlavor the model 'CreateInstancePayload' +// value type for enums +type CreateInstancePayloadFlavor string + +// List of Flavor +const ( + CREATEINSTANCEPAYLOADFLAVOR__10 CreateInstancePayloadFlavor = "git-10" + CREATEINSTANCEPAYLOADFLAVOR__100 CreateInstancePayloadFlavor = "git-100" +) + +// All allowed values of CreateInstancePayload enum +var AllowedCreateInstancePayloadFlavorEnumValues = []CreateInstancePayloadFlavor{ + "git-10", + "git-100", +} + +func (v *CreateInstancePayloadFlavor) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson CreateInstancePayloadFlavor + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := CreateInstancePayloadFlavor(value) + for _, existing := range AllowedCreateInstancePayloadFlavorEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CreateInstancePayload", value) +} + +// NewCreateInstancePayloadFlavorFromValue returns a pointer to a valid CreateInstancePayloadFlavor +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCreateInstancePayloadFlavorFromValue(v CreateInstancePayloadFlavor) (*CreateInstancePayloadFlavor, error) { + ev := CreateInstancePayloadFlavor(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CreateInstancePayloadFlavor: valid values are %v", v, AllowedCreateInstancePayloadFlavorEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CreateInstancePayloadFlavor) IsValid() bool { + for _, existing := range AllowedCreateInstancePayloadFlavorEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to FlavorFlavor value +func (v CreateInstancePayloadFlavor) Ptr() *CreateInstancePayloadFlavor { + return &v +} + +type NullableCreateInstancePayloadFlavor struct { + value *CreateInstancePayloadFlavor + isSet bool +} + +func (v NullableCreateInstancePayloadFlavor) Get() *CreateInstancePayloadFlavor { + return v.value +} + +func (v *NullableCreateInstancePayloadFlavor) Set(val *CreateInstancePayloadFlavor) { + v.value = val + v.isSet = true +} + +func (v NullableCreateInstancePayloadFlavor) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateInstancePayloadFlavor) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateInstancePayloadFlavor(val *CreateInstancePayloadFlavor) *NullableCreateInstancePayloadFlavor { + return &NullableCreateInstancePayloadFlavor{value: val, isSet: true} +} + +func (v NullableCreateInstancePayloadFlavor) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateInstancePayloadFlavor) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CreateInstancePayloadGetFlavorAttributeType = *CreateInstancePayloadFlavor +type CreateInstancePayloadGetFlavorArgType = CreateInstancePayloadFlavor +type CreateInstancePayloadGetFlavorRetType = CreateInstancePayloadFlavor + +func getCreateInstancePayloadGetFlavorAttributeTypeOk(arg CreateInstancePayloadGetFlavorAttributeType) (ret CreateInstancePayloadGetFlavorRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateInstancePayloadGetFlavorAttributeType(arg *CreateInstancePayloadGetFlavorAttributeType, val CreateInstancePayloadGetFlavorRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateInstancePayloadGetNameAttributeType = *string + +func getCreateInstancePayloadGetNameAttributeTypeOk(arg CreateInstancePayloadGetNameAttributeType) (ret CreateInstancePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateInstancePayloadGetNameAttributeType(arg *CreateInstancePayloadGetNameAttributeType, val CreateInstancePayloadGetNameRetType) { + *arg = &val +} + +type CreateInstancePayloadGetNameArgType = string +type CreateInstancePayloadGetNameRetType = string + +// CreateInstancePayload Request a STACKIT Git instance to be created with these properties. +type CreateInstancePayload struct { + // A list of CIDR network addresses that are allowed to access the instance. + Acl CreateInstancePayloadGetAclAttributeType `json:"acl,omitempty"` + Flavor CreateInstancePayloadGetFlavorAttributeType `json:"flavor,omitempty"` + // A user chosen name to distinguish multiple STACKIT Git instances. + // REQUIRED + Name CreateInstancePayloadGetNameAttributeType `json:"name" required:"true"` +} + +type _CreateInstancePayload CreateInstancePayload + +// NewCreateInstancePayload instantiates a new CreateInstancePayload 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 NewCreateInstancePayload(name CreateInstancePayloadGetNameArgType) *CreateInstancePayload { + this := CreateInstancePayload{} + setCreateInstancePayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateInstancePayloadWithDefaults instantiates a new CreateInstancePayload 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 NewCreateInstancePayloadWithDefaults() *CreateInstancePayload { + this := CreateInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetAcl() (res CreateInstancePayloadGetAclRetType) { + res, _ = o.GetAclOk() + return +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetAclOk() (ret CreateInstancePayloadGetAclRetType, ok bool) { + return getCreateInstancePayloadGetAclAttributeTypeOk(o.Acl) +} + +// HasAcl returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasAcl() bool { + _, ok := o.GetAclOk() + return ok +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *CreateInstancePayload) SetAcl(v CreateInstancePayloadGetAclRetType) { + setCreateInstancePayloadGetAclAttributeType(&o.Acl, v) +} + +// GetFlavor returns the Flavor field value if set, zero value otherwise. +func (o *CreateInstancePayload) GetFlavor() (res CreateInstancePayloadGetFlavorRetType) { + res, _ = o.GetFlavorOk() + return +} + +// GetFlavorOk returns a tuple with the Flavor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetFlavorOk() (ret CreateInstancePayloadGetFlavorRetType, ok bool) { + return getCreateInstancePayloadGetFlavorAttributeTypeOk(o.Flavor) +} + +// HasFlavor returns a boolean if a field has been set. +func (o *CreateInstancePayload) HasFlavor() bool { + _, ok := o.GetFlavorOk() + return ok +} + +// SetFlavor gets a reference to the given string and assigns it to the Flavor field. +func (o *CreateInstancePayload) SetFlavor(v CreateInstancePayloadGetFlavorRetType) { + setCreateInstancePayloadGetFlavorAttributeType(&o.Flavor, v) +} + +// GetName returns the Name field value +func (o *CreateInstancePayload) GetName() (ret CreateInstancePayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateInstancePayload) GetNameOk() (ret CreateInstancePayloadGetNameRetType, ok bool) { + return getCreateInstancePayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateInstancePayload) SetName(v CreateInstancePayloadGetNameRetType) { + setCreateInstancePayloadGetNameAttributeType(&o.Name, v) +} + +func (o CreateInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateInstancePayloadGetAclAttributeTypeOk(o.Acl); ok { + toSerialize["Acl"] = val + } + if val, ok := getCreateInstancePayloadGetFlavorAttributeTypeOk(o.Flavor); ok { + toSerialize["Flavor"] = val + } + if val, ok := getCreateInstancePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableCreateInstancePayload struct { + value *CreateInstancePayload + isSet bool +} + +func (v NullableCreateInstancePayload) Get() *CreateInstancePayload { + return v.value +} + +func (v *NullableCreateInstancePayload) Set(val *CreateInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateInstancePayload(val *CreateInstancePayload) *NullableCreateInstancePayload { + return &NullableCreateInstancePayload{value: val, isSet: true} +} + +func (v NullableCreateInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_create_instance_payload_test.go b/pkg/gitbeta/model_create_instance_payload_test.go new file mode 100644 index 00000000..f9196c3b --- /dev/null +++ b/pkg/gitbeta/model_create_instance_payload_test.go @@ -0,0 +1,58 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "testing" +) + +// isEnum + +func TestCreateInstancePayloadFlavor_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"git-10"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"git-100"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := CreateInstancePayloadFlavor("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/gitbeta/model_create_runner_payload.go b/pkg/gitbeta/model_create_runner_payload.go new file mode 100644 index 00000000..34a547ff --- /dev/null +++ b/pkg/gitbeta/model_create_runner_payload.go @@ -0,0 +1,125 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the CreateRunnerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateRunnerPayload{} + +/* + types and functions for labels +*/ + +// isArray +type CreateRunnerPayloadGetLabelsAttributeType = *[]string +type CreateRunnerPayloadGetLabelsArgType = []string +type CreateRunnerPayloadGetLabelsRetType = []string + +func getCreateRunnerPayloadGetLabelsAttributeTypeOk(arg CreateRunnerPayloadGetLabelsAttributeType) (ret CreateRunnerPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateRunnerPayloadGetLabelsAttributeType(arg *CreateRunnerPayloadGetLabelsAttributeType, val CreateRunnerPayloadGetLabelsRetType) { + *arg = &val +} + +// CreateRunnerPayload Request a runner to be created supporting the requested list of runtime labels. +type CreateRunnerPayload struct { + // REQUIRED + Labels CreateRunnerPayloadGetLabelsAttributeType `json:"labels" required:"true"` +} + +type _CreateRunnerPayload CreateRunnerPayload + +// NewCreateRunnerPayload instantiates a new CreateRunnerPayload 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 NewCreateRunnerPayload(labels CreateRunnerPayloadGetLabelsArgType) *CreateRunnerPayload { + this := CreateRunnerPayload{} + setCreateRunnerPayloadGetLabelsAttributeType(&this.Labels, labels) + return &this +} + +// NewCreateRunnerPayloadWithDefaults instantiates a new CreateRunnerPayload 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 NewCreateRunnerPayloadWithDefaults() *CreateRunnerPayload { + this := CreateRunnerPayload{} + return &this +} + +// GetLabels returns the Labels field value +func (o *CreateRunnerPayload) GetLabels() (ret CreateRunnerPayloadGetLabelsRetType) { + ret, _ = o.GetLabelsOk() + return ret +} + +// GetLabelsOk returns a tuple with the Labels field value +// and a boolean to check if the value has been set. +func (o *CreateRunnerPayload) GetLabelsOk() (ret CreateRunnerPayloadGetLabelsRetType, ok bool) { + return getCreateRunnerPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// SetLabels sets field value +func (o *CreateRunnerPayload) SetLabels(v CreateRunnerPayloadGetLabelsRetType) { + setCreateRunnerPayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o CreateRunnerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateRunnerPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableCreateRunnerPayload struct { + value *CreateRunnerPayload + isSet bool +} + +func (v NullableCreateRunnerPayload) Get() *CreateRunnerPayload { + return v.value +} + +func (v *NullableCreateRunnerPayload) Set(val *CreateRunnerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateRunnerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateRunnerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateRunnerPayload(val *CreateRunnerPayload) *NullableCreateRunnerPayload { + return &NullableCreateRunnerPayload{value: val, isSet: true} +} + +func (v NullableCreateRunnerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateRunnerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_create_runner_payload_test.go b/pkg/gitbeta/model_create_runner_payload_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_create_runner_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_feature_toggle.go b/pkg/gitbeta/model_feature_toggle.go new file mode 100644 index 00000000..7b3ca5f7 --- /dev/null +++ b/pkg/gitbeta/model_feature_toggle.go @@ -0,0 +1,366 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the FeatureToggle type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FeatureToggle{} + +/* + types and functions for default_email_notifications +*/ + +// isEnum + +// FeatureToggleDefaultEmailNotifications Default email notifications. +// value type for enums +type FeatureToggleDefaultEmailNotifications string + +// List of DefaultEmailNotifications +const ( + FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ENABLED FeatureToggleDefaultEmailNotifications = "enabled" + FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_DISABLED FeatureToggleDefaultEmailNotifications = "disabled" + FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ONMENTION FeatureToggleDefaultEmailNotifications = "onmention" + FEATURETOGGLEDEFAULT_EMAIL_NOTIFICATIONS_ANDYOUROWN FeatureToggleDefaultEmailNotifications = "andyourown" +) + +// All allowed values of FeatureToggle enum +var AllowedFeatureToggleDefaultEmailNotificationsEnumValues = []FeatureToggleDefaultEmailNotifications{ + "enabled", + "disabled", + "onmention", + "andyourown", +} + +func (v *FeatureToggleDefaultEmailNotifications) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson FeatureToggleDefaultEmailNotifications + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := FeatureToggleDefaultEmailNotifications(value) + for _, existing := range AllowedFeatureToggleDefaultEmailNotificationsEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid FeatureToggle", value) +} + +// NewFeatureToggleDefaultEmailNotificationsFromValue returns a pointer to a valid FeatureToggleDefaultEmailNotifications +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFeatureToggleDefaultEmailNotificationsFromValue(v FeatureToggleDefaultEmailNotifications) (*FeatureToggleDefaultEmailNotifications, error) { + ev := FeatureToggleDefaultEmailNotifications(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FeatureToggleDefaultEmailNotifications: valid values are %v", v, AllowedFeatureToggleDefaultEmailNotificationsEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FeatureToggleDefaultEmailNotifications) IsValid() bool { + for _, existing := range AllowedFeatureToggleDefaultEmailNotificationsEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DefaultEmailNotificationsDefaultEmailNotifications value +func (v FeatureToggleDefaultEmailNotifications) Ptr() *FeatureToggleDefaultEmailNotifications { + return &v +} + +type NullableFeatureToggleDefaultEmailNotifications struct { + value *FeatureToggleDefaultEmailNotifications + isSet bool +} + +func (v NullableFeatureToggleDefaultEmailNotifications) Get() *FeatureToggleDefaultEmailNotifications { + return v.value +} + +func (v *NullableFeatureToggleDefaultEmailNotifications) Set(val *FeatureToggleDefaultEmailNotifications) { + v.value = val + v.isSet = true +} + +func (v NullableFeatureToggleDefaultEmailNotifications) IsSet() bool { + return v.isSet +} + +func (v *NullableFeatureToggleDefaultEmailNotifications) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFeatureToggleDefaultEmailNotifications(val *FeatureToggleDefaultEmailNotifications) *NullableFeatureToggleDefaultEmailNotifications { + return &NullableFeatureToggleDefaultEmailNotifications{value: val, isSet: true} +} + +func (v NullableFeatureToggleDefaultEmailNotifications) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFeatureToggleDefaultEmailNotifications) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type FeatureToggleGetDefaultEmailNotificationsAttributeType = *FeatureToggleDefaultEmailNotifications +type FeatureToggleGetDefaultEmailNotificationsArgType = *FeatureToggleDefaultEmailNotifications +type FeatureToggleGetDefaultEmailNotificationsRetType = *FeatureToggleDefaultEmailNotifications + +func getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(arg FeatureToggleGetDefaultEmailNotificationsAttributeType) (ret FeatureToggleGetDefaultEmailNotificationsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setFeatureToggleGetDefaultEmailNotificationsAttributeType(arg *FeatureToggleGetDefaultEmailNotificationsAttributeType, val FeatureToggleGetDefaultEmailNotificationsRetType) { + *arg = val +} + +/* + types and functions for enable_commit_signatures +*/ + +// isBoolean +type FeatureTogglegetEnableCommitSignaturesAttributeType = *bool +type FeatureTogglegetEnableCommitSignaturesArgType = *bool +type FeatureTogglegetEnableCommitSignaturesRetType = *bool + +func getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(arg FeatureTogglegetEnableCommitSignaturesAttributeType) (ret FeatureTogglegetEnableCommitSignaturesRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setFeatureTogglegetEnableCommitSignaturesAttributeType(arg *FeatureTogglegetEnableCommitSignaturesAttributeType, val FeatureTogglegetEnableCommitSignaturesRetType) { + *arg = val +} + +/* + types and functions for enable_local_login +*/ + +// isBoolean +type FeatureTogglegetEnableLocalLoginAttributeType = *bool +type FeatureTogglegetEnableLocalLoginArgType = *bool +type FeatureTogglegetEnableLocalLoginRetType = *bool + +func getFeatureTogglegetEnableLocalLoginAttributeTypeOk(arg FeatureTogglegetEnableLocalLoginAttributeType) (ret FeatureTogglegetEnableLocalLoginRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setFeatureTogglegetEnableLocalLoginAttributeType(arg *FeatureTogglegetEnableLocalLoginAttributeType, val FeatureTogglegetEnableLocalLoginRetType) { + *arg = val +} + +// FeatureToggle Feature toggles for the instance. +type FeatureToggle struct { + // Default email notifications. + DefaultEmailNotifications FeatureToggleGetDefaultEmailNotificationsAttributeType `json:"default_email_notifications,omitempty"` + // Enable commit signatures. + EnableCommitSignatures FeatureTogglegetEnableCommitSignaturesAttributeType `json:"enable_commit_signatures,omitempty"` + // Enable local login. + EnableLocalLogin FeatureTogglegetEnableLocalLoginAttributeType `json:"enable_local_login,omitempty"` +} + +// NewFeatureToggle instantiates a new FeatureToggle 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 NewFeatureToggle() *FeatureToggle { + this := FeatureToggle{} + return &this +} + +// NewFeatureToggleWithDefaults instantiates a new FeatureToggle 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 NewFeatureToggleWithDefaults() *FeatureToggle { + this := FeatureToggle{} + return &this +} + +// GetDefaultEmailNotifications returns the DefaultEmailNotifications field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FeatureToggle) GetDefaultEmailNotifications() (res FeatureToggleGetDefaultEmailNotificationsRetType) { + res, _ = o.GetDefaultEmailNotificationsOk() + return +} + +// GetDefaultEmailNotificationsOk returns a tuple with the DefaultEmailNotifications field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FeatureToggle) GetDefaultEmailNotificationsOk() (ret FeatureToggleGetDefaultEmailNotificationsRetType, ok bool) { + return getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(o.DefaultEmailNotifications) +} + +// HasDefaultEmailNotifications returns a boolean if a field has been set. +func (o *FeatureToggle) HasDefaultEmailNotifications() bool { + _, ok := o.GetDefaultEmailNotificationsOk() + return ok +} + +// SetDefaultEmailNotifications gets a reference to the given string and assigns it to the DefaultEmailNotifications field. +func (o *FeatureToggle) SetDefaultEmailNotifications(v FeatureToggleGetDefaultEmailNotificationsRetType) { + setFeatureToggleGetDefaultEmailNotificationsAttributeType(&o.DefaultEmailNotifications, v) +} + +// SetDefaultEmailNotificationsNil sets the value for DefaultEmailNotifications to be an explicit nil +func (o *FeatureToggle) SetDefaultEmailNotificationsNil() { + o.DefaultEmailNotifications = nil +} + +// UnsetDefaultEmailNotifications ensures that no value is present for DefaultEmailNotifications, not even an explicit nil +func (o *FeatureToggle) UnsetDefaultEmailNotifications() { + o.DefaultEmailNotifications = nil +} + +// GetEnableCommitSignatures returns the EnableCommitSignatures field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FeatureToggle) GetEnableCommitSignatures() (res FeatureTogglegetEnableCommitSignaturesRetType) { + res, _ = o.GetEnableCommitSignaturesOk() + return +} + +// GetEnableCommitSignaturesOk returns a tuple with the EnableCommitSignatures field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FeatureToggle) GetEnableCommitSignaturesOk() (ret FeatureTogglegetEnableCommitSignaturesRetType, ok bool) { + return getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(o.EnableCommitSignatures) +} + +// HasEnableCommitSignatures returns a boolean if a field has been set. +func (o *FeatureToggle) HasEnableCommitSignatures() bool { + _, ok := o.GetEnableCommitSignaturesOk() + return ok +} + +// SetEnableCommitSignatures gets a reference to the given bool and assigns it to the EnableCommitSignatures field. +func (o *FeatureToggle) SetEnableCommitSignatures(v FeatureTogglegetEnableCommitSignaturesRetType) { + setFeatureTogglegetEnableCommitSignaturesAttributeType(&o.EnableCommitSignatures, v) +} + +// SetEnableCommitSignaturesNil sets the value for EnableCommitSignatures to be an explicit nil +func (o *FeatureToggle) SetEnableCommitSignaturesNil() { + o.EnableCommitSignatures = nil +} + +// UnsetEnableCommitSignatures ensures that no value is present for EnableCommitSignatures, not even an explicit nil +func (o *FeatureToggle) UnsetEnableCommitSignatures() { + o.EnableCommitSignatures = nil +} + +// GetEnableLocalLogin returns the EnableLocalLogin field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FeatureToggle) GetEnableLocalLogin() (res FeatureTogglegetEnableLocalLoginRetType) { + res, _ = o.GetEnableLocalLoginOk() + return +} + +// GetEnableLocalLoginOk returns a tuple with the EnableLocalLogin field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *FeatureToggle) GetEnableLocalLoginOk() (ret FeatureTogglegetEnableLocalLoginRetType, ok bool) { + return getFeatureTogglegetEnableLocalLoginAttributeTypeOk(o.EnableLocalLogin) +} + +// HasEnableLocalLogin returns a boolean if a field has been set. +func (o *FeatureToggle) HasEnableLocalLogin() bool { + _, ok := o.GetEnableLocalLoginOk() + return ok +} + +// SetEnableLocalLogin gets a reference to the given bool and assigns it to the EnableLocalLogin field. +func (o *FeatureToggle) SetEnableLocalLogin(v FeatureTogglegetEnableLocalLoginRetType) { + setFeatureTogglegetEnableLocalLoginAttributeType(&o.EnableLocalLogin, v) +} + +// SetEnableLocalLoginNil sets the value for EnableLocalLogin to be an explicit nil +func (o *FeatureToggle) SetEnableLocalLoginNil() { + o.EnableLocalLogin = nil +} + +// UnsetEnableLocalLogin ensures that no value is present for EnableLocalLogin, not even an explicit nil +func (o *FeatureToggle) UnsetEnableLocalLogin() { + o.EnableLocalLogin = nil +} + +func (o FeatureToggle) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getFeatureToggleGetDefaultEmailNotificationsAttributeTypeOk(o.DefaultEmailNotifications); ok { + toSerialize["DefaultEmailNotifications"] = val + } + if val, ok := getFeatureTogglegetEnableCommitSignaturesAttributeTypeOk(o.EnableCommitSignatures); ok { + toSerialize["EnableCommitSignatures"] = val + } + if val, ok := getFeatureTogglegetEnableLocalLoginAttributeTypeOk(o.EnableLocalLogin); ok { + toSerialize["EnableLocalLogin"] = val + } + return toSerialize, nil +} + +type NullableFeatureToggle struct { + value *FeatureToggle + isSet bool +} + +func (v NullableFeatureToggle) Get() *FeatureToggle { + return v.value +} + +func (v *NullableFeatureToggle) Set(val *FeatureToggle) { + v.value = val + v.isSet = true +} + +func (v NullableFeatureToggle) IsSet() bool { + return v.isSet +} + +func (v *NullableFeatureToggle) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFeatureToggle(val *FeatureToggle) *NullableFeatureToggle { + return &NullableFeatureToggle{value: val, isSet: true} +} + +func (v NullableFeatureToggle) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFeatureToggle) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_feature_toggle_test.go b/pkg/gitbeta/model_feature_toggle_test.go new file mode 100644 index 00000000..78e37ad4 --- /dev/null +++ b/pkg/gitbeta/model_feature_toggle_test.go @@ -0,0 +1,72 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "testing" +) + +// isEnum + +func TestFeatureToggleDefaultEmailNotifications_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"enabled"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"disabled"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"onmention"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"andyourown"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := FeatureToggleDefaultEmailNotifications("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/gitbeta/model_flavor.go b/pkg/gitbeta/model_flavor.go new file mode 100644 index 00000000..cb780a7a --- /dev/null +++ b/pkg/gitbeta/model_flavor.go @@ -0,0 +1,415 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the Flavor type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Flavor{} + +/* + types and functions for availability +*/ + +// isEnum + +// FlavorAvailability Defines the flavor availability. +// value type for enums +type FlavorAvailability string + +// List of Availability +const ( + FLAVORAVAILABILITY_AVAILABLE FlavorAvailability = "available" + FLAVORAVAILABILITY_UNAVAILABLE FlavorAvailability = "unavailable" + FLAVORAVAILABILITY_INTERNAL FlavorAvailability = "internal" + FLAVORAVAILABILITY_DEPRECATED FlavorAvailability = "deprecated" +) + +// All allowed values of Flavor enum +var AllowedFlavorAvailabilityEnumValues = []FlavorAvailability{ + "available", + "unavailable", + "internal", + "deprecated", +} + +func (v *FlavorAvailability) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson FlavorAvailability + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := FlavorAvailability(value) + for _, existing := range AllowedFlavorAvailabilityEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Flavor", value) +} + +// NewFlavorAvailabilityFromValue returns a pointer to a valid FlavorAvailability +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFlavorAvailabilityFromValue(v FlavorAvailability) (*FlavorAvailability, error) { + ev := FlavorAvailability(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FlavorAvailability: valid values are %v", v, AllowedFlavorAvailabilityEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FlavorAvailability) IsValid() bool { + for _, existing := range AllowedFlavorAvailabilityEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to AvailabilityAvailability value +func (v FlavorAvailability) Ptr() *FlavorAvailability { + return &v +} + +type NullableFlavorAvailability struct { + value *FlavorAvailability + isSet bool +} + +func (v NullableFlavorAvailability) Get() *FlavorAvailability { + return v.value +} + +func (v *NullableFlavorAvailability) Set(val *FlavorAvailability) { + v.value = val + v.isSet = true +} + +func (v NullableFlavorAvailability) IsSet() bool { + return v.isSet +} + +func (v *NullableFlavorAvailability) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFlavorAvailability(val *FlavorAvailability) *NullableFlavorAvailability { + return &NullableFlavorAvailability{value: val, isSet: true} +} + +func (v NullableFlavorAvailability) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFlavorAvailability) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type FlavorGetAvailabilityAttributeType = *FlavorAvailability +type FlavorGetAvailabilityArgType = FlavorAvailability +type FlavorGetAvailabilityRetType = FlavorAvailability + +func getFlavorGetAvailabilityAttributeTypeOk(arg FlavorGetAvailabilityAttributeType) (ret FlavorGetAvailabilityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFlavorGetAvailabilityAttributeType(arg *FlavorGetAvailabilityAttributeType, val FlavorGetAvailabilityRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type FlavorGetDescriptionAttributeType = *string + +func getFlavorGetDescriptionAttributeTypeOk(arg FlavorGetDescriptionAttributeType) (ret FlavorGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFlavorGetDescriptionAttributeType(arg *FlavorGetDescriptionAttributeType, val FlavorGetDescriptionRetType) { + *arg = &val +} + +type FlavorGetDescriptionArgType = string +type FlavorGetDescriptionRetType = string + +/* + types and functions for display_name +*/ + +// isNotNullableString +type FlavorGetDisplayNameAttributeType = *string + +func getFlavorGetDisplayNameAttributeTypeOk(arg FlavorGetDisplayNameAttributeType) (ret FlavorGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFlavorGetDisplayNameAttributeType(arg *FlavorGetDisplayNameAttributeType, val FlavorGetDisplayNameRetType) { + *arg = &val +} + +type FlavorGetDisplayNameArgType = string +type FlavorGetDisplayNameRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type FlavorGetIdAttributeType = *string + +func getFlavorGetIdAttributeTypeOk(arg FlavorGetIdAttributeType) (ret FlavorGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFlavorGetIdAttributeType(arg *FlavorGetIdAttributeType, val FlavorGetIdRetType) { + *arg = &val +} + +type FlavorGetIdArgType = string +type FlavorGetIdRetType = string + +/* + types and functions for sku +*/ + +// isNotNullableString +type FlavorGetSkuAttributeType = *string + +func getFlavorGetSkuAttributeTypeOk(arg FlavorGetSkuAttributeType) (ret FlavorGetSkuRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFlavorGetSkuAttributeType(arg *FlavorGetSkuAttributeType, val FlavorGetSkuRetType) { + *arg = &val +} + +type FlavorGetSkuArgType = string +type FlavorGetSkuRetType = string + +// Flavor Describes a STACKIT Git Flavor. +type Flavor struct { + // Defines the flavor availability. + // REQUIRED + Availability FlavorGetAvailabilityAttributeType `json:"availability" required:"true"` + // Flavor description. + // REQUIRED + Description FlavorGetDescriptionAttributeType `json:"description" required:"true"` + // The display name that will be shown in the Portal. + // REQUIRED + DisplayName FlavorGetDisplayNameAttributeType `json:"display_name" required:"true"` + // Flavor id. + // REQUIRED + Id FlavorGetIdAttributeType `json:"id" required:"true"` + // SAP article number. + // REQUIRED + Sku FlavorGetSkuAttributeType `json:"sku" required:"true"` +} + +type _Flavor Flavor + +// NewFlavor instantiates a new Flavor 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 NewFlavor(availability FlavorGetAvailabilityArgType, description FlavorGetDescriptionArgType, displayName FlavorGetDisplayNameArgType, id FlavorGetIdArgType, sku FlavorGetSkuArgType) *Flavor { + this := Flavor{} + setFlavorGetAvailabilityAttributeType(&this.Availability, availability) + setFlavorGetDescriptionAttributeType(&this.Description, description) + setFlavorGetDisplayNameAttributeType(&this.DisplayName, displayName) + setFlavorGetIdAttributeType(&this.Id, id) + setFlavorGetSkuAttributeType(&this.Sku, sku) + return &this +} + +// NewFlavorWithDefaults instantiates a new Flavor 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 NewFlavorWithDefaults() *Flavor { + this := Flavor{} + return &this +} + +// GetAvailability returns the Availability field value +func (o *Flavor) GetAvailability() (ret FlavorGetAvailabilityRetType) { + ret, _ = o.GetAvailabilityOk() + return ret +} + +// GetAvailabilityOk returns a tuple with the Availability field value +// and a boolean to check if the value has been set. +func (o *Flavor) GetAvailabilityOk() (ret FlavorGetAvailabilityRetType, ok bool) { + return getFlavorGetAvailabilityAttributeTypeOk(o.Availability) +} + +// SetAvailability sets field value +func (o *Flavor) SetAvailability(v FlavorGetAvailabilityRetType) { + setFlavorGetAvailabilityAttributeType(&o.Availability, v) +} + +// GetDescription returns the Description field value +func (o *Flavor) GetDescription() (ret FlavorGetDescriptionRetType) { + ret, _ = o.GetDescriptionOk() + return ret +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *Flavor) GetDescriptionOk() (ret FlavorGetDescriptionRetType, ok bool) { + return getFlavorGetDescriptionAttributeTypeOk(o.Description) +} + +// SetDescription sets field value +func (o *Flavor) SetDescription(v FlavorGetDescriptionRetType) { + setFlavorGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *Flavor) GetDisplayName() (ret FlavorGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *Flavor) GetDisplayNameOk() (ret FlavorGetDisplayNameRetType, ok bool) { + return getFlavorGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *Flavor) SetDisplayName(v FlavorGetDisplayNameRetType) { + setFlavorGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetId returns the Id field value +func (o *Flavor) GetId() (ret FlavorGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Flavor) GetIdOk() (ret FlavorGetIdRetType, ok bool) { + return getFlavorGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Flavor) SetId(v FlavorGetIdRetType) { + setFlavorGetIdAttributeType(&o.Id, v) +} + +// GetSku returns the Sku field value +func (o *Flavor) GetSku() (ret FlavorGetSkuRetType) { + ret, _ = o.GetSkuOk() + return ret +} + +// GetSkuOk returns a tuple with the Sku field value +// and a boolean to check if the value has been set. +func (o *Flavor) GetSkuOk() (ret FlavorGetSkuRetType, ok bool) { + return getFlavorGetSkuAttributeTypeOk(o.Sku) +} + +// SetSku sets field value +func (o *Flavor) SetSku(v FlavorGetSkuRetType) { + setFlavorGetSkuAttributeType(&o.Sku, v) +} + +func (o Flavor) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getFlavorGetAvailabilityAttributeTypeOk(o.Availability); ok { + toSerialize["Availability"] = val + } + if val, ok := getFlavorGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getFlavorGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getFlavorGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getFlavorGetSkuAttributeTypeOk(o.Sku); ok { + toSerialize["Sku"] = val + } + return toSerialize, nil +} + +type NullableFlavor struct { + value *Flavor + isSet bool +} + +func (v NullableFlavor) Get() *Flavor { + return v.value +} + +func (v *NullableFlavor) Set(val *Flavor) { + v.value = val + v.isSet = true +} + +func (v NullableFlavor) IsSet() bool { + return v.isSet +} + +func (v *NullableFlavor) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFlavor(val *Flavor) *NullableFlavor { + return &NullableFlavor{value: val, isSet: true} +} + +func (v NullableFlavor) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFlavor) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_flavor_test.go b/pkg/gitbeta/model_flavor_test.go new file mode 100644 index 00000000..a7f334ab --- /dev/null +++ b/pkg/gitbeta/model_flavor_test.go @@ -0,0 +1,72 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "testing" +) + +// isEnum + +func TestFlavorAvailability_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"available"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"unavailable"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"internal"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"deprecated"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := FlavorAvailability("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/gitbeta/model_flavors_list.go b/pkg/gitbeta/model_flavors_list.go new file mode 100644 index 00000000..7598ead5 --- /dev/null +++ b/pkg/gitbeta/model_flavors_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the FlavorsList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlavorsList{} + +/* + types and functions for flavors +*/ + +// isArray +type FlavorsListGetFlavorsAttributeType = *[]Flavor +type FlavorsListGetFlavorsArgType = []Flavor +type FlavorsListGetFlavorsRetType = []Flavor + +func getFlavorsListGetFlavorsAttributeTypeOk(arg FlavorsListGetFlavorsAttributeType) (ret FlavorsListGetFlavorsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFlavorsListGetFlavorsAttributeType(arg *FlavorsListGetFlavorsAttributeType, val FlavorsListGetFlavorsRetType) { + *arg = &val +} + +// FlavorsList A list of STACKIT Git Flavors. +type FlavorsList struct { + // REQUIRED + Flavors FlavorsListGetFlavorsAttributeType `json:"flavors" required:"true"` +} + +type _FlavorsList FlavorsList + +// NewFlavorsList instantiates a new FlavorsList 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 NewFlavorsList(flavors FlavorsListGetFlavorsArgType) *FlavorsList { + this := FlavorsList{} + setFlavorsListGetFlavorsAttributeType(&this.Flavors, flavors) + return &this +} + +// NewFlavorsListWithDefaults instantiates a new FlavorsList 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 NewFlavorsListWithDefaults() *FlavorsList { + this := FlavorsList{} + return &this +} + +// GetFlavors returns the Flavors field value +func (o *FlavorsList) GetFlavors() (ret FlavorsListGetFlavorsRetType) { + ret, _ = o.GetFlavorsOk() + return ret +} + +// GetFlavorsOk returns a tuple with the Flavors field value +// and a boolean to check if the value has been set. +func (o *FlavorsList) GetFlavorsOk() (ret FlavorsListGetFlavorsRetType, ok bool) { + return getFlavorsListGetFlavorsAttributeTypeOk(o.Flavors) +} + +// SetFlavors sets field value +func (o *FlavorsList) SetFlavors(v FlavorsListGetFlavorsRetType) { + setFlavorsListGetFlavorsAttributeType(&o.Flavors, v) +} + +func (o FlavorsList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getFlavorsListGetFlavorsAttributeTypeOk(o.Flavors); ok { + toSerialize["Flavors"] = val + } + return toSerialize, nil +} + +type NullableFlavorsList struct { + value *FlavorsList + isSet bool +} + +func (v NullableFlavorsList) Get() *FlavorsList { + return v.value +} + +func (v *NullableFlavorsList) Set(val *FlavorsList) { + v.value = val + v.isSet = true +} + +func (v NullableFlavorsList) IsSet() bool { + return v.isSet +} + +func (v *NullableFlavorsList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFlavorsList(val *FlavorsList) *NullableFlavorsList { + return &NullableFlavorsList{value: val, isSet: true} +} + +func (v NullableFlavorsList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFlavorsList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_flavors_list_test.go b/pkg/gitbeta/model_flavors_list_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_flavors_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_generic_error_response.go b/pkg/gitbeta/model_generic_error_response.go new file mode 100644 index 00000000..003d9c81 --- /dev/null +++ b/pkg/gitbeta/model_generic_error_response.go @@ -0,0 +1,173 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the GenericErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GenericErrorResponse{} + +/* + types and functions for details +*/ + +// isArray +type GenericErrorResponseGetDetailsAttributeType = *[]string +type GenericErrorResponseGetDetailsArgType = []string +type GenericErrorResponseGetDetailsRetType = []string + +func getGenericErrorResponseGetDetailsAttributeTypeOk(arg GenericErrorResponseGetDetailsAttributeType) (ret GenericErrorResponseGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGenericErrorResponseGetDetailsAttributeType(arg *GenericErrorResponseGetDetailsAttributeType, val GenericErrorResponseGetDetailsRetType) { + *arg = &val +} + +/* + types and functions for message +*/ + +// isNotNullableString +type GenericErrorResponseGetMessageAttributeType = *string + +func getGenericErrorResponseGetMessageAttributeTypeOk(arg GenericErrorResponseGetMessageAttributeType) (ret GenericErrorResponseGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGenericErrorResponseGetMessageAttributeType(arg *GenericErrorResponseGetMessageAttributeType, val GenericErrorResponseGetMessageRetType) { + *arg = &val +} + +type GenericErrorResponseGetMessageArgType = string +type GenericErrorResponseGetMessageRetType = string + +// GenericErrorResponse Generic Error Response. +type GenericErrorResponse struct { + Details GenericErrorResponseGetDetailsAttributeType `json:"details,omitempty"` + // REQUIRED + Message GenericErrorResponseGetMessageAttributeType `json:"message" required:"true"` +} + +type _GenericErrorResponse GenericErrorResponse + +// NewGenericErrorResponse instantiates a new GenericErrorResponse 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 NewGenericErrorResponse(message GenericErrorResponseGetMessageArgType) *GenericErrorResponse { + this := GenericErrorResponse{} + setGenericErrorResponseGetMessageAttributeType(&this.Message, message) + return &this +} + +// NewGenericErrorResponseWithDefaults instantiates a new GenericErrorResponse 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 NewGenericErrorResponseWithDefaults() *GenericErrorResponse { + this := GenericErrorResponse{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *GenericErrorResponse) GetDetails() (res GenericErrorResponseGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GenericErrorResponse) GetDetailsOk() (ret GenericErrorResponseGetDetailsRetType, ok bool) { + return getGenericErrorResponseGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *GenericErrorResponse) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given []string and assigns it to the Details field. +func (o *GenericErrorResponse) SetDetails(v GenericErrorResponseGetDetailsRetType) { + setGenericErrorResponseGetDetailsAttributeType(&o.Details, v) +} + +// GetMessage returns the Message field value +func (o *GenericErrorResponse) GetMessage() (ret GenericErrorResponseGetMessageRetType) { + ret, _ = o.GetMessageOk() + return ret +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *GenericErrorResponse) GetMessageOk() (ret GenericErrorResponseGetMessageRetType, ok bool) { + return getGenericErrorResponseGetMessageAttributeTypeOk(o.Message) +} + +// SetMessage sets field value +func (o *GenericErrorResponse) SetMessage(v GenericErrorResponseGetMessageRetType) { + setGenericErrorResponseGetMessageAttributeType(&o.Message, v) +} + +func (o GenericErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGenericErrorResponseGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getGenericErrorResponseGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableGenericErrorResponse struct { + value *GenericErrorResponse + isSet bool +} + +func (v NullableGenericErrorResponse) Get() *GenericErrorResponse { + return v.value +} + +func (v *NullableGenericErrorResponse) Set(val *GenericErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGenericErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGenericErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGenericErrorResponse(val *GenericErrorResponse) *NullableGenericErrorResponse { + return &NullableGenericErrorResponse{value: val, isSet: true} +} + +func (v NullableGenericErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGenericErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_generic_error_response_test.go b/pkg/gitbeta/model_generic_error_response_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_generic_error_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_instance.go b/pkg/gitbeta/model_instance.go new file mode 100644 index 00000000..f00d5e51 --- /dev/null +++ b/pkg/gitbeta/model_instance.go @@ -0,0 +1,686 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Instance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Instance{} + +/* + types and functions for acl +*/ + +// isArray +type InstanceGetAclAttributeType = *[]string +type InstanceGetAclArgType = []string +type InstanceGetAclRetType = []string + +func getInstanceGetAclAttributeTypeOk(arg InstanceGetAclAttributeType) (ret InstanceGetAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetAclAttributeType(arg *InstanceGetAclAttributeType, val InstanceGetAclRetType) { + *arg = &val +} + +/* + types and functions for consumed_disk +*/ + +// isNotNullableString +type InstanceGetConsumedDiskAttributeType = *string + +func getInstanceGetConsumedDiskAttributeTypeOk(arg InstanceGetConsumedDiskAttributeType) (ret InstanceGetConsumedDiskRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetConsumedDiskAttributeType(arg *InstanceGetConsumedDiskAttributeType, val InstanceGetConsumedDiskRetType) { + *arg = &val +} + +type InstanceGetConsumedDiskArgType = string +type InstanceGetConsumedDiskRetType = string + +/* + types and functions for consumed_object_storage +*/ + +// isNotNullableString +type InstanceGetConsumedObjectStorageAttributeType = *string + +func getInstanceGetConsumedObjectStorageAttributeTypeOk(arg InstanceGetConsumedObjectStorageAttributeType) (ret InstanceGetConsumedObjectStorageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetConsumedObjectStorageAttributeType(arg *InstanceGetConsumedObjectStorageAttributeType, val InstanceGetConsumedObjectStorageRetType) { + *arg = &val +} + +type InstanceGetConsumedObjectStorageArgType = string +type InstanceGetConsumedObjectStorageRetType = string + +/* + types and functions for created +*/ + +// isDateTime +type InstanceGetCreatedAttributeType = *time.Time +type InstanceGetCreatedArgType = time.Time +type InstanceGetCreatedRetType = time.Time + +func getInstanceGetCreatedAttributeTypeOk(arg InstanceGetCreatedAttributeType) (ret InstanceGetCreatedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetCreatedAttributeType(arg *InstanceGetCreatedAttributeType, val InstanceGetCreatedRetType) { + *arg = &val +} + +/* + types and functions for feature_toggle +*/ + +// isModel +type InstanceGetFeatureToggleAttributeType = *FeatureToggle +type InstanceGetFeatureToggleArgType = FeatureToggle +type InstanceGetFeatureToggleRetType = FeatureToggle + +func getInstanceGetFeatureToggleAttributeTypeOk(arg InstanceGetFeatureToggleAttributeType) (ret InstanceGetFeatureToggleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetFeatureToggleAttributeType(arg *InstanceGetFeatureToggleAttributeType, val InstanceGetFeatureToggleRetType) { + *arg = &val +} + +/* + types and functions for flavor +*/ + +// isNotNullableString +type InstanceGetFlavorAttributeType = *string + +func getInstanceGetFlavorAttributeTypeOk(arg InstanceGetFlavorAttributeType) (ret InstanceGetFlavorRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetFlavorAttributeType(arg *InstanceGetFlavorAttributeType, val InstanceGetFlavorRetType) { + *arg = &val +} + +type InstanceGetFlavorArgType = string +type InstanceGetFlavorRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type InstanceGetIdAttributeType = *string + +func getInstanceGetIdAttributeTypeOk(arg InstanceGetIdAttributeType) (ret InstanceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetIdAttributeType(arg *InstanceGetIdAttributeType, val InstanceGetIdRetType) { + *arg = &val +} + +type InstanceGetIdArgType = string +type InstanceGetIdRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type InstanceGetNameAttributeType = *string + +func getInstanceGetNameAttributeTypeOk(arg InstanceGetNameAttributeType) (ret InstanceGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetNameAttributeType(arg *InstanceGetNameAttributeType, val InstanceGetNameRetType) { + *arg = &val +} + +type InstanceGetNameArgType = string +type InstanceGetNameRetType = string + +/* + types and functions for state +*/ + +// isEnum + +// InstanceState The current state of the STACKIT Git instance. +// value type for enums +type InstanceState string + +// List of State +const ( + INSTANCESTATE_CREATING InstanceState = "Creating" + INSTANCESTATE_WAITING_FOR_RESOURCES InstanceState = "WaitingForResources" + INSTANCESTATE_UPDATING InstanceState = "Updating" + INSTANCESTATE_DELETING InstanceState = "Deleting" + INSTANCESTATE_READY InstanceState = "Ready" + INSTANCESTATE_ERROR InstanceState = "Error" +) + +// All allowed values of Instance enum +var AllowedInstanceStateEnumValues = []InstanceState{ + "Creating", + "WaitingForResources", + "Updating", + "Deleting", + "Ready", + "Error", +} + +func (v *InstanceState) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson InstanceState + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := InstanceState(value) + for _, existing := range AllowedInstanceStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Instance", value) +} + +// NewInstanceStateFromValue returns a pointer to a valid InstanceState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceStateFromValue(v InstanceState) (*InstanceState, error) { + ev := InstanceState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceState: valid values are %v", v, AllowedInstanceStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceState) IsValid() bool { + for _, existing := range AllowedInstanceStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v InstanceState) Ptr() *InstanceState { + return &v +} + +type NullableInstanceState struct { + value *InstanceState + isSet bool +} + +func (v NullableInstanceState) Get() *InstanceState { + return v.value +} + +func (v *NullableInstanceState) Set(val *InstanceState) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceState) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceState(val *InstanceState) *NullableInstanceState { + return &NullableInstanceState{value: val, isSet: true} +} + +func (v NullableInstanceState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type InstanceGetStateAttributeType = *InstanceState +type InstanceGetStateArgType = InstanceState +type InstanceGetStateRetType = InstanceState + +func getInstanceGetStateAttributeTypeOk(arg InstanceGetStateAttributeType) (ret InstanceGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetStateAttributeType(arg *InstanceGetStateAttributeType, val InstanceGetStateRetType) { + *arg = &val +} + +/* + types and functions for url +*/ + +// isNotNullableString +type InstanceGetUrlAttributeType = *string + +func getInstanceGetUrlAttributeTypeOk(arg InstanceGetUrlAttributeType) (ret InstanceGetUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetUrlAttributeType(arg *InstanceGetUrlAttributeType, val InstanceGetUrlRetType) { + *arg = &val +} + +type InstanceGetUrlArgType = string +type InstanceGetUrlRetType = string + +/* + types and functions for version +*/ + +// isNotNullableString +type InstanceGetVersionAttributeType = *string + +func getInstanceGetVersionAttributeTypeOk(arg InstanceGetVersionAttributeType) (ret InstanceGetVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceGetVersionAttributeType(arg *InstanceGetVersionAttributeType, val InstanceGetVersionRetType) { + *arg = &val +} + +type InstanceGetVersionArgType = string +type InstanceGetVersionRetType = string + +// Instance Describes a STACKIT Git instance. +type Instance struct { + // Restricted ACL for instance access. + // REQUIRED + Acl InstanceGetAclAttributeType `json:"acl" required:"true"` + // How many bytes of disk space is consumed. Read Only. + // REQUIRED + ConsumedDisk InstanceGetConsumedDiskAttributeType `json:"consumed_disk" required:"true"` + // How many bytes of Object Storage is consumed. Read Only. + // REQUIRED + ConsumedObjectStorage InstanceGetConsumedObjectStorageAttributeType `json:"consumed_object_storage" required:"true"` + // The date and time the creation of the STACKIT Git instance was triggered. + // REQUIRED + Created InstanceGetCreatedAttributeType `json:"created" required:"true"` + // REQUIRED + FeatureToggle InstanceGetFeatureToggleAttributeType `json:"feature_toggle" required:"true"` + // Instance flavor. + // REQUIRED + Flavor InstanceGetFlavorAttributeType `json:"flavor" required:"true"` + // A auto generated unique id which identifies the STACKIT Git instances. + // REQUIRED + Id InstanceGetIdAttributeType `json:"id" required:"true"` + // A user chosen name to distinguish multiple STACKIT Git instances. + // REQUIRED + Name InstanceGetNameAttributeType `json:"name" required:"true"` + // The current state of the STACKIT Git instance. + // REQUIRED + State InstanceGetStateAttributeType `json:"state" required:"true"` + // The URL for reaching the STACKIT Git instance. + // REQUIRED + Url InstanceGetUrlAttributeType `json:"url" required:"true"` + // The current version of STACKIT Git deployed to the instance. + // REQUIRED + Version InstanceGetVersionAttributeType `json:"version" required:"true"` +} + +type _Instance Instance + +// NewInstance instantiates a new Instance 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 NewInstance(acl InstanceGetAclArgType, consumedDisk InstanceGetConsumedDiskArgType, consumedObjectStorage InstanceGetConsumedObjectStorageArgType, created InstanceGetCreatedArgType, featureToggle InstanceGetFeatureToggleArgType, flavor InstanceGetFlavorArgType, id InstanceGetIdArgType, name InstanceGetNameArgType, state InstanceGetStateArgType, url InstanceGetUrlArgType, version InstanceGetVersionArgType) *Instance { + this := Instance{} + setInstanceGetAclAttributeType(&this.Acl, acl) + setInstanceGetConsumedDiskAttributeType(&this.ConsumedDisk, consumedDisk) + setInstanceGetConsumedObjectStorageAttributeType(&this.ConsumedObjectStorage, consumedObjectStorage) + setInstanceGetCreatedAttributeType(&this.Created, created) + setInstanceGetFeatureToggleAttributeType(&this.FeatureToggle, featureToggle) + setInstanceGetFlavorAttributeType(&this.Flavor, flavor) + setInstanceGetIdAttributeType(&this.Id, id) + setInstanceGetNameAttributeType(&this.Name, name) + setInstanceGetStateAttributeType(&this.State, state) + setInstanceGetUrlAttributeType(&this.Url, url) + setInstanceGetVersionAttributeType(&this.Version, version) + return &this +} + +// NewInstanceWithDefaults instantiates a new Instance 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 NewInstanceWithDefaults() *Instance { + this := Instance{} + return &this +} + +// GetAcl returns the Acl field value +func (o *Instance) GetAcl() (ret InstanceGetAclRetType) { + ret, _ = o.GetAclOk() + return ret +} + +// GetAclOk returns a tuple with the Acl field value +// and a boolean to check if the value has been set. +func (o *Instance) GetAclOk() (ret InstanceGetAclRetType, ok bool) { + return getInstanceGetAclAttributeTypeOk(o.Acl) +} + +// SetAcl sets field value +func (o *Instance) SetAcl(v InstanceGetAclRetType) { + setInstanceGetAclAttributeType(&o.Acl, v) +} + +// GetConsumedDisk returns the ConsumedDisk field value +func (o *Instance) GetConsumedDisk() (ret InstanceGetConsumedDiskRetType) { + ret, _ = o.GetConsumedDiskOk() + return ret +} + +// GetConsumedDiskOk returns a tuple with the ConsumedDisk field value +// and a boolean to check if the value has been set. +func (o *Instance) GetConsumedDiskOk() (ret InstanceGetConsumedDiskRetType, ok bool) { + return getInstanceGetConsumedDiskAttributeTypeOk(o.ConsumedDisk) +} + +// SetConsumedDisk sets field value +func (o *Instance) SetConsumedDisk(v InstanceGetConsumedDiskRetType) { + setInstanceGetConsumedDiskAttributeType(&o.ConsumedDisk, v) +} + +// GetConsumedObjectStorage returns the ConsumedObjectStorage field value +func (o *Instance) GetConsumedObjectStorage() (ret InstanceGetConsumedObjectStorageRetType) { + ret, _ = o.GetConsumedObjectStorageOk() + return ret +} + +// GetConsumedObjectStorageOk returns a tuple with the ConsumedObjectStorage field value +// and a boolean to check if the value has been set. +func (o *Instance) GetConsumedObjectStorageOk() (ret InstanceGetConsumedObjectStorageRetType, ok bool) { + return getInstanceGetConsumedObjectStorageAttributeTypeOk(o.ConsumedObjectStorage) +} + +// SetConsumedObjectStorage sets field value +func (o *Instance) SetConsumedObjectStorage(v InstanceGetConsumedObjectStorageRetType) { + setInstanceGetConsumedObjectStorageAttributeType(&o.ConsumedObjectStorage, v) +} + +// GetCreated returns the Created field value +func (o *Instance) GetCreated() (ret InstanceGetCreatedRetType) { + ret, _ = o.GetCreatedOk() + return ret +} + +// GetCreatedOk returns a tuple with the Created field value +// and a boolean to check if the value has been set. +func (o *Instance) GetCreatedOk() (ret InstanceGetCreatedRetType, ok bool) { + return getInstanceGetCreatedAttributeTypeOk(o.Created) +} + +// SetCreated sets field value +func (o *Instance) SetCreated(v InstanceGetCreatedRetType) { + setInstanceGetCreatedAttributeType(&o.Created, v) +} + +// GetFeatureToggle returns the FeatureToggle field value +func (o *Instance) GetFeatureToggle() (ret InstanceGetFeatureToggleRetType) { + ret, _ = o.GetFeatureToggleOk() + return ret +} + +// GetFeatureToggleOk returns a tuple with the FeatureToggle field value +// and a boolean to check if the value has been set. +func (o *Instance) GetFeatureToggleOk() (ret InstanceGetFeatureToggleRetType, ok bool) { + return getInstanceGetFeatureToggleAttributeTypeOk(o.FeatureToggle) +} + +// SetFeatureToggle sets field value +func (o *Instance) SetFeatureToggle(v InstanceGetFeatureToggleRetType) { + setInstanceGetFeatureToggleAttributeType(&o.FeatureToggle, v) +} + +// GetFlavor returns the Flavor field value +func (o *Instance) GetFlavor() (ret InstanceGetFlavorRetType) { + ret, _ = o.GetFlavorOk() + return ret +} + +// GetFlavorOk returns a tuple with the Flavor field value +// and a boolean to check if the value has been set. +func (o *Instance) GetFlavorOk() (ret InstanceGetFlavorRetType, ok bool) { + return getInstanceGetFlavorAttributeTypeOk(o.Flavor) +} + +// SetFlavor sets field value +func (o *Instance) SetFlavor(v InstanceGetFlavorRetType) { + setInstanceGetFlavorAttributeType(&o.Flavor, v) +} + +// GetId returns the Id field value +func (o *Instance) GetId() (ret InstanceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Instance) GetIdOk() (ret InstanceGetIdRetType, ok bool) { + return getInstanceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Instance) SetId(v InstanceGetIdRetType) { + setInstanceGetIdAttributeType(&o.Id, v) +} + +// GetName returns the Name field value +func (o *Instance) GetName() (ret InstanceGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Instance) GetNameOk() (ret InstanceGetNameRetType, ok bool) { + return getInstanceGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Instance) SetName(v InstanceGetNameRetType) { + setInstanceGetNameAttributeType(&o.Name, v) +} + +// GetState returns the State field value +func (o *Instance) GetState() (ret InstanceGetStateRetType) { + ret, _ = o.GetStateOk() + return ret +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *Instance) GetStateOk() (ret InstanceGetStateRetType, ok bool) { + return getInstanceGetStateAttributeTypeOk(o.State) +} + +// SetState sets field value +func (o *Instance) SetState(v InstanceGetStateRetType) { + setInstanceGetStateAttributeType(&o.State, v) +} + +// GetUrl returns the Url field value +func (o *Instance) GetUrl() (ret InstanceGetUrlRetType) { + ret, _ = o.GetUrlOk() + return ret +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *Instance) GetUrlOk() (ret InstanceGetUrlRetType, ok bool) { + return getInstanceGetUrlAttributeTypeOk(o.Url) +} + +// SetUrl sets field value +func (o *Instance) SetUrl(v InstanceGetUrlRetType) { + setInstanceGetUrlAttributeType(&o.Url, v) +} + +// GetVersion returns the Version field value +func (o *Instance) GetVersion() (ret InstanceGetVersionRetType) { + ret, _ = o.GetVersionOk() + return ret +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *Instance) GetVersionOk() (ret InstanceGetVersionRetType, ok bool) { + return getInstanceGetVersionAttributeTypeOk(o.Version) +} + +// SetVersion sets field value +func (o *Instance) SetVersion(v InstanceGetVersionRetType) { + setInstanceGetVersionAttributeType(&o.Version, v) +} + +func (o Instance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getInstanceGetAclAttributeTypeOk(o.Acl); ok { + toSerialize["Acl"] = val + } + if val, ok := getInstanceGetConsumedDiskAttributeTypeOk(o.ConsumedDisk); ok { + toSerialize["ConsumedDisk"] = val + } + if val, ok := getInstanceGetConsumedObjectStorageAttributeTypeOk(o.ConsumedObjectStorage); ok { + toSerialize["ConsumedObjectStorage"] = val + } + if val, ok := getInstanceGetCreatedAttributeTypeOk(o.Created); ok { + toSerialize["Created"] = val + } + if val, ok := getInstanceGetFeatureToggleAttributeTypeOk(o.FeatureToggle); ok { + toSerialize["FeatureToggle"] = val + } + if val, ok := getInstanceGetFlavorAttributeTypeOk(o.Flavor); ok { + toSerialize["Flavor"] = val + } + if val, ok := getInstanceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getInstanceGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getInstanceGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + if val, ok := getInstanceGetUrlAttributeTypeOk(o.Url); ok { + toSerialize["Url"] = val + } + if val, ok := getInstanceGetVersionAttributeTypeOk(o.Version); ok { + toSerialize["Version"] = val + } + return toSerialize, nil +} + +type NullableInstance struct { + value *Instance + isSet bool +} + +func (v NullableInstance) Get() *Instance { + return v.value +} + +func (v *NullableInstance) Set(val *Instance) { + v.value = val + v.isSet = true +} + +func (v NullableInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstance(val *Instance) *NullableInstance { + return &NullableInstance{value: val, isSet: true} +} + +func (v NullableInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_instance_list.go b/pkg/gitbeta/model_instance_list.go new file mode 100644 index 00000000..9109da9b --- /dev/null +++ b/pkg/gitbeta/model_instance_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the InstanceList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceList{} + +/* + types and functions for instances +*/ + +// isArray +type InstanceListGetInstancesAttributeType = *[]Instance +type InstanceListGetInstancesArgType = []Instance +type InstanceListGetInstancesRetType = []Instance + +func getInstanceListGetInstancesAttributeTypeOk(arg InstanceListGetInstancesAttributeType) (ret InstanceListGetInstancesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceListGetInstancesAttributeType(arg *InstanceListGetInstancesAttributeType, val InstanceListGetInstancesRetType) { + *arg = &val +} + +// InstanceList A list of STACKIT Git instances. +type InstanceList struct { + // REQUIRED + Instances InstanceListGetInstancesAttributeType `json:"instances" required:"true"` +} + +type _InstanceList InstanceList + +// NewInstanceList instantiates a new InstanceList 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 NewInstanceList(instances InstanceListGetInstancesArgType) *InstanceList { + this := InstanceList{} + setInstanceListGetInstancesAttributeType(&this.Instances, instances) + return &this +} + +// NewInstanceListWithDefaults instantiates a new InstanceList 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 NewInstanceListWithDefaults() *InstanceList { + this := InstanceList{} + return &this +} + +// GetInstances returns the Instances field value +func (o *InstanceList) GetInstances() (ret InstanceListGetInstancesRetType) { + ret, _ = o.GetInstancesOk() + return ret +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *InstanceList) GetInstancesOk() (ret InstanceListGetInstancesRetType, ok bool) { + return getInstanceListGetInstancesAttributeTypeOk(o.Instances) +} + +// SetInstances sets field value +func (o *InstanceList) SetInstances(v InstanceListGetInstancesRetType) { + setInstanceListGetInstancesAttributeType(&o.Instances, v) +} + +func (o InstanceList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getInstanceListGetInstancesAttributeTypeOk(o.Instances); ok { + toSerialize["Instances"] = val + } + return toSerialize, nil +} + +type NullableInstanceList struct { + value *InstanceList + isSet bool +} + +func (v NullableInstanceList) Get() *InstanceList { + return v.value +} + +func (v *NullableInstanceList) Set(val *InstanceList) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceList) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceList(val *InstanceList) *NullableInstanceList { + return &NullableInstanceList{value: val, isSet: true} +} + +func (v NullableInstanceList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_instance_list_test.go b/pkg/gitbeta/model_instance_list_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_instance_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_instance_test.go b/pkg/gitbeta/model_instance_test.go new file mode 100644 index 00000000..577e6305 --- /dev/null +++ b/pkg/gitbeta/model_instance_test.go @@ -0,0 +1,86 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "testing" +) + +// isEnum + +func TestInstanceState_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"Creating"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"WaitingForResources"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"Updating"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"Deleting"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 5`, + args: args{ + src: []byte(`"Ready"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 6`, + args: args{ + src: []byte(`"Error"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := InstanceState("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/gitbeta/model_internal_server_error_response.go b/pkg/gitbeta/model_internal_server_error_response.go new file mode 100644 index 00000000..e3645101 --- /dev/null +++ b/pkg/gitbeta/model_internal_server_error_response.go @@ -0,0 +1,128 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the InternalServerErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InternalServerErrorResponse{} + +/* + types and functions for error +*/ + +// isNotNullableString +type InternalServerErrorResponseGetErrorAttributeType = *string + +func getInternalServerErrorResponseGetErrorAttributeTypeOk(arg InternalServerErrorResponseGetErrorAttributeType) (ret InternalServerErrorResponseGetErrorRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInternalServerErrorResponseGetErrorAttributeType(arg *InternalServerErrorResponseGetErrorAttributeType, val InternalServerErrorResponseGetErrorRetType) { + *arg = &val +} + +type InternalServerErrorResponseGetErrorArgType = string +type InternalServerErrorResponseGetErrorRetType = string + +// InternalServerErrorResponse Internal server error. +type InternalServerErrorResponse struct { + Error InternalServerErrorResponseGetErrorAttributeType `json:"error,omitempty"` +} + +// NewInternalServerErrorResponse instantiates a new InternalServerErrorResponse 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 NewInternalServerErrorResponse() *InternalServerErrorResponse { + this := InternalServerErrorResponse{} + return &this +} + +// NewInternalServerErrorResponseWithDefaults instantiates a new InternalServerErrorResponse 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 NewInternalServerErrorResponseWithDefaults() *InternalServerErrorResponse { + this := InternalServerErrorResponse{} + return &this +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *InternalServerErrorResponse) GetError() (res InternalServerErrorResponseGetErrorRetType) { + res, _ = o.GetErrorOk() + return +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InternalServerErrorResponse) GetErrorOk() (ret InternalServerErrorResponseGetErrorRetType, ok bool) { + return getInternalServerErrorResponseGetErrorAttributeTypeOk(o.Error) +} + +// HasError returns a boolean if a field has been set. +func (o *InternalServerErrorResponse) HasError() bool { + _, ok := o.GetErrorOk() + return ok +} + +// SetError gets a reference to the given string and assigns it to the Error field. +func (o *InternalServerErrorResponse) SetError(v InternalServerErrorResponseGetErrorRetType) { + setInternalServerErrorResponseGetErrorAttributeType(&o.Error, v) +} + +func (o InternalServerErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getInternalServerErrorResponseGetErrorAttributeTypeOk(o.Error); ok { + toSerialize["Error"] = val + } + return toSerialize, nil +} + +type NullableInternalServerErrorResponse struct { + value *InternalServerErrorResponse + isSet bool +} + +func (v NullableInternalServerErrorResponse) Get() *InternalServerErrorResponse { + return v.value +} + +func (v *NullableInternalServerErrorResponse) Set(val *InternalServerErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableInternalServerErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableInternalServerErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInternalServerErrorResponse(val *InternalServerErrorResponse) *NullableInternalServerErrorResponse { + return &NullableInternalServerErrorResponse{value: val, isSet: true} +} + +func (v NullableInternalServerErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInternalServerErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_internal_server_error_response_test.go b/pkg/gitbeta/model_internal_server_error_response_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_internal_server_error_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_patch_authentication_payload.go b/pkg/gitbeta/model_patch_authentication_payload.go new file mode 100644 index 00000000..1436e2f1 --- /dev/null +++ b/pkg/gitbeta/model_patch_authentication_payload.go @@ -0,0 +1,374 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the PatchAuthenticationPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchAuthenticationPayload{} + +/* + types and functions for auto_discover_url +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType = *string + +func getPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(arg PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType) (ret PatchAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType(arg *PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType, val PatchAuthenticationPayloadGetAutoDiscoverUrlRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetAutoDiscoverUrlArgType = string +type PatchAuthenticationPayloadGetAutoDiscoverUrlRetType = string + +/* + types and functions for client_id +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetClientIdAttributeType = *string + +func getPatchAuthenticationPayloadGetClientIdAttributeTypeOk(arg PatchAuthenticationPayloadGetClientIdAttributeType) (ret PatchAuthenticationPayloadGetClientIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetClientIdAttributeType(arg *PatchAuthenticationPayloadGetClientIdAttributeType, val PatchAuthenticationPayloadGetClientIdRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetClientIdArgType = string +type PatchAuthenticationPayloadGetClientIdRetType = string + +/* + types and functions for client_secret +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetClientSecretAttributeType = *string + +func getPatchAuthenticationPayloadGetClientSecretAttributeTypeOk(arg PatchAuthenticationPayloadGetClientSecretAttributeType) (ret PatchAuthenticationPayloadGetClientSecretRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetClientSecretAttributeType(arg *PatchAuthenticationPayloadGetClientSecretAttributeType, val PatchAuthenticationPayloadGetClientSecretRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetClientSecretArgType = string +type PatchAuthenticationPayloadGetClientSecretRetType = string + +/* + types and functions for icon_url +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetIconUrlAttributeType = *string + +func getPatchAuthenticationPayloadGetIconUrlAttributeTypeOk(arg PatchAuthenticationPayloadGetIconUrlAttributeType) (ret PatchAuthenticationPayloadGetIconUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetIconUrlAttributeType(arg *PatchAuthenticationPayloadGetIconUrlAttributeType, val PatchAuthenticationPayloadGetIconUrlRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetIconUrlArgType = string +type PatchAuthenticationPayloadGetIconUrlRetType = string + +/* + types and functions for provider +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetProviderAttributeType = *string + +func getPatchAuthenticationPayloadGetProviderAttributeTypeOk(arg PatchAuthenticationPayloadGetProviderAttributeType) (ret PatchAuthenticationPayloadGetProviderRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetProviderAttributeType(arg *PatchAuthenticationPayloadGetProviderAttributeType, val PatchAuthenticationPayloadGetProviderRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetProviderArgType = string +type PatchAuthenticationPayloadGetProviderRetType = string + +/* + types and functions for scopes +*/ + +// isNotNullableString +type PatchAuthenticationPayloadGetScopesAttributeType = *string + +func getPatchAuthenticationPayloadGetScopesAttributeTypeOk(arg PatchAuthenticationPayloadGetScopesAttributeType) (ret PatchAuthenticationPayloadGetScopesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchAuthenticationPayloadGetScopesAttributeType(arg *PatchAuthenticationPayloadGetScopesAttributeType, val PatchAuthenticationPayloadGetScopesRetType) { + *arg = &val +} + +type PatchAuthenticationPayloadGetScopesArgType = string +type PatchAuthenticationPayloadGetScopesRetType = string + +// PatchAuthenticationPayload Properties to patch on an authentication. All fields are optional. +type PatchAuthenticationPayload struct { + // The well-known configuration url to use for this authentication definition. + AutoDiscoverUrl PatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType `json:"auto_discover_url,omitempty"` + // The IDP client id to use. + ClientId PatchAuthenticationPayloadGetClientIdAttributeType `json:"client_id,omitempty"` + // The IDP client secret to use. + ClientSecret PatchAuthenticationPayloadGetClientSecretAttributeType `json:"client_secret,omitempty"` + // The url of the icon to use for this authentication definition. + IconUrl PatchAuthenticationPayloadGetIconUrlAttributeType `json:"icon_url,omitempty"` + // The Oauth2 provider to use. + Provider PatchAuthenticationPayloadGetProviderAttributeType `json:"provider,omitempty"` + // Scopes defines the OIDC scopes to request. + Scopes PatchAuthenticationPayloadGetScopesAttributeType `json:"scopes,omitempty"` +} + +// NewPatchAuthenticationPayload instantiates a new PatchAuthenticationPayload 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 NewPatchAuthenticationPayload() *PatchAuthenticationPayload { + this := PatchAuthenticationPayload{} + return &this +} + +// NewPatchAuthenticationPayloadWithDefaults instantiates a new PatchAuthenticationPayload 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 NewPatchAuthenticationPayloadWithDefaults() *PatchAuthenticationPayload { + this := PatchAuthenticationPayload{} + return &this +} + +// GetAutoDiscoverUrl returns the AutoDiscoverUrl field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetAutoDiscoverUrl() (res PatchAuthenticationPayloadGetAutoDiscoverUrlRetType) { + res, _ = o.GetAutoDiscoverUrlOk() + return +} + +// GetAutoDiscoverUrlOk returns a tuple with the AutoDiscoverUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetAutoDiscoverUrlOk() (ret PatchAuthenticationPayloadGetAutoDiscoverUrlRetType, ok bool) { + return getPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl) +} + +// HasAutoDiscoverUrl returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasAutoDiscoverUrl() bool { + _, ok := o.GetAutoDiscoverUrlOk() + return ok +} + +// SetAutoDiscoverUrl gets a reference to the given string and assigns it to the AutoDiscoverUrl field. +func (o *PatchAuthenticationPayload) SetAutoDiscoverUrl(v PatchAuthenticationPayloadGetAutoDiscoverUrlRetType) { + setPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeType(&o.AutoDiscoverUrl, v) +} + +// GetClientId returns the ClientId field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetClientId() (res PatchAuthenticationPayloadGetClientIdRetType) { + res, _ = o.GetClientIdOk() + return +} + +// GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetClientIdOk() (ret PatchAuthenticationPayloadGetClientIdRetType, ok bool) { + return getPatchAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId) +} + +// HasClientId returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasClientId() bool { + _, ok := o.GetClientIdOk() + return ok +} + +// SetClientId gets a reference to the given string and assigns it to the ClientId field. +func (o *PatchAuthenticationPayload) SetClientId(v PatchAuthenticationPayloadGetClientIdRetType) { + setPatchAuthenticationPayloadGetClientIdAttributeType(&o.ClientId, v) +} + +// GetClientSecret returns the ClientSecret field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetClientSecret() (res PatchAuthenticationPayloadGetClientSecretRetType) { + res, _ = o.GetClientSecretOk() + return +} + +// GetClientSecretOk returns a tuple with the ClientSecret field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetClientSecretOk() (ret PatchAuthenticationPayloadGetClientSecretRetType, ok bool) { + return getPatchAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret) +} + +// HasClientSecret returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasClientSecret() bool { + _, ok := o.GetClientSecretOk() + return ok +} + +// SetClientSecret gets a reference to the given string and assigns it to the ClientSecret field. +func (o *PatchAuthenticationPayload) SetClientSecret(v PatchAuthenticationPayloadGetClientSecretRetType) { + setPatchAuthenticationPayloadGetClientSecretAttributeType(&o.ClientSecret, v) +} + +// GetIconUrl returns the IconUrl field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetIconUrl() (res PatchAuthenticationPayloadGetIconUrlRetType) { + res, _ = o.GetIconUrlOk() + return +} + +// GetIconUrlOk returns a tuple with the IconUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetIconUrlOk() (ret PatchAuthenticationPayloadGetIconUrlRetType, ok bool) { + return getPatchAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl) +} + +// HasIconUrl returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasIconUrl() bool { + _, ok := o.GetIconUrlOk() + return ok +} + +// SetIconUrl gets a reference to the given string and assigns it to the IconUrl field. +func (o *PatchAuthenticationPayload) SetIconUrl(v PatchAuthenticationPayloadGetIconUrlRetType) { + setPatchAuthenticationPayloadGetIconUrlAttributeType(&o.IconUrl, v) +} + +// GetProvider returns the Provider field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetProvider() (res PatchAuthenticationPayloadGetProviderRetType) { + res, _ = o.GetProviderOk() + return +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetProviderOk() (ret PatchAuthenticationPayloadGetProviderRetType, ok bool) { + return getPatchAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider) +} + +// HasProvider returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasProvider() bool { + _, ok := o.GetProviderOk() + return ok +} + +// SetProvider gets a reference to the given string and assigns it to the Provider field. +func (o *PatchAuthenticationPayload) SetProvider(v PatchAuthenticationPayloadGetProviderRetType) { + setPatchAuthenticationPayloadGetProviderAttributeType(&o.Provider, v) +} + +// GetScopes returns the Scopes field value if set, zero value otherwise. +func (o *PatchAuthenticationPayload) GetScopes() (res PatchAuthenticationPayloadGetScopesRetType) { + res, _ = o.GetScopesOk() + return +} + +// GetScopesOk returns a tuple with the Scopes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchAuthenticationPayload) GetScopesOk() (ret PatchAuthenticationPayloadGetScopesRetType, ok bool) { + return getPatchAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes) +} + +// HasScopes returns a boolean if a field has been set. +func (o *PatchAuthenticationPayload) HasScopes() bool { + _, ok := o.GetScopesOk() + return ok +} + +// SetScopes gets a reference to the given string and assigns it to the Scopes field. +func (o *PatchAuthenticationPayload) SetScopes(v PatchAuthenticationPayloadGetScopesRetType) { + setPatchAuthenticationPayloadGetScopesAttributeType(&o.Scopes, v) +} + +func (o PatchAuthenticationPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPatchAuthenticationPayloadGetAutoDiscoverUrlAttributeTypeOk(o.AutoDiscoverUrl); ok { + toSerialize["AutoDiscoverUrl"] = val + } + if val, ok := getPatchAuthenticationPayloadGetClientIdAttributeTypeOk(o.ClientId); ok { + toSerialize["ClientId"] = val + } + if val, ok := getPatchAuthenticationPayloadGetClientSecretAttributeTypeOk(o.ClientSecret); ok { + toSerialize["ClientSecret"] = val + } + if val, ok := getPatchAuthenticationPayloadGetIconUrlAttributeTypeOk(o.IconUrl); ok { + toSerialize["IconUrl"] = val + } + if val, ok := getPatchAuthenticationPayloadGetProviderAttributeTypeOk(o.Provider); ok { + toSerialize["Provider"] = val + } + if val, ok := getPatchAuthenticationPayloadGetScopesAttributeTypeOk(o.Scopes); ok { + toSerialize["Scopes"] = val + } + return toSerialize, nil +} + +type NullablePatchAuthenticationPayload struct { + value *PatchAuthenticationPayload + isSet bool +} + +func (v NullablePatchAuthenticationPayload) Get() *PatchAuthenticationPayload { + return v.value +} + +func (v *NullablePatchAuthenticationPayload) Set(val *PatchAuthenticationPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePatchAuthenticationPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchAuthenticationPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchAuthenticationPayload(val *PatchAuthenticationPayload) *NullablePatchAuthenticationPayload { + return &NullablePatchAuthenticationPayload{value: val, isSet: true} +} + +func (v NullablePatchAuthenticationPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchAuthenticationPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_patch_authentication_payload_test.go b/pkg/gitbeta/model_patch_authentication_payload_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_patch_authentication_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_patch_instance_payload.go b/pkg/gitbeta/model_patch_instance_payload.go new file mode 100644 index 00000000..9143dd44 --- /dev/null +++ b/pkg/gitbeta/model_patch_instance_payload.go @@ -0,0 +1,176 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the PatchInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchInstancePayload{} + +/* + types and functions for acl +*/ + +// isArray +type PatchInstancePayloadGetAclAttributeType = *[]string +type PatchInstancePayloadGetAclArgType = *[]string +type PatchInstancePayloadGetAclRetType = *[]string + +func getPatchInstancePayloadGetAclAttributeTypeOk(arg PatchInstancePayloadGetAclAttributeType) (ret PatchInstancePayloadGetAclRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setPatchInstancePayloadGetAclAttributeType(arg *PatchInstancePayloadGetAclAttributeType, val PatchInstancePayloadGetAclRetType) { + *arg = val +} + +/* + types and functions for feature_toggle +*/ + +// isModel +type PatchInstancePayloadGetFeatureToggleAttributeType = *FeatureToggle +type PatchInstancePayloadGetFeatureToggleArgType = FeatureToggle +type PatchInstancePayloadGetFeatureToggleRetType = FeatureToggle + +func getPatchInstancePayloadGetFeatureToggleAttributeTypeOk(arg PatchInstancePayloadGetFeatureToggleAttributeType) (ret PatchInstancePayloadGetFeatureToggleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchInstancePayloadGetFeatureToggleAttributeType(arg *PatchInstancePayloadGetFeatureToggleAttributeType, val PatchInstancePayloadGetFeatureToggleRetType) { + *arg = &val +} + +// PatchInstancePayload Properties to patch on an instance. All fields are optional. +type PatchInstancePayload struct { + // A list of CIDR network addresses that are allowed to access the instance. + Acl PatchInstancePayloadGetAclAttributeType `json:"acl,omitempty"` + FeatureToggle PatchInstancePayloadGetFeatureToggleAttributeType `json:"feature_toggle,omitempty"` +} + +// NewPatchInstancePayload instantiates a new PatchInstancePayload 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 NewPatchInstancePayload() *PatchInstancePayload { + this := PatchInstancePayload{} + return &this +} + +// NewPatchInstancePayloadWithDefaults instantiates a new PatchInstancePayload 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 NewPatchInstancePayloadWithDefaults() *PatchInstancePayload { + this := PatchInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *PatchInstancePayload) GetAcl() (res PatchInstancePayloadGetAclRetType) { + res, _ = o.GetAclOk() + return +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PatchInstancePayload) GetAclOk() (ret PatchInstancePayloadGetAclRetType, ok bool) { + return getPatchInstancePayloadGetAclAttributeTypeOk(o.Acl) +} + +// HasAcl returns a boolean if a field has been set. +func (o *PatchInstancePayload) HasAcl() bool { + _, ok := o.GetAclOk() + return ok +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *PatchInstancePayload) SetAcl(v PatchInstancePayloadGetAclRetType) { + setPatchInstancePayloadGetAclAttributeType(&o.Acl, v) +} + +// GetFeatureToggle returns the FeatureToggle field value if set, zero value otherwise. +func (o *PatchInstancePayload) GetFeatureToggle() (res PatchInstancePayloadGetFeatureToggleRetType) { + res, _ = o.GetFeatureToggleOk() + return +} + +// GetFeatureToggleOk returns a tuple with the FeatureToggle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchInstancePayload) GetFeatureToggleOk() (ret PatchInstancePayloadGetFeatureToggleRetType, ok bool) { + return getPatchInstancePayloadGetFeatureToggleAttributeTypeOk(o.FeatureToggle) +} + +// HasFeatureToggle returns a boolean if a field has been set. +func (o *PatchInstancePayload) HasFeatureToggle() bool { + _, ok := o.GetFeatureToggleOk() + return ok +} + +// SetFeatureToggle gets a reference to the given FeatureToggle and assigns it to the FeatureToggle field. +func (o *PatchInstancePayload) SetFeatureToggle(v PatchInstancePayloadGetFeatureToggleRetType) { + setPatchInstancePayloadGetFeatureToggleAttributeType(&o.FeatureToggle, v) +} + +func (o PatchInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPatchInstancePayloadGetAclAttributeTypeOk(o.Acl); ok { + toSerialize["Acl"] = val + } + if val, ok := getPatchInstancePayloadGetFeatureToggleAttributeTypeOk(o.FeatureToggle); ok { + toSerialize["FeatureToggle"] = val + } + return toSerialize, nil +} + +type NullablePatchInstancePayload struct { + value *PatchInstancePayload + isSet bool +} + +func (v NullablePatchInstancePayload) Get() *PatchInstancePayload { + return v.value +} + +func (v *NullablePatchInstancePayload) Set(val *PatchInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullablePatchInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchInstancePayload(val *PatchInstancePayload) *NullablePatchInstancePayload { + return &NullablePatchInstancePayload{value: val, isSet: true} +} + +func (v NullablePatchInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_patch_instance_payload_test.go b/pkg/gitbeta/model_patch_instance_payload_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_patch_instance_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_patch_operation.go b/pkg/gitbeta/model_patch_operation.go new file mode 100644 index 00000000..62580ffe --- /dev/null +++ b/pkg/gitbeta/model_patch_operation.go @@ -0,0 +1,325 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the PatchOperation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchOperation{} + +/* + types and functions for op +*/ + +// isEnum + +// PatchOperationOp The patch operation to perform. +// value type for enums +type PatchOperationOp string + +// List of Op +const ( + PATCHOPERATIONOP_ADD PatchOperationOp = "add" + PATCHOPERATIONOP_REMOVE PatchOperationOp = "remove" +) + +// All allowed values of PatchOperation enum +var AllowedPatchOperationOpEnumValues = []PatchOperationOp{ + "add", + "remove", +} + +func (v *PatchOperationOp) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson PatchOperationOp + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := PatchOperationOp(value) + for _, existing := range AllowedPatchOperationOpEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PatchOperation", value) +} + +// NewPatchOperationOpFromValue returns a pointer to a valid PatchOperationOp +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPatchOperationOpFromValue(v PatchOperationOp) (*PatchOperationOp, error) { + ev := PatchOperationOp(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PatchOperationOp: valid values are %v", v, AllowedPatchOperationOpEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PatchOperationOp) IsValid() bool { + for _, existing := range AllowedPatchOperationOpEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to OpOp value +func (v PatchOperationOp) Ptr() *PatchOperationOp { + return &v +} + +type NullablePatchOperationOp struct { + value *PatchOperationOp + isSet bool +} + +func (v NullablePatchOperationOp) Get() *PatchOperationOp { + return v.value +} + +func (v *NullablePatchOperationOp) Set(val *PatchOperationOp) { + v.value = val + v.isSet = true +} + +func (v NullablePatchOperationOp) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchOperationOp) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchOperationOp(val *PatchOperationOp) *NullablePatchOperationOp { + return &NullablePatchOperationOp{value: val, isSet: true} +} + +func (v NullablePatchOperationOp) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchOperationOp) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type PatchOperationGetOpAttributeType = *PatchOperationOp +type PatchOperationGetOpArgType = PatchOperationOp +type PatchOperationGetOpRetType = PatchOperationOp + +func getPatchOperationGetOpAttributeTypeOk(arg PatchOperationGetOpAttributeType) (ret PatchOperationGetOpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchOperationGetOpAttributeType(arg *PatchOperationGetOpAttributeType, val PatchOperationGetOpRetType) { + *arg = &val +} + +/* + types and functions for path +*/ + +// isNotNullableString +type PatchOperationGetPathAttributeType = *string + +func getPatchOperationGetPathAttributeTypeOk(arg PatchOperationGetPathAttributeType) (ret PatchOperationGetPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchOperationGetPathAttributeType(arg *PatchOperationGetPathAttributeType, val PatchOperationGetPathRetType) { + *arg = &val +} + +type PatchOperationGetPathArgType = string +type PatchOperationGetPathRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type PatchOperationGetValueAttributeType = *string + +func getPatchOperationGetValueAttributeTypeOk(arg PatchOperationGetValueAttributeType) (ret PatchOperationGetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPatchOperationGetValueAttributeType(arg *PatchOperationGetValueAttributeType, val PatchOperationGetValueRetType) { + *arg = &val +} + +type PatchOperationGetValueArgType = string +type PatchOperationGetValueRetType = string + +// PatchOperation Request a STACKIT Git instance to be patch with these properties. +type PatchOperation struct { + // The patch operation to perform. + // REQUIRED + Op PatchOperationGetOpAttributeType `json:"op" required:"true"` + // An RFC6901 JSON Pointer to the target location. + // REQUIRED + Path PatchOperationGetPathAttributeType `json:"path" required:"true"` + // The value to be used for 'add' and 'remove' operations. + Value PatchOperationGetValueAttributeType `json:"value,omitempty"` +} + +type _PatchOperation PatchOperation + +// NewPatchOperation instantiates a new PatchOperation 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 NewPatchOperation(op PatchOperationGetOpArgType, path PatchOperationGetPathArgType) *PatchOperation { + this := PatchOperation{} + setPatchOperationGetOpAttributeType(&this.Op, op) + setPatchOperationGetPathAttributeType(&this.Path, path) + return &this +} + +// NewPatchOperationWithDefaults instantiates a new PatchOperation 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 NewPatchOperationWithDefaults() *PatchOperation { + this := PatchOperation{} + return &this +} + +// GetOp returns the Op field value +func (o *PatchOperation) GetOp() (ret PatchOperationGetOpRetType) { + ret, _ = o.GetOpOk() + return ret +} + +// GetOpOk returns a tuple with the Op field value +// and a boolean to check if the value has been set. +func (o *PatchOperation) GetOpOk() (ret PatchOperationGetOpRetType, ok bool) { + return getPatchOperationGetOpAttributeTypeOk(o.Op) +} + +// SetOp sets field value +func (o *PatchOperation) SetOp(v PatchOperationGetOpRetType) { + setPatchOperationGetOpAttributeType(&o.Op, v) +} + +// GetPath returns the Path field value +func (o *PatchOperation) GetPath() (ret PatchOperationGetPathRetType) { + ret, _ = o.GetPathOk() + return ret +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *PatchOperation) GetPathOk() (ret PatchOperationGetPathRetType, ok bool) { + return getPatchOperationGetPathAttributeTypeOk(o.Path) +} + +// SetPath sets field value +func (o *PatchOperation) SetPath(v PatchOperationGetPathRetType) { + setPatchOperationGetPathAttributeType(&o.Path, v) +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *PatchOperation) GetValue() (res PatchOperationGetValueRetType) { + res, _ = o.GetValueOk() + return +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchOperation) GetValueOk() (ret PatchOperationGetValueRetType, ok bool) { + return getPatchOperationGetValueAttributeTypeOk(o.Value) +} + +// HasValue returns a boolean if a field has been set. +func (o *PatchOperation) HasValue() bool { + _, ok := o.GetValueOk() + return ok +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *PatchOperation) SetValue(v PatchOperationGetValueRetType) { + setPatchOperationGetValueAttributeType(&o.Value, v) +} + +func (o PatchOperation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPatchOperationGetOpAttributeTypeOk(o.Op); ok { + toSerialize["Op"] = val + } + if val, ok := getPatchOperationGetPathAttributeTypeOk(o.Path); ok { + toSerialize["Path"] = val + } + if val, ok := getPatchOperationGetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullablePatchOperation struct { + value *PatchOperation + isSet bool +} + +func (v NullablePatchOperation) Get() *PatchOperation { + return v.value +} + +func (v *NullablePatchOperation) Set(val *PatchOperation) { + v.value = val + v.isSet = true +} + +func (v NullablePatchOperation) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchOperation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchOperation(val *PatchOperation) *NullablePatchOperation { + return &NullablePatchOperation{value: val, isSet: true} +} + +func (v NullablePatchOperation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchOperation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_patch_operation_test.go b/pkg/gitbeta/model_patch_operation_test.go new file mode 100644 index 00000000..8775d61c --- /dev/null +++ b/pkg/gitbeta/model_patch_operation_test.go @@ -0,0 +1,58 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "testing" +) + +// isEnum + +func TestPatchOperationOp_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"add"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"remove"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := PatchOperationOp("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/gitbeta/model_runner.go b/pkg/gitbeta/model_runner.go new file mode 100644 index 00000000..4f3cceec --- /dev/null +++ b/pkg/gitbeta/model_runner.go @@ -0,0 +1,258 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Runner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Runner{} + +/* + types and functions for created_at +*/ + +// isDateTime +type RunnerGetCreatedAtAttributeType = *time.Time +type RunnerGetCreatedAtArgType = time.Time +type RunnerGetCreatedAtRetType = time.Time + +func getRunnerGetCreatedAtAttributeTypeOk(arg RunnerGetCreatedAtAttributeType) (ret RunnerGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerGetCreatedAtAttributeType(arg *RunnerGetCreatedAtAttributeType, val RunnerGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type RunnerGetIdAttributeType = *string + +func getRunnerGetIdAttributeTypeOk(arg RunnerGetIdAttributeType) (ret RunnerGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerGetIdAttributeType(arg *RunnerGetIdAttributeType, val RunnerGetIdRetType) { + *arg = &val +} + +type RunnerGetIdArgType = string +type RunnerGetIdRetType = string + +/* + types and functions for labels +*/ + +// isArray +type RunnerGetLabelsAttributeType = *[]string +type RunnerGetLabelsArgType = []string +type RunnerGetLabelsRetType = []string + +func getRunnerGetLabelsAttributeTypeOk(arg RunnerGetLabelsAttributeType) (ret RunnerGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerGetLabelsAttributeType(arg *RunnerGetLabelsAttributeType, val RunnerGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type RunnerGetStatusAttributeType = *string + +func getRunnerGetStatusAttributeTypeOk(arg RunnerGetStatusAttributeType) (ret RunnerGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerGetStatusAttributeType(arg *RunnerGetStatusAttributeType, val RunnerGetStatusRetType) { + *arg = &val +} + +type RunnerGetStatusArgType = string +type RunnerGetStatusRetType = string + +// Runner Describes a runner associated to a STACKIT Git instance. +type Runner struct { + // REQUIRED + CreatedAt RunnerGetCreatedAtAttributeType `json:"created_at" required:"true"` + // REQUIRED + Id RunnerGetIdAttributeType `json:"id" required:"true"` + // REQUIRED + Labels RunnerGetLabelsAttributeType `json:"labels" required:"true"` + // The current status of the runner. + // REQUIRED + Status RunnerGetStatusAttributeType `json:"status" required:"true"` +} + +type _Runner Runner + +// NewRunner instantiates a new Runner 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 NewRunner(createdAt RunnerGetCreatedAtArgType, id RunnerGetIdArgType, labels RunnerGetLabelsArgType, status RunnerGetStatusArgType) *Runner { + this := Runner{} + setRunnerGetCreatedAtAttributeType(&this.CreatedAt, createdAt) + setRunnerGetIdAttributeType(&this.Id, id) + setRunnerGetLabelsAttributeType(&this.Labels, labels) + setRunnerGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewRunnerWithDefaults instantiates a new Runner 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 NewRunnerWithDefaults() *Runner { + this := Runner{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Runner) GetCreatedAt() (ret RunnerGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() + return ret +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *Runner) GetCreatedAtOk() (ret RunnerGetCreatedAtRetType, ok bool) { + return getRunnerGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// SetCreatedAt sets field value +func (o *Runner) SetCreatedAt(v RunnerGetCreatedAtRetType) { + setRunnerGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value +func (o *Runner) GetId() (ret RunnerGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Runner) GetIdOk() (ret RunnerGetIdRetType, ok bool) { + return getRunnerGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Runner) SetId(v RunnerGetIdRetType) { + setRunnerGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value +func (o *Runner) GetLabels() (ret RunnerGetLabelsRetType) { + ret, _ = o.GetLabelsOk() + return ret +} + +// GetLabelsOk returns a tuple with the Labels field value +// and a boolean to check if the value has been set. +func (o *Runner) GetLabelsOk() (ret RunnerGetLabelsRetType, ok bool) { + return getRunnerGetLabelsAttributeTypeOk(o.Labels) +} + +// SetLabels sets field value +func (o *Runner) SetLabels(v RunnerGetLabelsRetType) { + setRunnerGetLabelsAttributeType(&o.Labels, v) +} + +// GetStatus returns the Status field value +func (o *Runner) GetStatus() (ret RunnerGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Runner) GetStatusOk() (ret RunnerGetStatusRetType, ok bool) { + return getRunnerGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Runner) SetStatus(v RunnerGetStatusRetType) { + setRunnerGetStatusAttributeType(&o.Status, v) +} + +func (o Runner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRunnerGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getRunnerGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRunnerGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getRunnerGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableRunner struct { + value *Runner + isSet bool +} + +func (v NullableRunner) Get() *Runner { + return v.value +} + +func (v *NullableRunner) Set(val *Runner) { + v.value = val + v.isSet = true +} + +func (v NullableRunner) IsSet() bool { + return v.isSet +} + +func (v *NullableRunner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRunner(val *Runner) *NullableRunner { + return &NullableRunner{value: val, isSet: true} +} + +func (v NullableRunner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRunner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_runner_runtime.go b/pkg/gitbeta/model_runner_runtime.go new file mode 100644 index 00000000..ba5d2e4a --- /dev/null +++ b/pkg/gitbeta/model_runner_runtime.go @@ -0,0 +1,307 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the RunnerRuntime type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RunnerRuntime{} + +/* + types and functions for availability +*/ + +// isNotNullableString +type RunnerRuntimeGetAvailabilityAttributeType = *string + +func getRunnerRuntimeGetAvailabilityAttributeTypeOk(arg RunnerRuntimeGetAvailabilityAttributeType) (ret RunnerRuntimeGetAvailabilityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeGetAvailabilityAttributeType(arg *RunnerRuntimeGetAvailabilityAttributeType, val RunnerRuntimeGetAvailabilityRetType) { + *arg = &val +} + +type RunnerRuntimeGetAvailabilityArgType = string +type RunnerRuntimeGetAvailabilityRetType = string + +/* + types and functions for description +*/ + +// isNotNullableString +type RunnerRuntimeGetDescriptionAttributeType = *string + +func getRunnerRuntimeGetDescriptionAttributeTypeOk(arg RunnerRuntimeGetDescriptionAttributeType) (ret RunnerRuntimeGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeGetDescriptionAttributeType(arg *RunnerRuntimeGetDescriptionAttributeType, val RunnerRuntimeGetDescriptionRetType) { + *arg = &val +} + +type RunnerRuntimeGetDescriptionArgType = string +type RunnerRuntimeGetDescriptionRetType = string + +/* + types and functions for display_name +*/ + +// isNotNullableString +type RunnerRuntimeGetDisplayNameAttributeType = *string + +func getRunnerRuntimeGetDisplayNameAttributeTypeOk(arg RunnerRuntimeGetDisplayNameAttributeType) (ret RunnerRuntimeGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeGetDisplayNameAttributeType(arg *RunnerRuntimeGetDisplayNameAttributeType, val RunnerRuntimeGetDisplayNameRetType) { + *arg = &val +} + +type RunnerRuntimeGetDisplayNameArgType = string +type RunnerRuntimeGetDisplayNameRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type RunnerRuntimeGetIdAttributeType = *string + +func getRunnerRuntimeGetIdAttributeTypeOk(arg RunnerRuntimeGetIdAttributeType) (ret RunnerRuntimeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeGetIdAttributeType(arg *RunnerRuntimeGetIdAttributeType, val RunnerRuntimeGetIdRetType) { + *arg = &val +} + +type RunnerRuntimeGetIdArgType = string +type RunnerRuntimeGetIdRetType = string + +/* + types and functions for label +*/ + +// isNotNullableString +type RunnerRuntimeGetLabelAttributeType = *string + +func getRunnerRuntimeGetLabelAttributeTypeOk(arg RunnerRuntimeGetLabelAttributeType) (ret RunnerRuntimeGetLabelRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeGetLabelAttributeType(arg *RunnerRuntimeGetLabelAttributeType, val RunnerRuntimeGetLabelRetType) { + *arg = &val +} + +type RunnerRuntimeGetLabelArgType = string +type RunnerRuntimeGetLabelRetType = string + +// RunnerRuntime Describes a STACKIT Git Runner runtime. +type RunnerRuntime struct { + // Indicates the availability of the runner label + // REQUIRED + Availability RunnerRuntimeGetAvailabilityAttributeType `json:"availability" required:"true"` + // Human-friendly description of the runtime and it's capabilities. + // REQUIRED + Description RunnerRuntimeGetDescriptionAttributeType `json:"description" required:"true"` + // Human-friendly name of the runtime. + // REQUIRED + DisplayName RunnerRuntimeGetDisplayNameAttributeType `json:"display_name" required:"true"` + // Runtime identifier. + // REQUIRED + Id RunnerRuntimeGetIdAttributeType `json:"id" required:"true"` + // Runtime label. + // REQUIRED + Label RunnerRuntimeGetLabelAttributeType `json:"label" required:"true"` +} + +type _RunnerRuntime RunnerRuntime + +// NewRunnerRuntime instantiates a new RunnerRuntime 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 NewRunnerRuntime(availability RunnerRuntimeGetAvailabilityArgType, description RunnerRuntimeGetDescriptionArgType, displayName RunnerRuntimeGetDisplayNameArgType, id RunnerRuntimeGetIdArgType, label RunnerRuntimeGetLabelArgType) *RunnerRuntime { + this := RunnerRuntime{} + setRunnerRuntimeGetAvailabilityAttributeType(&this.Availability, availability) + setRunnerRuntimeGetDescriptionAttributeType(&this.Description, description) + setRunnerRuntimeGetDisplayNameAttributeType(&this.DisplayName, displayName) + setRunnerRuntimeGetIdAttributeType(&this.Id, id) + setRunnerRuntimeGetLabelAttributeType(&this.Label, label) + return &this +} + +// NewRunnerRuntimeWithDefaults instantiates a new RunnerRuntime 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 NewRunnerRuntimeWithDefaults() *RunnerRuntime { + this := RunnerRuntime{} + return &this +} + +// GetAvailability returns the Availability field value +func (o *RunnerRuntime) GetAvailability() (ret RunnerRuntimeGetAvailabilityRetType) { + ret, _ = o.GetAvailabilityOk() + return ret +} + +// GetAvailabilityOk returns a tuple with the Availability field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntime) GetAvailabilityOk() (ret RunnerRuntimeGetAvailabilityRetType, ok bool) { + return getRunnerRuntimeGetAvailabilityAttributeTypeOk(o.Availability) +} + +// SetAvailability sets field value +func (o *RunnerRuntime) SetAvailability(v RunnerRuntimeGetAvailabilityRetType) { + setRunnerRuntimeGetAvailabilityAttributeType(&o.Availability, v) +} + +// GetDescription returns the Description field value +func (o *RunnerRuntime) GetDescription() (ret RunnerRuntimeGetDescriptionRetType) { + ret, _ = o.GetDescriptionOk() + return ret +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntime) GetDescriptionOk() (ret RunnerRuntimeGetDescriptionRetType, ok bool) { + return getRunnerRuntimeGetDescriptionAttributeTypeOk(o.Description) +} + +// SetDescription sets field value +func (o *RunnerRuntime) SetDescription(v RunnerRuntimeGetDescriptionRetType) { + setRunnerRuntimeGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *RunnerRuntime) GetDisplayName() (ret RunnerRuntimeGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntime) GetDisplayNameOk() (ret RunnerRuntimeGetDisplayNameRetType, ok bool) { + return getRunnerRuntimeGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *RunnerRuntime) SetDisplayName(v RunnerRuntimeGetDisplayNameRetType) { + setRunnerRuntimeGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetId returns the Id field value +func (o *RunnerRuntime) GetId() (ret RunnerRuntimeGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntime) GetIdOk() (ret RunnerRuntimeGetIdRetType, ok bool) { + return getRunnerRuntimeGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *RunnerRuntime) SetId(v RunnerRuntimeGetIdRetType) { + setRunnerRuntimeGetIdAttributeType(&o.Id, v) +} + +// GetLabel returns the Label field value +func (o *RunnerRuntime) GetLabel() (ret RunnerRuntimeGetLabelRetType) { + ret, _ = o.GetLabelOk() + return ret +} + +// GetLabelOk returns a tuple with the Label field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntime) GetLabelOk() (ret RunnerRuntimeGetLabelRetType, ok bool) { + return getRunnerRuntimeGetLabelAttributeTypeOk(o.Label) +} + +// SetLabel sets field value +func (o *RunnerRuntime) SetLabel(v RunnerRuntimeGetLabelRetType) { + setRunnerRuntimeGetLabelAttributeType(&o.Label, v) +} + +func (o RunnerRuntime) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRunnerRuntimeGetAvailabilityAttributeTypeOk(o.Availability); ok { + toSerialize["Availability"] = val + } + if val, ok := getRunnerRuntimeGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getRunnerRuntimeGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getRunnerRuntimeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRunnerRuntimeGetLabelAttributeTypeOk(o.Label); ok { + toSerialize["Label"] = val + } + return toSerialize, nil +} + +type NullableRunnerRuntime struct { + value *RunnerRuntime + isSet bool +} + +func (v NullableRunnerRuntime) Get() *RunnerRuntime { + return v.value +} + +func (v *NullableRunnerRuntime) Set(val *RunnerRuntime) { + v.value = val + v.isSet = true +} + +func (v NullableRunnerRuntime) IsSet() bool { + return v.isSet +} + +func (v *NullableRunnerRuntime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRunnerRuntime(val *RunnerRuntime) *NullableRunnerRuntime { + return &NullableRunnerRuntime{value: val, isSet: true} +} + +func (v NullableRunnerRuntime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRunnerRuntime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_runner_runtime_list.go b/pkg/gitbeta/model_runner_runtime_list.go new file mode 100644 index 00000000..bd8a2f89 --- /dev/null +++ b/pkg/gitbeta/model_runner_runtime_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" +) + +// checks if the RunnerRuntimeList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RunnerRuntimeList{} + +/* + types and functions for items +*/ + +// isArray +type RunnerRuntimeListGetItemsAttributeType = *[]RunnerRuntime +type RunnerRuntimeListGetItemsArgType = []RunnerRuntime +type RunnerRuntimeListGetItemsRetType = []RunnerRuntime + +func getRunnerRuntimeListGetItemsAttributeTypeOk(arg RunnerRuntimeListGetItemsAttributeType) (ret RunnerRuntimeListGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRunnerRuntimeListGetItemsAttributeType(arg *RunnerRuntimeListGetItemsAttributeType, val RunnerRuntimeListGetItemsRetType) { + *arg = &val +} + +// RunnerRuntimeList A list of STACKIT Git RunnerLabels. +type RunnerRuntimeList struct { + // REQUIRED + Items RunnerRuntimeListGetItemsAttributeType `json:"items" required:"true"` +} + +type _RunnerRuntimeList RunnerRuntimeList + +// NewRunnerRuntimeList instantiates a new RunnerRuntimeList 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 NewRunnerRuntimeList(items RunnerRuntimeListGetItemsArgType) *RunnerRuntimeList { + this := RunnerRuntimeList{} + setRunnerRuntimeListGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewRunnerRuntimeListWithDefaults instantiates a new RunnerRuntimeList 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 NewRunnerRuntimeListWithDefaults() *RunnerRuntimeList { + this := RunnerRuntimeList{} + return &this +} + +// GetItems returns the Items field value +func (o *RunnerRuntimeList) GetItems() (ret RunnerRuntimeListGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *RunnerRuntimeList) GetItemsOk() (ret RunnerRuntimeListGetItemsRetType, ok bool) { + return getRunnerRuntimeListGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *RunnerRuntimeList) SetItems(v RunnerRuntimeListGetItemsRetType) { + setRunnerRuntimeListGetItemsAttributeType(&o.Items, v) +} + +func (o RunnerRuntimeList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRunnerRuntimeListGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableRunnerRuntimeList struct { + value *RunnerRuntimeList + isSet bool +} + +func (v NullableRunnerRuntimeList) Get() *RunnerRuntimeList { + return v.value +} + +func (v *NullableRunnerRuntimeList) Set(val *RunnerRuntimeList) { + v.value = val + v.isSet = true +} + +func (v NullableRunnerRuntimeList) IsSet() bool { + return v.isSet +} + +func (v *NullableRunnerRuntimeList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRunnerRuntimeList(val *RunnerRuntimeList) *NullableRunnerRuntimeList { + return &NullableRunnerRuntimeList{value: val, isSet: true} +} + +func (v NullableRunnerRuntimeList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRunnerRuntimeList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/gitbeta/model_runner_runtime_list_test.go b/pkg/gitbeta/model_runner_runtime_list_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_runner_runtime_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_runner_runtime_test.go b/pkg/gitbeta/model_runner_runtime_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_runner_runtime_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/model_runner_test.go b/pkg/gitbeta/model_runner_test.go new file mode 100644 index 00000000..cc6f9fc0 --- /dev/null +++ b/pkg/gitbeta/model_runner_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta diff --git a/pkg/gitbeta/utils.go b/pkg/gitbeta/utils.go new file mode 100644 index 00000000..2001281f --- /dev/null +++ b/pkg/gitbeta/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT Git API + +STACKIT Git management API. + +API version: 1beta.0.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package gitbeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/iaasalpha/.openapi-generator/VERSION b/pkg/iaasalpha/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/iaasalpha/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/iaasalpha/api_default.go b/pkg/iaasalpha/api_default.go new file mode 100644 index 00000000..05f9ca82 --- /dev/null +++ b/pkg/iaasalpha/api_default.go @@ -0,0 +1,3830 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + AddRoutesToRoutingTable Create new routes in a routing table. + Create new routes in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiAddRoutesToRoutingTableRequest + */ + AddRoutesToRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiAddRoutesToRoutingTableRequest + /* + AddRoutesToRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RouteListResponse + + */ + AddRoutesToRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) + /* + AddRoutingTableToArea Create new routing table in a network area. + Create a new routing table in an existing network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiAddRoutingTableToAreaRequest + */ + AddRoutingTableToArea(ctx context.Context, organizationId string, areaId string, region string) ApiAddRoutingTableToAreaRequest + /* + AddRoutingTableToAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RoutingTable + + */ + AddRoutingTableToAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTable, error) + /* + CreateNetwork Create new network. + Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkRequest + */ + CreateNetwork(ctx context.Context, projectId string, region string) ApiCreateNetworkRequest + /* + CreateNetworkExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Network + + */ + CreateNetworkExecute(ctx context.Context, projectId string, region string) (*Network, error) + /* + DeleteNetwork Delete network. + Delete a network. If the network is still in use, the deletion will fail. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiDeleteNetworkRequest + */ + DeleteNetwork(ctx context.Context, projectId string, region string, networkId string) ApiDeleteNetworkRequest + /* + DeleteNetworkExecute executes the request + + */ + DeleteNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error + /* + DeleteRouteFromRoutingTable Delete a route in a routing table. + Delete a route in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteRouteFromRoutingTableRequest + */ + DeleteRouteFromRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiDeleteRouteFromRoutingTableRequest + /* + DeleteRouteFromRoutingTableExecute executes the request + + */ + DeleteRouteFromRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) error + /* + DeleteRoutingTableFromArea Delete a routing table. + Delete a routing table of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiDeleteRoutingTableFromAreaRequest + */ + DeleteRoutingTableFromArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiDeleteRoutingTableFromAreaRequest + /* + DeleteRoutingTableFromAreaExecute executes the request + + */ + DeleteRoutingTableFromAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) error + /* + GetNetwork Get network details. + Get details about a network of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiGetNetworkRequest + */ + GetNetwork(ctx context.Context, projectId string, region string, networkId string) ApiGetNetworkRequest + /* + GetNetworkExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return Network + + */ + GetNetworkExecute(ctx context.Context, projectId string, region string, networkId string) (*Network, error) + /* + GetRouteOfRoutingTable Get details about a route of a routing table. + Get details about a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetRouteOfRoutingTableRequest + */ + GetRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiGetRouteOfRoutingTableRequest + /* + GetRouteOfRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return Route + + */ + GetRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) + /* + GetRoutingTableOfArea Get details about a routing table. + Get details about a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiGetRoutingTableOfAreaRequest + */ + GetRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiGetRoutingTableOfAreaRequest + /* + GetRoutingTableOfAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RoutingTable + + */ + GetRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) + /* + ListNetworks List all networks inside a project. + Get a list of all networks inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListNetworksRequest + */ + ListNetworks(ctx context.Context, projectId string, region string) ApiListNetworksRequest + /* + ListNetworksExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return NetworkListResponse + + */ + ListNetworksExecute(ctx context.Context, projectId string, region string) (*NetworkListResponse, error) + /* + ListNetworksOfRoutingTable List all networks in a routing table. + Get a list of all networks in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiListNetworksOfRoutingTableRequest + */ + ListNetworksOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiListNetworksOfRoutingTableRequest + /* + ListNetworksOfRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return NetworkListResponse + + */ + ListNetworksOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*NetworkListResponse, error) + /* + ListRoutesOfRoutingTable List all routes in a routing table. + Get a list of all routes in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiListRoutesOfRoutingTableRequest + */ + ListRoutesOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiListRoutesOfRoutingTableRequest + /* + ListRoutesOfRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RouteListResponse + + */ + ListRoutesOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) + /* + ListRoutingTablesOfArea List all routing tables in a network area. + Get a list of all routing tables in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListRoutingTablesOfAreaRequest + */ + ListRoutingTablesOfArea(ctx context.Context, organizationId string, areaId string, region string) ApiListRoutingTablesOfAreaRequest + /* + ListRoutingTablesOfAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RoutingTableListResponse + + */ + ListRoutingTablesOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTableListResponse, error) + /* + PartialUpdateNetwork Update network settings. + Update the settings of a network inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiPartialUpdateNetworkRequest + */ + PartialUpdateNetwork(ctx context.Context, projectId string, region string, networkId string) ApiPartialUpdateNetworkRequest + /* + PartialUpdateNetworkExecute executes the request + + */ + PartialUpdateNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error + /* + UpdateRouteOfRoutingTable Update a route of a routing table. + Update a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiUpdateRouteOfRoutingTableRequest + */ + UpdateRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiUpdateRouteOfRoutingTableRequest + /* + UpdateRouteOfRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return Route + + */ + UpdateRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) + /* + UpdateRoutingTableOfArea Update a routing table. + Update a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiUpdateRoutingTableOfAreaRequest + */ + UpdateRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiUpdateRoutingTableOfAreaRequest + /* + UpdateRoutingTableOfAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RoutingTable + + */ + UpdateRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) +} + +type ApiAddRoutesToRoutingTableRequest interface { + // Request an addition of routes to a routing table. + AddRoutesToRoutingTablePayload(addRoutesToRoutingTablePayload AddRoutesToRoutingTablePayload) ApiAddRoutesToRoutingTableRequest + Execute() (*RouteListResponse, error) +} + +type ApiAddRoutingTableToAreaRequest interface { + // Request an addition of a routing table to an area. + AddRoutingTableToAreaPayload(addRoutingTableToAreaPayload AddRoutingTableToAreaPayload) ApiAddRoutingTableToAreaRequest + Execute() (*RoutingTable, error) +} + +type ApiCreateNetworkRequest interface { + // Request a network creation. + CreateNetworkPayload(createNetworkPayload CreateNetworkPayload) ApiCreateNetworkRequest + Execute() (*Network, error) +} + +type ApiDeleteNetworkRequest interface { + Execute() error +} + +type ApiDeleteRouteFromRoutingTableRequest interface { + Execute() error +} + +type ApiDeleteRoutingTableFromAreaRequest interface { + Execute() error +} + +type ApiGetNetworkRequest interface { + Execute() (*Network, error) +} + +type ApiGetRouteOfRoutingTableRequest interface { + Execute() (*Route, error) +} + +type ApiGetRoutingTableOfAreaRequest interface { + Execute() (*RoutingTable, error) +} + +type ApiListNetworksRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListNetworksRequest + Execute() (*NetworkListResponse, error) +} + +type ApiListNetworksOfRoutingTableRequest interface { + Execute() (*NetworkListResponse, error) +} + +type ApiListRoutesOfRoutingTableRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListRoutesOfRoutingTableRequest + Execute() (*RouteListResponse, error) +} + +type ApiListRoutingTablesOfAreaRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListRoutingTablesOfAreaRequest + Execute() (*RoutingTableListResponse, error) +} + +type ApiPartialUpdateNetworkRequest interface { + // Request an update of a network. + PartialUpdateNetworkPayload(partialUpdateNetworkPayload PartialUpdateNetworkPayload) ApiPartialUpdateNetworkRequest + Execute() error +} + +type ApiUpdateRouteOfRoutingTableRequest interface { + // Request an update of a route in a routing table. + UpdateRouteOfRoutingTablePayload(updateRouteOfRoutingTablePayload UpdateRouteOfRoutingTablePayload) ApiUpdateRouteOfRoutingTableRequest + Execute() (*Route, error) +} + +type ApiUpdateRoutingTableOfAreaRequest interface { + // Request an update of a routing table. + UpdateRoutingTableOfAreaPayload(updateRoutingTableOfAreaPayload UpdateRoutingTableOfAreaPayload) ApiUpdateRoutingTableOfAreaRequest + Execute() (*RoutingTable, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type AddRoutesToRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + addRoutesToRoutingTablePayload *AddRoutesToRoutingTablePayload +} + +// Request an addition of routes to a routing table. + +func (r AddRoutesToRoutingTableRequest) AddRoutesToRoutingTablePayload(addRoutesToRoutingTablePayload AddRoutesToRoutingTablePayload) ApiAddRoutesToRoutingTableRequest { + r.addRoutesToRoutingTablePayload = &addRoutesToRoutingTablePayload + return r +} + +func (r AddRoutesToRoutingTableRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddRoutesToRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if r.addRoutesToRoutingTablePayload == nil { + return localVarReturnValue, fmt.Errorf("addRoutesToRoutingTablePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.addRoutesToRoutingTablePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +AddRoutesToRoutingTable: Create new routes in a routing table. + +Create new routes in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiAddRoutesToRoutingTableRequest +*/ +func (a *APIClient) AddRoutesToRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiAddRoutesToRoutingTableRequest { + return AddRoutesToRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) AddRoutesToRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) { + r := AddRoutesToRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type AddRoutingTableToAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + addRoutingTableToAreaPayload *AddRoutingTableToAreaPayload +} + +// Request an addition of a routing table to an area. + +func (r AddRoutingTableToAreaRequest) AddRoutingTableToAreaPayload(addRoutingTableToAreaPayload AddRoutingTableToAreaPayload) ApiAddRoutingTableToAreaRequest { + r.addRoutingTableToAreaPayload = &addRoutingTableToAreaPayload + return r +} + +func (r AddRoutingTableToAreaRequest) Execute() (*RoutingTable, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTable + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddRoutingTableToArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.addRoutingTableToAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("addRoutingTableToAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.addRoutingTableToAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +AddRoutingTableToArea: Create new routing table in a network area. + +Create a new routing table in an existing network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiAddRoutingTableToAreaRequest +*/ +func (a *APIClient) AddRoutingTableToArea(ctx context.Context, organizationId string, areaId string, region string) ApiAddRoutingTableToAreaRequest { + return AddRoutingTableToAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) AddRoutingTableToAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTable, error) { + r := AddRoutingTableToAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type CreateNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createNetworkPayload *CreateNetworkPayload +} + +// Request a network creation. + +func (r CreateNetworkRequest) CreateNetworkPayload(createNetworkPayload CreateNetworkPayload) ApiCreateNetworkRequest { + r.createNetworkPayload = &createNetworkPayload + return r +} + +func (r CreateNetworkRequest) Execute() (*Network, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Network + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetwork") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/projects/{projectId}/regions/{region}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createNetworkPayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNetworkPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNetwork: Create new network. + +Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkRequest +*/ +func (a *APIClient) CreateNetwork(ctx context.Context, projectId string, region string) ApiCreateNetworkRequest { + return CreateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateNetworkExecute(ctx context.Context, projectId string, region string) (*Network, error) { + r := CreateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type DeleteNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string +} + +func (r DeleteNetworkRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetwork") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetwork: Delete network. + +Delete a network. If the network is still in use, the deletion will fail. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiDeleteNetworkRequest +*/ +func (a *APIClient) DeleteNetwork(ctx context.Context, projectId string, region string, networkId string) ApiDeleteNetworkRequest { + return DeleteNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) DeleteNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error { + r := DeleteNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type DeleteRouteFromRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + routeId string +} + +func (r DeleteRouteFromRoutingTableRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteRouteFromRoutingTable") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return fmt.Errorf("routingTableId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteRouteFromRoutingTable: Delete a route in a routing table. + +Delete a route in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteRouteFromRoutingTableRequest +*/ +func (a *APIClient) DeleteRouteFromRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiDeleteRouteFromRoutingTableRequest { + return DeleteRouteFromRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } +} + +func (a *APIClient) DeleteRouteFromRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) error { + r := DeleteRouteFromRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } + return r.Execute() +} + +type DeleteRoutingTableFromAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string +} + +func (r DeleteRoutingTableFromAreaRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteRoutingTableFromArea") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return fmt.Errorf("routingTableId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteRoutingTableFromArea: Delete a routing table. + +Delete a routing table of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiDeleteRoutingTableFromAreaRequest +*/ +func (a *APIClient) DeleteRoutingTableFromArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiDeleteRoutingTableFromAreaRequest { + return DeleteRoutingTableFromAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) DeleteRoutingTableFromAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) error { + r := DeleteRoutingTableFromAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type GetNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string +} + +func (r GetNetworkRequest) Execute() (*Network, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Network + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetwork") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNetwork: Get network details. + +Get details about a network of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiGetNetworkRequest +*/ +func (a *APIClient) GetNetwork(ctx context.Context, projectId string, region string, networkId string) ApiGetNetworkRequest { + return GetNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) GetNetworkExecute(ctx context.Context, projectId string, region string, networkId string) (*Network, error) { + r := GetNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type GetRouteOfRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + routeId string +} + +func (r GetRouteOfRoutingTableRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRouteOfRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetRouteOfRoutingTable: Get details about a route of a routing table. + +Get details about a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetRouteOfRoutingTableRequest +*/ +func (a *APIClient) GetRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiGetRouteOfRoutingTableRequest { + return GetRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } +} + +func (a *APIClient) GetRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) { + r := GetRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } + return r.Execute() +} + +type GetRoutingTableOfAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string +} + +func (r GetRoutingTableOfAreaRequest) Execute() (*RoutingTable, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTable + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRoutingTableOfArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetRoutingTableOfArea: Get details about a routing table. + +Get details about a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiGetRoutingTableOfAreaRequest +*/ +func (a *APIClient) GetRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiGetRoutingTableOfAreaRequest { + return GetRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) GetRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) { + r := GetRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type ListNetworksRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListNetworksRequest) LabelSelector(labelSelector string) ApiListNetworksRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListNetworksRequest) Execute() (*NetworkListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworks") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/projects/{projectId}/regions/{region}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworks: List all networks inside a project. + +Get a list of all networks inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListNetworksRequest +*/ +func (a *APIClient) ListNetworks(ctx context.Context, projectId string, region string) ApiListNetworksRequest { + return ListNetworksRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListNetworksExecute(ctx context.Context, projectId string, region string) (*NetworkListResponse, error) { + r := ListNetworksRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListNetworksOfRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string +} + +func (r ListNetworksOfRoutingTableRequest) Execute() (*NetworkListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworksOfRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworksOfRoutingTable: List all networks in a routing table. + +Get a list of all networks in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiListNetworksOfRoutingTableRequest +*/ +func (a *APIClient) ListNetworksOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiListNetworksOfRoutingTableRequest { + return ListNetworksOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) ListNetworksOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*NetworkListResponse, error) { + r := ListNetworksOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type ListRoutesOfRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListRoutesOfRoutingTableRequest) LabelSelector(labelSelector string) ApiListRoutesOfRoutingTableRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListRoutesOfRoutingTableRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListRoutesOfRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListRoutesOfRoutingTable: List all routes in a routing table. + +Get a list of all routes in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiListRoutesOfRoutingTableRequest +*/ +func (a *APIClient) ListRoutesOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiListRoutesOfRoutingTableRequest { + return ListRoutesOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) ListRoutesOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) { + r := ListRoutesOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type ListRoutingTablesOfAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListRoutingTablesOfAreaRequest) LabelSelector(labelSelector string) ApiListRoutingTablesOfAreaRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListRoutingTablesOfAreaRequest) Execute() (*RoutingTableListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTableListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListRoutingTablesOfArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListRoutingTablesOfArea: List all routing tables in a network area. + +Get a list of all routing tables in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListRoutingTablesOfAreaRequest +*/ +func (a *APIClient) ListRoutingTablesOfArea(ctx context.Context, organizationId string, areaId string, region string) ApiListRoutingTablesOfAreaRequest { + return ListRoutingTablesOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) ListRoutingTablesOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTableListResponse, error) { + r := ListRoutingTablesOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type PartialUpdateNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + partialUpdateNetworkPayload *PartialUpdateNetworkPayload +} + +// Request an update of a network. + +func (r PartialUpdateNetworkRequest) PartialUpdateNetworkPayload(partialUpdateNetworkPayload PartialUpdateNetworkPayload) ApiPartialUpdateNetworkRequest { + r.partialUpdateNetworkPayload = &partialUpdateNetworkPayload + return r +} + +func (r PartialUpdateNetworkRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetwork") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + if r.partialUpdateNetworkPayload == nil { + return fmt.Errorf("partialUpdateNetworkPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.partialUpdateNetworkPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +PartialUpdateNetwork: Update network settings. + +Update the settings of a network inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiPartialUpdateNetworkRequest +*/ +func (a *APIClient) PartialUpdateNetwork(ctx context.Context, projectId string, region string, networkId string) ApiPartialUpdateNetworkRequest { + return PartialUpdateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) PartialUpdateNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error { + r := PartialUpdateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type UpdateRouteOfRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + routeId string + updateRouteOfRoutingTablePayload *UpdateRouteOfRoutingTablePayload +} + +// Request an update of a route in a routing table. + +func (r UpdateRouteOfRoutingTableRequest) UpdateRouteOfRoutingTablePayload(updateRouteOfRoutingTablePayload UpdateRouteOfRoutingTablePayload) ApiUpdateRouteOfRoutingTableRequest { + r.updateRouteOfRoutingTablePayload = &updateRouteOfRoutingTablePayload + return r +} + +func (r UpdateRouteOfRoutingTableRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateRouteOfRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + if r.updateRouteOfRoutingTablePayload == nil { + return localVarReturnValue, fmt.Errorf("updateRouteOfRoutingTablePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateRouteOfRoutingTablePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateRouteOfRoutingTable: Update a route of a routing table. + +Update a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiUpdateRouteOfRoutingTableRequest +*/ +func (a *APIClient) UpdateRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiUpdateRouteOfRoutingTableRequest { + return UpdateRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } +} + +func (a *APIClient) UpdateRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) { + r := UpdateRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } + return r.Execute() +} + +type UpdateRoutingTableOfAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + updateRoutingTableOfAreaPayload *UpdateRoutingTableOfAreaPayload +} + +// Request an update of a routing table. + +func (r UpdateRoutingTableOfAreaRequest) UpdateRoutingTableOfAreaPayload(updateRoutingTableOfAreaPayload UpdateRoutingTableOfAreaPayload) ApiUpdateRoutingTableOfAreaRequest { + r.updateRoutingTableOfAreaPayload = &updateRoutingTableOfAreaPayload + return r +} + +func (r UpdateRoutingTableOfAreaRequest) Execute() (*RoutingTable, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTable + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateRoutingTableOfArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if r.updateRoutingTableOfAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("updateRoutingTableOfAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateRoutingTableOfAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateRoutingTableOfArea: Update a routing table. + +Update a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiUpdateRoutingTableOfAreaRequest +*/ +func (a *APIClient) UpdateRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiUpdateRoutingTableOfAreaRequest { + return UpdateRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) UpdateRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) { + r := UpdateRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} diff --git a/pkg/iaasalpha/api_default_test.go b/pkg/iaasalpha/api_default_test.go new file mode 100644 index 00000000..e0ab157a --- /dev/null +++ b/pkg/iaasalpha/api_default_test.go @@ -0,0 +1,966 @@ +/* +STACKIT IaaS API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package iaasalpha + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_iaasalpha_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService AddRoutesToRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RouteListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + addRoutesToRoutingTablePayload := AddRoutesToRoutingTablePayload{} + + resp, reqErr := apiClient.AddRoutesToRoutingTable(context.Background(), organizationId, areaId, region, routingTableId).AddRoutesToRoutingTablePayload(addRoutesToRoutingTablePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService AddRoutingTableToArea", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RoutingTable{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + addRoutingTableToAreaPayload := AddRoutingTableToAreaPayload{} + + resp, reqErr := apiClient.AddRoutingTableToArea(context.Background(), organizationId, areaId, region).AddRoutingTableToAreaPayload(addRoutingTableToAreaPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateNetwork", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/projects/{projectId}/regions/{region}/networks" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Network{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createNetworkPayload := CreateNetworkPayload{} + + resp, reqErr := apiClient.CreateNetwork(context.Background(), projectId, region).CreateNetworkPayload(createNetworkPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteNetwork", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + + reqErr := apiClient.DeleteNetwork(context.Background(), projectId, region, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteRouteFromRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + routeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + routeId := routeIdValue + + reqErr := apiClient.DeleteRouteFromRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteRoutingTableFromArea", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + + reqErr := apiClient.DeleteRoutingTableFromArea(context.Background(), organizationId, areaId, region, routingTableId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetNetwork", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Network{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + + resp, reqErr := apiClient.GetNetwork(context.Background(), projectId, region, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetRouteOfRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + routeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Route{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + routeId := routeIdValue + + resp, reqErr := apiClient.GetRouteOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetRoutingTableOfArea", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RoutingTable{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + + resp, reqErr := apiClient.GetRoutingTableOfArea(context.Background(), organizationId, areaId, region, routingTableId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworks", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/projects/{projectId}/regions/{region}/networks" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NetworkListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListNetworks(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworksOfRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/networks" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NetworkListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + + resp, reqErr := apiClient.ListNetworksOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListRoutesOfRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RouteListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + + resp, reqErr := apiClient.ListRoutesOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListRoutingTablesOfArea", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RoutingTableListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + + resp, reqErr := apiClient.ListRoutingTablesOfArea(context.Background(), organizationId, areaId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService PartialUpdateNetwork", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/projects/{projectId}/regions/{region}/networks/{networkId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + partialUpdateNetworkPayload := PartialUpdateNetworkPayload{} + + reqErr := apiClient.PartialUpdateNetwork(context.Background(), projectId, region, networkId).PartialUpdateNetworkPayload(partialUpdateNetworkPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService UpdateRouteOfRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + routeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Route{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + routeId := routeIdValue + updateRouteOfRoutingTablePayload := UpdateRouteOfRoutingTablePayload{} + + resp, reqErr := apiClient.UpdateRouteOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).UpdateRouteOfRoutingTablePayload(updateRouteOfRoutingTablePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateRoutingTableOfArea", func(t *testing.T) { + _apiUrlPath := "/v2alpha1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RoutingTable{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + updateRoutingTableOfAreaPayload := UpdateRoutingTableOfAreaPayload{} + + resp, reqErr := apiClient.UpdateRoutingTableOfArea(context.Background(), organizationId, areaId, region, routingTableId).UpdateRoutingTableOfAreaPayload(updateRoutingTableOfAreaPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/iaasalpha/client.go b/pkg/iaasalpha/client.go new file mode 100644 index 00000000..ecb8c6bc --- /dev/null +++ b/pkg/iaasalpha/client.go @@ -0,0 +1,628 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT IaaS API API v2alpha1 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/iaasalpha/configuration.go b/pkg/iaasalpha/configuration.go new file mode 100644 index 00000000..2edd836c --- /dev/null +++ b/pkg/iaasalpha/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/iaasalpha", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://iaas.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/iaasalpha/model_add_routes_to_routing_table_payload.go b/pkg/iaasalpha/model_add_routes_to_routing_table_payload.go new file mode 100644 index 00000000..b669e76e --- /dev/null +++ b/pkg/iaasalpha/model_add_routes_to_routing_table_payload.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the AddRoutesToRoutingTablePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddRoutesToRoutingTablePayload{} + +/* + types and functions for items +*/ + +// isArray +type AddRoutesToRoutingTablePayloadGetItemsAttributeType = *[]Route +type AddRoutesToRoutingTablePayloadGetItemsArgType = []Route +type AddRoutesToRoutingTablePayloadGetItemsRetType = []Route + +func getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(arg AddRoutesToRoutingTablePayloadGetItemsAttributeType) (ret AddRoutesToRoutingTablePayloadGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutesToRoutingTablePayloadGetItemsAttributeType(arg *AddRoutesToRoutingTablePayloadGetItemsAttributeType, val AddRoutesToRoutingTablePayloadGetItemsRetType) { + *arg = &val +} + +// AddRoutesToRoutingTablePayload Object represents a request to add network routes. +type AddRoutesToRoutingTablePayload struct { + // A list of routes. + // REQUIRED + Items AddRoutesToRoutingTablePayloadGetItemsAttributeType `json:"items" required:"true"` +} + +type _AddRoutesToRoutingTablePayload AddRoutesToRoutingTablePayload + +// NewAddRoutesToRoutingTablePayload instantiates a new AddRoutesToRoutingTablePayload 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 NewAddRoutesToRoutingTablePayload(items AddRoutesToRoutingTablePayloadGetItemsArgType) *AddRoutesToRoutingTablePayload { + this := AddRoutesToRoutingTablePayload{} + setAddRoutesToRoutingTablePayloadGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewAddRoutesToRoutingTablePayloadWithDefaults instantiates a new AddRoutesToRoutingTablePayload 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 NewAddRoutesToRoutingTablePayloadWithDefaults() *AddRoutesToRoutingTablePayload { + this := AddRoutesToRoutingTablePayload{} + return &this +} + +// GetItems returns the Items field value +func (o *AddRoutesToRoutingTablePayload) GetItems() (ret AddRoutesToRoutingTablePayloadGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *AddRoutesToRoutingTablePayload) GetItemsOk() (ret AddRoutesToRoutingTablePayloadGetItemsRetType, ok bool) { + return getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *AddRoutesToRoutingTablePayload) SetItems(v AddRoutesToRoutingTablePayloadGetItemsRetType) { + setAddRoutesToRoutingTablePayloadGetItemsAttributeType(&o.Items, v) +} + +func (o AddRoutesToRoutingTablePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableAddRoutesToRoutingTablePayload struct { + value *AddRoutesToRoutingTablePayload + isSet bool +} + +func (v NullableAddRoutesToRoutingTablePayload) Get() *AddRoutesToRoutingTablePayload { + return v.value +} + +func (v *NullableAddRoutesToRoutingTablePayload) Set(val *AddRoutesToRoutingTablePayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddRoutesToRoutingTablePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddRoutesToRoutingTablePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddRoutesToRoutingTablePayload(val *AddRoutesToRoutingTablePayload) *NullableAddRoutesToRoutingTablePayload { + return &NullableAddRoutesToRoutingTablePayload{value: val, isSet: true} +} + +func (v NullableAddRoutesToRoutingTablePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddRoutesToRoutingTablePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_add_routes_to_routing_table_payload_test.go b/pkg/iaasalpha/model_add_routes_to_routing_table_payload_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_add_routes_to_routing_table_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_add_routing_table_to_area_payload.go b/pkg/iaasalpha/model_add_routing_table_to_area_payload.go new file mode 100644 index 00000000..e826e44f --- /dev/null +++ b/pkg/iaasalpha/model_add_routing_table_to_area_payload.go @@ -0,0 +1,518 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" + "time" +) + +// checks if the AddRoutingTableToAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddRoutingTableToAreaPayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type AddRoutingTableToAreaPayloadGetCreatedAtAttributeType = *time.Time +type AddRoutingTableToAreaPayloadGetCreatedAtArgType = time.Time +type AddRoutingTableToAreaPayloadGetCreatedAtRetType = time.Time + +func getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetCreatedAtAttributeType) (ret AddRoutingTableToAreaPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetCreatedAtAttributeType(arg *AddRoutingTableToAreaPayloadGetCreatedAtAttributeType, val AddRoutingTableToAreaPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for default +*/ + +// isBoolean +type AddRoutingTableToAreaPayloadgetDefaultAttributeType = *bool +type AddRoutingTableToAreaPayloadgetDefaultArgType = bool +type AddRoutingTableToAreaPayloadgetDefaultRetType = bool + +func getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetDefaultAttributeType) (ret AddRoutingTableToAreaPayloadgetDefaultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadgetDefaultAttributeType(arg *AddRoutingTableToAreaPayloadgetDefaultAttributeType, val AddRoutingTableToAreaPayloadgetDefaultRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type AddRoutingTableToAreaPayloadGetDescriptionAttributeType = *string + +func getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetDescriptionAttributeType) (ret AddRoutingTableToAreaPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetDescriptionAttributeType(arg *AddRoutingTableToAreaPayloadGetDescriptionAttributeType, val AddRoutingTableToAreaPayloadGetDescriptionRetType) { + *arg = &val +} + +type AddRoutingTableToAreaPayloadGetDescriptionArgType = string +type AddRoutingTableToAreaPayloadGetDescriptionRetType = string + +/* + types and functions for dynamicRoutes +*/ + +// isBoolean +type AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType = *bool +type AddRoutingTableToAreaPayloadgetDynamicRoutesArgType = bool +type AddRoutingTableToAreaPayloadgetDynamicRoutesRetType = bool + +func getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType) (ret AddRoutingTableToAreaPayloadgetDynamicRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType(arg *AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType, val AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type AddRoutingTableToAreaPayloadGetIdAttributeType = *string + +func getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetIdAttributeType) (ret AddRoutingTableToAreaPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetIdAttributeType(arg *AddRoutingTableToAreaPayloadGetIdAttributeType, val AddRoutingTableToAreaPayloadGetIdRetType) { + *arg = &val +} + +type AddRoutingTableToAreaPayloadGetIdArgType = string +type AddRoutingTableToAreaPayloadGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type AddRoutingTableToAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type AddRoutingTableToAreaPayloadGetLabelsArgType = map[string]interface{} +type AddRoutingTableToAreaPayloadGetLabelsRetType = map[string]interface{} + +func getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetLabelsAttributeType) (ret AddRoutingTableToAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetLabelsAttributeType(arg *AddRoutingTableToAreaPayloadGetLabelsAttributeType, val AddRoutingTableToAreaPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type AddRoutingTableToAreaPayloadGetNameAttributeType = *string + +func getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetNameAttributeType) (ret AddRoutingTableToAreaPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetNameAttributeType(arg *AddRoutingTableToAreaPayloadGetNameAttributeType, val AddRoutingTableToAreaPayloadGetNameRetType) { + *arg = &val +} + +type AddRoutingTableToAreaPayloadGetNameArgType = string +type AddRoutingTableToAreaPayloadGetNameRetType = string + +/* + types and functions for systemRoutes +*/ + +// isBoolean +type AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType = *bool +type AddRoutingTableToAreaPayloadgetSystemRoutesArgType = bool +type AddRoutingTableToAreaPayloadgetSystemRoutesRetType = bool + +func getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType) (ret AddRoutingTableToAreaPayloadgetSystemRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadgetSystemRoutesAttributeType(arg *AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType, val AddRoutingTableToAreaPayloadgetSystemRoutesRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType = *time.Time +type AddRoutingTableToAreaPayloadGetUpdatedAtArgType = time.Time +type AddRoutingTableToAreaPayloadGetUpdatedAtRetType = time.Time + +func getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType) (ret AddRoutingTableToAreaPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetUpdatedAtAttributeType(arg *AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType, val AddRoutingTableToAreaPayloadGetUpdatedAtRetType) { + *arg = &val +} + +// AddRoutingTableToAreaPayload An object representing a routing table. +type AddRoutingTableToAreaPayload struct { + // Date-time when resource was created. + CreatedAt AddRoutingTableToAreaPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // This is the default routing table. It can't be deleted and is used if the user does not specify it otherwise. + Default AddRoutingTableToAreaPayloadgetDefaultAttributeType `json:"default,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description AddRoutingTableToAreaPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // A config setting for a routing table which allows propagation of dynamic routes to this routing table. + DynamicRoutes AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"` + // Universally Unique Identifier (UUID). + Id AddRoutingTableToAreaPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels AddRoutingTableToAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name AddRoutingTableToAreaPayloadGetNameAttributeType `json:"name" required:"true"` + // A config setting for a routing table which allows installation of automatic system routes for connectivity between projects in the same SNA. + SystemRoutes AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType `json:"systemRoutes,omitempty"` + // Date-time when resource was last updated. + UpdatedAt AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _AddRoutingTableToAreaPayload AddRoutingTableToAreaPayload + +// NewAddRoutingTableToAreaPayload instantiates a new AddRoutingTableToAreaPayload 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 NewAddRoutingTableToAreaPayload(name AddRoutingTableToAreaPayloadGetNameArgType) *AddRoutingTableToAreaPayload { + this := AddRoutingTableToAreaPayload{} + setAddRoutingTableToAreaPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewAddRoutingTableToAreaPayloadWithDefaults instantiates a new AddRoutingTableToAreaPayload 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 NewAddRoutingTableToAreaPayloadWithDefaults() *AddRoutingTableToAreaPayload { + this := AddRoutingTableToAreaPayload{} + var dynamicRoutes bool = true + this.DynamicRoutes = &dynamicRoutes + var systemRoutes bool = true + this.SystemRoutes = &systemRoutes + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetCreatedAt() (res AddRoutingTableToAreaPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetCreatedAtOk() (ret AddRoutingTableToAreaPayloadGetCreatedAtRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *AddRoutingTableToAreaPayload) SetCreatedAt(v AddRoutingTableToAreaPayloadGetCreatedAtRetType) { + setAddRoutingTableToAreaPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetDefault() (res AddRoutingTableToAreaPayloadgetDefaultRetType) { + res, _ = o.GetDefaultOk() + return +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetDefaultOk() (ret AddRoutingTableToAreaPayloadgetDefaultRetType, ok bool) { + return getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(o.Default) +} + +// HasDefault returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasDefault() bool { + _, ok := o.GetDefaultOk() + return ok +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *AddRoutingTableToAreaPayload) SetDefault(v AddRoutingTableToAreaPayloadgetDefaultRetType) { + setAddRoutingTableToAreaPayloadgetDefaultAttributeType(&o.Default, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetDescription() (res AddRoutingTableToAreaPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetDescriptionOk() (ret AddRoutingTableToAreaPayloadGetDescriptionRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AddRoutingTableToAreaPayload) SetDescription(v AddRoutingTableToAreaPayloadGetDescriptionRetType) { + setAddRoutingTableToAreaPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetDynamicRoutes() (res AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) { + res, _ = o.GetDynamicRoutesOk() + return +} + +// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetDynamicRoutesOk() (ret AddRoutingTableToAreaPayloadgetDynamicRoutesRetType, ok bool) { + return getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes) +} + +// HasDynamicRoutes returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasDynamicRoutes() bool { + _, ok := o.GetDynamicRoutesOk() + return ok +} + +// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field. +func (o *AddRoutingTableToAreaPayload) SetDynamicRoutes(v AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) { + setAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType(&o.DynamicRoutes, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetId() (res AddRoutingTableToAreaPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetIdOk() (ret AddRoutingTableToAreaPayloadGetIdRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AddRoutingTableToAreaPayload) SetId(v AddRoutingTableToAreaPayloadGetIdRetType) { + setAddRoutingTableToAreaPayloadGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetLabels() (res AddRoutingTableToAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetLabelsOk() (ret AddRoutingTableToAreaPayloadGetLabelsRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *AddRoutingTableToAreaPayload) SetLabels(v AddRoutingTableToAreaPayloadGetLabelsRetType) { + setAddRoutingTableToAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *AddRoutingTableToAreaPayload) GetName() (ret AddRoutingTableToAreaPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetNameOk() (ret AddRoutingTableToAreaPayloadGetNameRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *AddRoutingTableToAreaPayload) SetName(v AddRoutingTableToAreaPayloadGetNameRetType) { + setAddRoutingTableToAreaPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetSystemRoutes() (res AddRoutingTableToAreaPayloadgetSystemRoutesRetType) { + res, _ = o.GetSystemRoutesOk() + return +} + +// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetSystemRoutesOk() (ret AddRoutingTableToAreaPayloadgetSystemRoutesRetType, ok bool) { + return getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes) +} + +// HasSystemRoutes returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasSystemRoutes() bool { + _, ok := o.GetSystemRoutesOk() + return ok +} + +// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field. +func (o *AddRoutingTableToAreaPayload) SetSystemRoutes(v AddRoutingTableToAreaPayloadgetSystemRoutesRetType) { + setAddRoutingTableToAreaPayloadgetSystemRoutesAttributeType(&o.SystemRoutes, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetUpdatedAt() (res AddRoutingTableToAreaPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetUpdatedAtOk() (ret AddRoutingTableToAreaPayloadGetUpdatedAtRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *AddRoutingTableToAreaPayload) SetUpdatedAt(v AddRoutingTableToAreaPayloadGetUpdatedAtRetType) { + setAddRoutingTableToAreaPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o AddRoutingTableToAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(o.Default); ok { + toSerialize["Default"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok { + toSerialize["DynamicRoutes"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok { + toSerialize["SystemRoutes"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableAddRoutingTableToAreaPayload struct { + value *AddRoutingTableToAreaPayload + isSet bool +} + +func (v NullableAddRoutingTableToAreaPayload) Get() *AddRoutingTableToAreaPayload { + return v.value +} + +func (v *NullableAddRoutingTableToAreaPayload) Set(val *AddRoutingTableToAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddRoutingTableToAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddRoutingTableToAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddRoutingTableToAreaPayload(val *AddRoutingTableToAreaPayload) *NullableAddRoutingTableToAreaPayload { + return &NullableAddRoutingTableToAreaPayload{value: val, isSet: true} +} + +func (v NullableAddRoutingTableToAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddRoutingTableToAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_add_routing_table_to_area_payload_test.go b/pkg/iaasalpha/model_add_routing_table_to_area_payload_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_add_routing_table_to_area_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_create_network_ipv4.go b/pkg/iaasalpha/model_create_network_ipv4.go new file mode 100644 index 00000000..b2adaa57 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv4.go @@ -0,0 +1,144 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" + "fmt" +) + +// CreateNetworkIPv4 - The create request for an IPv4 network. +type CreateNetworkIPv4 struct { + CreateNetworkIPv4WithPrefix *CreateNetworkIPv4WithPrefix + CreateNetworkIPv4WithPrefixLength *CreateNetworkIPv4WithPrefixLength +} + +// CreateNetworkIPv4WithPrefixAsCreateNetworkIPv4 is a convenience function that returns CreateNetworkIPv4WithPrefix wrapped in CreateNetworkIPv4 +func CreateNetworkIPv4WithPrefixAsCreateNetworkIPv4(v *CreateNetworkIPv4WithPrefix) CreateNetworkIPv4 { + return CreateNetworkIPv4{ + CreateNetworkIPv4WithPrefix: v, + } +} + +// CreateNetworkIPv4WithPrefixLengthAsCreateNetworkIPv4 is a convenience function that returns CreateNetworkIPv4WithPrefixLength wrapped in CreateNetworkIPv4 +func CreateNetworkIPv4WithPrefixLengthAsCreateNetworkIPv4(v *CreateNetworkIPv4WithPrefixLength) CreateNetworkIPv4 { + return CreateNetworkIPv4{ + CreateNetworkIPv4WithPrefixLength: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateNetworkIPv4) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateNetworkIPv4WithPrefix + dstCreateNetworkIPv41 := &CreateNetworkIPv4{} + err = json.Unmarshal(data, &dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix) + if err == nil { + jsonCreateNetworkIPv4WithPrefix, _ := json.Marshal(&dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix) + if string(jsonCreateNetworkIPv4WithPrefix) != "{}" { // empty struct + dst.CreateNetworkIPv4WithPrefix = dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix + match++ + } + } + + // try to unmarshal data into CreateNetworkIPv4WithPrefixLength + dstCreateNetworkIPv42 := &CreateNetworkIPv4{} + err = json.Unmarshal(data, &dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength) + if err == nil { + jsonCreateNetworkIPv4WithPrefixLength, _ := json.Marshal(&dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength) + if string(jsonCreateNetworkIPv4WithPrefixLength) != "{}" { // empty struct + dst.CreateNetworkIPv4WithPrefixLength = dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateNetworkIPv4WithPrefix = nil + dst.CreateNetworkIPv4WithPrefixLength = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateNetworkIPv4)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateNetworkIPv4)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateNetworkIPv4) MarshalJSON() ([]byte, error) { + if src.CreateNetworkIPv4WithPrefix != nil { + return json.Marshal(&src.CreateNetworkIPv4WithPrefix) + } + + if src.CreateNetworkIPv4WithPrefixLength != nil { + return json.Marshal(&src.CreateNetworkIPv4WithPrefixLength) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateNetworkIPv4) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateNetworkIPv4WithPrefix != nil { + return obj.CreateNetworkIPv4WithPrefix + } + + if obj.CreateNetworkIPv4WithPrefixLength != nil { + return obj.CreateNetworkIPv4WithPrefixLength + } + + // all schemas are nil + return nil +} + +type NullableCreateNetworkIPv4 struct { + value *CreateNetworkIPv4 + isSet bool +} + +func (v NullableCreateNetworkIPv4) Get() *CreateNetworkIPv4 { + return v.value +} + +func (v *NullableCreateNetworkIPv4) Set(val *CreateNetworkIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv4(val *CreateNetworkIPv4) *NullableCreateNetworkIPv4 { + return &NullableCreateNetworkIPv4{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_create_network_ipv4_test.go b/pkg/iaasalpha/model_create_network_ipv4_test.go new file mode 100644 index 00000000..69bd9b20 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv4_test.go @@ -0,0 +1,43 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "testing" +) + +// isOneOf + +func TestCreateNetworkIPv4_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := &CreateNetworkIPv4{} + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + marshalJson, err := v.MarshalJSON() + if err != nil { + t.Fatalf("failed marshalling CreateNetworkIPv4: %v", err) + } + if string(marshalJson) != string(tt.args.src) { + t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson) + } + }) + } +} diff --git a/pkg/iaasalpha/model_create_network_ipv4_with_prefix.go b/pkg/iaasalpha/model_create_network_ipv4_with_prefix.go new file mode 100644 index 00000000..55a05318 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv4_with_prefix.go @@ -0,0 +1,239 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv4WithPrefix type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv4WithPrefix{} + +/* + types and functions for gateway +*/ + +// isNullableString +type CreateNetworkIPv4WithPrefixGetGatewayAttributeType = *NullableString + +func getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetGatewayAttributeType) (ret CreateNetworkIPv4WithPrefixGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateNetworkIPv4WithPrefixGetGatewayAttributeType(arg *CreateNetworkIPv4WithPrefixGetGatewayAttributeType, val CreateNetworkIPv4WithPrefixGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateNetworkIPv4WithPrefixGetGatewayArgType = *string +type CreateNetworkIPv4WithPrefixGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv4WithPrefixGetNameserversAttributeType = *[]string +type CreateNetworkIPv4WithPrefixGetNameserversArgType = []string +type CreateNetworkIPv4WithPrefixGetNameserversRetType = []string + +func getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetNameserversAttributeType) (ret CreateNetworkIPv4WithPrefixGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixGetNameserversAttributeType(arg *CreateNetworkIPv4WithPrefixGetNameserversAttributeType, val CreateNetworkIPv4WithPrefixGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefix +*/ + +// isNotNullableString +type CreateNetworkIPv4WithPrefixGetPrefixAttributeType = *string + +func getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetPrefixAttributeType) (ret CreateNetworkIPv4WithPrefixGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(arg *CreateNetworkIPv4WithPrefixGetPrefixAttributeType, val CreateNetworkIPv4WithPrefixGetPrefixRetType) { + *arg = &val +} + +type CreateNetworkIPv4WithPrefixGetPrefixArgType = string +type CreateNetworkIPv4WithPrefixGetPrefixRetType = string + +// CreateNetworkIPv4WithPrefix The create request for an IPv4 network with a specified prefix. +type CreateNetworkIPv4WithPrefix struct { + // The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway CreateNetworkIPv4WithPrefixGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers CreateNetworkIPv4WithPrefixGetNameserversAttributeType `json:"nameservers,omitempty"` + // IPv4 Classless Inter-Domain Routing (CIDR). + // REQUIRED + Prefix CreateNetworkIPv4WithPrefixGetPrefixAttributeType `json:"prefix" required:"true"` +} + +type _CreateNetworkIPv4WithPrefix CreateNetworkIPv4WithPrefix + +// NewCreateNetworkIPv4WithPrefix instantiates a new CreateNetworkIPv4WithPrefix 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 NewCreateNetworkIPv4WithPrefix(prefix CreateNetworkIPv4WithPrefixGetPrefixArgType) *CreateNetworkIPv4WithPrefix { + this := CreateNetworkIPv4WithPrefix{} + setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(&this.Prefix, prefix) + return &this +} + +// NewCreateNetworkIPv4WithPrefixWithDefaults instantiates a new CreateNetworkIPv4WithPrefix 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 NewCreateNetworkIPv4WithPrefixWithDefaults() *CreateNetworkIPv4WithPrefix { + this := CreateNetworkIPv4WithPrefix{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateNetworkIPv4WithPrefix) GetGateway() (res CreateNetworkIPv4WithPrefixGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateNetworkIPv4WithPrefix) GetGatewayOk() (ret CreateNetworkIPv4WithPrefixGetGatewayRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *CreateNetworkIPv4WithPrefix) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *CreateNetworkIPv4WithPrefix) SetGateway(v CreateNetworkIPv4WithPrefixGetGatewayRetType) { + setCreateNetworkIPv4WithPrefixGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *CreateNetworkIPv4WithPrefix) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *CreateNetworkIPv4WithPrefix) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv4WithPrefix) GetNameservers() (res CreateNetworkIPv4WithPrefixGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefix) GetNameserversOk() (ret CreateNetworkIPv4WithPrefixGetNameserversRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv4WithPrefix) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv4WithPrefix) SetNameservers(v CreateNetworkIPv4WithPrefixGetNameserversRetType) { + setCreateNetworkIPv4WithPrefixGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefix returns the Prefix field value +func (o *CreateNetworkIPv4WithPrefix) GetPrefix() (ret CreateNetworkIPv4WithPrefixGetPrefixRetType) { + ret, _ = o.GetPrefixOk() + return ret +} + +// GetPrefixOk returns a tuple with the Prefix field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefix) GetPrefixOk() (ret CreateNetworkIPv4WithPrefixGetPrefixRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(o.Prefix) +} + +// SetPrefix sets field value +func (o *CreateNetworkIPv4WithPrefix) SetPrefix(v CreateNetworkIPv4WithPrefixGetPrefixRetType) { + setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(&o.Prefix, v) +} + +func (o CreateNetworkIPv4WithPrefix) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv4WithPrefix struct { + value *CreateNetworkIPv4WithPrefix + isSet bool +} + +func (v NullableCreateNetworkIPv4WithPrefix) Get() *CreateNetworkIPv4WithPrefix { + return v.value +} + +func (v *NullableCreateNetworkIPv4WithPrefix) Set(val *CreateNetworkIPv4WithPrefix) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv4WithPrefix) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv4WithPrefix) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv4WithPrefix(val *CreateNetworkIPv4WithPrefix) *NullableCreateNetworkIPv4WithPrefix { + return &NullableCreateNetworkIPv4WithPrefix{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv4WithPrefix) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv4WithPrefix) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_create_network_ipv4_with_prefix_length.go b/pkg/iaasalpha/model_create_network_ipv4_with_prefix_length.go new file mode 100644 index 00000000..3177f491 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv4_with_prefix_length.go @@ -0,0 +1,173 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv4WithPrefixLength type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv4WithPrefixLength{} + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType = *[]string +type CreateNetworkIPv4WithPrefixLengthGetNameserversArgType = []string +type CreateNetworkIPv4WithPrefixLengthGetNameserversRetType = []string + +func getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(arg CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType) (ret CreateNetworkIPv4WithPrefixLengthGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType(arg *CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType, val CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixLength +*/ + +// isLong +type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType = *int64 +type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthArgType = int64 +type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType = int64 + +func getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(arg CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType) (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(arg *CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType, val CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) { + *arg = &val +} + +// CreateNetworkIPv4WithPrefixLength The create request for an IPv4 network with a wanted prefix length. +type CreateNetworkIPv4WithPrefixLength struct { + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + PrefixLength CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType `json:"prefixLength" required:"true"` +} + +type _CreateNetworkIPv4WithPrefixLength CreateNetworkIPv4WithPrefixLength + +// NewCreateNetworkIPv4WithPrefixLength instantiates a new CreateNetworkIPv4WithPrefixLength 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 NewCreateNetworkIPv4WithPrefixLength(prefixLength CreateNetworkIPv4WithPrefixLengthGetPrefixLengthArgType) *CreateNetworkIPv4WithPrefixLength { + this := CreateNetworkIPv4WithPrefixLength{} + setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(&this.PrefixLength, prefixLength) + return &this +} + +// NewCreateNetworkIPv4WithPrefixLengthWithDefaults instantiates a new CreateNetworkIPv4WithPrefixLength 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 NewCreateNetworkIPv4WithPrefixLengthWithDefaults() *CreateNetworkIPv4WithPrefixLength { + this := CreateNetworkIPv4WithPrefixLength{} + return &this +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv4WithPrefixLength) GetNameservers() (res CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefixLength) GetNameserversOk() (ret CreateNetworkIPv4WithPrefixLengthGetNameserversRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv4WithPrefixLength) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv4WithPrefixLength) SetNameservers(v CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) { + setCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixLength returns the PrefixLength field value +func (o *CreateNetworkIPv4WithPrefixLength) GetPrefixLength() (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) { + ret, _ = o.GetPrefixLengthOk() + return ret +} + +// GetPrefixLengthOk returns a tuple with the PrefixLength field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefixLength) GetPrefixLengthOk() (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength) +} + +// SetPrefixLength sets field value +func (o *CreateNetworkIPv4WithPrefixLength) SetPrefixLength(v CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) { + setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(&o.PrefixLength, v) +} + +func (o CreateNetworkIPv4WithPrefixLength) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength); ok { + toSerialize["PrefixLength"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv4WithPrefixLength struct { + value *CreateNetworkIPv4WithPrefixLength + isSet bool +} + +func (v NullableCreateNetworkIPv4WithPrefixLength) Get() *CreateNetworkIPv4WithPrefixLength { + return v.value +} + +func (v *NullableCreateNetworkIPv4WithPrefixLength) Set(val *CreateNetworkIPv4WithPrefixLength) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv4WithPrefixLength) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv4WithPrefixLength) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv4WithPrefixLength(val *CreateNetworkIPv4WithPrefixLength) *NullableCreateNetworkIPv4WithPrefixLength { + return &NullableCreateNetworkIPv4WithPrefixLength{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv4WithPrefixLength) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv4WithPrefixLength) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_create_network_ipv4_with_prefix_length_test.go b/pkg/iaasalpha/model_create_network_ipv4_with_prefix_length_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv4_with_prefix_length_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_create_network_ipv4_with_prefix_test.go b/pkg/iaasalpha/model_create_network_ipv4_with_prefix_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv4_with_prefix_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_create_network_ipv6.go b/pkg/iaasalpha/model_create_network_ipv6.go new file mode 100644 index 00000000..1bf2bb89 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv6.go @@ -0,0 +1,144 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" + "fmt" +) + +// CreateNetworkIPv6 - The create request for an IPv6 network. +type CreateNetworkIPv6 struct { + CreateNetworkIPv6WithPrefix *CreateNetworkIPv6WithPrefix + CreateNetworkIPv6WithPrefixLength *CreateNetworkIPv6WithPrefixLength +} + +// CreateNetworkIPv6WithPrefixAsCreateNetworkIPv6 is a convenience function that returns CreateNetworkIPv6WithPrefix wrapped in CreateNetworkIPv6 +func CreateNetworkIPv6WithPrefixAsCreateNetworkIPv6(v *CreateNetworkIPv6WithPrefix) CreateNetworkIPv6 { + return CreateNetworkIPv6{ + CreateNetworkIPv6WithPrefix: v, + } +} + +// CreateNetworkIPv6WithPrefixLengthAsCreateNetworkIPv6 is a convenience function that returns CreateNetworkIPv6WithPrefixLength wrapped in CreateNetworkIPv6 +func CreateNetworkIPv6WithPrefixLengthAsCreateNetworkIPv6(v *CreateNetworkIPv6WithPrefixLength) CreateNetworkIPv6 { + return CreateNetworkIPv6{ + CreateNetworkIPv6WithPrefixLength: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateNetworkIPv6) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateNetworkIPv6WithPrefix + dstCreateNetworkIPv61 := &CreateNetworkIPv6{} + err = json.Unmarshal(data, &dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix) + if err == nil { + jsonCreateNetworkIPv6WithPrefix, _ := json.Marshal(&dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix) + if string(jsonCreateNetworkIPv6WithPrefix) != "{}" { // empty struct + dst.CreateNetworkIPv6WithPrefix = dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix + match++ + } + } + + // try to unmarshal data into CreateNetworkIPv6WithPrefixLength + dstCreateNetworkIPv62 := &CreateNetworkIPv6{} + err = json.Unmarshal(data, &dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength) + if err == nil { + jsonCreateNetworkIPv6WithPrefixLength, _ := json.Marshal(&dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength) + if string(jsonCreateNetworkIPv6WithPrefixLength) != "{}" { // empty struct + dst.CreateNetworkIPv6WithPrefixLength = dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateNetworkIPv6WithPrefix = nil + dst.CreateNetworkIPv6WithPrefixLength = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateNetworkIPv6)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateNetworkIPv6)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateNetworkIPv6) MarshalJSON() ([]byte, error) { + if src.CreateNetworkIPv6WithPrefix != nil { + return json.Marshal(&src.CreateNetworkIPv6WithPrefix) + } + + if src.CreateNetworkIPv6WithPrefixLength != nil { + return json.Marshal(&src.CreateNetworkIPv6WithPrefixLength) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateNetworkIPv6) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateNetworkIPv6WithPrefix != nil { + return obj.CreateNetworkIPv6WithPrefix + } + + if obj.CreateNetworkIPv6WithPrefixLength != nil { + return obj.CreateNetworkIPv6WithPrefixLength + } + + // all schemas are nil + return nil +} + +type NullableCreateNetworkIPv6 struct { + value *CreateNetworkIPv6 + isSet bool +} + +func (v NullableCreateNetworkIPv6) Get() *CreateNetworkIPv6 { + return v.value +} + +func (v *NullableCreateNetworkIPv6) Set(val *CreateNetworkIPv6) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv6) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv6(val *CreateNetworkIPv6) *NullableCreateNetworkIPv6 { + return &NullableCreateNetworkIPv6{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_create_network_ipv6_test.go b/pkg/iaasalpha/model_create_network_ipv6_test.go new file mode 100644 index 00000000..bdac6bfa --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv6_test.go @@ -0,0 +1,43 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "testing" +) + +// isOneOf + +func TestCreateNetworkIPv6_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := &CreateNetworkIPv6{} + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + marshalJson, err := v.MarshalJSON() + if err != nil { + t.Fatalf("failed marshalling CreateNetworkIPv6: %v", err) + } + if string(marshalJson) != string(tt.args.src) { + t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson) + } + }) + } +} diff --git a/pkg/iaasalpha/model_create_network_ipv6_with_prefix.go b/pkg/iaasalpha/model_create_network_ipv6_with_prefix.go new file mode 100644 index 00000000..1add0e9b --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv6_with_prefix.go @@ -0,0 +1,239 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv6WithPrefix type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv6WithPrefix{} + +/* + types and functions for gateway +*/ + +// isNullableString +type CreateNetworkIPv6WithPrefixGetGatewayAttributeType = *NullableString + +func getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetGatewayAttributeType) (ret CreateNetworkIPv6WithPrefixGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateNetworkIPv6WithPrefixGetGatewayAttributeType(arg *CreateNetworkIPv6WithPrefixGetGatewayAttributeType, val CreateNetworkIPv6WithPrefixGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateNetworkIPv6WithPrefixGetGatewayArgType = *string +type CreateNetworkIPv6WithPrefixGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv6WithPrefixGetNameserversAttributeType = *[]string +type CreateNetworkIPv6WithPrefixGetNameserversArgType = []string +type CreateNetworkIPv6WithPrefixGetNameserversRetType = []string + +func getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetNameserversAttributeType) (ret CreateNetworkIPv6WithPrefixGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixGetNameserversAttributeType(arg *CreateNetworkIPv6WithPrefixGetNameserversAttributeType, val CreateNetworkIPv6WithPrefixGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefix +*/ + +// isNotNullableString +type CreateNetworkIPv6WithPrefixGetPrefixAttributeType = *string + +func getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetPrefixAttributeType) (ret CreateNetworkIPv6WithPrefixGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(arg *CreateNetworkIPv6WithPrefixGetPrefixAttributeType, val CreateNetworkIPv6WithPrefixGetPrefixRetType) { + *arg = &val +} + +type CreateNetworkIPv6WithPrefixGetPrefixArgType = string +type CreateNetworkIPv6WithPrefixGetPrefixRetType = string + +// CreateNetworkIPv6WithPrefix The create request for an IPv6 network with a specified prefix. +type CreateNetworkIPv6WithPrefix struct { + // The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway CreateNetworkIPv6WithPrefixGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers CreateNetworkIPv6WithPrefixGetNameserversAttributeType `json:"nameservers,omitempty"` + // Classless Inter-Domain Routing (CIDR) for IPv6. + // REQUIRED + Prefix CreateNetworkIPv6WithPrefixGetPrefixAttributeType `json:"prefix" required:"true"` +} + +type _CreateNetworkIPv6WithPrefix CreateNetworkIPv6WithPrefix + +// NewCreateNetworkIPv6WithPrefix instantiates a new CreateNetworkIPv6WithPrefix 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 NewCreateNetworkIPv6WithPrefix(prefix CreateNetworkIPv6WithPrefixGetPrefixArgType) *CreateNetworkIPv6WithPrefix { + this := CreateNetworkIPv6WithPrefix{} + setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(&this.Prefix, prefix) + return &this +} + +// NewCreateNetworkIPv6WithPrefixWithDefaults instantiates a new CreateNetworkIPv6WithPrefix 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 NewCreateNetworkIPv6WithPrefixWithDefaults() *CreateNetworkIPv6WithPrefix { + this := CreateNetworkIPv6WithPrefix{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateNetworkIPv6WithPrefix) GetGateway() (res CreateNetworkIPv6WithPrefixGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateNetworkIPv6WithPrefix) GetGatewayOk() (ret CreateNetworkIPv6WithPrefixGetGatewayRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *CreateNetworkIPv6WithPrefix) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *CreateNetworkIPv6WithPrefix) SetGateway(v CreateNetworkIPv6WithPrefixGetGatewayRetType) { + setCreateNetworkIPv6WithPrefixGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *CreateNetworkIPv6WithPrefix) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *CreateNetworkIPv6WithPrefix) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv6WithPrefix) GetNameservers() (res CreateNetworkIPv6WithPrefixGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefix) GetNameserversOk() (ret CreateNetworkIPv6WithPrefixGetNameserversRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv6WithPrefix) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv6WithPrefix) SetNameservers(v CreateNetworkIPv6WithPrefixGetNameserversRetType) { + setCreateNetworkIPv6WithPrefixGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefix returns the Prefix field value +func (o *CreateNetworkIPv6WithPrefix) GetPrefix() (ret CreateNetworkIPv6WithPrefixGetPrefixRetType) { + ret, _ = o.GetPrefixOk() + return ret +} + +// GetPrefixOk returns a tuple with the Prefix field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefix) GetPrefixOk() (ret CreateNetworkIPv6WithPrefixGetPrefixRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(o.Prefix) +} + +// SetPrefix sets field value +func (o *CreateNetworkIPv6WithPrefix) SetPrefix(v CreateNetworkIPv6WithPrefixGetPrefixRetType) { + setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(&o.Prefix, v) +} + +func (o CreateNetworkIPv6WithPrefix) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv6WithPrefix struct { + value *CreateNetworkIPv6WithPrefix + isSet bool +} + +func (v NullableCreateNetworkIPv6WithPrefix) Get() *CreateNetworkIPv6WithPrefix { + return v.value +} + +func (v *NullableCreateNetworkIPv6WithPrefix) Set(val *CreateNetworkIPv6WithPrefix) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv6WithPrefix) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv6WithPrefix) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv6WithPrefix(val *CreateNetworkIPv6WithPrefix) *NullableCreateNetworkIPv6WithPrefix { + return &NullableCreateNetworkIPv6WithPrefix{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv6WithPrefix) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv6WithPrefix) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_create_network_ipv6_with_prefix_length.go b/pkg/iaasalpha/model_create_network_ipv6_with_prefix_length.go new file mode 100644 index 00000000..2113b8ad --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv6_with_prefix_length.go @@ -0,0 +1,173 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv6WithPrefixLength type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv6WithPrefixLength{} + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType = *[]string +type CreateNetworkIPv6WithPrefixLengthGetNameserversArgType = []string +type CreateNetworkIPv6WithPrefixLengthGetNameserversRetType = []string + +func getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(arg CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType) (ret CreateNetworkIPv6WithPrefixLengthGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType(arg *CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType, val CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixLength +*/ + +// isLong +type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType = *int64 +type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthArgType = int64 +type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType = int64 + +func getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(arg CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType) (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(arg *CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType, val CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) { + *arg = &val +} + +// CreateNetworkIPv6WithPrefixLength The create request for an IPv6 network with a wanted prefix length. +type CreateNetworkIPv6WithPrefixLength struct { + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + PrefixLength CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType `json:"prefixLength" required:"true"` +} + +type _CreateNetworkIPv6WithPrefixLength CreateNetworkIPv6WithPrefixLength + +// NewCreateNetworkIPv6WithPrefixLength instantiates a new CreateNetworkIPv6WithPrefixLength 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 NewCreateNetworkIPv6WithPrefixLength(prefixLength CreateNetworkIPv6WithPrefixLengthGetPrefixLengthArgType) *CreateNetworkIPv6WithPrefixLength { + this := CreateNetworkIPv6WithPrefixLength{} + setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(&this.PrefixLength, prefixLength) + return &this +} + +// NewCreateNetworkIPv6WithPrefixLengthWithDefaults instantiates a new CreateNetworkIPv6WithPrefixLength 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 NewCreateNetworkIPv6WithPrefixLengthWithDefaults() *CreateNetworkIPv6WithPrefixLength { + this := CreateNetworkIPv6WithPrefixLength{} + return &this +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv6WithPrefixLength) GetNameservers() (res CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefixLength) GetNameserversOk() (ret CreateNetworkIPv6WithPrefixLengthGetNameserversRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv6WithPrefixLength) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv6WithPrefixLength) SetNameservers(v CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) { + setCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixLength returns the PrefixLength field value +func (o *CreateNetworkIPv6WithPrefixLength) GetPrefixLength() (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) { + ret, _ = o.GetPrefixLengthOk() + return ret +} + +// GetPrefixLengthOk returns a tuple with the PrefixLength field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefixLength) GetPrefixLengthOk() (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength) +} + +// SetPrefixLength sets field value +func (o *CreateNetworkIPv6WithPrefixLength) SetPrefixLength(v CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) { + setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(&o.PrefixLength, v) +} + +func (o CreateNetworkIPv6WithPrefixLength) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength); ok { + toSerialize["PrefixLength"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv6WithPrefixLength struct { + value *CreateNetworkIPv6WithPrefixLength + isSet bool +} + +func (v NullableCreateNetworkIPv6WithPrefixLength) Get() *CreateNetworkIPv6WithPrefixLength { + return v.value +} + +func (v *NullableCreateNetworkIPv6WithPrefixLength) Set(val *CreateNetworkIPv6WithPrefixLength) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv6WithPrefixLength) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv6WithPrefixLength) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv6WithPrefixLength(val *CreateNetworkIPv6WithPrefixLength) *NullableCreateNetworkIPv6WithPrefixLength { + return &NullableCreateNetworkIPv6WithPrefixLength{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv6WithPrefixLength) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv6WithPrefixLength) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_create_network_ipv6_with_prefix_length_test.go b/pkg/iaasalpha/model_create_network_ipv6_with_prefix_length_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv6_with_prefix_length_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_create_network_ipv6_with_prefix_test.go b/pkg/iaasalpha/model_create_network_ipv6_with_prefix_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_ipv6_with_prefix_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_create_network_payload.go b/pkg/iaasalpha/model_create_network_payload.go new file mode 100644 index 00000000..4ab163d3 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_payload.go @@ -0,0 +1,416 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the CreateNetworkPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkPayload{} + +/* + types and functions for dhcp +*/ + +// isBoolean +type CreateNetworkPayloadgetDhcpAttributeType = *bool +type CreateNetworkPayloadgetDhcpArgType = bool +type CreateNetworkPayloadgetDhcpRetType = bool + +func getCreateNetworkPayloadgetDhcpAttributeTypeOk(arg CreateNetworkPayloadgetDhcpAttributeType) (ret CreateNetworkPayloadgetDhcpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadgetDhcpAttributeType(arg *CreateNetworkPayloadgetDhcpAttributeType, val CreateNetworkPayloadgetDhcpRetType) { + *arg = &val +} + +/* + types and functions for ipv4 +*/ + +// isModel +type CreateNetworkPayloadGetIpv4AttributeType = *CreateNetworkIPv4 +type CreateNetworkPayloadGetIpv4ArgType = CreateNetworkIPv4 +type CreateNetworkPayloadGetIpv4RetType = CreateNetworkIPv4 + +func getCreateNetworkPayloadGetIpv4AttributeTypeOk(arg CreateNetworkPayloadGetIpv4AttributeType) (ret CreateNetworkPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetIpv4AttributeType(arg *CreateNetworkPayloadGetIpv4AttributeType, val CreateNetworkPayloadGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type CreateNetworkPayloadGetIpv6AttributeType = *CreateNetworkIPv6 +type CreateNetworkPayloadGetIpv6ArgType = CreateNetworkIPv6 +type CreateNetworkPayloadGetIpv6RetType = CreateNetworkIPv6 + +func getCreateNetworkPayloadGetIpv6AttributeTypeOk(arg CreateNetworkPayloadGetIpv6AttributeType) (ret CreateNetworkPayloadGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetIpv6AttributeType(arg *CreateNetworkPayloadGetIpv6AttributeType, val CreateNetworkPayloadGetIpv6RetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateNetworkPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateNetworkPayloadGetLabelsArgType = map[string]interface{} +type CreateNetworkPayloadGetLabelsRetType = map[string]interface{} + +func getCreateNetworkPayloadGetLabelsAttributeTypeOk(arg CreateNetworkPayloadGetLabelsAttributeType) (ret CreateNetworkPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetLabelsAttributeType(arg *CreateNetworkPayloadGetLabelsAttributeType, val CreateNetworkPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateNetworkPayloadGetNameAttributeType = *string + +func getCreateNetworkPayloadGetNameAttributeTypeOk(arg CreateNetworkPayloadGetNameAttributeType) (ret CreateNetworkPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetNameAttributeType(arg *CreateNetworkPayloadGetNameAttributeType, val CreateNetworkPayloadGetNameRetType) { + *arg = &val +} + +type CreateNetworkPayloadGetNameArgType = string +type CreateNetworkPayloadGetNameRetType = string + +/* + types and functions for routed +*/ + +// isBoolean +type CreateNetworkPayloadgetRoutedAttributeType = *bool +type CreateNetworkPayloadgetRoutedArgType = bool +type CreateNetworkPayloadgetRoutedRetType = bool + +func getCreateNetworkPayloadgetRoutedAttributeTypeOk(arg CreateNetworkPayloadgetRoutedAttributeType) (ret CreateNetworkPayloadgetRoutedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadgetRoutedAttributeType(arg *CreateNetworkPayloadgetRoutedAttributeType, val CreateNetworkPayloadgetRoutedRetType) { + *arg = &val +} + +/* + types and functions for routingTableId +*/ + +// isNotNullableString +type CreateNetworkPayloadGetRoutingTableIdAttributeType = *string + +func getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(arg CreateNetworkPayloadGetRoutingTableIdAttributeType) (ret CreateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetRoutingTableIdAttributeType(arg *CreateNetworkPayloadGetRoutingTableIdAttributeType, val CreateNetworkPayloadGetRoutingTableIdRetType) { + *arg = &val +} + +type CreateNetworkPayloadGetRoutingTableIdArgType = string +type CreateNetworkPayloadGetRoutingTableIdRetType = string + +// CreateNetworkPayload Object that represents the request body for a network create. +type CreateNetworkPayload struct { + // Enable or disable DHCP for a network. + Dhcp CreateNetworkPayloadgetDhcpAttributeType `json:"dhcp,omitempty"` + Ipv4 CreateNetworkPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 CreateNetworkPayloadGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateNetworkPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name CreateNetworkPayloadGetNameAttributeType `json:"name" required:"true"` + // Shows if the network is routed and therefore accessible from other networks. + Routed CreateNetworkPayloadgetRoutedAttributeType `json:"routed,omitempty"` + // Universally Unique Identifier (UUID). + RoutingTableId CreateNetworkPayloadGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"` +} + +type _CreateNetworkPayload CreateNetworkPayload + +// NewCreateNetworkPayload instantiates a new CreateNetworkPayload 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 NewCreateNetworkPayload(name CreateNetworkPayloadGetNameArgType) *CreateNetworkPayload { + this := CreateNetworkPayload{} + setCreateNetworkPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateNetworkPayloadWithDefaults instantiates a new CreateNetworkPayload 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 NewCreateNetworkPayloadWithDefaults() *CreateNetworkPayload { + this := CreateNetworkPayload{} + var dhcp bool = true + this.Dhcp = &dhcp + return &this +} + +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetDhcp() (res CreateNetworkPayloadgetDhcpRetType) { + res, _ = o.GetDhcpOk() + return +} + +// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetDhcpOk() (ret CreateNetworkPayloadgetDhcpRetType, ok bool) { + return getCreateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp) +} + +// HasDhcp returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasDhcp() bool { + _, ok := o.GetDhcpOk() + return ok +} + +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *CreateNetworkPayload) SetDhcp(v CreateNetworkPayloadgetDhcpRetType) { + setCreateNetworkPayloadgetDhcpAttributeType(&o.Dhcp, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetIpv4() (res CreateNetworkPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetIpv4Ok() (ret CreateNetworkPayloadGetIpv4RetType, ok bool) { + return getCreateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given CreateNetworkIPv4 and assigns it to the Ipv4 field. +func (o *CreateNetworkPayload) SetIpv4(v CreateNetworkPayloadGetIpv4RetType) { + setCreateNetworkPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetIpv6() (res CreateNetworkPayloadGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetIpv6Ok() (ret CreateNetworkPayloadGetIpv6RetType, ok bool) { + return getCreateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given CreateNetworkIPv6 and assigns it to the Ipv6 field. +func (o *CreateNetworkPayload) SetIpv6(v CreateNetworkPayloadGetIpv6RetType) { + setCreateNetworkPayloadGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetLabels() (res CreateNetworkPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetLabelsOk() (ret CreateNetworkPayloadGetLabelsRetType, ok bool) { + return getCreateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateNetworkPayload) SetLabels(v CreateNetworkPayloadGetLabelsRetType) { + setCreateNetworkPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *CreateNetworkPayload) GetName() (ret CreateNetworkPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetNameOk() (ret CreateNetworkPayloadGetNameRetType, ok bool) { + return getCreateNetworkPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateNetworkPayload) SetName(v CreateNetworkPayloadGetNameRetType) { + setCreateNetworkPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRouted returns the Routed field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetRouted() (res CreateNetworkPayloadgetRoutedRetType) { + res, _ = o.GetRoutedOk() + return +} + +// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetRoutedOk() (ret CreateNetworkPayloadgetRoutedRetType, ok bool) { + return getCreateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed) +} + +// HasRouted returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasRouted() bool { + _, ok := o.GetRoutedOk() + return ok +} + +// SetRouted gets a reference to the given bool and assigns it to the Routed field. +func (o *CreateNetworkPayload) SetRouted(v CreateNetworkPayloadgetRoutedRetType) { + setCreateNetworkPayloadgetRoutedAttributeType(&o.Routed, v) +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetRoutingTableId() (res CreateNetworkPayloadGetRoutingTableIdRetType) { + res, _ = o.GetRoutingTableIdOk() + return +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetRoutingTableIdOk() (ret CreateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + return getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId) +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasRoutingTableId() bool { + _, ok := o.GetRoutingTableIdOk() + return ok +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *CreateNetworkPayload) SetRoutingTableId(v CreateNetworkPayloadGetRoutingTableIdRetType) { + setCreateNetworkPayloadGetRoutingTableIdAttributeType(&o.RoutingTableId, v) +} + +func (o CreateNetworkPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp); ok { + toSerialize["Dhcp"] = val + } + if val, ok := getCreateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getCreateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getCreateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateNetworkPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed); ok { + toSerialize["Routed"] = val + } + if val, ok := getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok { + toSerialize["RoutingTableId"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkPayload struct { + value *CreateNetworkPayload + isSet bool +} + +func (v NullableCreateNetworkPayload) Get() *CreateNetworkPayload { + return v.value +} + +func (v *NullableCreateNetworkPayload) Set(val *CreateNetworkPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkPayload(val *CreateNetworkPayload) *NullableCreateNetworkPayload { + return &NullableCreateNetworkPayload{value: val, isSet: true} +} + +func (v NullableCreateNetworkPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_create_network_payload_test.go b/pkg/iaasalpha/model_create_network_payload_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_create_network_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_destination_cidrv4.go b/pkg/iaasalpha/model_destination_cidrv4.go new file mode 100644 index 00000000..96836443 --- /dev/null +++ b/pkg/iaasalpha/model_destination_cidrv4.go @@ -0,0 +1,171 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the DestinationCIDRv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationCIDRv4{} + +/* + types and functions for type +*/ + +// isNotNullableString +type DestinationCIDRv4GetTypeAttributeType = *string + +func getDestinationCIDRv4GetTypeAttributeTypeOk(arg DestinationCIDRv4GetTypeAttributeType) (ret DestinationCIDRv4GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv4GetTypeAttributeType(arg *DestinationCIDRv4GetTypeAttributeType, val DestinationCIDRv4GetTypeRetType) { + *arg = &val +} + +type DestinationCIDRv4GetTypeArgType = string +type DestinationCIDRv4GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type DestinationCIDRv4GetValueAttributeType = *string + +func getDestinationCIDRv4GetValueAttributeTypeOk(arg DestinationCIDRv4GetValueAttributeType) (ret DestinationCIDRv4GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv4GetValueAttributeType(arg *DestinationCIDRv4GetValueAttributeType, val DestinationCIDRv4GetValueRetType) { + *arg = &val +} + +type DestinationCIDRv4GetValueArgType = string +type DestinationCIDRv4GetValueRetType = string + +// DestinationCIDRv4 IPv4 Classless Inter-Domain Routing (CIDR) Object. +type DestinationCIDRv4 struct { + // REQUIRED + Type DestinationCIDRv4GetTypeAttributeType `json:"type" required:"true"` + // An CIDRv4 string. + // REQUIRED + Value DestinationCIDRv4GetValueAttributeType `json:"value" required:"true"` +} + +type _DestinationCIDRv4 DestinationCIDRv4 + +// NewDestinationCIDRv4 instantiates a new DestinationCIDRv4 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 NewDestinationCIDRv4(types DestinationCIDRv4GetTypeArgType, value DestinationCIDRv4GetValueArgType) *DestinationCIDRv4 { + this := DestinationCIDRv4{} + setDestinationCIDRv4GetTypeAttributeType(&this.Type, types) + setDestinationCIDRv4GetValueAttributeType(&this.Value, value) + return &this +} + +// NewDestinationCIDRv4WithDefaults instantiates a new DestinationCIDRv4 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 NewDestinationCIDRv4WithDefaults() *DestinationCIDRv4 { + this := DestinationCIDRv4{} + return &this +} + +// GetType returns the Type field value +func (o *DestinationCIDRv4) GetType() (ret DestinationCIDRv4GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv4) GetTypeOk() (ret DestinationCIDRv4GetTypeRetType, ok bool) { + return getDestinationCIDRv4GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *DestinationCIDRv4) SetType(v DestinationCIDRv4GetTypeRetType) { + setDestinationCIDRv4GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *DestinationCIDRv4) GetValue() (ret DestinationCIDRv4GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv4) GetValueOk() (ret DestinationCIDRv4GetValueRetType, ok bool) { + return getDestinationCIDRv4GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *DestinationCIDRv4) SetValue(v DestinationCIDRv4GetValueRetType) { + setDestinationCIDRv4GetValueAttributeType(&o.Value, v) +} + +func (o DestinationCIDRv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDestinationCIDRv4GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getDestinationCIDRv4GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableDestinationCIDRv4 struct { + value *DestinationCIDRv4 + isSet bool +} + +func (v NullableDestinationCIDRv4) Get() *DestinationCIDRv4 { + return v.value +} + +func (v *NullableDestinationCIDRv4) Set(val *DestinationCIDRv4) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationCIDRv4) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationCIDRv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationCIDRv4(val *DestinationCIDRv4) *NullableDestinationCIDRv4 { + return &NullableDestinationCIDRv4{value: val, isSet: true} +} + +func (v NullableDestinationCIDRv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationCIDRv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_destination_cidrv4_test.go b/pkg/iaasalpha/model_destination_cidrv4_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_destination_cidrv4_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_destination_cidrv6.go b/pkg/iaasalpha/model_destination_cidrv6.go new file mode 100644 index 00000000..d89dfefd --- /dev/null +++ b/pkg/iaasalpha/model_destination_cidrv6.go @@ -0,0 +1,171 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the DestinationCIDRv6 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationCIDRv6{} + +/* + types and functions for type +*/ + +// isNotNullableString +type DestinationCIDRv6GetTypeAttributeType = *string + +func getDestinationCIDRv6GetTypeAttributeTypeOk(arg DestinationCIDRv6GetTypeAttributeType) (ret DestinationCIDRv6GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv6GetTypeAttributeType(arg *DestinationCIDRv6GetTypeAttributeType, val DestinationCIDRv6GetTypeRetType) { + *arg = &val +} + +type DestinationCIDRv6GetTypeArgType = string +type DestinationCIDRv6GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type DestinationCIDRv6GetValueAttributeType = *string + +func getDestinationCIDRv6GetValueAttributeTypeOk(arg DestinationCIDRv6GetValueAttributeType) (ret DestinationCIDRv6GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv6GetValueAttributeType(arg *DestinationCIDRv6GetValueAttributeType, val DestinationCIDRv6GetValueRetType) { + *arg = &val +} + +type DestinationCIDRv6GetValueArgType = string +type DestinationCIDRv6GetValueRetType = string + +// DestinationCIDRv6 IPv6 Classless Inter-Domain Routing (CIDR) Object. +type DestinationCIDRv6 struct { + // REQUIRED + Type DestinationCIDRv6GetTypeAttributeType `json:"type" required:"true"` + // An CIDRv6 string. + // REQUIRED + Value DestinationCIDRv6GetValueAttributeType `json:"value" required:"true"` +} + +type _DestinationCIDRv6 DestinationCIDRv6 + +// NewDestinationCIDRv6 instantiates a new DestinationCIDRv6 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 NewDestinationCIDRv6(types DestinationCIDRv6GetTypeArgType, value DestinationCIDRv6GetValueArgType) *DestinationCIDRv6 { + this := DestinationCIDRv6{} + setDestinationCIDRv6GetTypeAttributeType(&this.Type, types) + setDestinationCIDRv6GetValueAttributeType(&this.Value, value) + return &this +} + +// NewDestinationCIDRv6WithDefaults instantiates a new DestinationCIDRv6 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 NewDestinationCIDRv6WithDefaults() *DestinationCIDRv6 { + this := DestinationCIDRv6{} + return &this +} + +// GetType returns the Type field value +func (o *DestinationCIDRv6) GetType() (ret DestinationCIDRv6GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv6) GetTypeOk() (ret DestinationCIDRv6GetTypeRetType, ok bool) { + return getDestinationCIDRv6GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *DestinationCIDRv6) SetType(v DestinationCIDRv6GetTypeRetType) { + setDestinationCIDRv6GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *DestinationCIDRv6) GetValue() (ret DestinationCIDRv6GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv6) GetValueOk() (ret DestinationCIDRv6GetValueRetType, ok bool) { + return getDestinationCIDRv6GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *DestinationCIDRv6) SetValue(v DestinationCIDRv6GetValueRetType) { + setDestinationCIDRv6GetValueAttributeType(&o.Value, v) +} + +func (o DestinationCIDRv6) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDestinationCIDRv6GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getDestinationCIDRv6GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableDestinationCIDRv6 struct { + value *DestinationCIDRv6 + isSet bool +} + +func (v NullableDestinationCIDRv6) Get() *DestinationCIDRv6 { + return v.value +} + +func (v *NullableDestinationCIDRv6) Set(val *DestinationCIDRv6) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationCIDRv6) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationCIDRv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationCIDRv6(val *DestinationCIDRv6) *NullableDestinationCIDRv6 { + return &NullableDestinationCIDRv6{value: val, isSet: true} +} + +func (v NullableDestinationCIDRv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationCIDRv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_destination_cidrv6_test.go b/pkg/iaasalpha/model_destination_cidrv6_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_destination_cidrv6_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_error.go b/pkg/iaasalpha/model_error.go new file mode 100644 index 00000000..ab95fdfc --- /dev/null +++ b/pkg/iaasalpha/model_error.go @@ -0,0 +1,170 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + +/* + types and functions for code +*/ + +// isLong +type ErrorGetCodeAttributeType = *int64 +type ErrorGetCodeArgType = int64 +type ErrorGetCodeRetType = int64 + +func getErrorGetCodeAttributeTypeOk(arg ErrorGetCodeAttributeType) (ret ErrorGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorGetCodeAttributeType(arg *ErrorGetCodeAttributeType, val ErrorGetCodeRetType) { + *arg = &val +} + +/* + types and functions for msg +*/ + +// isNotNullableString +type ErrorGetMsgAttributeType = *string + +func getErrorGetMsgAttributeTypeOk(arg ErrorGetMsgAttributeType) (ret ErrorGetMsgRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorGetMsgAttributeType(arg *ErrorGetMsgAttributeType, val ErrorGetMsgRetType) { + *arg = &val +} + +type ErrorGetMsgArgType = string +type ErrorGetMsgRetType = string + +// Error Error with HTTP error code and an error message. +type Error struct { + // REQUIRED + Code ErrorGetCodeAttributeType `json:"code" required:"true"` + // An error message. + // REQUIRED + Msg ErrorGetMsgAttributeType `json:"msg" required:"true"` +} + +type _Error Error + +// NewError instantiates a new Error object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewError(code ErrorGetCodeArgType, msg ErrorGetMsgArgType) *Error { + this := Error{} + setErrorGetCodeAttributeType(&this.Code, code) + setErrorGetMsgAttributeType(&this.Msg, msg) + return &this +} + +// NewErrorWithDefaults instantiates a new Error object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetCode returns the Code field value +func (o *Error) GetCode() (ret ErrorGetCodeRetType) { + ret, _ = o.GetCodeOk() + return ret +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *Error) GetCodeOk() (ret ErrorGetCodeRetType, ok bool) { + return getErrorGetCodeAttributeTypeOk(o.Code) +} + +// SetCode sets field value +func (o *Error) SetCode(v ErrorGetCodeRetType) { + setErrorGetCodeAttributeType(&o.Code, v) +} + +// GetMsg returns the Msg field value +func (o *Error) GetMsg() (ret ErrorGetMsgRetType) { + ret, _ = o.GetMsgOk() + return ret +} + +// GetMsgOk returns a tuple with the Msg field value +// and a boolean to check if the value has been set. +func (o *Error) GetMsgOk() (ret ErrorGetMsgRetType, ok bool) { + return getErrorGetMsgAttributeTypeOk(o.Msg) +} + +// SetMsg sets field value +func (o *Error) SetMsg(v ErrorGetMsgRetType) { + setErrorGetMsgAttributeType(&o.Msg, v) +} + +func (o Error) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getErrorGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getErrorGetMsgAttributeTypeOk(o.Msg); ok { + toSerialize["Msg"] = val + } + return toSerialize, nil +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_error_test.go b/pkg/iaasalpha/model_error_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_error_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_network.go b/pkg/iaasalpha/model_network.go new file mode 100644 index 00000000..f30f5756 --- /dev/null +++ b/pkg/iaasalpha/model_network.go @@ -0,0 +1,600 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" + "time" +) + +// checks if the Network type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Network{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type NetworkGetCreatedAtAttributeType = *time.Time +type NetworkGetCreatedAtArgType = time.Time +type NetworkGetCreatedAtRetType = time.Time + +func getNetworkGetCreatedAtAttributeTypeOk(arg NetworkGetCreatedAtAttributeType) (ret NetworkGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetCreatedAtAttributeType(arg *NetworkGetCreatedAtAttributeType, val NetworkGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for dhcp +*/ + +// isBoolean +type NetworkgetDhcpAttributeType = *bool +type NetworkgetDhcpArgType = bool +type NetworkgetDhcpRetType = bool + +func getNetworkgetDhcpAttributeTypeOk(arg NetworkgetDhcpAttributeType) (ret NetworkgetDhcpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkgetDhcpAttributeType(arg *NetworkgetDhcpAttributeType, val NetworkgetDhcpRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type NetworkGetIdAttributeType = *string + +func getNetworkGetIdAttributeTypeOk(arg NetworkGetIdAttributeType) (ret NetworkGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetIdAttributeType(arg *NetworkGetIdAttributeType, val NetworkGetIdRetType) { + *arg = &val +} + +type NetworkGetIdArgType = string +type NetworkGetIdRetType = string + +/* + types and functions for ipv4 +*/ + +// isModel +type NetworkGetIpv4AttributeType = *NetworkIPv4 +type NetworkGetIpv4ArgType = NetworkIPv4 +type NetworkGetIpv4RetType = NetworkIPv4 + +func getNetworkGetIpv4AttributeTypeOk(arg NetworkGetIpv4AttributeType) (ret NetworkGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetIpv4AttributeType(arg *NetworkGetIpv4AttributeType, val NetworkGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type NetworkGetIpv6AttributeType = *NetworkIPv6 +type NetworkGetIpv6ArgType = NetworkIPv6 +type NetworkGetIpv6RetType = NetworkIPv6 + +func getNetworkGetIpv6AttributeTypeOk(arg NetworkGetIpv6AttributeType) (ret NetworkGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetIpv6AttributeType(arg *NetworkGetIpv6AttributeType, val NetworkGetIpv6RetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type NetworkGetLabelsAttributeType = *map[string]interface{} +type NetworkGetLabelsArgType = map[string]interface{} +type NetworkGetLabelsRetType = map[string]interface{} + +func getNetworkGetLabelsAttributeTypeOk(arg NetworkGetLabelsAttributeType) (ret NetworkGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetLabelsAttributeType(arg *NetworkGetLabelsAttributeType, val NetworkGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type NetworkGetNameAttributeType = *string + +func getNetworkGetNameAttributeTypeOk(arg NetworkGetNameAttributeType) (ret NetworkGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetNameAttributeType(arg *NetworkGetNameAttributeType, val NetworkGetNameRetType) { + *arg = &val +} + +type NetworkGetNameArgType = string +type NetworkGetNameRetType = string + +/* + types and functions for routed +*/ + +// isBoolean +type NetworkgetRoutedAttributeType = *bool +type NetworkgetRoutedArgType = bool +type NetworkgetRoutedRetType = bool + +func getNetworkgetRoutedAttributeTypeOk(arg NetworkgetRoutedAttributeType) (ret NetworkgetRoutedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkgetRoutedAttributeType(arg *NetworkgetRoutedAttributeType, val NetworkgetRoutedRetType) { + *arg = &val +} + +/* + types and functions for routingTableId +*/ + +// isNotNullableString +type NetworkGetRoutingTableIdAttributeType = *string + +func getNetworkGetRoutingTableIdAttributeTypeOk(arg NetworkGetRoutingTableIdAttributeType) (ret NetworkGetRoutingTableIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetRoutingTableIdAttributeType(arg *NetworkGetRoutingTableIdAttributeType, val NetworkGetRoutingTableIdRetType) { + *arg = &val +} + +type NetworkGetRoutingTableIdArgType = string +type NetworkGetRoutingTableIdRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type NetworkGetStatusAttributeType = *string + +func getNetworkGetStatusAttributeTypeOk(arg NetworkGetStatusAttributeType) (ret NetworkGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetStatusAttributeType(arg *NetworkGetStatusAttributeType, val NetworkGetStatusRetType) { + *arg = &val +} + +type NetworkGetStatusArgType = string +type NetworkGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type NetworkGetUpdatedAtAttributeType = *time.Time +type NetworkGetUpdatedAtArgType = time.Time +type NetworkGetUpdatedAtRetType = time.Time + +func getNetworkGetUpdatedAtAttributeTypeOk(arg NetworkGetUpdatedAtAttributeType) (ret NetworkGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetUpdatedAtAttributeType(arg *NetworkGetUpdatedAtAttributeType, val NetworkGetUpdatedAtRetType) { + *arg = &val +} + +// Network Object that represents a network. If no routing table is specified, the default routing table is used. +type Network struct { + // Date-time when resource was created. + CreatedAt NetworkGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Enable or disable DHCP for a network. + Dhcp NetworkgetDhcpAttributeType `json:"dhcp,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + Id NetworkGetIdAttributeType `json:"id" required:"true"` + Ipv4 NetworkGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 NetworkGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels NetworkGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Name NetworkGetNameAttributeType `json:"name" required:"true"` + // Shows if the network is routed and therefore accessible from other networks. + Routed NetworkgetRoutedAttributeType `json:"routed,omitempty"` + // Universally Unique Identifier (UUID). + RoutingTableId NetworkGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + // REQUIRED + Status NetworkGetStatusAttributeType `json:"status" required:"true"` + // Date-time when resource was last updated. + UpdatedAt NetworkGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Network Network + +// NewNetwork instantiates a new Network 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 NewNetwork(id NetworkGetIdArgType, name NetworkGetNameArgType, status NetworkGetStatusArgType) *Network { + this := Network{} + setNetworkGetIdAttributeType(&this.Id, id) + setNetworkGetNameAttributeType(&this.Name, name) + setNetworkGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewNetworkWithDefaults instantiates a new Network 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 NewNetworkWithDefaults() *Network { + this := Network{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Network) GetCreatedAt() (res NetworkGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetCreatedAtOk() (ret NetworkGetCreatedAtRetType, ok bool) { + return getNetworkGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Network) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Network) SetCreatedAt(v NetworkGetCreatedAtRetType) { + setNetworkGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *Network) GetDhcp() (res NetworkgetDhcpRetType) { + res, _ = o.GetDhcpOk() + return +} + +// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetDhcpOk() (ret NetworkgetDhcpRetType, ok bool) { + return getNetworkgetDhcpAttributeTypeOk(o.Dhcp) +} + +// HasDhcp returns a boolean if a field has been set. +func (o *Network) HasDhcp() bool { + _, ok := o.GetDhcpOk() + return ok +} + +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *Network) SetDhcp(v NetworkgetDhcpRetType) { + setNetworkgetDhcpAttributeType(&o.Dhcp, v) +} + +// GetId returns the Id field value +func (o *Network) GetId() (ret NetworkGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Network) GetIdOk() (ret NetworkGetIdRetType, ok bool) { + return getNetworkGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Network) SetId(v NetworkGetIdRetType) { + setNetworkGetIdAttributeType(&o.Id, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *Network) GetIpv4() (res NetworkGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetIpv4Ok() (ret NetworkGetIpv4RetType, ok bool) { + return getNetworkGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *Network) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given NetworkIPv4 and assigns it to the Ipv4 field. +func (o *Network) SetIpv4(v NetworkGetIpv4RetType) { + setNetworkGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *Network) GetIpv6() (res NetworkGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetIpv6Ok() (ret NetworkGetIpv6RetType, ok bool) { + return getNetworkGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *Network) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given NetworkIPv6 and assigns it to the Ipv6 field. +func (o *Network) SetIpv6(v NetworkGetIpv6RetType) { + setNetworkGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Network) GetLabels() (res NetworkGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetLabelsOk() (ret NetworkGetLabelsRetType, ok bool) { + return getNetworkGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Network) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Network) SetLabels(v NetworkGetLabelsRetType) { + setNetworkGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *Network) GetName() (ret NetworkGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Network) GetNameOk() (ret NetworkGetNameRetType, ok bool) { + return getNetworkGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Network) SetName(v NetworkGetNameRetType) { + setNetworkGetNameAttributeType(&o.Name, v) +} + +// GetRouted returns the Routed field value if set, zero value otherwise. +func (o *Network) GetRouted() (res NetworkgetRoutedRetType) { + res, _ = o.GetRoutedOk() + return +} + +// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetRoutedOk() (ret NetworkgetRoutedRetType, ok bool) { + return getNetworkgetRoutedAttributeTypeOk(o.Routed) +} + +// HasRouted returns a boolean if a field has been set. +func (o *Network) HasRouted() bool { + _, ok := o.GetRoutedOk() + return ok +} + +// SetRouted gets a reference to the given bool and assigns it to the Routed field. +func (o *Network) SetRouted(v NetworkgetRoutedRetType) { + setNetworkgetRoutedAttributeType(&o.Routed, v) +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *Network) GetRoutingTableId() (res NetworkGetRoutingTableIdRetType) { + res, _ = o.GetRoutingTableIdOk() + return +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetRoutingTableIdOk() (ret NetworkGetRoutingTableIdRetType, ok bool) { + return getNetworkGetRoutingTableIdAttributeTypeOk(o.RoutingTableId) +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *Network) HasRoutingTableId() bool { + _, ok := o.GetRoutingTableIdOk() + return ok +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *Network) SetRoutingTableId(v NetworkGetRoutingTableIdRetType) { + setNetworkGetRoutingTableIdAttributeType(&o.RoutingTableId, v) +} + +// GetStatus returns the Status field value +func (o *Network) GetStatus() (ret NetworkGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Network) GetStatusOk() (ret NetworkGetStatusRetType, ok bool) { + return getNetworkGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Network) SetStatus(v NetworkGetStatusRetType) { + setNetworkGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Network) GetUpdatedAt() (res NetworkGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetUpdatedAtOk() (ret NetworkGetUpdatedAtRetType, ok bool) { + return getNetworkGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Network) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Network) SetUpdatedAt(v NetworkGetUpdatedAtRetType) { + setNetworkGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Network) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getNetworkgetDhcpAttributeTypeOk(o.Dhcp); ok { + toSerialize["Dhcp"] = val + } + if val, ok := getNetworkGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getNetworkGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getNetworkGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getNetworkGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getNetworkGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getNetworkgetRoutedAttributeTypeOk(o.Routed); ok { + toSerialize["Routed"] = val + } + if val, ok := getNetworkGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok { + toSerialize["RoutingTableId"] = val + } + if val, ok := getNetworkGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getNetworkGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableNetwork struct { + value *Network + isSet bool +} + +func (v NullableNetwork) Get() *Network { + return v.value +} + +func (v *NullableNetwork) Set(val *Network) { + v.value = val + v.isSet = true +} + +func (v NullableNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetwork(val *Network) *NullableNetwork { + return &NullableNetwork{value: val, isSet: true} +} + +func (v NullableNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_network_ipv4.go b/pkg/iaasalpha/model_network_ipv4.go new file mode 100644 index 00000000..cb76c88b --- /dev/null +++ b/pkg/iaasalpha/model_network_ipv4.go @@ -0,0 +1,286 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the NetworkIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkIPv4{} + +/* + types and functions for gateway +*/ + +// isNullableString +type NetworkIPv4GetGatewayAttributeType = *NullableString + +func getNetworkIPv4GetGatewayAttributeTypeOk(arg NetworkIPv4GetGatewayAttributeType) (ret NetworkIPv4GetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setNetworkIPv4GetGatewayAttributeType(arg *NetworkIPv4GetGatewayAttributeType, val NetworkIPv4GetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type NetworkIPv4GetGatewayArgType = *string +type NetworkIPv4GetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type NetworkIPv4GetNameserversAttributeType = *[]string +type NetworkIPv4GetNameserversArgType = []string +type NetworkIPv4GetNameserversRetType = []string + +func getNetworkIPv4GetNameserversAttributeTypeOk(arg NetworkIPv4GetNameserversAttributeType) (ret NetworkIPv4GetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv4GetNameserversAttributeType(arg *NetworkIPv4GetNameserversAttributeType, val NetworkIPv4GetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixes +*/ + +// isArray +type NetworkIPv4GetPrefixesAttributeType = *[]string +type NetworkIPv4GetPrefixesArgType = []string +type NetworkIPv4GetPrefixesRetType = []string + +func getNetworkIPv4GetPrefixesAttributeTypeOk(arg NetworkIPv4GetPrefixesAttributeType) (ret NetworkIPv4GetPrefixesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv4GetPrefixesAttributeType(arg *NetworkIPv4GetPrefixesAttributeType, val NetworkIPv4GetPrefixesRetType) { + *arg = &val +} + +/* + types and functions for publicIp +*/ + +// isNotNullableString +type NetworkIPv4GetPublicIpAttributeType = *string + +func getNetworkIPv4GetPublicIpAttributeTypeOk(arg NetworkIPv4GetPublicIpAttributeType) (ret NetworkIPv4GetPublicIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv4GetPublicIpAttributeType(arg *NetworkIPv4GetPublicIpAttributeType, val NetworkIPv4GetPublicIpRetType) { + *arg = &val +} + +type NetworkIPv4GetPublicIpArgType = string +type NetworkIPv4GetPublicIpRetType = string + +// NetworkIPv4 Object that represents the IPv4 part of a network. +type NetworkIPv4 struct { + // The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway NetworkIPv4GetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers NetworkIPv4GetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + Prefixes NetworkIPv4GetPrefixesAttributeType `json:"prefixes" required:"true"` + // String that represents an IPv4 address. + PublicIp NetworkIPv4GetPublicIpAttributeType `json:"publicIp,omitempty"` +} + +type _NetworkIPv4 NetworkIPv4 + +// NewNetworkIPv4 instantiates a new NetworkIPv4 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 NewNetworkIPv4(prefixes NetworkIPv4GetPrefixesArgType) *NetworkIPv4 { + this := NetworkIPv4{} + setNetworkIPv4GetPrefixesAttributeType(&this.Prefixes, prefixes) + return &this +} + +// NewNetworkIPv4WithDefaults instantiates a new NetworkIPv4 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 NewNetworkIPv4WithDefaults() *NetworkIPv4 { + this := NetworkIPv4{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NetworkIPv4) GetGateway() (res NetworkIPv4GetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NetworkIPv4) GetGatewayOk() (ret NetworkIPv4GetGatewayRetType, ok bool) { + return getNetworkIPv4GetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *NetworkIPv4) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *NetworkIPv4) SetGateway(v NetworkIPv4GetGatewayRetType) { + setNetworkIPv4GetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *NetworkIPv4) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *NetworkIPv4) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *NetworkIPv4) GetNameservers() (res NetworkIPv4GetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkIPv4) GetNameserversOk() (ret NetworkIPv4GetNameserversRetType, ok bool) { + return getNetworkIPv4GetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *NetworkIPv4) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *NetworkIPv4) SetNameservers(v NetworkIPv4GetNameserversRetType) { + setNetworkIPv4GetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixes returns the Prefixes field value +func (o *NetworkIPv4) GetPrefixes() (ret NetworkIPv4GetPrefixesRetType) { + ret, _ = o.GetPrefixesOk() + return ret +} + +// GetPrefixesOk returns a tuple with the Prefixes field value +// and a boolean to check if the value has been set. +func (o *NetworkIPv4) GetPrefixesOk() (ret NetworkIPv4GetPrefixesRetType, ok bool) { + return getNetworkIPv4GetPrefixesAttributeTypeOk(o.Prefixes) +} + +// SetPrefixes sets field value +func (o *NetworkIPv4) SetPrefixes(v NetworkIPv4GetPrefixesRetType) { + setNetworkIPv4GetPrefixesAttributeType(&o.Prefixes, v) +} + +// GetPublicIp returns the PublicIp field value if set, zero value otherwise. +func (o *NetworkIPv4) GetPublicIp() (res NetworkIPv4GetPublicIpRetType) { + res, _ = o.GetPublicIpOk() + return +} + +// GetPublicIpOk returns a tuple with the PublicIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkIPv4) GetPublicIpOk() (ret NetworkIPv4GetPublicIpRetType, ok bool) { + return getNetworkIPv4GetPublicIpAttributeTypeOk(o.PublicIp) +} + +// HasPublicIp returns a boolean if a field has been set. +func (o *NetworkIPv4) HasPublicIp() bool { + _, ok := o.GetPublicIpOk() + return ok +} + +// SetPublicIp gets a reference to the given string and assigns it to the PublicIp field. +func (o *NetworkIPv4) SetPublicIp(v NetworkIPv4GetPublicIpRetType) { + setNetworkIPv4GetPublicIpAttributeType(&o.PublicIp, v) +} + +func (o NetworkIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkIPv4GetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getNetworkIPv4GetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getNetworkIPv4GetPrefixesAttributeTypeOk(o.Prefixes); ok { + toSerialize["Prefixes"] = val + } + if val, ok := getNetworkIPv4GetPublicIpAttributeTypeOk(o.PublicIp); ok { + toSerialize["PublicIp"] = val + } + return toSerialize, nil +} + +type NullableNetworkIPv4 struct { + value *NetworkIPv4 + isSet bool +} + +func (v NullableNetworkIPv4) Get() *NetworkIPv4 { + return v.value +} + +func (v *NullableNetworkIPv4) Set(val *NetworkIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkIPv4(val *NetworkIPv4) *NullableNetworkIPv4 { + return &NullableNetworkIPv4{value: val, isSet: true} +} + +func (v NullableNetworkIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_network_ipv4_test.go b/pkg/iaasalpha/model_network_ipv4_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_network_ipv4_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_network_ipv6.go b/pkg/iaasalpha/model_network_ipv6.go new file mode 100644 index 00000000..c6966234 --- /dev/null +++ b/pkg/iaasalpha/model_network_ipv6.go @@ -0,0 +1,237 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the NetworkIPv6 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkIPv6{} + +/* + types and functions for gateway +*/ + +// isNullableString +type NetworkIPv6GetGatewayAttributeType = *NullableString + +func getNetworkIPv6GetGatewayAttributeTypeOk(arg NetworkIPv6GetGatewayAttributeType) (ret NetworkIPv6GetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setNetworkIPv6GetGatewayAttributeType(arg *NetworkIPv6GetGatewayAttributeType, val NetworkIPv6GetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type NetworkIPv6GetGatewayArgType = *string +type NetworkIPv6GetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type NetworkIPv6GetNameserversAttributeType = *[]string +type NetworkIPv6GetNameserversArgType = []string +type NetworkIPv6GetNameserversRetType = []string + +func getNetworkIPv6GetNameserversAttributeTypeOk(arg NetworkIPv6GetNameserversAttributeType) (ret NetworkIPv6GetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv6GetNameserversAttributeType(arg *NetworkIPv6GetNameserversAttributeType, val NetworkIPv6GetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixes +*/ + +// isArray +type NetworkIPv6GetPrefixesAttributeType = *[]string +type NetworkIPv6GetPrefixesArgType = []string +type NetworkIPv6GetPrefixesRetType = []string + +func getNetworkIPv6GetPrefixesAttributeTypeOk(arg NetworkIPv6GetPrefixesAttributeType) (ret NetworkIPv6GetPrefixesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv6GetPrefixesAttributeType(arg *NetworkIPv6GetPrefixesAttributeType, val NetworkIPv6GetPrefixesRetType) { + *arg = &val +} + +// NetworkIPv6 Object that represents the IPv6 part of a network. +type NetworkIPv6 struct { + // The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway NetworkIPv6GetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers NetworkIPv6GetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + Prefixes NetworkIPv6GetPrefixesAttributeType `json:"prefixes" required:"true"` +} + +type _NetworkIPv6 NetworkIPv6 + +// NewNetworkIPv6 instantiates a new NetworkIPv6 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 NewNetworkIPv6(prefixes NetworkIPv6GetPrefixesArgType) *NetworkIPv6 { + this := NetworkIPv6{} + setNetworkIPv6GetPrefixesAttributeType(&this.Prefixes, prefixes) + return &this +} + +// NewNetworkIPv6WithDefaults instantiates a new NetworkIPv6 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 NewNetworkIPv6WithDefaults() *NetworkIPv6 { + this := NetworkIPv6{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NetworkIPv6) GetGateway() (res NetworkIPv6GetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NetworkIPv6) GetGatewayOk() (ret NetworkIPv6GetGatewayRetType, ok bool) { + return getNetworkIPv6GetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *NetworkIPv6) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *NetworkIPv6) SetGateway(v NetworkIPv6GetGatewayRetType) { + setNetworkIPv6GetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *NetworkIPv6) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *NetworkIPv6) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *NetworkIPv6) GetNameservers() (res NetworkIPv6GetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkIPv6) GetNameserversOk() (ret NetworkIPv6GetNameserversRetType, ok bool) { + return getNetworkIPv6GetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *NetworkIPv6) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *NetworkIPv6) SetNameservers(v NetworkIPv6GetNameserversRetType) { + setNetworkIPv6GetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixes returns the Prefixes field value +func (o *NetworkIPv6) GetPrefixes() (ret NetworkIPv6GetPrefixesRetType) { + ret, _ = o.GetPrefixesOk() + return ret +} + +// GetPrefixesOk returns a tuple with the Prefixes field value +// and a boolean to check if the value has been set. +func (o *NetworkIPv6) GetPrefixesOk() (ret NetworkIPv6GetPrefixesRetType, ok bool) { + return getNetworkIPv6GetPrefixesAttributeTypeOk(o.Prefixes) +} + +// SetPrefixes sets field value +func (o *NetworkIPv6) SetPrefixes(v NetworkIPv6GetPrefixesRetType) { + setNetworkIPv6GetPrefixesAttributeType(&o.Prefixes, v) +} + +func (o NetworkIPv6) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkIPv6GetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getNetworkIPv6GetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getNetworkIPv6GetPrefixesAttributeTypeOk(o.Prefixes); ok { + toSerialize["Prefixes"] = val + } + return toSerialize, nil +} + +type NullableNetworkIPv6 struct { + value *NetworkIPv6 + isSet bool +} + +func (v NullableNetworkIPv6) Get() *NetworkIPv6 { + return v.value +} + +func (v *NullableNetworkIPv6) Set(val *NetworkIPv6) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkIPv6) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkIPv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkIPv6(val *NetworkIPv6) *NullableNetworkIPv6 { + return &NullableNetworkIPv6{value: val, isSet: true} +} + +func (v NullableNetworkIPv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkIPv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_network_ipv6_test.go b/pkg/iaasalpha/model_network_ipv6_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_network_ipv6_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_network_list_response.go b/pkg/iaasalpha/model_network_list_response.go new file mode 100644 index 00000000..47892a89 --- /dev/null +++ b/pkg/iaasalpha/model_network_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the NetworkListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkListResponse{} + +/* + types and functions for items +*/ + +// isArray +type NetworkListResponseGetItemsAttributeType = *[]Network +type NetworkListResponseGetItemsArgType = []Network +type NetworkListResponseGetItemsRetType = []Network + +func getNetworkListResponseGetItemsAttributeTypeOk(arg NetworkListResponseGetItemsAttributeType) (ret NetworkListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkListResponseGetItemsAttributeType(arg *NetworkListResponseGetItemsAttributeType, val NetworkListResponseGetItemsRetType) { + *arg = &val +} + +// NetworkListResponse Network list response. +type NetworkListResponse struct { + // A list of networks. + // REQUIRED + Items NetworkListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _NetworkListResponse NetworkListResponse + +// NewNetworkListResponse instantiates a new NetworkListResponse 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 NewNetworkListResponse(items NetworkListResponseGetItemsArgType) *NetworkListResponse { + this := NetworkListResponse{} + setNetworkListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewNetworkListResponseWithDefaults instantiates a new NetworkListResponse 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 NewNetworkListResponseWithDefaults() *NetworkListResponse { + this := NetworkListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *NetworkListResponse) GetItems() (ret NetworkListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *NetworkListResponse) GetItemsOk() (ret NetworkListResponseGetItemsRetType, ok bool) { + return getNetworkListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *NetworkListResponse) SetItems(v NetworkListResponseGetItemsRetType) { + setNetworkListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o NetworkListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableNetworkListResponse struct { + value *NetworkListResponse + isSet bool +} + +func (v NullableNetworkListResponse) Get() *NetworkListResponse { + return v.value +} + +func (v *NullableNetworkListResponse) Set(val *NetworkListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkListResponse(val *NetworkListResponse) *NullableNetworkListResponse { + return &NullableNetworkListResponse{value: val, isSet: true} +} + +func (v NullableNetworkListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_network_list_response_test.go b/pkg/iaasalpha/model_network_list_response_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_network_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_network_test.go b/pkg/iaasalpha/model_network_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_network_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_nexthop_blackhole.go b/pkg/iaasalpha/model_nexthop_blackhole.go new file mode 100644 index 00000000..743e2a7c --- /dev/null +++ b/pkg/iaasalpha/model_nexthop_blackhole.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the NexthopBlackhole type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopBlackhole{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopBlackholeGetTypeAttributeType = *string + +func getNexthopBlackholeGetTypeAttributeTypeOk(arg NexthopBlackholeGetTypeAttributeType) (ret NexthopBlackholeGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopBlackholeGetTypeAttributeType(arg *NexthopBlackholeGetTypeAttributeType, val NexthopBlackholeGetTypeRetType) { + *arg = &val +} + +type NexthopBlackholeGetTypeArgType = string +type NexthopBlackholeGetTypeRetType = string + +// NexthopBlackhole Object that represents a blackhole route. +type NexthopBlackhole struct { + // REQUIRED + Type NexthopBlackholeGetTypeAttributeType `json:"type" required:"true"` +} + +type _NexthopBlackhole NexthopBlackhole + +// NewNexthopBlackhole instantiates a new NexthopBlackhole 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 NewNexthopBlackhole(types NexthopBlackholeGetTypeArgType) *NexthopBlackhole { + this := NexthopBlackhole{} + setNexthopBlackholeGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewNexthopBlackholeWithDefaults instantiates a new NexthopBlackhole 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 NewNexthopBlackholeWithDefaults() *NexthopBlackhole { + this := NexthopBlackhole{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopBlackhole) GetType() (ret NexthopBlackholeGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopBlackhole) GetTypeOk() (ret NexthopBlackholeGetTypeRetType, ok bool) { + return getNexthopBlackholeGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopBlackhole) SetType(v NexthopBlackholeGetTypeRetType) { + setNexthopBlackholeGetTypeAttributeType(&o.Type, v) +} + +func (o NexthopBlackhole) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopBlackholeGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableNexthopBlackhole struct { + value *NexthopBlackhole + isSet bool +} + +func (v NullableNexthopBlackhole) Get() *NexthopBlackhole { + return v.value +} + +func (v *NullableNexthopBlackhole) Set(val *NexthopBlackhole) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopBlackhole) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopBlackhole) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopBlackhole(val *NexthopBlackhole) *NullableNexthopBlackhole { + return &NullableNexthopBlackhole{value: val, isSet: true} +} + +func (v NullableNexthopBlackhole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopBlackhole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_nexthop_blackhole_test.go b/pkg/iaasalpha/model_nexthop_blackhole_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_nexthop_blackhole_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_nexthop_internet.go b/pkg/iaasalpha/model_nexthop_internet.go new file mode 100644 index 00000000..bbb6bdf3 --- /dev/null +++ b/pkg/iaasalpha/model_nexthop_internet.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the NexthopInternet type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopInternet{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopInternetGetTypeAttributeType = *string + +func getNexthopInternetGetTypeAttributeTypeOk(arg NexthopInternetGetTypeAttributeType) (ret NexthopInternetGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopInternetGetTypeAttributeType(arg *NexthopInternetGetTypeAttributeType, val NexthopInternetGetTypeRetType) { + *arg = &val +} + +type NexthopInternetGetTypeArgType = string +type NexthopInternetGetTypeRetType = string + +// NexthopInternet Object that represents a route to the internet. +type NexthopInternet struct { + // REQUIRED + Type NexthopInternetGetTypeAttributeType `json:"type" required:"true"` +} + +type _NexthopInternet NexthopInternet + +// NewNexthopInternet instantiates a new NexthopInternet 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 NewNexthopInternet(types NexthopInternetGetTypeArgType) *NexthopInternet { + this := NexthopInternet{} + setNexthopInternetGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewNexthopInternetWithDefaults instantiates a new NexthopInternet 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 NewNexthopInternetWithDefaults() *NexthopInternet { + this := NexthopInternet{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopInternet) GetType() (ret NexthopInternetGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopInternet) GetTypeOk() (ret NexthopInternetGetTypeRetType, ok bool) { + return getNexthopInternetGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopInternet) SetType(v NexthopInternetGetTypeRetType) { + setNexthopInternetGetTypeAttributeType(&o.Type, v) +} + +func (o NexthopInternet) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopInternetGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableNexthopInternet struct { + value *NexthopInternet + isSet bool +} + +func (v NullableNexthopInternet) Get() *NexthopInternet { + return v.value +} + +func (v *NullableNexthopInternet) Set(val *NexthopInternet) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopInternet) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopInternet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopInternet(val *NexthopInternet) *NullableNexthopInternet { + return &NullableNexthopInternet{value: val, isSet: true} +} + +func (v NullableNexthopInternet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopInternet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_nexthop_internet_test.go b/pkg/iaasalpha/model_nexthop_internet_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_nexthop_internet_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_nexthop_ipv4.go b/pkg/iaasalpha/model_nexthop_ipv4.go new file mode 100644 index 00000000..83ce911f --- /dev/null +++ b/pkg/iaasalpha/model_nexthop_ipv4.go @@ -0,0 +1,171 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the NexthopIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopIPv4{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopIPv4GetTypeAttributeType = *string + +func getNexthopIPv4GetTypeAttributeTypeOk(arg NexthopIPv4GetTypeAttributeType) (ret NexthopIPv4GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv4GetTypeAttributeType(arg *NexthopIPv4GetTypeAttributeType, val NexthopIPv4GetTypeRetType) { + *arg = &val +} + +type NexthopIPv4GetTypeArgType = string +type NexthopIPv4GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type NexthopIPv4GetValueAttributeType = *string + +func getNexthopIPv4GetValueAttributeTypeOk(arg NexthopIPv4GetValueAttributeType) (ret NexthopIPv4GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv4GetValueAttributeType(arg *NexthopIPv4GetValueAttributeType, val NexthopIPv4GetValueRetType) { + *arg = &val +} + +type NexthopIPv4GetValueArgType = string +type NexthopIPv4GetValueRetType = string + +// NexthopIPv4 Object that represents an IPv4 address. +type NexthopIPv4 struct { + // REQUIRED + Type NexthopIPv4GetTypeAttributeType `json:"type" required:"true"` + // An IPv4 address. + // REQUIRED + Value NexthopIPv4GetValueAttributeType `json:"value" required:"true"` +} + +type _NexthopIPv4 NexthopIPv4 + +// NewNexthopIPv4 instantiates a new NexthopIPv4 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 NewNexthopIPv4(types NexthopIPv4GetTypeArgType, value NexthopIPv4GetValueArgType) *NexthopIPv4 { + this := NexthopIPv4{} + setNexthopIPv4GetTypeAttributeType(&this.Type, types) + setNexthopIPv4GetValueAttributeType(&this.Value, value) + return &this +} + +// NewNexthopIPv4WithDefaults instantiates a new NexthopIPv4 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 NewNexthopIPv4WithDefaults() *NexthopIPv4 { + this := NexthopIPv4{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopIPv4) GetType() (ret NexthopIPv4GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv4) GetTypeOk() (ret NexthopIPv4GetTypeRetType, ok bool) { + return getNexthopIPv4GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopIPv4) SetType(v NexthopIPv4GetTypeRetType) { + setNexthopIPv4GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *NexthopIPv4) GetValue() (ret NexthopIPv4GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv4) GetValueOk() (ret NexthopIPv4GetValueRetType, ok bool) { + return getNexthopIPv4GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *NexthopIPv4) SetValue(v NexthopIPv4GetValueRetType) { + setNexthopIPv4GetValueAttributeType(&o.Value, v) +} + +func (o NexthopIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopIPv4GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getNexthopIPv4GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableNexthopIPv4 struct { + value *NexthopIPv4 + isSet bool +} + +func (v NullableNexthopIPv4) Get() *NexthopIPv4 { + return v.value +} + +func (v *NullableNexthopIPv4) Set(val *NexthopIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopIPv4(val *NexthopIPv4) *NullableNexthopIPv4 { + return &NullableNexthopIPv4{value: val, isSet: true} +} + +func (v NullableNexthopIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_nexthop_ipv4_test.go b/pkg/iaasalpha/model_nexthop_ipv4_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_nexthop_ipv4_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_nexthop_ipv6.go b/pkg/iaasalpha/model_nexthop_ipv6.go new file mode 100644 index 00000000..079ae452 --- /dev/null +++ b/pkg/iaasalpha/model_nexthop_ipv6.go @@ -0,0 +1,171 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the NexthopIPv6 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopIPv6{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopIPv6GetTypeAttributeType = *string + +func getNexthopIPv6GetTypeAttributeTypeOk(arg NexthopIPv6GetTypeAttributeType) (ret NexthopIPv6GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv6GetTypeAttributeType(arg *NexthopIPv6GetTypeAttributeType, val NexthopIPv6GetTypeRetType) { + *arg = &val +} + +type NexthopIPv6GetTypeArgType = string +type NexthopIPv6GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type NexthopIPv6GetValueAttributeType = *string + +func getNexthopIPv6GetValueAttributeTypeOk(arg NexthopIPv6GetValueAttributeType) (ret NexthopIPv6GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv6GetValueAttributeType(arg *NexthopIPv6GetValueAttributeType, val NexthopIPv6GetValueRetType) { + *arg = &val +} + +type NexthopIPv6GetValueArgType = string +type NexthopIPv6GetValueRetType = string + +// NexthopIPv6 Object that represents an IPv6 address. +type NexthopIPv6 struct { + // REQUIRED + Type NexthopIPv6GetTypeAttributeType `json:"type" required:"true"` + // An IPv6 address. + // REQUIRED + Value NexthopIPv6GetValueAttributeType `json:"value" required:"true"` +} + +type _NexthopIPv6 NexthopIPv6 + +// NewNexthopIPv6 instantiates a new NexthopIPv6 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 NewNexthopIPv6(types NexthopIPv6GetTypeArgType, value NexthopIPv6GetValueArgType) *NexthopIPv6 { + this := NexthopIPv6{} + setNexthopIPv6GetTypeAttributeType(&this.Type, types) + setNexthopIPv6GetValueAttributeType(&this.Value, value) + return &this +} + +// NewNexthopIPv6WithDefaults instantiates a new NexthopIPv6 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 NewNexthopIPv6WithDefaults() *NexthopIPv6 { + this := NexthopIPv6{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopIPv6) GetType() (ret NexthopIPv6GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv6) GetTypeOk() (ret NexthopIPv6GetTypeRetType, ok bool) { + return getNexthopIPv6GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopIPv6) SetType(v NexthopIPv6GetTypeRetType) { + setNexthopIPv6GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *NexthopIPv6) GetValue() (ret NexthopIPv6GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv6) GetValueOk() (ret NexthopIPv6GetValueRetType, ok bool) { + return getNexthopIPv6GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *NexthopIPv6) SetValue(v NexthopIPv6GetValueRetType) { + setNexthopIPv6GetValueAttributeType(&o.Value, v) +} + +func (o NexthopIPv6) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopIPv6GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getNexthopIPv6GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableNexthopIPv6 struct { + value *NexthopIPv6 + isSet bool +} + +func (v NullableNexthopIPv6) Get() *NexthopIPv6 { + return v.value +} + +func (v *NullableNexthopIPv6) Set(val *NexthopIPv6) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopIPv6) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopIPv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopIPv6(val *NexthopIPv6) *NullableNexthopIPv6 { + return &NullableNexthopIPv6{value: val, isSet: true} +} + +func (v NullableNexthopIPv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopIPv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_nexthop_ipv6_test.go b/pkg/iaasalpha/model_nexthop_ipv6_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_nexthop_ipv6_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_partial_update_network_payload.go b/pkg/iaasalpha/model_partial_update_network_payload.go new file mode 100644 index 00000000..1f837fc9 --- /dev/null +++ b/pkg/iaasalpha/model_partial_update_network_payload.go @@ -0,0 +1,416 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the PartialUpdateNetworkPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PartialUpdateNetworkPayload{} + +/* + types and functions for dhcp +*/ + +// isBoolean +type PartialUpdateNetworkPayloadgetDhcpAttributeType = *bool +type PartialUpdateNetworkPayloadgetDhcpArgType = bool +type PartialUpdateNetworkPayloadgetDhcpRetType = bool + +func getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(arg PartialUpdateNetworkPayloadgetDhcpAttributeType) (ret PartialUpdateNetworkPayloadgetDhcpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadgetDhcpAttributeType(arg *PartialUpdateNetworkPayloadgetDhcpAttributeType, val PartialUpdateNetworkPayloadgetDhcpRetType) { + *arg = &val +} + +/* + types and functions for ipv4 +*/ + +// isModel +type PartialUpdateNetworkPayloadGetIpv4AttributeType = *UpdateNetworkIPv4Body +type PartialUpdateNetworkPayloadGetIpv4ArgType = UpdateNetworkIPv4Body +type PartialUpdateNetworkPayloadGetIpv4RetType = UpdateNetworkIPv4Body + +func getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(arg PartialUpdateNetworkPayloadGetIpv4AttributeType) (ret PartialUpdateNetworkPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetIpv4AttributeType(arg *PartialUpdateNetworkPayloadGetIpv4AttributeType, val PartialUpdateNetworkPayloadGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type PartialUpdateNetworkPayloadGetIpv6AttributeType = *UpdateNetworkIPv6Body +type PartialUpdateNetworkPayloadGetIpv6ArgType = UpdateNetworkIPv6Body +type PartialUpdateNetworkPayloadGetIpv6RetType = UpdateNetworkIPv6Body + +func getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(arg PartialUpdateNetworkPayloadGetIpv6AttributeType) (ret PartialUpdateNetworkPayloadGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetIpv6AttributeType(arg *PartialUpdateNetworkPayloadGetIpv6AttributeType, val PartialUpdateNetworkPayloadGetIpv6RetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type PartialUpdateNetworkPayloadGetLabelsAttributeType = *map[string]interface{} +type PartialUpdateNetworkPayloadGetLabelsArgType = map[string]interface{} +type PartialUpdateNetworkPayloadGetLabelsRetType = map[string]interface{} + +func getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(arg PartialUpdateNetworkPayloadGetLabelsAttributeType) (ret PartialUpdateNetworkPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetLabelsAttributeType(arg *PartialUpdateNetworkPayloadGetLabelsAttributeType, val PartialUpdateNetworkPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type PartialUpdateNetworkPayloadGetNameAttributeType = *string + +func getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(arg PartialUpdateNetworkPayloadGetNameAttributeType) (ret PartialUpdateNetworkPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetNameAttributeType(arg *PartialUpdateNetworkPayloadGetNameAttributeType, val PartialUpdateNetworkPayloadGetNameRetType) { + *arg = &val +} + +type PartialUpdateNetworkPayloadGetNameArgType = string +type PartialUpdateNetworkPayloadGetNameRetType = string + +/* + types and functions for routed +*/ + +// isBoolean +type PartialUpdateNetworkPayloadgetRoutedAttributeType = *bool +type PartialUpdateNetworkPayloadgetRoutedArgType = bool +type PartialUpdateNetworkPayloadgetRoutedRetType = bool + +func getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(arg PartialUpdateNetworkPayloadgetRoutedAttributeType) (ret PartialUpdateNetworkPayloadgetRoutedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadgetRoutedAttributeType(arg *PartialUpdateNetworkPayloadgetRoutedAttributeType, val PartialUpdateNetworkPayloadgetRoutedRetType) { + *arg = &val +} + +/* + types and functions for routingTableId +*/ + +// isNotNullableString +type PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType = *string + +func getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(arg PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType) (ret PartialUpdateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetRoutingTableIdAttributeType(arg *PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType, val PartialUpdateNetworkPayloadGetRoutingTableIdRetType) { + *arg = &val +} + +type PartialUpdateNetworkPayloadGetRoutingTableIdArgType = string +type PartialUpdateNetworkPayloadGetRoutingTableIdRetType = string + +// PartialUpdateNetworkPayload Object that represents the request body for a network update. +type PartialUpdateNetworkPayload struct { + // Enable or disable DHCP for a network. + Dhcp PartialUpdateNetworkPayloadgetDhcpAttributeType `json:"dhcp,omitempty"` + Ipv4 PartialUpdateNetworkPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 PartialUpdateNetworkPayloadGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels PartialUpdateNetworkPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name PartialUpdateNetworkPayloadGetNameAttributeType `json:"name,omitempty"` + // Shows if the network is routed and therefore accessible from other networks. + Routed PartialUpdateNetworkPayloadgetRoutedAttributeType `json:"routed,omitempty"` + // Universally Unique Identifier (UUID). + RoutingTableId PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"` +} + +// NewPartialUpdateNetworkPayload instantiates a new PartialUpdateNetworkPayload 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 NewPartialUpdateNetworkPayload() *PartialUpdateNetworkPayload { + this := PartialUpdateNetworkPayload{} + return &this +} + +// NewPartialUpdateNetworkPayloadWithDefaults instantiates a new PartialUpdateNetworkPayload 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 NewPartialUpdateNetworkPayloadWithDefaults() *PartialUpdateNetworkPayload { + this := PartialUpdateNetworkPayload{} + return &this +} + +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetDhcp() (res PartialUpdateNetworkPayloadgetDhcpRetType) { + res, _ = o.GetDhcpOk() + return +} + +// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetDhcpOk() (ret PartialUpdateNetworkPayloadgetDhcpRetType, ok bool) { + return getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp) +} + +// HasDhcp returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasDhcp() bool { + _, ok := o.GetDhcpOk() + return ok +} + +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *PartialUpdateNetworkPayload) SetDhcp(v PartialUpdateNetworkPayloadgetDhcpRetType) { + setPartialUpdateNetworkPayloadgetDhcpAttributeType(&o.Dhcp, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetIpv4() (res PartialUpdateNetworkPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetIpv4Ok() (ret PartialUpdateNetworkPayloadGetIpv4RetType, ok bool) { + return getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given UpdateNetworkIPv4Body and assigns it to the Ipv4 field. +func (o *PartialUpdateNetworkPayload) SetIpv4(v PartialUpdateNetworkPayloadGetIpv4RetType) { + setPartialUpdateNetworkPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetIpv6() (res PartialUpdateNetworkPayloadGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetIpv6Ok() (ret PartialUpdateNetworkPayloadGetIpv6RetType, ok bool) { + return getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given UpdateNetworkIPv6Body and assigns it to the Ipv6 field. +func (o *PartialUpdateNetworkPayload) SetIpv6(v PartialUpdateNetworkPayloadGetIpv6RetType) { + setPartialUpdateNetworkPayloadGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetLabels() (res PartialUpdateNetworkPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetLabelsOk() (ret PartialUpdateNetworkPayloadGetLabelsRetType, ok bool) { + return getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *PartialUpdateNetworkPayload) SetLabels(v PartialUpdateNetworkPayloadGetLabelsRetType) { + setPartialUpdateNetworkPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetName() (res PartialUpdateNetworkPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetNameOk() (ret PartialUpdateNetworkPayloadGetNameRetType, ok bool) { + return getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PartialUpdateNetworkPayload) SetName(v PartialUpdateNetworkPayloadGetNameRetType) { + setPartialUpdateNetworkPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRouted returns the Routed field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetRouted() (res PartialUpdateNetworkPayloadgetRoutedRetType) { + res, _ = o.GetRoutedOk() + return +} + +// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetRoutedOk() (ret PartialUpdateNetworkPayloadgetRoutedRetType, ok bool) { + return getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed) +} + +// HasRouted returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasRouted() bool { + _, ok := o.GetRoutedOk() + return ok +} + +// SetRouted gets a reference to the given bool and assigns it to the Routed field. +func (o *PartialUpdateNetworkPayload) SetRouted(v PartialUpdateNetworkPayloadgetRoutedRetType) { + setPartialUpdateNetworkPayloadgetRoutedAttributeType(&o.Routed, v) +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetRoutingTableId() (res PartialUpdateNetworkPayloadGetRoutingTableIdRetType) { + res, _ = o.GetRoutingTableIdOk() + return +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetRoutingTableIdOk() (ret PartialUpdateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + return getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId) +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasRoutingTableId() bool { + _, ok := o.GetRoutingTableIdOk() + return ok +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *PartialUpdateNetworkPayload) SetRoutingTableId(v PartialUpdateNetworkPayloadGetRoutingTableIdRetType) { + setPartialUpdateNetworkPayloadGetRoutingTableIdAttributeType(&o.RoutingTableId, v) +} + +func (o PartialUpdateNetworkPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp); ok { + toSerialize["Dhcp"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed); ok { + toSerialize["Routed"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok { + toSerialize["RoutingTableId"] = val + } + return toSerialize, nil +} + +type NullablePartialUpdateNetworkPayload struct { + value *PartialUpdateNetworkPayload + isSet bool +} + +func (v NullablePartialUpdateNetworkPayload) Get() *PartialUpdateNetworkPayload { + return v.value +} + +func (v *NullablePartialUpdateNetworkPayload) Set(val *PartialUpdateNetworkPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateNetworkPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateNetworkPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateNetworkPayload(val *PartialUpdateNetworkPayload) *NullablePartialUpdateNetworkPayload { + return &NullablePartialUpdateNetworkPayload{value: val, isSet: true} +} + +func (v NullablePartialUpdateNetworkPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateNetworkPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_partial_update_network_payload_test.go b/pkg/iaasalpha/model_partial_update_network_payload_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_partial_update_network_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_route.go b/pkg/iaasalpha/model_route.go new file mode 100644 index 00000000..0227580b --- /dev/null +++ b/pkg/iaasalpha/model_route.go @@ -0,0 +1,362 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" + "time" +) + +// checks if the Route type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Route{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type RouteGetCreatedAtAttributeType = *time.Time +type RouteGetCreatedAtArgType = time.Time +type RouteGetCreatedAtRetType = time.Time + +func getRouteGetCreatedAtAttributeTypeOk(arg RouteGetCreatedAtAttributeType) (ret RouteGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetCreatedAtAttributeType(arg *RouteGetCreatedAtAttributeType, val RouteGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for destination +*/ + +// isModel +type RouteGetDestinationAttributeType = *RouteDestination +type RouteGetDestinationArgType = RouteDestination +type RouteGetDestinationRetType = RouteDestination + +func getRouteGetDestinationAttributeTypeOk(arg RouteGetDestinationAttributeType) (ret RouteGetDestinationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetDestinationAttributeType(arg *RouteGetDestinationAttributeType, val RouteGetDestinationRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type RouteGetIdAttributeType = *string + +func getRouteGetIdAttributeTypeOk(arg RouteGetIdAttributeType) (ret RouteGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetIdAttributeType(arg *RouteGetIdAttributeType, val RouteGetIdRetType) { + *arg = &val +} + +type RouteGetIdArgType = string +type RouteGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type RouteGetLabelsAttributeType = *map[string]interface{} +type RouteGetLabelsArgType = map[string]interface{} +type RouteGetLabelsRetType = map[string]interface{} + +func getRouteGetLabelsAttributeTypeOk(arg RouteGetLabelsAttributeType) (ret RouteGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetLabelsAttributeType(arg *RouteGetLabelsAttributeType, val RouteGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for nexthop +*/ + +// isModel +type RouteGetNexthopAttributeType = *RouteNexthop +type RouteGetNexthopArgType = RouteNexthop +type RouteGetNexthopRetType = RouteNexthop + +func getRouteGetNexthopAttributeTypeOk(arg RouteGetNexthopAttributeType) (ret RouteGetNexthopRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetNexthopAttributeType(arg *RouteGetNexthopAttributeType, val RouteGetNexthopRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type RouteGetUpdatedAtAttributeType = *time.Time +type RouteGetUpdatedAtArgType = time.Time +type RouteGetUpdatedAtRetType = time.Time + +func getRouteGetUpdatedAtAttributeTypeOk(arg RouteGetUpdatedAtAttributeType) (ret RouteGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetUpdatedAtAttributeType(arg *RouteGetUpdatedAtAttributeType, val RouteGetUpdatedAtRetType) { + *arg = &val +} + +// Route Object represents a network route. +type Route struct { + // Date-time when resource was created. + CreatedAt RouteGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // REQUIRED + Destination RouteGetDestinationAttributeType `json:"destination" required:"true"` + // Universally Unique Identifier (UUID). + Id RouteGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels RouteGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Nexthop RouteGetNexthopAttributeType `json:"nexthop" required:"true"` + // Date-time when resource was last updated. + UpdatedAt RouteGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Route Route + +// NewRoute instantiates a new Route 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 NewRoute(destination RouteGetDestinationArgType, nexthop RouteGetNexthopArgType) *Route { + this := Route{} + setRouteGetDestinationAttributeType(&this.Destination, destination) + setRouteGetNexthopAttributeType(&this.Nexthop, nexthop) + return &this +} + +// NewRouteWithDefaults instantiates a new Route 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 NewRouteWithDefaults() *Route { + this := Route{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Route) GetCreatedAt() (res RouteGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetCreatedAtOk() (ret RouteGetCreatedAtRetType, ok bool) { + return getRouteGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Route) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Route) SetCreatedAt(v RouteGetCreatedAtRetType) { + setRouteGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDestination returns the Destination field value +func (o *Route) GetDestination() (ret RouteGetDestinationRetType) { + ret, _ = o.GetDestinationOk() + return ret +} + +// GetDestinationOk returns a tuple with the Destination field value +// and a boolean to check if the value has been set. +func (o *Route) GetDestinationOk() (ret RouteGetDestinationRetType, ok bool) { + return getRouteGetDestinationAttributeTypeOk(o.Destination) +} + +// SetDestination sets field value +func (o *Route) SetDestination(v RouteGetDestinationRetType) { + setRouteGetDestinationAttributeType(&o.Destination, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Route) GetId() (res RouteGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetIdOk() (ret RouteGetIdRetType, ok bool) { + return getRouteGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Route) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Route) SetId(v RouteGetIdRetType) { + setRouteGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Route) GetLabels() (res RouteGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetLabelsOk() (ret RouteGetLabelsRetType, ok bool) { + return getRouteGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Route) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Route) SetLabels(v RouteGetLabelsRetType) { + setRouteGetLabelsAttributeType(&o.Labels, v) +} + +// GetNexthop returns the Nexthop field value +func (o *Route) GetNexthop() (ret RouteGetNexthopRetType) { + ret, _ = o.GetNexthopOk() + return ret +} + +// GetNexthopOk returns a tuple with the Nexthop field value +// and a boolean to check if the value has been set. +func (o *Route) GetNexthopOk() (ret RouteGetNexthopRetType, ok bool) { + return getRouteGetNexthopAttributeTypeOk(o.Nexthop) +} + +// SetNexthop sets field value +func (o *Route) SetNexthop(v RouteGetNexthopRetType) { + setRouteGetNexthopAttributeType(&o.Nexthop, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Route) GetUpdatedAt() (res RouteGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetUpdatedAtOk() (ret RouteGetUpdatedAtRetType, ok bool) { + return getRouteGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Route) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Route) SetUpdatedAt(v RouteGetUpdatedAtRetType) { + setRouteGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Route) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRouteGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getRouteGetDestinationAttributeTypeOk(o.Destination); ok { + toSerialize["Destination"] = val + } + if val, ok := getRouteGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRouteGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getRouteGetNexthopAttributeTypeOk(o.Nexthop); ok { + toSerialize["Nexthop"] = val + } + if val, ok := getRouteGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableRoute struct { + value *Route + isSet bool +} + +func (v NullableRoute) Get() *Route { + return v.value +} + +func (v *NullableRoute) Set(val *Route) { + v.value = val + v.isSet = true +} + +func (v NullableRoute) IsSet() bool { + return v.isSet +} + +func (v *NullableRoute) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoute(val *Route) *NullableRoute { + return &NullableRoute{value: val, isSet: true} +} + +func (v NullableRoute) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoute) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_route_destination.go b/pkg/iaasalpha/model_route_destination.go new file mode 100644 index 00000000..90061ce7 --- /dev/null +++ b/pkg/iaasalpha/model_route_destination.go @@ -0,0 +1,163 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" + "fmt" +) + +// RouteDestination - struct for RouteDestination +type RouteDestination struct { + DestinationCIDRv4 *DestinationCIDRv4 + DestinationCIDRv6 *DestinationCIDRv6 +} + +// DestinationCIDRv4AsRouteDestination is a convenience function that returns DestinationCIDRv4 wrapped in RouteDestination +func DestinationCIDRv4AsRouteDestination(v *DestinationCIDRv4) RouteDestination { + return RouteDestination{ + DestinationCIDRv4: v, + } +} + +// DestinationCIDRv6AsRouteDestination is a convenience function that returns DestinationCIDRv6 wrapped in RouteDestination +func DestinationCIDRv6AsRouteDestination(v *DestinationCIDRv6) RouteDestination { + return RouteDestination{ + DestinationCIDRv6: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *RouteDestination) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'DestinationCIDRv4' + if jsonDict["type"] == "DestinationCIDRv4" { + // try to unmarshal JSON data into DestinationCIDRv4 + err = json.Unmarshal(data, &dst.DestinationCIDRv4) + if err == nil { + return nil // data stored in dst.DestinationCIDRv4, return on the first match + } else { + dst.DestinationCIDRv4 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'DestinationCIDRv6' + if jsonDict["type"] == "DestinationCIDRv6" { + // try to unmarshal JSON data into DestinationCIDRv6 + err = json.Unmarshal(data, &dst.DestinationCIDRv6) + if err == nil { + return nil // data stored in dst.DestinationCIDRv6, return on the first match + } else { + dst.DestinationCIDRv6 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv6: %s", err.Error()) + } + } + + // check if the discriminator value is 'cidrv4' + if jsonDict["type"] == "cidrv4" { + // try to unmarshal JSON data into DestinationCIDRv4 + err = json.Unmarshal(data, &dst.DestinationCIDRv4) + if err == nil { + return nil // data stored in dst.DestinationCIDRv4, return on the first match + } else { + dst.DestinationCIDRv4 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'cidrv6' + if jsonDict["type"] == "cidrv6" { + // try to unmarshal JSON data into DestinationCIDRv6 + err = json.Unmarshal(data, &dst.DestinationCIDRv6) + if err == nil { + return nil // data stored in dst.DestinationCIDRv6, return on the first match + } else { + dst.DestinationCIDRv6 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv6: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src RouteDestination) MarshalJSON() ([]byte, error) { + if src.DestinationCIDRv4 != nil { + return json.Marshal(&src.DestinationCIDRv4) + } + + if src.DestinationCIDRv6 != nil { + return json.Marshal(&src.DestinationCIDRv6) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *RouteDestination) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.DestinationCIDRv4 != nil { + return obj.DestinationCIDRv4 + } + + if obj.DestinationCIDRv6 != nil { + return obj.DestinationCIDRv6 + } + + // all schemas are nil + return nil +} + +type NullableRouteDestination struct { + value *RouteDestination + isSet bool +} + +func (v NullableRouteDestination) Get() *RouteDestination { + return v.value +} + +func (v *NullableRouteDestination) Set(val *RouteDestination) { + v.value = val + v.isSet = true +} + +func (v NullableRouteDestination) IsSet() bool { + return v.isSet +} + +func (v *NullableRouteDestination) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRouteDestination(val *RouteDestination) *NullableRouteDestination { + return &NullableRouteDestination{value: val, isSet: true} +} + +func (v NullableRouteDestination) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRouteDestination) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_route_destination_test.go b/pkg/iaasalpha/model_route_destination_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_route_destination_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_route_list_response.go b/pkg/iaasalpha/model_route_list_response.go new file mode 100644 index 00000000..548ccce2 --- /dev/null +++ b/pkg/iaasalpha/model_route_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the RouteListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RouteListResponse{} + +/* + types and functions for items +*/ + +// isArray +type RouteListResponseGetItemsAttributeType = *[]Route +type RouteListResponseGetItemsArgType = []Route +type RouteListResponseGetItemsRetType = []Route + +func getRouteListResponseGetItemsAttributeTypeOk(arg RouteListResponseGetItemsAttributeType) (ret RouteListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteListResponseGetItemsAttributeType(arg *RouteListResponseGetItemsAttributeType, val RouteListResponseGetItemsRetType) { + *arg = &val +} + +// RouteListResponse Route list response. +type RouteListResponse struct { + // A list of routes. + // REQUIRED + Items RouteListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _RouteListResponse RouteListResponse + +// NewRouteListResponse instantiates a new RouteListResponse 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 NewRouteListResponse(items RouteListResponseGetItemsArgType) *RouteListResponse { + this := RouteListResponse{} + setRouteListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewRouteListResponseWithDefaults instantiates a new RouteListResponse 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 NewRouteListResponseWithDefaults() *RouteListResponse { + this := RouteListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *RouteListResponse) GetItems() (ret RouteListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *RouteListResponse) GetItemsOk() (ret RouteListResponseGetItemsRetType, ok bool) { + return getRouteListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *RouteListResponse) SetItems(v RouteListResponseGetItemsRetType) { + setRouteListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o RouteListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRouteListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableRouteListResponse struct { + value *RouteListResponse + isSet bool +} + +func (v NullableRouteListResponse) Get() *RouteListResponse { + return v.value +} + +func (v *NullableRouteListResponse) Set(val *RouteListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRouteListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRouteListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRouteListResponse(val *RouteListResponse) *NullableRouteListResponse { + return &NullableRouteListResponse{value: val, isSet: true} +} + +func (v NullableRouteListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRouteListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_route_list_response_test.go b/pkg/iaasalpha/model_route_list_response_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_route_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_route_nexthop.go b/pkg/iaasalpha/model_route_nexthop.go new file mode 100644 index 00000000..ada85df7 --- /dev/null +++ b/pkg/iaasalpha/model_route_nexthop.go @@ -0,0 +1,243 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" + "fmt" +) + +// RouteNexthop - struct for RouteNexthop +type RouteNexthop struct { + NexthopBlackhole *NexthopBlackhole + NexthopIPv4 *NexthopIPv4 + NexthopIPv6 *NexthopIPv6 + NexthopInternet *NexthopInternet +} + +// NexthopBlackholeAsRouteNexthop is a convenience function that returns NexthopBlackhole wrapped in RouteNexthop +func NexthopBlackholeAsRouteNexthop(v *NexthopBlackhole) RouteNexthop { + return RouteNexthop{ + NexthopBlackhole: v, + } +} + +// NexthopIPv4AsRouteNexthop is a convenience function that returns NexthopIPv4 wrapped in RouteNexthop +func NexthopIPv4AsRouteNexthop(v *NexthopIPv4) RouteNexthop { + return RouteNexthop{ + NexthopIPv4: v, + } +} + +// NexthopIPv6AsRouteNexthop is a convenience function that returns NexthopIPv6 wrapped in RouteNexthop +func NexthopIPv6AsRouteNexthop(v *NexthopIPv6) RouteNexthop { + return RouteNexthop{ + NexthopIPv6: v, + } +} + +// NexthopInternetAsRouteNexthop is a convenience function that returns NexthopInternet wrapped in RouteNexthop +func NexthopInternetAsRouteNexthop(v *NexthopInternet) RouteNexthop { + return RouteNexthop{ + NexthopInternet: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *RouteNexthop) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'NexthopBlackhole' + if jsonDict["type"] == "NexthopBlackhole" { + // try to unmarshal JSON data into NexthopBlackhole + err = json.Unmarshal(data, &dst.NexthopBlackhole) + if err == nil { + return nil // data stored in dst.NexthopBlackhole, return on the first match + } else { + dst.NexthopBlackhole = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopBlackhole: %s", err.Error()) + } + } + + // check if the discriminator value is 'NexthopIPv4' + if jsonDict["type"] == "NexthopIPv4" { + // try to unmarshal JSON data into NexthopIPv4 + err = json.Unmarshal(data, &dst.NexthopIPv4) + if err == nil { + return nil // data stored in dst.NexthopIPv4, return on the first match + } else { + dst.NexthopIPv4 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'NexthopIPv6' + if jsonDict["type"] == "NexthopIPv6" { + // try to unmarshal JSON data into NexthopIPv6 + err = json.Unmarshal(data, &dst.NexthopIPv6) + if err == nil { + return nil // data stored in dst.NexthopIPv6, return on the first match + } else { + dst.NexthopIPv6 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv6: %s", err.Error()) + } + } + + // check if the discriminator value is 'NexthopInternet' + if jsonDict["type"] == "NexthopInternet" { + // try to unmarshal JSON data into NexthopInternet + err = json.Unmarshal(data, &dst.NexthopInternet) + if err == nil { + return nil // data stored in dst.NexthopInternet, return on the first match + } else { + dst.NexthopInternet = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopInternet: %s", err.Error()) + } + } + + // check if the discriminator value is 'blackhole' + if jsonDict["type"] == "blackhole" { + // try to unmarshal JSON data into NexthopBlackhole + err = json.Unmarshal(data, &dst.NexthopBlackhole) + if err == nil { + return nil // data stored in dst.NexthopBlackhole, return on the first match + } else { + dst.NexthopBlackhole = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopBlackhole: %s", err.Error()) + } + } + + // check if the discriminator value is 'internet' + if jsonDict["type"] == "internet" { + // try to unmarshal JSON data into NexthopInternet + err = json.Unmarshal(data, &dst.NexthopInternet) + if err == nil { + return nil // data stored in dst.NexthopInternet, return on the first match + } else { + dst.NexthopInternet = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopInternet: %s", err.Error()) + } + } + + // check if the discriminator value is 'ipv4' + if jsonDict["type"] == "ipv4" { + // try to unmarshal JSON data into NexthopIPv4 + err = json.Unmarshal(data, &dst.NexthopIPv4) + if err == nil { + return nil // data stored in dst.NexthopIPv4, return on the first match + } else { + dst.NexthopIPv4 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'ipv6' + if jsonDict["type"] == "ipv6" { + // try to unmarshal JSON data into NexthopIPv6 + err = json.Unmarshal(data, &dst.NexthopIPv6) + if err == nil { + return nil // data stored in dst.NexthopIPv6, return on the first match + } else { + dst.NexthopIPv6 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv6: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src RouteNexthop) MarshalJSON() ([]byte, error) { + if src.NexthopBlackhole != nil { + return json.Marshal(&src.NexthopBlackhole) + } + + if src.NexthopIPv4 != nil { + return json.Marshal(&src.NexthopIPv4) + } + + if src.NexthopIPv6 != nil { + return json.Marshal(&src.NexthopIPv6) + } + + if src.NexthopInternet != nil { + return json.Marshal(&src.NexthopInternet) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *RouteNexthop) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.NexthopBlackhole != nil { + return obj.NexthopBlackhole + } + + if obj.NexthopIPv4 != nil { + return obj.NexthopIPv4 + } + + if obj.NexthopIPv6 != nil { + return obj.NexthopIPv6 + } + + if obj.NexthopInternet != nil { + return obj.NexthopInternet + } + + // all schemas are nil + return nil +} + +type NullableRouteNexthop struct { + value *RouteNexthop + isSet bool +} + +func (v NullableRouteNexthop) Get() *RouteNexthop { + return v.value +} + +func (v *NullableRouteNexthop) Set(val *RouteNexthop) { + v.value = val + v.isSet = true +} + +func (v NullableRouteNexthop) IsSet() bool { + return v.isSet +} + +func (v *NullableRouteNexthop) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRouteNexthop(val *RouteNexthop) *NullableRouteNexthop { + return &NullableRouteNexthop{value: val, isSet: true} +} + +func (v NullableRouteNexthop) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRouteNexthop) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_route_nexthop_test.go b/pkg/iaasalpha/model_route_nexthop_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_route_nexthop_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_route_test.go b/pkg/iaasalpha/model_route_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_route_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_routing_table.go b/pkg/iaasalpha/model_routing_table.go new file mode 100644 index 00000000..fdbe737e --- /dev/null +++ b/pkg/iaasalpha/model_routing_table.go @@ -0,0 +1,518 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" + "time" +) + +// checks if the RoutingTable type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RoutingTable{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type RoutingTableGetCreatedAtAttributeType = *time.Time +type RoutingTableGetCreatedAtArgType = time.Time +type RoutingTableGetCreatedAtRetType = time.Time + +func getRoutingTableGetCreatedAtAttributeTypeOk(arg RoutingTableGetCreatedAtAttributeType) (ret RoutingTableGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetCreatedAtAttributeType(arg *RoutingTableGetCreatedAtAttributeType, val RoutingTableGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for default +*/ + +// isBoolean +type RoutingTablegetDefaultAttributeType = *bool +type RoutingTablegetDefaultArgType = bool +type RoutingTablegetDefaultRetType = bool + +func getRoutingTablegetDefaultAttributeTypeOk(arg RoutingTablegetDefaultAttributeType) (ret RoutingTablegetDefaultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTablegetDefaultAttributeType(arg *RoutingTablegetDefaultAttributeType, val RoutingTablegetDefaultRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type RoutingTableGetDescriptionAttributeType = *string + +func getRoutingTableGetDescriptionAttributeTypeOk(arg RoutingTableGetDescriptionAttributeType) (ret RoutingTableGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetDescriptionAttributeType(arg *RoutingTableGetDescriptionAttributeType, val RoutingTableGetDescriptionRetType) { + *arg = &val +} + +type RoutingTableGetDescriptionArgType = string +type RoutingTableGetDescriptionRetType = string + +/* + types and functions for dynamicRoutes +*/ + +// isBoolean +type RoutingTablegetDynamicRoutesAttributeType = *bool +type RoutingTablegetDynamicRoutesArgType = bool +type RoutingTablegetDynamicRoutesRetType = bool + +func getRoutingTablegetDynamicRoutesAttributeTypeOk(arg RoutingTablegetDynamicRoutesAttributeType) (ret RoutingTablegetDynamicRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTablegetDynamicRoutesAttributeType(arg *RoutingTablegetDynamicRoutesAttributeType, val RoutingTablegetDynamicRoutesRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type RoutingTableGetIdAttributeType = *string + +func getRoutingTableGetIdAttributeTypeOk(arg RoutingTableGetIdAttributeType) (ret RoutingTableGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetIdAttributeType(arg *RoutingTableGetIdAttributeType, val RoutingTableGetIdRetType) { + *arg = &val +} + +type RoutingTableGetIdArgType = string +type RoutingTableGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type RoutingTableGetLabelsAttributeType = *map[string]interface{} +type RoutingTableGetLabelsArgType = map[string]interface{} +type RoutingTableGetLabelsRetType = map[string]interface{} + +func getRoutingTableGetLabelsAttributeTypeOk(arg RoutingTableGetLabelsAttributeType) (ret RoutingTableGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetLabelsAttributeType(arg *RoutingTableGetLabelsAttributeType, val RoutingTableGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type RoutingTableGetNameAttributeType = *string + +func getRoutingTableGetNameAttributeTypeOk(arg RoutingTableGetNameAttributeType) (ret RoutingTableGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetNameAttributeType(arg *RoutingTableGetNameAttributeType, val RoutingTableGetNameRetType) { + *arg = &val +} + +type RoutingTableGetNameArgType = string +type RoutingTableGetNameRetType = string + +/* + types and functions for systemRoutes +*/ + +// isBoolean +type RoutingTablegetSystemRoutesAttributeType = *bool +type RoutingTablegetSystemRoutesArgType = bool +type RoutingTablegetSystemRoutesRetType = bool + +func getRoutingTablegetSystemRoutesAttributeTypeOk(arg RoutingTablegetSystemRoutesAttributeType) (ret RoutingTablegetSystemRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTablegetSystemRoutesAttributeType(arg *RoutingTablegetSystemRoutesAttributeType, val RoutingTablegetSystemRoutesRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type RoutingTableGetUpdatedAtAttributeType = *time.Time +type RoutingTableGetUpdatedAtArgType = time.Time +type RoutingTableGetUpdatedAtRetType = time.Time + +func getRoutingTableGetUpdatedAtAttributeTypeOk(arg RoutingTableGetUpdatedAtAttributeType) (ret RoutingTableGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetUpdatedAtAttributeType(arg *RoutingTableGetUpdatedAtAttributeType, val RoutingTableGetUpdatedAtRetType) { + *arg = &val +} + +// RoutingTable An object representing a routing table. +type RoutingTable struct { + // Date-time when resource was created. + CreatedAt RoutingTableGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // This is the default routing table. It can't be deleted and is used if the user does not specify it otherwise. + Default RoutingTablegetDefaultAttributeType `json:"default,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description RoutingTableGetDescriptionAttributeType `json:"description,omitempty"` + // A config setting for a routing table which allows propagation of dynamic routes to this routing table. + DynamicRoutes RoutingTablegetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"` + // Universally Unique Identifier (UUID). + Id RoutingTableGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels RoutingTableGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name RoutingTableGetNameAttributeType `json:"name" required:"true"` + // A config setting for a routing table which allows installation of automatic system routes for connectivity between projects in the same SNA. + SystemRoutes RoutingTablegetSystemRoutesAttributeType `json:"systemRoutes,omitempty"` + // Date-time when resource was last updated. + UpdatedAt RoutingTableGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _RoutingTable RoutingTable + +// NewRoutingTable instantiates a new RoutingTable 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 NewRoutingTable(name RoutingTableGetNameArgType) *RoutingTable { + this := RoutingTable{} + setRoutingTableGetNameAttributeType(&this.Name, name) + return &this +} + +// NewRoutingTableWithDefaults instantiates a new RoutingTable 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 NewRoutingTableWithDefaults() *RoutingTable { + this := RoutingTable{} + var dynamicRoutes bool = true + this.DynamicRoutes = &dynamicRoutes + var systemRoutes bool = true + this.SystemRoutes = &systemRoutes + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *RoutingTable) GetCreatedAt() (res RoutingTableGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetCreatedAtOk() (ret RoutingTableGetCreatedAtRetType, ok bool) { + return getRoutingTableGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *RoutingTable) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *RoutingTable) SetCreatedAt(v RoutingTableGetCreatedAtRetType) { + setRoutingTableGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *RoutingTable) GetDefault() (res RoutingTablegetDefaultRetType) { + res, _ = o.GetDefaultOk() + return +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetDefaultOk() (ret RoutingTablegetDefaultRetType, ok bool) { + return getRoutingTablegetDefaultAttributeTypeOk(o.Default) +} + +// HasDefault returns a boolean if a field has been set. +func (o *RoutingTable) HasDefault() bool { + _, ok := o.GetDefaultOk() + return ok +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *RoutingTable) SetDefault(v RoutingTablegetDefaultRetType) { + setRoutingTablegetDefaultAttributeType(&o.Default, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *RoutingTable) GetDescription() (res RoutingTableGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetDescriptionOk() (ret RoutingTableGetDescriptionRetType, ok bool) { + return getRoutingTableGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *RoutingTable) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *RoutingTable) SetDescription(v RoutingTableGetDescriptionRetType) { + setRoutingTableGetDescriptionAttributeType(&o.Description, v) +} + +// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise. +func (o *RoutingTable) GetDynamicRoutes() (res RoutingTablegetDynamicRoutesRetType) { + res, _ = o.GetDynamicRoutesOk() + return +} + +// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetDynamicRoutesOk() (ret RoutingTablegetDynamicRoutesRetType, ok bool) { + return getRoutingTablegetDynamicRoutesAttributeTypeOk(o.DynamicRoutes) +} + +// HasDynamicRoutes returns a boolean if a field has been set. +func (o *RoutingTable) HasDynamicRoutes() bool { + _, ok := o.GetDynamicRoutesOk() + return ok +} + +// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field. +func (o *RoutingTable) SetDynamicRoutes(v RoutingTablegetDynamicRoutesRetType) { + setRoutingTablegetDynamicRoutesAttributeType(&o.DynamicRoutes, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RoutingTable) GetId() (res RoutingTableGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetIdOk() (ret RoutingTableGetIdRetType, ok bool) { + return getRoutingTableGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *RoutingTable) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RoutingTable) SetId(v RoutingTableGetIdRetType) { + setRoutingTableGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *RoutingTable) GetLabels() (res RoutingTableGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetLabelsOk() (ret RoutingTableGetLabelsRetType, ok bool) { + return getRoutingTableGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *RoutingTable) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *RoutingTable) SetLabels(v RoutingTableGetLabelsRetType) { + setRoutingTableGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *RoutingTable) GetName() (ret RoutingTableGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetNameOk() (ret RoutingTableGetNameRetType, ok bool) { + return getRoutingTableGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *RoutingTable) SetName(v RoutingTableGetNameRetType) { + setRoutingTableGetNameAttributeType(&o.Name, v) +} + +// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise. +func (o *RoutingTable) GetSystemRoutes() (res RoutingTablegetSystemRoutesRetType) { + res, _ = o.GetSystemRoutesOk() + return +} + +// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetSystemRoutesOk() (ret RoutingTablegetSystemRoutesRetType, ok bool) { + return getRoutingTablegetSystemRoutesAttributeTypeOk(o.SystemRoutes) +} + +// HasSystemRoutes returns a boolean if a field has been set. +func (o *RoutingTable) HasSystemRoutes() bool { + _, ok := o.GetSystemRoutesOk() + return ok +} + +// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field. +func (o *RoutingTable) SetSystemRoutes(v RoutingTablegetSystemRoutesRetType) { + setRoutingTablegetSystemRoutesAttributeType(&o.SystemRoutes, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *RoutingTable) GetUpdatedAt() (res RoutingTableGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetUpdatedAtOk() (ret RoutingTableGetUpdatedAtRetType, ok bool) { + return getRoutingTableGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *RoutingTable) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *RoutingTable) SetUpdatedAt(v RoutingTableGetUpdatedAtRetType) { + setRoutingTableGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o RoutingTable) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRoutingTableGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getRoutingTablegetDefaultAttributeTypeOk(o.Default); ok { + toSerialize["Default"] = val + } + if val, ok := getRoutingTableGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getRoutingTablegetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok { + toSerialize["DynamicRoutes"] = val + } + if val, ok := getRoutingTableGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRoutingTableGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getRoutingTableGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getRoutingTablegetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok { + toSerialize["SystemRoutes"] = val + } + if val, ok := getRoutingTableGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableRoutingTable struct { + value *RoutingTable + isSet bool +} + +func (v NullableRoutingTable) Get() *RoutingTable { + return v.value +} + +func (v *NullableRoutingTable) Set(val *RoutingTable) { + v.value = val + v.isSet = true +} + +func (v NullableRoutingTable) IsSet() bool { + return v.isSet +} + +func (v *NullableRoutingTable) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoutingTable(val *RoutingTable) *NullableRoutingTable { + return &NullableRoutingTable{value: val, isSet: true} +} + +func (v NullableRoutingTable) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoutingTable) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_routing_table_list_response.go b/pkg/iaasalpha/model_routing_table_list_response.go new file mode 100644 index 00000000..5ba2383a --- /dev/null +++ b/pkg/iaasalpha/model_routing_table_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the RoutingTableListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RoutingTableListResponse{} + +/* + types and functions for items +*/ + +// isArray +type RoutingTableListResponseGetItemsAttributeType = *[]RoutingTable +type RoutingTableListResponseGetItemsArgType = []RoutingTable +type RoutingTableListResponseGetItemsRetType = []RoutingTable + +func getRoutingTableListResponseGetItemsAttributeTypeOk(arg RoutingTableListResponseGetItemsAttributeType) (ret RoutingTableListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableListResponseGetItemsAttributeType(arg *RoutingTableListResponseGetItemsAttributeType, val RoutingTableListResponseGetItemsRetType) { + *arg = &val +} + +// RoutingTableListResponse Routing table response. +type RoutingTableListResponse struct { + // A list of routing tables. + // REQUIRED + Items RoutingTableListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _RoutingTableListResponse RoutingTableListResponse + +// NewRoutingTableListResponse instantiates a new RoutingTableListResponse 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 NewRoutingTableListResponse(items RoutingTableListResponseGetItemsArgType) *RoutingTableListResponse { + this := RoutingTableListResponse{} + setRoutingTableListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewRoutingTableListResponseWithDefaults instantiates a new RoutingTableListResponse 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 NewRoutingTableListResponseWithDefaults() *RoutingTableListResponse { + this := RoutingTableListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *RoutingTableListResponse) GetItems() (ret RoutingTableListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *RoutingTableListResponse) GetItemsOk() (ret RoutingTableListResponseGetItemsRetType, ok bool) { + return getRoutingTableListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *RoutingTableListResponse) SetItems(v RoutingTableListResponseGetItemsRetType) { + setRoutingTableListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o RoutingTableListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRoutingTableListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableRoutingTableListResponse struct { + value *RoutingTableListResponse + isSet bool +} + +func (v NullableRoutingTableListResponse) Get() *RoutingTableListResponse { + return v.value +} + +func (v *NullableRoutingTableListResponse) Set(val *RoutingTableListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRoutingTableListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRoutingTableListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoutingTableListResponse(val *RoutingTableListResponse) *NullableRoutingTableListResponse { + return &NullableRoutingTableListResponse{value: val, isSet: true} +} + +func (v NullableRoutingTableListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoutingTableListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_routing_table_list_response_test.go b/pkg/iaasalpha/model_routing_table_list_response_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_routing_table_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_routing_table_test.go b/pkg/iaasalpha/model_routing_table_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_routing_table_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_update_network_ipv4_body.go b/pkg/iaasalpha/model_update_network_ipv4_body.go new file mode 100644 index 00000000..e4799f1a --- /dev/null +++ b/pkg/iaasalpha/model_update_network_ipv4_body.go @@ -0,0 +1,192 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the UpdateNetworkIPv4Body type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNetworkIPv4Body{} + +/* + types and functions for gateway +*/ + +// isNullableString +type UpdateNetworkIPv4BodyGetGatewayAttributeType = *NullableString + +func getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(arg UpdateNetworkIPv4BodyGetGatewayAttributeType) (ret UpdateNetworkIPv4BodyGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setUpdateNetworkIPv4BodyGetGatewayAttributeType(arg *UpdateNetworkIPv4BodyGetGatewayAttributeType, val UpdateNetworkIPv4BodyGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type UpdateNetworkIPv4BodyGetGatewayArgType = *string +type UpdateNetworkIPv4BodyGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type UpdateNetworkIPv4BodyGetNameserversAttributeType = *[]string +type UpdateNetworkIPv4BodyGetNameserversArgType = []string +type UpdateNetworkIPv4BodyGetNameserversRetType = []string + +func getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(arg UpdateNetworkIPv4BodyGetNameserversAttributeType) (ret UpdateNetworkIPv4BodyGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNetworkIPv4BodyGetNameserversAttributeType(arg *UpdateNetworkIPv4BodyGetNameserversAttributeType, val UpdateNetworkIPv4BodyGetNameserversRetType) { + *arg = &val +} + +// UpdateNetworkIPv4Body The config object for a IPv4 network update. +type UpdateNetworkIPv4Body struct { + // The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway UpdateNetworkIPv4BodyGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers UpdateNetworkIPv4BodyGetNameserversAttributeType `json:"nameservers,omitempty"` +} + +// NewUpdateNetworkIPv4Body instantiates a new UpdateNetworkIPv4Body 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 NewUpdateNetworkIPv4Body() *UpdateNetworkIPv4Body { + this := UpdateNetworkIPv4Body{} + return &this +} + +// NewUpdateNetworkIPv4BodyWithDefaults instantiates a new UpdateNetworkIPv4Body 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 NewUpdateNetworkIPv4BodyWithDefaults() *UpdateNetworkIPv4Body { + this := UpdateNetworkIPv4Body{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateNetworkIPv4Body) GetGateway() (res UpdateNetworkIPv4BodyGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateNetworkIPv4Body) GetGatewayOk() (ret UpdateNetworkIPv4BodyGetGatewayRetType, ok bool) { + return getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *UpdateNetworkIPv4Body) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *UpdateNetworkIPv4Body) SetGateway(v UpdateNetworkIPv4BodyGetGatewayRetType) { + setUpdateNetworkIPv4BodyGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *UpdateNetworkIPv4Body) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *UpdateNetworkIPv4Body) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *UpdateNetworkIPv4Body) GetNameservers() (res UpdateNetworkIPv4BodyGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNetworkIPv4Body) GetNameserversOk() (ret UpdateNetworkIPv4BodyGetNameserversRetType, ok bool) { + return getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *UpdateNetworkIPv4Body) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *UpdateNetworkIPv4Body) SetNameservers(v UpdateNetworkIPv4BodyGetNameserversRetType) { + setUpdateNetworkIPv4BodyGetNameserversAttributeType(&o.Nameservers, v) +} + +func (o UpdateNetworkIPv4Body) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + return toSerialize, nil +} + +type NullableUpdateNetworkIPv4Body struct { + value *UpdateNetworkIPv4Body + isSet bool +} + +func (v NullableUpdateNetworkIPv4Body) Get() *UpdateNetworkIPv4Body { + return v.value +} + +func (v *NullableUpdateNetworkIPv4Body) Set(val *UpdateNetworkIPv4Body) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNetworkIPv4Body) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNetworkIPv4Body) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNetworkIPv4Body(val *UpdateNetworkIPv4Body) *NullableUpdateNetworkIPv4Body { + return &NullableUpdateNetworkIPv4Body{value: val, isSet: true} +} + +func (v NullableUpdateNetworkIPv4Body) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNetworkIPv4Body) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_update_network_ipv4_body_test.go b/pkg/iaasalpha/model_update_network_ipv4_body_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_update_network_ipv4_body_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_update_network_ipv6_body.go b/pkg/iaasalpha/model_update_network_ipv6_body.go new file mode 100644 index 00000000..9c6fe0ec --- /dev/null +++ b/pkg/iaasalpha/model_update_network_ipv6_body.go @@ -0,0 +1,192 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the UpdateNetworkIPv6Body type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNetworkIPv6Body{} + +/* + types and functions for gateway +*/ + +// isNullableString +type UpdateNetworkIPv6BodyGetGatewayAttributeType = *NullableString + +func getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(arg UpdateNetworkIPv6BodyGetGatewayAttributeType) (ret UpdateNetworkIPv6BodyGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setUpdateNetworkIPv6BodyGetGatewayAttributeType(arg *UpdateNetworkIPv6BodyGetGatewayAttributeType, val UpdateNetworkIPv6BodyGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type UpdateNetworkIPv6BodyGetGatewayArgType = *string +type UpdateNetworkIPv6BodyGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type UpdateNetworkIPv6BodyGetNameserversAttributeType = *[]string +type UpdateNetworkIPv6BodyGetNameserversArgType = []string +type UpdateNetworkIPv6BodyGetNameserversRetType = []string + +func getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(arg UpdateNetworkIPv6BodyGetNameserversAttributeType) (ret UpdateNetworkIPv6BodyGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNetworkIPv6BodyGetNameserversAttributeType(arg *UpdateNetworkIPv6BodyGetNameserversAttributeType, val UpdateNetworkIPv6BodyGetNameserversRetType) { + *arg = &val +} + +// UpdateNetworkIPv6Body The config object for a IPv6 network update. +type UpdateNetworkIPv6Body struct { + // The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway UpdateNetworkIPv6BodyGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers UpdateNetworkIPv6BodyGetNameserversAttributeType `json:"nameservers,omitempty"` +} + +// NewUpdateNetworkIPv6Body instantiates a new UpdateNetworkIPv6Body 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 NewUpdateNetworkIPv6Body() *UpdateNetworkIPv6Body { + this := UpdateNetworkIPv6Body{} + return &this +} + +// NewUpdateNetworkIPv6BodyWithDefaults instantiates a new UpdateNetworkIPv6Body 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 NewUpdateNetworkIPv6BodyWithDefaults() *UpdateNetworkIPv6Body { + this := UpdateNetworkIPv6Body{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateNetworkIPv6Body) GetGateway() (res UpdateNetworkIPv6BodyGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateNetworkIPv6Body) GetGatewayOk() (ret UpdateNetworkIPv6BodyGetGatewayRetType, ok bool) { + return getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *UpdateNetworkIPv6Body) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *UpdateNetworkIPv6Body) SetGateway(v UpdateNetworkIPv6BodyGetGatewayRetType) { + setUpdateNetworkIPv6BodyGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *UpdateNetworkIPv6Body) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *UpdateNetworkIPv6Body) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *UpdateNetworkIPv6Body) GetNameservers() (res UpdateNetworkIPv6BodyGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNetworkIPv6Body) GetNameserversOk() (ret UpdateNetworkIPv6BodyGetNameserversRetType, ok bool) { + return getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *UpdateNetworkIPv6Body) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *UpdateNetworkIPv6Body) SetNameservers(v UpdateNetworkIPv6BodyGetNameserversRetType) { + setUpdateNetworkIPv6BodyGetNameserversAttributeType(&o.Nameservers, v) +} + +func (o UpdateNetworkIPv6Body) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + return toSerialize, nil +} + +type NullableUpdateNetworkIPv6Body struct { + value *UpdateNetworkIPv6Body + isSet bool +} + +func (v NullableUpdateNetworkIPv6Body) Get() *UpdateNetworkIPv6Body { + return v.value +} + +func (v *NullableUpdateNetworkIPv6Body) Set(val *UpdateNetworkIPv6Body) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNetworkIPv6Body) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNetworkIPv6Body) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNetworkIPv6Body(val *UpdateNetworkIPv6Body) *NullableUpdateNetworkIPv6Body { + return &NullableUpdateNetworkIPv6Body{value: val, isSet: true} +} + +func (v NullableUpdateNetworkIPv6Body) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNetworkIPv6Body) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_update_network_ipv6_body_test.go b/pkg/iaasalpha/model_update_network_ipv6_body_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_update_network_ipv6_body_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_update_route_of_routing_table_payload.go b/pkg/iaasalpha/model_update_route_of_routing_table_payload.go new file mode 100644 index 00000000..4b65c9f4 --- /dev/null +++ b/pkg/iaasalpha/model_update_route_of_routing_table_payload.go @@ -0,0 +1,128 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the UpdateRouteOfRoutingTablePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRouteOfRoutingTablePayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateRouteOfRoutingTablePayloadGetLabelsArgType = map[string]interface{} +type UpdateRouteOfRoutingTablePayloadGetLabelsRetType = map[string]interface{} + +func getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(arg UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType) (ret UpdateRouteOfRoutingTablePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRouteOfRoutingTablePayloadGetLabelsAttributeType(arg *UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType, val UpdateRouteOfRoutingTablePayloadGetLabelsRetType) { + *arg = &val +} + +// UpdateRouteOfRoutingTablePayload Object that represents the request body for a route update. +type UpdateRouteOfRoutingTablePayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType `json:"labels,omitempty"` +} + +// NewUpdateRouteOfRoutingTablePayload instantiates a new UpdateRouteOfRoutingTablePayload 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 NewUpdateRouteOfRoutingTablePayload() *UpdateRouteOfRoutingTablePayload { + this := UpdateRouteOfRoutingTablePayload{} + return &this +} + +// NewUpdateRouteOfRoutingTablePayloadWithDefaults instantiates a new UpdateRouteOfRoutingTablePayload 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 NewUpdateRouteOfRoutingTablePayloadWithDefaults() *UpdateRouteOfRoutingTablePayload { + this := UpdateRouteOfRoutingTablePayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateRouteOfRoutingTablePayload) GetLabels() (res UpdateRouteOfRoutingTablePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRouteOfRoutingTablePayload) GetLabelsOk() (ret UpdateRouteOfRoutingTablePayloadGetLabelsRetType, ok bool) { + return getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateRouteOfRoutingTablePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateRouteOfRoutingTablePayload) SetLabels(v UpdateRouteOfRoutingTablePayloadGetLabelsRetType) { + setUpdateRouteOfRoutingTablePayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o UpdateRouteOfRoutingTablePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableUpdateRouteOfRoutingTablePayload struct { + value *UpdateRouteOfRoutingTablePayload + isSet bool +} + +func (v NullableUpdateRouteOfRoutingTablePayload) Get() *UpdateRouteOfRoutingTablePayload { + return v.value +} + +func (v *NullableUpdateRouteOfRoutingTablePayload) Set(val *UpdateRouteOfRoutingTablePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRouteOfRoutingTablePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRouteOfRoutingTablePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRouteOfRoutingTablePayload(val *UpdateRouteOfRoutingTablePayload) *NullableUpdateRouteOfRoutingTablePayload { + return &NullableUpdateRouteOfRoutingTablePayload{value: val, isSet: true} +} + +func (v NullableUpdateRouteOfRoutingTablePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRouteOfRoutingTablePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_update_route_of_routing_table_payload_test.go b/pkg/iaasalpha/model_update_route_of_routing_table_payload_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_update_route_of_routing_table_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/model_update_routing_table_of_area_payload.go b/pkg/iaasalpha/model_update_routing_table_of_area_payload.go new file mode 100644 index 00000000..8b7cf956 --- /dev/null +++ b/pkg/iaasalpha/model_update_routing_table_of_area_payload.go @@ -0,0 +1,322 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" +) + +// checks if the UpdateRoutingTableOfAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRoutingTableOfAreaPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType = *string + +func getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType, val UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateRoutingTableOfAreaPayloadGetDescriptionArgType = string +type UpdateRoutingTableOfAreaPayloadGetDescriptionRetType = string + +/* + types and functions for dynamicRoutes +*/ + +// isBoolean +type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType = *bool +type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesArgType = bool +type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType = bool + +func getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType) (ret UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType(arg *UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType, val UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateRoutingTableOfAreaPayloadGetLabelsArgType = map[string]interface{} +type UpdateRoutingTableOfAreaPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadGetLabelsAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType, val UpdateRoutingTableOfAreaPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateRoutingTableOfAreaPayloadGetNameAttributeType = *string + +func getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetNameAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadGetNameAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetNameAttributeType, val UpdateRoutingTableOfAreaPayloadGetNameRetType) { + *arg = &val +} + +type UpdateRoutingTableOfAreaPayloadGetNameArgType = string +type UpdateRoutingTableOfAreaPayloadGetNameRetType = string + +/* + types and functions for systemRoutes +*/ + +// isBoolean +type UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType = *bool +type UpdateRoutingTableOfAreaPayloadgetSystemRoutesArgType = bool +type UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType = bool + +func getUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType) (ret UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType(arg *UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType, val UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType) { + *arg = &val +} + +// UpdateRoutingTableOfAreaPayload Object that represents the request body for a routing table update. +type UpdateRoutingTableOfAreaPayload struct { + // Description Object. Allows string up to 255 Characters. + Description UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The update config setting for a routing table which allows propagation of dynamic routes to this routing table. + DynamicRoutes UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateRoutingTableOfAreaPayloadGetNameAttributeType `json:"name,omitempty"` + // The update config setting for a routing table which allows installation of automatic system routes for connectivity between projects in the same SNA. + SystemRoutes UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType `json:"systemRoutes,omitempty"` +} + +// NewUpdateRoutingTableOfAreaPayload instantiates a new UpdateRoutingTableOfAreaPayload 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 NewUpdateRoutingTableOfAreaPayload() *UpdateRoutingTableOfAreaPayload { + this := UpdateRoutingTableOfAreaPayload{} + return &this +} + +// NewUpdateRoutingTableOfAreaPayloadWithDefaults instantiates a new UpdateRoutingTableOfAreaPayload 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 NewUpdateRoutingTableOfAreaPayloadWithDefaults() *UpdateRoutingTableOfAreaPayload { + this := UpdateRoutingTableOfAreaPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetDescription() (res UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetDescriptionOk() (ret UpdateRoutingTableOfAreaPayloadGetDescriptionRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateRoutingTableOfAreaPayload) SetDescription(v UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) { + setUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetDynamicRoutes() (res UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) { + res, _ = o.GetDynamicRoutesOk() + return +} + +// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetDynamicRoutesOk() (ret UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes) +} + +// HasDynamicRoutes returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasDynamicRoutes() bool { + _, ok := o.GetDynamicRoutesOk() + return ok +} + +// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field. +func (o *UpdateRoutingTableOfAreaPayload) SetDynamicRoutes(v UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) { + setUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType(&o.DynamicRoutes, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetLabels() (res UpdateRoutingTableOfAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetLabelsOk() (ret UpdateRoutingTableOfAreaPayloadGetLabelsRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateRoutingTableOfAreaPayload) SetLabels(v UpdateRoutingTableOfAreaPayloadGetLabelsRetType) { + setUpdateRoutingTableOfAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetName() (res UpdateRoutingTableOfAreaPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetNameOk() (ret UpdateRoutingTableOfAreaPayloadGetNameRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateRoutingTableOfAreaPayload) SetName(v UpdateRoutingTableOfAreaPayloadGetNameRetType) { + setUpdateRoutingTableOfAreaPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetSystemRoutes() (res UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType) { + res, _ = o.GetSystemRoutesOk() + return +} + +// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetSystemRoutesOk() (ret UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes) +} + +// HasSystemRoutes returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasSystemRoutes() bool { + _, ok := o.GetSystemRoutesOk() + return ok +} + +// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field. +func (o *UpdateRoutingTableOfAreaPayload) SetSystemRoutes(v UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType) { + setUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType(&o.SystemRoutes, v) +} + +func (o UpdateRoutingTableOfAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok { + toSerialize["DynamicRoutes"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok { + toSerialize["SystemRoutes"] = val + } + return toSerialize, nil +} + +type NullableUpdateRoutingTableOfAreaPayload struct { + value *UpdateRoutingTableOfAreaPayload + isSet bool +} + +func (v NullableUpdateRoutingTableOfAreaPayload) Get() *UpdateRoutingTableOfAreaPayload { + return v.value +} + +func (v *NullableUpdateRoutingTableOfAreaPayload) Set(val *UpdateRoutingTableOfAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRoutingTableOfAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRoutingTableOfAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRoutingTableOfAreaPayload(val *UpdateRoutingTableOfAreaPayload) *NullableUpdateRoutingTableOfAreaPayload { + return &NullableUpdateRoutingTableOfAreaPayload{value: val, isSet: true} +} + +func (v NullableUpdateRoutingTableOfAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRoutingTableOfAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasalpha/model_update_routing_table_of_area_payload_test.go b/pkg/iaasalpha/model_update_routing_table_of_area_payload_test.go new file mode 100644 index 00000000..0eb7b505 --- /dev/null +++ b/pkg/iaasalpha/model_update_routing_table_of_area_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha diff --git a/pkg/iaasalpha/utils.go b/pkg/iaasalpha/utils.go new file mode 100644 index 00000000..93de50a6 --- /dev/null +++ b/pkg/iaasalpha/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasalpha + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/iaasalpha/wait/wait.go b/pkg/iaasalpha/wait/wait.go new file mode 100644 index 00000000..6293355a --- /dev/null +++ b/pkg/iaasalpha/wait/wait.go @@ -0,0 +1,85 @@ +package wait + +import ( + "context" + "errors" + "fmt" + "net/http" + "time" + + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" + "github.com/stackitcloud/stackit-sdk-go/core/wait" + "github.com/stackitcloud/stackit-sdk-go/services/iaasalpha" +) + +const ( + CreateSuccess = "CREATED" +) + +// Interfaces needed for tests +type APIClientInterface interface { + GetNetworkExecute(ctx context.Context, projectId, region, networkId string) (*iaasalpha.Network, error) +} + +// CreateNetworkWaitHandler will wait for network creation using network id +func CreateNetworkWaitHandler(ctx context.Context, a APIClientInterface, projectId, region, networkId string) *wait.AsyncActionHandler[iaasalpha.Network] { + handler := wait.New(func() (waitFinished bool, response *iaasalpha.Network, err error) { + network, err := a.GetNetworkExecute(ctx, projectId, region, networkId) + if err != nil { + return false, network, err + } + if network.Id == nil || network.Status == nil { + return false, network, fmt.Errorf("create failed for network with id %s, the response is not valid: the id or the state are missing", networkId) + } + // The state returns to "CREATED" after a successful creation is completed + if *network.Id == networkId && *network.Status == CreateSuccess { + return true, network, nil + } + return false, network, nil + }) + handler.SetSleepBeforeWait(2 * time.Second) + handler.SetTimeout(15 * time.Minute) + return handler +} + +// UpdateNetworkWaitHandler will wait for network update +func UpdateNetworkWaitHandler(ctx context.Context, a APIClientInterface, projectId, region, networkId string) *wait.AsyncActionHandler[iaasalpha.Network] { + handler := wait.New(func() (waitFinished bool, response *iaasalpha.Network, err error) { + network, err := a.GetNetworkExecute(ctx, projectId, region, networkId) + if err != nil { + return false, network, err + } + if network.Id == nil || network.Status == nil { + return false, network, fmt.Errorf("update failed for network with id %s, the response is not valid: the id or the state are missing", networkId) + } + // The state returns to "CREATED" after a successful update is completed + if *network.Id == networkId && *network.Status == CreateSuccess { + return true, network, nil + } + return false, network, nil + }) + handler.SetSleepBeforeWait(2 * time.Second) + handler.SetTimeout(15 * time.Minute) + return handler +} + +// DeleteNetworkWaitHandler will wait for network deletion +func DeleteNetworkWaitHandler(ctx context.Context, a APIClientInterface, projectId, region, networkId string) *wait.AsyncActionHandler[iaasalpha.Network] { + handler := wait.New(func() (waitFinished bool, response *iaasalpha.Network, err error) { + network, err := a.GetNetworkExecute(ctx, projectId, region, networkId) + if err == nil { + return false, nil, nil + } + var oapiErr *oapierror.GenericOpenAPIError + ok := errors.As(err, &oapiErr) + if !ok { + return false, network, fmt.Errorf("could not convert error to oapierror.GenericOpenAPIError: %w", err) + } + if oapiErr.StatusCode != http.StatusNotFound { + return false, network, err + } + return true, nil, nil + }) + handler.SetTimeout(15 * time.Minute) + return handler +} diff --git a/pkg/iaasalpha/wait/wait_test.go b/pkg/iaasalpha/wait/wait_test.go new file mode 100644 index 00000000..a9aba5b1 --- /dev/null +++ b/pkg/iaasalpha/wait/wait_test.go @@ -0,0 +1,216 @@ +package wait + +import ( + "context" + "testing" + "time" + + "github.com/google/go-cmp/cmp" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" + "github.com/stackitcloud/stackit-sdk-go/core/utils" + "github.com/stackitcloud/stackit-sdk-go/services/iaasalpha" +) + +type apiClientMocked struct { + getNetworkFails bool + isDeleted bool + resourceState string +} + +func (a *apiClientMocked) GetNetworkExecute(_ context.Context, _, _, _ string) (*iaasalpha.Network, error) { + if a.isDeleted { + return nil, &oapierror.GenericOpenAPIError{ + StatusCode: 404, + } + } + + if a.getNetworkFails { + return nil, &oapierror.GenericOpenAPIError{ + StatusCode: 500, + } + } + + return &iaasalpha.Network{ + Id: utils.Ptr("nid"), + Status: &a.resourceState, + }, nil +} + +func TestCreateNetworkWaitHandler(t *testing.T) { + tests := []struct { + desc string + getFails bool + resourceState string + wantErr bool + wantResp bool + }{ + { + desc: "create_succeeded", + getFails: false, + resourceState: CreateSuccess, + wantErr: false, + wantResp: true, + }, + { + desc: "get_fails", + getFails: true, + resourceState: "", + wantErr: true, + wantResp: false, + }, + { + desc: "timeout", + getFails: false, + resourceState: "ANOTHER STATE", + wantErr: true, + wantResp: true, + }, + } + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + apiClient := &apiClientMocked{ + getNetworkFails: tt.getFails, + resourceState: tt.resourceState, + } + + var wantRes *iaasalpha.Network + if tt.wantResp { + wantRes = &iaasalpha.Network{ + Id: utils.Ptr("nid"), + Status: utils.Ptr(tt.resourceState), + } + } + + handler := CreateNetworkWaitHandler(context.Background(), apiClient, "pid", "eu01", "nid") + + gotRes, err := handler.SetTimeout(10 * time.Millisecond).SetSleepBeforeWait(1 * time.Millisecond).WaitWithContext(context.Background()) + + if (err != nil) != tt.wantErr { + t.Fatalf("handler error = %v, wantErr %v", err, tt.wantErr) + } + if !cmp.Equal(gotRes, wantRes) { + t.Fatalf("handler gotRes = %v, want %v", gotRes, wantRes) + } + }) + } +} + +func TestUpdateNetworkWaitHandler(t *testing.T) { + tests := []struct { + desc string + getFails bool + resourceState string + wantErr bool + wantResp bool + }{ + { + desc: "update_succeeded", + getFails: false, + resourceState: CreateSuccess, + wantErr: false, + wantResp: true, + }, + { + desc: "get_fails", + getFails: true, + resourceState: "", + wantErr: true, + wantResp: false, + }, + { + desc: "timeout", + getFails: false, + resourceState: "ANOTHER STATE", + wantErr: true, + wantResp: true, + }, + } + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + apiClient := &apiClientMocked{ + getNetworkFails: tt.getFails, + resourceState: tt.resourceState, + } + + var wantRes *iaasalpha.Network + if tt.wantResp { + wantRes = &iaasalpha.Network{ + Id: utils.Ptr("nid"), + Status: utils.Ptr(tt.resourceState), + } + } + + handler := UpdateNetworkWaitHandler(context.Background(), apiClient, "pid", "eu01", "nid") + + gotRes, err := handler.SetTimeout(10 * time.Millisecond).SetSleepBeforeWait(1 * time.Millisecond).WaitWithContext(context.Background()) + + if (err != nil) != tt.wantErr { + t.Fatalf("handler error = %v, wantErr %v", err, tt.wantErr) + } + if !cmp.Equal(gotRes, wantRes) { + t.Fatalf("handler gotRes = %v, want %v", gotRes, wantRes) + } + }) + } +} + +func TestDeleteNetworkWaitHandler(t *testing.T) { + tests := []struct { + desc string + getFails bool + isDeleted bool + resourceState string + wantErr bool + wantResp bool + }{ + { + desc: "delete_succeeded", + getFails: false, + isDeleted: true, + wantErr: false, + wantResp: false, + }, + { + desc: "get_fails", + getFails: true, + resourceState: "", + wantErr: true, + wantResp: false, + }, + { + desc: "timeout", + getFails: false, + resourceState: "ANOTHER STATE", + wantErr: true, + wantResp: false, + }, + } + for _, tt := range tests { + t.Run(tt.desc, func(t *testing.T) { + apiClient := &apiClientMocked{ + getNetworkFails: tt.getFails, + isDeleted: tt.isDeleted, + resourceState: tt.resourceState, + } + + var wantRes *iaasalpha.Network + if tt.wantResp { + wantRes = &iaasalpha.Network{ + Id: utils.Ptr("nid"), + Status: utils.Ptr(tt.resourceState), + } + } + + handler := DeleteNetworkWaitHandler(context.Background(), apiClient, "pid", "eu01", "nid") + + gotRes, err := handler.SetTimeout(10 * time.Millisecond).WaitWithContext(context.Background()) + + if (err != nil) != tt.wantErr { + t.Fatalf("handler error = %v, wantErr %v", err, tt.wantErr) + } + if !cmp.Equal(gotRes, wantRes) { + t.Fatalf("handler gotRes = %v, want %v", gotRes, wantRes) + } + }) + } +} diff --git a/pkg/iaasbeta/.openapi-generator/VERSION b/pkg/iaasbeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/iaasbeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/iaasbeta/api_default.go b/pkg/iaasbeta/api_default.go new file mode 100644 index 00000000..e3f34fe8 --- /dev/null +++ b/pkg/iaasbeta/api_default.go @@ -0,0 +1,30658 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + AddNetworkToServer Create and attach a network interface from the specified network. + Create and attach a network interface from the specified network to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiAddNetworkToServerRequest + */ + AddNetworkToServer(ctx context.Context, projectId string, region string, serverId string, networkId string) ApiAddNetworkToServerRequest + /* + AddNetworkToServerExecute executes the request + + */ + AddNetworkToServerExecute(ctx context.Context, projectId string, region string, serverId string, networkId string) error + /* + AddNicToServer Attach an existing network interface. + Attach an existing network interface to a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param nicId The identifier (ID) of a network interface. + @return ApiAddNicToServerRequest + */ + AddNicToServer(ctx context.Context, projectId string, region string, serverId string, nicId string) ApiAddNicToServerRequest + /* + AddNicToServerExecute executes the request + + */ + AddNicToServerExecute(ctx context.Context, projectId string, region string, serverId string, nicId string) error + /* + AddPublicIpToServer Associate a public IP to the server. + Associate a public IP to a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiAddPublicIpToServerRequest + */ + AddPublicIpToServer(ctx context.Context, projectId string, region string, serverId string, publicIpId string) ApiAddPublicIpToServerRequest + /* + AddPublicIpToServerExecute executes the request + + */ + AddPublicIpToServerExecute(ctx context.Context, projectId string, region string, serverId string, publicIpId string) error + /* + AddRoutesToRoutingTable Create new routes in a routing table. + Create new routes in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiAddRoutesToRoutingTableRequest + */ + AddRoutesToRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiAddRoutesToRoutingTableRequest + /* + AddRoutesToRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RouteListResponse + + */ + AddRoutesToRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) + /* + AddRoutingTableToArea Create new routing table in a network area. + Create a new routing table in an existing network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiAddRoutingTableToAreaRequest + */ + AddRoutingTableToArea(ctx context.Context, organizationId string, areaId string, region string) ApiAddRoutingTableToAreaRequest + /* + AddRoutingTableToAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RoutingTable + + */ + AddRoutingTableToAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTable, error) + /* + AddSecurityGroupToServer Add a server to a security group. + Add an existing server to an existing security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiAddSecurityGroupToServerRequest + */ + AddSecurityGroupToServer(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) ApiAddSecurityGroupToServerRequest + /* + AddSecurityGroupToServerExecute executes the request + + */ + AddSecurityGroupToServerExecute(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) error + /* + AddServiceAccountToServer Attach service account to a server. + Attach an additional service account to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ApiAddServiceAccountToServerRequest + */ + AddServiceAccountToServer(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) ApiAddServiceAccountToServerRequest + /* + AddServiceAccountToServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ServiceAccountMailListResponse + + */ + AddServiceAccountToServerExecute(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) + /* + AddVolumeToServer Attach a volume to a server. + Attach an existing volume to an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiAddVolumeToServerRequest + */ + AddVolumeToServer(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiAddVolumeToServerRequest + /* + AddVolumeToServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return VolumeAttachment + + */ + AddVolumeToServerExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) + /* + CreateAffinityGroup Create a new affinity group in a project. + Create a new server affinity group in the given project ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateAffinityGroupRequest + */ + CreateAffinityGroup(ctx context.Context, projectId string, region string) ApiCreateAffinityGroupRequest + /* + CreateAffinityGroupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return AffinityGroup + + */ + CreateAffinityGroupExecute(ctx context.Context, projectId string, region string) (*AffinityGroup, error) + /* + CreateBackup Create new Backup. + Create a new Backup in a project. If a snapshot ID is provided create the backup from the snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateBackupRequest + */ + CreateBackup(ctx context.Context, projectId string, region string) ApiCreateBackupRequest + /* + CreateBackupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Backup + + */ + CreateBackupExecute(ctx context.Context, projectId string, region string) (*Backup, error) + /* + CreateImage Create new Image. + Create a new Image in a project. This call, if successful, returns a pre-signed URL for the customer to upload the image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateImageRequest + */ + CreateImage(ctx context.Context, projectId string, region string) ApiCreateImageRequest + /* + CreateImageExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ImageCreateResponse + + */ + CreateImageExecute(ctx context.Context, projectId string, region string) (*ImageCreateResponse, error) + /* + CreateIsolatedNetwork Create a single isolated network. + Creates an isolated network which is not connected to other networks in this project. We recommend using this endpoint only if you are fully aware of its purpose and the consequences of its execution. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateIsolatedNetworkRequest + */ + CreateIsolatedNetwork(ctx context.Context, projectId string, region string) ApiCreateIsolatedNetworkRequest + /* + CreateIsolatedNetworkExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Network + + */ + CreateIsolatedNetworkExecute(ctx context.Context, projectId string, region string) (*Network, error) + /* + CreateKeyPair Import a public key. + Import a new public key for the requesting user based on provided public key material. The creation will fail if an SSH keypair with the same name already exists. If a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is also not present it will be the the MD5 fingerprint of the key. For autogenerated names invalid characters will be removed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateKeyPairRequest + */ + CreateKeyPair(ctx context.Context) ApiCreateKeyPairRequest + /* + CreateKeyPairExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return Keypair + + */ + CreateKeyPairExecute(ctx context.Context) (*Keypair, error) + /* + CreateNetwork Create new network. + Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkRequest + */ + CreateNetwork(ctx context.Context, projectId string, region string) ApiCreateNetworkRequest + /* + CreateNetworkExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Network + + */ + CreateNetworkExecute(ctx context.Context, projectId string, region string) (*Network, error) + /* + CreateNetworkArea Create new network area in an organization. + Create a new network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiCreateNetworkAreaRequest + */ + CreateNetworkArea(ctx context.Context, organizationId string) ApiCreateNetworkAreaRequest + /* + CreateNetworkAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return NetworkArea + + */ + CreateNetworkAreaExecute(ctx context.Context, organizationId string) (*NetworkArea, error) + /* + CreateNetworkAreaRange Create new network range in a network area. + Create a new network range in an existing network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkAreaRangeRequest + */ + CreateNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string) ApiCreateNetworkAreaRangeRequest + /* + CreateNetworkAreaRangeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return NetworkRangeListResponse + + */ + CreateNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string) (*NetworkRangeListResponse, error) + /* + CreateNetworkAreaRoute Create new network routes. + Create one or several new network routes in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkAreaRouteRequest + */ + CreateNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string) ApiCreateNetworkAreaRouteRequest + /* + CreateNetworkAreaRouteExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RouteListResponse + + */ + CreateNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string) (*RouteListResponse, error) + /* + CreateNic Create new network interface. + Create a new network interface in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiCreateNicRequest + */ + CreateNic(ctx context.Context, projectId string, region string, networkId string) ApiCreateNicRequest + /* + CreateNicExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return NIC + + */ + CreateNicExecute(ctx context.Context, projectId string, region string, networkId string) (*NIC, error) + /* + CreatePublicIP Create new public IP. + Create a new public IP in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreatePublicIPRequest + */ + CreatePublicIP(ctx context.Context, projectId string, region string) ApiCreatePublicIPRequest + /* + CreatePublicIPExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return PublicIp + + */ + CreatePublicIPExecute(ctx context.Context, projectId string, region string) (*PublicIp, error) + /* + CreateSecurityGroup Create new security group. + Create a new security group in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateSecurityGroupRequest + */ + CreateSecurityGroup(ctx context.Context, projectId string, region string) ApiCreateSecurityGroupRequest + /* + CreateSecurityGroupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return SecurityGroup + + */ + CreateSecurityGroupExecute(ctx context.Context, projectId string, region string) (*SecurityGroup, error) + /* + CreateSecurityGroupRule Create new security group rule. + Create a new security group rule in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiCreateSecurityGroupRuleRequest + */ + CreateSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string) ApiCreateSecurityGroupRuleRequest + /* + CreateSecurityGroupRuleExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return SecurityGroupRule + + */ + CreateSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroupRule, error) + /* + CreateServer Create new server. + Create a new server in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateServerRequest + */ + CreateServer(ctx context.Context, projectId string, region string) ApiCreateServerRequest + /* + CreateServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Server + + */ + CreateServerExecute(ctx context.Context, projectId string, region string) (*Server, error) + /* + CreateVolume Create new volume. + Create a new volume in a project. If a volume source is not provided, an empty volume will be created. The size property is required if no source or an image source is provided. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateVolumeRequest + */ + CreateVolume(ctx context.Context, projectId string, region string) ApiCreateVolumeRequest + /* + CreateVolumeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Volume + + */ + CreateVolumeExecute(ctx context.Context, projectId string, region string) (*Volume, error) + /* + DeallocateServer Deallocate an existing server. + Deallocate an existing server. The server will be removed from the hypervisor so only the volume will be billed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeallocateServerRequest + */ + DeallocateServer(ctx context.Context, projectId string, region string, serverId string) ApiDeallocateServerRequest + /* + DeallocateServerExecute executes the request + + */ + DeallocateServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + DeleteAffinityGroup Delete a affinity group in a project. + Delete a affinity group in the given project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return ApiDeleteAffinityGroupRequest + */ + DeleteAffinityGroup(ctx context.Context, projectId string, region string, affinityGroupId string) ApiDeleteAffinityGroupRequest + /* + DeleteAffinityGroupExecute executes the request + + */ + DeleteAffinityGroupExecute(ctx context.Context, projectId string, region string, affinityGroupId string) error + /* + DeleteBackup Delete a backup. + Delete a backup that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiDeleteBackupRequest + */ + DeleteBackup(ctx context.Context, projectId string, region string, backupId string) ApiDeleteBackupRequest + /* + DeleteBackupExecute executes the request + + */ + DeleteBackupExecute(ctx context.Context, projectId string, region string, backupId string) error + /* + DeleteImage Delete an Image. + Delete an image that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageRequest + */ + DeleteImage(ctx context.Context, projectId string, region string, imageId string) ApiDeleteImageRequest + /* + DeleteImageExecute executes the request + + */ + DeleteImageExecute(ctx context.Context, projectId string, region string, imageId string) error + /* + DeleteImageShare Remove image share. + Remove the image share. New scope will be local. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageShareRequest + */ + DeleteImageShare(ctx context.Context, projectId string, region string, imageId string) ApiDeleteImageShareRequest + /* + DeleteImageShareExecute executes the request + + */ + DeleteImageShareExecute(ctx context.Context, projectId string, region string, imageId string) error + /* + DeleteImageShareConsumer Remove an image share consumer. + Remove consumer from a shared image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiDeleteImageShareConsumerRequest + */ + DeleteImageShareConsumer(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) ApiDeleteImageShareConsumerRequest + /* + DeleteImageShareConsumerExecute executes the request + + */ + DeleteImageShareConsumerExecute(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) error + /* + DeleteKeyPair Delete an SSH keypair. + Delete an SSH keypair from a user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiDeleteKeyPairRequest + */ + DeleteKeyPair(ctx context.Context, keypairName string) ApiDeleteKeyPairRequest + /* + DeleteKeyPairExecute executes the request + + */ + DeleteKeyPairExecute(ctx context.Context, keypairName string) error + /* + DeleteNetwork Delete network. + Delete a network. If the network is still in use, the deletion will fail. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiDeleteNetworkRequest + */ + DeleteNetwork(ctx context.Context, projectId string, region string, networkId string) ApiDeleteNetworkRequest + /* + DeleteNetworkExecute executes the request + + */ + DeleteNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error + /* + DeleteNetworkArea Delete a network area. + Delete an existing network area in an organization. This is only possible if no projects are using the area anymore. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiDeleteNetworkAreaRequest + */ + DeleteNetworkArea(ctx context.Context, organizationId string, areaId string) ApiDeleteNetworkAreaRequest + /* + DeleteNetworkAreaExecute executes the request + + */ + DeleteNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) error + /* + DeleteNetworkAreaRange Delete a network range. + Delete a network range of a network area. The deletion will fail if the network range is still used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiDeleteNetworkAreaRangeRequest + */ + DeleteNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) ApiDeleteNetworkAreaRangeRequest + /* + DeleteNetworkAreaRangeExecute executes the request + + */ + DeleteNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) error + /* + DeleteNetworkAreaRoute Delete a network route. + Delete a network route of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteNetworkAreaRouteRequest + */ + DeleteNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiDeleteNetworkAreaRouteRequest + /* + DeleteNetworkAreaRouteExecute executes the request + + */ + DeleteNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) error + /* + DeleteNic Delete a network interface. + Delete a network interface that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiDeleteNicRequest + */ + DeleteNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiDeleteNicRequest + /* + DeleteNicExecute executes the request + + */ + DeleteNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) error + /* + DeletePublicIP Delete a public IP. + Delete a public IP that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiDeletePublicIPRequest + */ + DeletePublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiDeletePublicIPRequest + /* + DeletePublicIPExecute executes the request + + */ + DeletePublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) error + /* + DeleteRouteFromRoutingTable Delete a route in a routing table. + Delete a route in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteRouteFromRoutingTableRequest + */ + DeleteRouteFromRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiDeleteRouteFromRoutingTableRequest + /* + DeleteRouteFromRoutingTableExecute executes the request + + */ + DeleteRouteFromRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) error + /* + DeleteRoutingTableFromArea Delete a routing table. + Delete a routing table of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiDeleteRoutingTableFromAreaRequest + */ + DeleteRoutingTableFromArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiDeleteRoutingTableFromAreaRequest + /* + DeleteRoutingTableFromAreaExecute executes the request + + */ + DeleteRoutingTableFromAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) error + /* + DeleteSecurityGroup Delete security group. + Delete a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiDeleteSecurityGroupRequest + */ + DeleteSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiDeleteSecurityGroupRequest + /* + DeleteSecurityGroupExecute executes the request + + */ + DeleteSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) error + /* + DeleteSecurityGroupRule Delete security group rule. + Delete a security group rule. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiDeleteSecurityGroupRuleRequest + */ + DeleteSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) ApiDeleteSecurityGroupRuleRequest + /* + DeleteSecurityGroupRuleExecute executes the request + + */ + DeleteSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) error + /* + DeleteServer Delete a server. + Delete a server. Volumes won't be deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeleteServerRequest + */ + DeleteServer(ctx context.Context, projectId string, region string, serverId string) ApiDeleteServerRequest + /* + DeleteServerExecute executes the request + + */ + DeleteServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + DeleteVolume Delete a volume. + Delete a volume inside a project. The deletion will fail if the volume is still in use. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiDeleteVolumeRequest + */ + DeleteVolume(ctx context.Context, projectId string, region string, volumeId string) ApiDeleteVolumeRequest + /* + DeleteVolumeExecute executes the request + + */ + DeleteVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) error + /* + GetAffinityGroup Get the affinity group. + Get the affinity group created in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return ApiGetAffinityGroupRequest + */ + GetAffinityGroup(ctx context.Context, projectId string, region string, affinityGroupId string) ApiGetAffinityGroupRequest + /* + GetAffinityGroupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return AffinityGroup + + */ + GetAffinityGroupExecute(ctx context.Context, projectId string, region string, affinityGroupId string) (*AffinityGroup, error) + /* + GetAttachedVolume Get Volume Attachment details. + Get the details of an existing Volume Attachment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetAttachedVolumeRequest + */ + GetAttachedVolume(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiGetAttachedVolumeRequest + /* + GetAttachedVolumeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return VolumeAttachment + + */ + GetAttachedVolumeExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) + /* + GetBackup Get details about a backup. + Get details about a block device backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiGetBackupRequest + */ + GetBackup(ctx context.Context, projectId string, region string, backupId string) ApiGetBackupRequest + /* + GetBackupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return Backup + + */ + GetBackupExecute(ctx context.Context, projectId string, region string, backupId string) (*Backup, error) + /* + GetImage Get details about an image. + Get details about a specific Image inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageRequest + */ + GetImage(ctx context.Context, projectId string, region string, imageId string) ApiGetImageRequest + /* + GetImageExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return Image + + */ + GetImageExecute(ctx context.Context, projectId string, region string, imageId string) (*Image, error) + /* + GetImageShare Get share details of an image. + Get share details about an shared image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageShareRequest + */ + GetImageShare(ctx context.Context, projectId string, region string, imageId string) ApiGetImageShareRequest + /* + GetImageShareExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ImageShare + + */ + GetImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) + /* + GetImageShareConsumer Get image share consumer. + Get details about an image share consumer. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiGetImageShareConsumerRequest + */ + GetImageShareConsumer(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) ApiGetImageShareConsumerRequest + /* + GetImageShareConsumerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ImageShareConsumer + + */ + GetImageShareConsumerExecute(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) (*ImageShareConsumer, error) + /* + GetKeyPair Get SSH keypair details. + Get details about an SSH keypair. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiGetKeyPairRequest + */ + GetKeyPair(ctx context.Context, keypairName string) ApiGetKeyPairRequest + /* + GetKeyPairExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return Keypair + + */ + GetKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) + /* + GetMachineType Get details about a machine type. + Get details about a specific machine type. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param machineType STACKIT machine type Name. + @return ApiGetMachineTypeRequest + */ + GetMachineType(ctx context.Context, projectId string, region string, machineType string) ApiGetMachineTypeRequest + /* + GetMachineTypeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param machineType STACKIT machine type Name. + @return MachineType + + */ + GetMachineTypeExecute(ctx context.Context, projectId string, region string, machineType string) (*MachineType, error) + /* + GetNetwork Get network details. + Get details about a network of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiGetNetworkRequest + */ + GetNetwork(ctx context.Context, projectId string, region string, networkId string) ApiGetNetworkRequest + /* + GetNetworkExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return Network + + */ + GetNetworkExecute(ctx context.Context, projectId string, region string, networkId string) (*Network, error) + /* + GetNetworkArea Get details about a network area. + Get details about a network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiGetNetworkAreaRequest + */ + GetNetworkArea(ctx context.Context, organizationId string, areaId string) ApiGetNetworkAreaRequest + /* + GetNetworkAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return NetworkArea + + */ + GetNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) + /* + GetNetworkAreaRange Get details about a network range. + Get details about a network range in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiGetNetworkAreaRangeRequest + */ + GetNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) ApiGetNetworkAreaRangeRequest + /* + GetNetworkAreaRangeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return NetworkRange + + */ + GetNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) (*NetworkRange, error) + /* + GetNetworkAreaRoute Get details about a network route. + Get details about a network route defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetNetworkAreaRouteRequest + */ + GetNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiGetNetworkAreaRouteRequest + /* + GetNetworkAreaRouteExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return Route + + */ + GetNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) (*Route, error) + /* + GetNic Get details about a network interface. + Get details about a network interface inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiGetNicRequest + */ + GetNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiGetNicRequest + /* + GetNicExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return NIC + + */ + GetNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) (*NIC, error) + /* + GetOrganizationRequest Lookup an organization request ID. + Lookup an organization request ID from a previous request. This allows to find resource IDs of resources generated during a organization request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetOrganizationRequestRequest + */ + GetOrganizationRequest(ctx context.Context, organizationId string, requestId string) ApiGetOrganizationRequestRequest + /* + GetOrganizationRequestExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param requestId The identifier (ID) of a STACKIT Request. + @return Request + + */ + GetOrganizationRequestExecute(ctx context.Context, organizationId string, requestId string) (*Request, error) + /* + GetProjectDetails Get project details. + Get details about a STACKIT project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiGetProjectDetailsRequest + */ + GetProjectDetails(ctx context.Context, projectId string) ApiGetProjectDetailsRequest + /* + GetProjectDetailsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return Project + + */ + GetProjectDetailsExecute(ctx context.Context, projectId string) (*Project, error) + /* + GetProjectNIC Get details about a network interface of a project. + Get details about a network interface inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param nicId The identifier (ID) of a network interface. + @return ApiGetProjectNICRequest + */ + GetProjectNIC(ctx context.Context, projectId string, region string, nicId string) ApiGetProjectNICRequest + /* + GetProjectNICExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param nicId The identifier (ID) of a network interface. + @return NIC + + */ + GetProjectNICExecute(ctx context.Context, projectId string, region string, nicId string) (*NIC, error) + /* + GetProjectRequest Lookup a project request ID. + Lookup a project request ID from a previous request. This allows to find resource IDs of resources generated during a projects request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetProjectRequestRequest + */ + GetProjectRequest(ctx context.Context, projectId string, region string, requestId string) ApiGetProjectRequestRequest + /* + GetProjectRequestExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param requestId The identifier (ID) of a STACKIT Request. + @return Request + + */ + GetProjectRequestExecute(ctx context.Context, projectId string, region string, requestId string) (*Request, error) + /* + GetPublicIP Get details about a public IP. + Get details about a public IP inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiGetPublicIPRequest + */ + GetPublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiGetPublicIPRequest + /* + GetPublicIPExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return PublicIp + + */ + GetPublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) (*PublicIp, error) + /* + GetRouteOfRoutingTable Get details about a route of a routing table. + Get details about a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetRouteOfRoutingTableRequest + */ + GetRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiGetRouteOfRoutingTableRequest + /* + GetRouteOfRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return Route + + */ + GetRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) + /* + GetRoutingTableOfArea Get details about a routing table. + Get details about a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiGetRoutingTableOfAreaRequest + */ + GetRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiGetRoutingTableOfAreaRequest + /* + GetRoutingTableOfAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RoutingTable + + */ + GetRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) + /* + GetSecurityGroup Get security group details. + Get details about a security group of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiGetSecurityGroupRequest + */ + GetSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiGetSecurityGroupRequest + /* + GetSecurityGroupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return SecurityGroup + + */ + GetSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroup, error) + /* + GetSecurityGroupRule Get security group rule details. + Get details about a security group rule of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiGetSecurityGroupRuleRequest + */ + GetSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) ApiGetSecurityGroupRuleRequest + /* + GetSecurityGroupRuleExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return SecurityGroupRule + + */ + GetSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) (*SecurityGroupRule, error) + /* + GetServer Get server details. + Get details about a server by its ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerRequest + */ + GetServer(ctx context.Context, projectId string, region string, serverId string) ApiGetServerRequest + /* + GetServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return Server + + */ + GetServerExecute(ctx context.Context, projectId string, region string, serverId string) (*Server, error) + /* + GetServerConsole Get server console. + Get a URL for server remote console. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerConsoleRequest + */ + GetServerConsole(ctx context.Context, projectId string, region string, serverId string) ApiGetServerConsoleRequest + /* + GetServerConsoleExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ServerConsoleUrl + + */ + GetServerConsoleExecute(ctx context.Context, projectId string, region string, serverId string) (*ServerConsoleUrl, error) + /* + GetServerLog Get server log. + Get server console log. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerLogRequest + */ + GetServerLog(ctx context.Context, projectId string, region string, serverId string) ApiGetServerLogRequest + /* + GetServerLogExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return GetServerLog200Response + + */ + GetServerLogExecute(ctx context.Context, projectId string, region string, serverId string) (*GetServerLog200Response, error) + /* + GetVolume Get details about a volume. + Get details about a block device volume. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetVolumeRequest + */ + GetVolume(ctx context.Context, projectId string, region string, volumeId string) ApiGetVolumeRequest + /* + GetVolumeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return Volume + + */ + GetVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) (*Volume, error) + /* + GetVolumePerformanceClass Get details about a volume performance class. + Get details about a specific volume performance class. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumePerformanceClass The name of a STACKIT Volume performance class. + @return ApiGetVolumePerformanceClassRequest + */ + GetVolumePerformanceClass(ctx context.Context, projectId string, region string, volumePerformanceClass string) ApiGetVolumePerformanceClassRequest + /* + GetVolumePerformanceClassExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumePerformanceClass The name of a STACKIT Volume performance class. + @return VolumePerformanceClass + + */ + GetVolumePerformanceClassExecute(ctx context.Context, projectId string, region string, volumePerformanceClass string) (*VolumePerformanceClass, error) + /* + ListAffinityGroups Get the affinity groups setup for a project. + Get the affinity groups created in a project. Affinity groups are an indication of locality of a server relative to another group of servers. They can be either running on the same host (affinity) or on different ones (anti-affinity). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListAffinityGroupsRequest + */ + ListAffinityGroups(ctx context.Context, projectId string, region string) ApiListAffinityGroupsRequest + /* + ListAffinityGroupsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return AffinityGroupListResponse + + */ + ListAffinityGroupsExecute(ctx context.Context, projectId string, region string) (*AffinityGroupListResponse, error) + /* + ListAttachedVolumes List all volume attachments of a server. + Get a list of all volume attachments of a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListAttachedVolumesRequest + */ + ListAttachedVolumes(ctx context.Context, projectId string, region string, serverId string) ApiListAttachedVolumesRequest + /* + ListAttachedVolumesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return VolumeAttachmentListResponse + + */ + ListAttachedVolumesExecute(ctx context.Context, projectId string, region string, serverId string) (*VolumeAttachmentListResponse, error) + /* + ListAvailabilityZones List all availability zones. + Get a list of all availability zones. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region The STACKIT Region of the resources. + @return ApiListAvailabilityZonesRequest + */ + ListAvailabilityZones(ctx context.Context, region string) ApiListAvailabilityZonesRequest + /* + ListAvailabilityZonesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region The STACKIT Region of the resources. + @return AvailabilityZoneListResponse + + */ + ListAvailabilityZonesExecute(ctx context.Context, region string) (*AvailabilityZoneListResponse, error) + /* + ListBackups List all backups inside a project. + Get a list of all backups inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListBackupsRequest + */ + ListBackups(ctx context.Context, projectId string, region string) ApiListBackupsRequest + /* + ListBackupsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return BackupListResponse + + */ + ListBackupsExecute(ctx context.Context, projectId string, region string) (*BackupListResponse, error) + /* + ListImages List all Images inside a project. + Get a list of all images inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListImagesRequest + */ + ListImages(ctx context.Context, projectId string, region string) ApiListImagesRequest + /* + ListImagesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ImageListResponse + + */ + ListImagesExecute(ctx context.Context, projectId string, region string) (*ImageListResponse, error) + /* + ListKeyPairs List all SSH keypairs for the requesting user. + Get a list of all SSH keypairs assigned to the requesting user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListKeyPairsRequest + */ + ListKeyPairs(ctx context.Context) ApiListKeyPairsRequest + /* + ListKeyPairsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return KeyPairListResponse + + */ + ListKeyPairsExecute(ctx context.Context) (*KeyPairListResponse, error) + /* + ListMachineTypes List all machine types available for a project. + Get a list of all machine type available in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListMachineTypesRequest + */ + ListMachineTypes(ctx context.Context, projectId string, region string) ApiListMachineTypesRequest + /* + ListMachineTypesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return MachineTypeListResponse + + */ + ListMachineTypesExecute(ctx context.Context, projectId string, region string) (*MachineTypeListResponse, error) + /* + ListNetworkAreaProjects List all projects using a network area. + Get a list of all projects using a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaProjectsRequest + */ + ListNetworkAreaProjects(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaProjectsRequest + /* + ListNetworkAreaProjectsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ProjectListResponse + + */ + ListNetworkAreaProjectsExecute(ctx context.Context, organizationId string, areaId string) (*ProjectListResponse, error) + /* + ListNetworkAreaRanges List all network ranges in a network area. + Get a list of all network ranges in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListNetworkAreaRangesRequest + */ + ListNetworkAreaRanges(ctx context.Context, organizationId string, areaId string, region string) ApiListNetworkAreaRangesRequest + /* + ListNetworkAreaRangesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return NetworkRangeListResponse + + */ + ListNetworkAreaRangesExecute(ctx context.Context, organizationId string, areaId string, region string) (*NetworkRangeListResponse, error) + /* + ListNetworkAreaRoutes List all network routes in a network area. + Get a list of all network routes defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListNetworkAreaRoutesRequest + */ + ListNetworkAreaRoutes(ctx context.Context, organizationId string, areaId string, region string) ApiListNetworkAreaRoutesRequest + /* + ListNetworkAreaRoutesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RouteListResponse + + */ + ListNetworkAreaRoutesExecute(ctx context.Context, organizationId string, areaId string, region string) (*RouteListResponse, error) + /* + ListNetworkAreas List all network areas in an organization. + Get a list of all visible network areas defined in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiListNetworkAreasRequest + */ + ListNetworkAreas(ctx context.Context, organizationId string) ApiListNetworkAreasRequest + /* + ListNetworkAreasExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return NetworkAreaListResponse + + */ + ListNetworkAreasExecute(ctx context.Context, organizationId string) (*NetworkAreaListResponse, error) + /* + ListNetworks List all networks inside a project. + Get a list of all networks inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListNetworksRequest + */ + ListNetworks(ctx context.Context, projectId string, region string) ApiListNetworksRequest + /* + ListNetworksExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return NetworkListResponse + + */ + ListNetworksExecute(ctx context.Context, projectId string, region string) (*NetworkListResponse, error) + /* + ListNics List all network interfaces inside a network. + Get a list of all network interfaces inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiListNicsRequest + */ + ListNics(ctx context.Context, projectId string, region string, networkId string) ApiListNicsRequest + /* + ListNicsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return NICListResponse + + */ + ListNicsExecute(ctx context.Context, projectId string, region string, networkId string) (*NICListResponse, error) + /* + ListProjectNICs List all network interfaces inside a project. + Get a list of all network interfaces inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListProjectNICsRequest + */ + ListProjectNICs(ctx context.Context, projectId string, region string) ApiListProjectNICsRequest + /* + ListProjectNICsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return NICListResponse + + */ + ListProjectNICsExecute(ctx context.Context, projectId string, region string) (*NICListResponse, error) + /* + ListPublicIPRanges List all public IP ranges. + Get a list of all public IP ranges that STACKIT uses. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListPublicIPRangesRequest + */ + ListPublicIPRanges(ctx context.Context) ApiListPublicIPRangesRequest + /* + ListPublicIPRangesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return PublicNetworkListResponse + + */ + ListPublicIPRangesExecute(ctx context.Context) (*PublicNetworkListResponse, error) + /* + ListPublicIPs List all public IPs inside a project. + Get a list of all public IPs inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListPublicIPsRequest + */ + ListPublicIPs(ctx context.Context, projectId string, region string) ApiListPublicIPsRequest + /* + ListPublicIPsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return PublicIpListResponse + + */ + ListPublicIPsExecute(ctx context.Context, projectId string, region string) (*PublicIpListResponse, error) + /* + ListQuotas List project quotas. + List quota limits and usage for project resources. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListQuotasRequest + */ + ListQuotas(ctx context.Context, projectId string, region string) ApiListQuotasRequest + /* + ListQuotasExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return QuotaListResponse + + */ + ListQuotasExecute(ctx context.Context, projectId string, region string) (*QuotaListResponse, error) + /* + ListRoutesOfRoutingTable List all routes in a routing table. + Get a list of all routes in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiListRoutesOfRoutingTableRequest + */ + ListRoutesOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiListRoutesOfRoutingTableRequest + /* + ListRoutesOfRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RouteListResponse + + */ + ListRoutesOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) + /* + ListRoutingTablesOfArea List all routing tables in a network area. + Get a list of all routing tables in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListRoutingTablesOfAreaRequest + */ + ListRoutingTablesOfArea(ctx context.Context, organizationId string, areaId string, region string) ApiListRoutingTablesOfAreaRequest + /* + ListRoutingTablesOfAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RoutingTableListResponse + + */ + ListRoutingTablesOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTableListResponse, error) + /* + ListSecurityGroupRules List all rules for a security group. + Get a list of all rules inside a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiListSecurityGroupRulesRequest + */ + ListSecurityGroupRules(ctx context.Context, projectId string, region string, securityGroupId string) ApiListSecurityGroupRulesRequest + /* + ListSecurityGroupRulesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return SecurityGroupRuleListResponse + + */ + ListSecurityGroupRulesExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroupRuleListResponse, error) + /* + ListSecurityGroups List all security groups inside a project. + Get a list of all security groups inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListSecurityGroupsRequest + */ + ListSecurityGroups(ctx context.Context, projectId string, region string) ApiListSecurityGroupsRequest + /* + ListSecurityGroupsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return SecurityGroupListResponse + + */ + ListSecurityGroupsExecute(ctx context.Context, projectId string, region string) (*SecurityGroupListResponse, error) + /* + ListServerNICs Get all network interfaces. + Get all network interfaces attached to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerNICsRequest + */ + ListServerNICs(ctx context.Context, projectId string, region string, serverId string) ApiListServerNICsRequest + /* + ListServerNICsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return NICListResponse + + */ + ListServerNICsExecute(ctx context.Context, projectId string, region string, serverId string) (*NICListResponse, error) + /* + ListServerServiceAccounts List all service accounts of the Server. + Get the list of the service accounts of the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerServiceAccountsRequest + */ + ListServerServiceAccounts(ctx context.Context, projectId string, region string, serverId string) ApiListServerServiceAccountsRequest + /* + ListServerServiceAccountsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ServiceAccountMailListResponse + + */ + ListServerServiceAccountsExecute(ctx context.Context, projectId string, region string, serverId string) (*ServiceAccountMailListResponse, error) + /* + ListServers List all servers inside a project. + Get a list of all servers inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListServersRequest + */ + ListServers(ctx context.Context, projectId string, region string) ApiListServersRequest + /* + ListServersExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ServerListResponse + + */ + ListServersExecute(ctx context.Context, projectId string, region string) (*ServerListResponse, error) + /* + ListVolumePerformanceClasses List all volume performance classes available for a project. + Get a list of all volume performance classes available inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListVolumePerformanceClassesRequest + */ + ListVolumePerformanceClasses(ctx context.Context, projectId string, region string) ApiListVolumePerformanceClassesRequest + /* + ListVolumePerformanceClassesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return VolumePerformanceClassListResponse + + */ + ListVolumePerformanceClassesExecute(ctx context.Context, projectId string, region string) (*VolumePerformanceClassListResponse, error) + /* + ListVolumes List all volumes inside a project. + Get a list of all volumes inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListVolumesRequest + */ + ListVolumes(ctx context.Context, projectId string, region string) ApiListVolumesRequest + /* + ListVolumesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return VolumeListResponse + + */ + ListVolumesExecute(ctx context.Context, projectId string, region string) (*VolumeListResponse, error) + /* + PartialUpdateNetwork Update network settings. + Update the settings of a network inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiPartialUpdateNetworkRequest + */ + PartialUpdateNetwork(ctx context.Context, projectId string, region string, networkId string) ApiPartialUpdateNetworkRequest + /* + PartialUpdateNetworkExecute executes the request + + */ + PartialUpdateNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error + /* + PartialUpdateNetworkArea Update network area settings. + Update the settings of a network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiPartialUpdateNetworkAreaRequest + */ + PartialUpdateNetworkArea(ctx context.Context, organizationId string, areaId string) ApiPartialUpdateNetworkAreaRequest + /* + PartialUpdateNetworkAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return NetworkArea + + */ + PartialUpdateNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) + /* + RebootServer Reboot the server. + Reboot the server. A soft reboot will attempt to gracefully shut down the server by passing the command to the operating system. A hard reboot will power cycle the server without waiting for the operating system to shutdown properly. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRebootServerRequest + */ + RebootServer(ctx context.Context, projectId string, region string, serverId string) ApiRebootServerRequest + /* + RebootServerExecute executes the request + + */ + RebootServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + RemoveNetworkFromServer Detach and delete all network interfaces associated with the specified network. + Detach and delete all network interfaces associated with the specified network from the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiRemoveNetworkFromServerRequest + */ + RemoveNetworkFromServer(ctx context.Context, projectId string, region string, serverId string, networkId string) ApiRemoveNetworkFromServerRequest + /* + RemoveNetworkFromServerExecute executes the request + + */ + RemoveNetworkFromServerExecute(ctx context.Context, projectId string, region string, serverId string, networkId string) error + /* + RemoveNicFromServer Detach a network interface. + Detach a network interface from a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param nicId The identifier (ID) of a network interface. + @return ApiRemoveNicFromServerRequest + */ + RemoveNicFromServer(ctx context.Context, projectId string, region string, serverId string, nicId string) ApiRemoveNicFromServerRequest + /* + RemoveNicFromServerExecute executes the request + + */ + RemoveNicFromServerExecute(ctx context.Context, projectId string, region string, serverId string, nicId string) error + /* + RemovePublicIpFromServer Dissociate a public IP from a server. + Dissociate a public IP on an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiRemovePublicIpFromServerRequest + */ + RemovePublicIpFromServer(ctx context.Context, projectId string, region string, serverId string, publicIpId string) ApiRemovePublicIpFromServerRequest + /* + RemovePublicIpFromServerExecute executes the request + + */ + RemovePublicIpFromServerExecute(ctx context.Context, projectId string, region string, serverId string, publicIpId string) error + /* + RemoveSecurityGroupFromServer Remove a server from a security group. + Remove a server from a attached security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiRemoveSecurityGroupFromServerRequest + */ + RemoveSecurityGroupFromServer(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) ApiRemoveSecurityGroupFromServerRequest + /* + RemoveSecurityGroupFromServerExecute executes the request + + */ + RemoveSecurityGroupFromServerExecute(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) error + /* + RemoveServiceAccountFromServer Detach a service account from a server. + Detach an additional service account from the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ApiRemoveServiceAccountFromServerRequest + */ + RemoveServiceAccountFromServer(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) ApiRemoveServiceAccountFromServerRequest + /* + RemoveServiceAccountFromServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ServiceAccountMailListResponse + + */ + RemoveServiceAccountFromServerExecute(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) + /* + RemoveVolumeFromServer Detach a volume from a server. + Detach an existing volume from an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiRemoveVolumeFromServerRequest + */ + RemoveVolumeFromServer(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiRemoveVolumeFromServerRequest + /* + RemoveVolumeFromServerExecute executes the request + + */ + RemoveVolumeFromServerExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) error + /* + RescueServer Rescue an existing server. + Rescue an existing server. It is shutdown and the initial image is attached as the boot volume, while the boot volume is attached as secondary volume and the server is booted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRescueServerRequest + */ + RescueServer(ctx context.Context, projectId string, region string, serverId string) ApiRescueServerRequest + /* + RescueServerExecute executes the request + + */ + RescueServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + ResizeServer Resize a server. + Resize the server to the given machine type. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiResizeServerRequest + */ + ResizeServer(ctx context.Context, projectId string, region string, serverId string) ApiResizeServerRequest + /* + ResizeServerExecute executes the request + + */ + ResizeServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + ResizeVolume Update the size of a volume. + Update the size of a block device volume. The new volume size must be larger than the current size. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiResizeVolumeRequest + */ + ResizeVolume(ctx context.Context, projectId string, region string, volumeId string) ApiResizeVolumeRequest + /* + ResizeVolumeExecute executes the request + + */ + ResizeVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) error + /* + RestoreBackup Restore Backup to the referenced source Volume. + Restores a Backup to the existing Volume it references to. The use of this endpoint is disruptive as the volume needs to be detached. If a new volume is to be created use the volumes endpoint with the option to create from backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiRestoreBackupRequest + */ + RestoreBackup(ctx context.Context, projectId string, region string, backupId string) ApiRestoreBackupRequest + /* + RestoreBackupExecute executes the request + + */ + RestoreBackupExecute(ctx context.Context, projectId string, region string, backupId string) error + /* + SetImageShare Set image share. + Set share of an Image. New Options will replace existing settings. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiSetImageShareRequest + */ + SetImageShare(ctx context.Context, projectId string, region string, imageId string) ApiSetImageShareRequest + /* + SetImageShareExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ImageShare + + */ + SetImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) + /* + StartServer Boot up a server. + Start an existing server or allocates the server if deallocated. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiStartServerRequest + */ + StartServer(ctx context.Context, projectId string, region string, serverId string) ApiStartServerRequest + /* + StartServerExecute executes the request + + */ + StartServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + StopServer Stop an existing server. + Stops an existing server. The server will remain on the Hypervisor and will be charged full price for all resources attached to it. The attached resources will remain reserved. Useful particularly for vGPU servers. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiStopServerRequest + */ + StopServer(ctx context.Context, projectId string, region string, serverId string) ApiStopServerRequest + /* + StopServerExecute executes the request + + */ + StopServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + UnrescueServer Unrescue an existing server. + Unrescue an existing server. The original boot volume is attached as boot volume of the server and the server is booted up. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUnrescueServerRequest + */ + UnrescueServer(ctx context.Context, projectId string, region string, serverId string) ApiUnrescueServerRequest + /* + UnrescueServerExecute executes the request + + */ + UnrescueServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + UpdateAttachedVolume Update Volume Attachment Parameters. + Update the properties of an existing Volume Attachment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateAttachedVolumeRequest + */ + UpdateAttachedVolume(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiUpdateAttachedVolumeRequest + /* + UpdateAttachedVolumeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return VolumeAttachment + + */ + UpdateAttachedVolumeExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) + /* + UpdateImage Update Image Parameters. + Update the properties of an existing Image inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageRequest + */ + UpdateImage(ctx context.Context, projectId string, region string, imageId string) ApiUpdateImageRequest + /* + UpdateImageExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return Image + + */ + UpdateImageExecute(ctx context.Context, projectId string, region string, imageId string) (*Image, error) + /* + UpdateImageShare Update image share. + Update share of an Image. Projects will be appended to existing list. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageShareRequest + */ + UpdateImageShare(ctx context.Context, projectId string, region string, imageId string) ApiUpdateImageShareRequest + /* + UpdateImageShareExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ImageShare + + */ + UpdateImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) + /* + UpdateKeyPair Update information of an SSH keypair. + Update labels of the SSH keypair. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiUpdateKeyPairRequest + */ + UpdateKeyPair(ctx context.Context, keypairName string) ApiUpdateKeyPairRequest + /* + UpdateKeyPairExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return Keypair + + */ + UpdateKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) + /* + UpdateNic Update a network interface. + Update the properties of an existing network interface inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiUpdateNicRequest + */ + UpdateNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiUpdateNicRequest + /* + UpdateNicExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return NIC + + */ + UpdateNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) (*NIC, error) + /* + UpdatePublicIP Update a public IP. + Update the properties of an existing public IP inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiUpdatePublicIPRequest + */ + UpdatePublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiUpdatePublicIPRequest + /* + UpdatePublicIPExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return PublicIp + + */ + UpdatePublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) (*PublicIp, error) + /* + UpdateRouteOfRoutingTable Update a route of a routing table. + Update a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiUpdateRouteOfRoutingTableRequest + */ + UpdateRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiUpdateRouteOfRoutingTableRequest + /* + UpdateRouteOfRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return Route + + */ + UpdateRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) + /* + UpdateRoutingTableOfArea Update a routing table. + Update a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiUpdateRoutingTableOfAreaRequest + */ + UpdateRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiUpdateRoutingTableOfAreaRequest + /* + UpdateRoutingTableOfAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RoutingTable + + */ + UpdateRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) + /* + UpdateServer Update information of a server. + Update name or labels of the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUpdateServerRequest + */ + UpdateServer(ctx context.Context, projectId string, region string, serverId string) ApiUpdateServerRequest + /* + UpdateServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return Server + + */ + UpdateServerExecute(ctx context.Context, projectId string, region string, serverId string) (*Server, error) + /* + UpdateVolume Update information of a volume. + Update name, description or labels of the volume. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateVolumeRequest + */ + UpdateVolume(ctx context.Context, projectId string, region string, volumeId string) ApiUpdateVolumeRequest + /* + UpdateVolumeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return Volume + + */ + UpdateVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) (*Volume, error) + /* + V2beta1ConfigureNetworkAreaRegion Configure a region for a network area. + Configure a new region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiV2beta1ConfigureNetworkAreaRegionRequest + */ + V2beta1ConfigureNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1ConfigureNetworkAreaRegionRequest + /* + V2beta1ConfigureNetworkAreaRegionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RegionalArea + + */ + V2beta1ConfigureNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) + /* + V2beta1CreateSnapshot Create new Snapshot. + Create a new Snapshot from a Volume in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiV2beta1CreateSnapshotRequest + */ + V2beta1CreateSnapshot(ctx context.Context, projectId string, region string) ApiV2beta1CreateSnapshotRequest + /* + V2beta1CreateSnapshotExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Snapshot + + */ + V2beta1CreateSnapshotExecute(ctx context.Context, projectId string, region string) (*Snapshot, error) + /* + V2beta1DeleteNetworkAreaRegion Delete a configuration of region for a network area. + Delete a current configuration of region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiV2beta1DeleteNetworkAreaRegionRequest + */ + V2beta1DeleteNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1DeleteNetworkAreaRegionRequest + /* + V2beta1DeleteNetworkAreaRegionExecute executes the request + + */ + V2beta1DeleteNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) error + /* + V2beta1DeleteSnapshot Delete a snapshot. + Delete a snapshot that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiV2beta1DeleteSnapshotRequest + */ + V2beta1DeleteSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1DeleteSnapshotRequest + /* + V2beta1DeleteSnapshotExecute executes the request + + */ + V2beta1DeleteSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) error + /* + V2beta1GetAreaRegion Get details about a configured region. + Get details about a configured region in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiV2beta1GetAreaRegionRequest + */ + V2beta1GetAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1GetAreaRegionRequest + /* + V2beta1GetAreaRegionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RegionalArea + + */ + V2beta1GetAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) + /* + V2beta1GetSnapshot Get details about a snapshot. + Get details about a block device snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiV2beta1GetSnapshotRequest + */ + V2beta1GetSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1GetSnapshotRequest + /* + V2beta1GetSnapshotExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return Snapshot + + */ + V2beta1GetSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error) + /* + V2beta1ListAreaRegions List all configured regions in a network area. + Get a list of all configured regions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiV2beta1ListAreaRegionsRequest + */ + V2beta1ListAreaRegions(ctx context.Context, organizationId string, areaId string) ApiV2beta1ListAreaRegionsRequest + /* + V2beta1ListAreaRegionsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return RegionalAreaListResponse + + */ + V2beta1ListAreaRegionsExecute(ctx context.Context, organizationId string, areaId string) (*RegionalAreaListResponse, error) + /* + V2beta1ListSnapshotsInProject List all snapshots inside a project. + Get a list of all snapshots inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiV2beta1ListSnapshotsInProjectRequest + */ + V2beta1ListSnapshotsInProject(ctx context.Context, projectId string, region string) ApiV2beta1ListSnapshotsInProjectRequest + /* + V2beta1ListSnapshotsInProjectExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return SnapshotListResponse + + */ + V2beta1ListSnapshotsInProjectExecute(ctx context.Context, projectId string, region string) (*SnapshotListResponse, error) + /* + V2beta1UpdateBackup Update information of a backup. + Update name or labels of the backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiV2beta1UpdateBackupRequest + */ + V2beta1UpdateBackup(ctx context.Context, projectId string, region string, backupId string) ApiV2beta1UpdateBackupRequest + /* + V2beta1UpdateBackupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return Backup + + */ + V2beta1UpdateBackupExecute(ctx context.Context, projectId string, region string, backupId string) (*Backup, error) + /* + V2beta1UpdateNetworkAreaRegion Update a region for a network area. + Update a new region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiV2beta1UpdateNetworkAreaRegionRequest + */ + V2beta1UpdateNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1UpdateNetworkAreaRegionRequest + /* + V2beta1UpdateNetworkAreaRegionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RegionalArea + + */ + V2beta1UpdateNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) + /* + V2beta1UpdateRouteOfArea Update a network route. + Update a network route defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiV2beta1UpdateRouteOfAreaRequest + */ + V2beta1UpdateRouteOfArea(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiV2beta1UpdateRouteOfAreaRequest + /* + V2beta1UpdateRouteOfAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return Route + + */ + V2beta1UpdateRouteOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) (*Route, error) + /* + V2beta1UpdateSecurityGroup Update information of a security group. + Update labels of the security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiV2beta1UpdateSecurityGroupRequest + */ + V2beta1UpdateSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiV2beta1UpdateSecurityGroupRequest + /* + V2beta1UpdateSecurityGroupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return SecurityGroup + + */ + V2beta1UpdateSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroup, error) + /* + V2beta1UpdateSnapshot Update information of the snapshot. + Update information like name or labels of the snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiV2beta1UpdateSnapshotRequest + */ + V2beta1UpdateSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1UpdateSnapshotRequest + /* + V2beta1UpdateSnapshotExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return Snapshot + + */ + V2beta1UpdateSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error) +} + +type ApiAddNetworkToServerRequest interface { + Execute() error +} + +type ApiAddNicToServerRequest interface { + Execute() error +} + +type ApiAddPublicIpToServerRequest interface { + Execute() error +} + +type ApiAddRoutesToRoutingTableRequest interface { + // Request an addition of routes to a routing table. + AddRoutesToRoutingTablePayload(addRoutesToRoutingTablePayload AddRoutesToRoutingTablePayload) ApiAddRoutesToRoutingTableRequest + Execute() (*RouteListResponse, error) +} + +type ApiAddRoutingTableToAreaRequest interface { + // Request an addition of a routing table to an area. + AddRoutingTableToAreaPayload(addRoutingTableToAreaPayload AddRoutingTableToAreaPayload) ApiAddRoutingTableToAreaRequest + Execute() (*RoutingTable, error) +} + +type ApiAddSecurityGroupToServerRequest interface { + Execute() error +} + +type ApiAddServiceAccountToServerRequest interface { + Execute() (*ServiceAccountMailListResponse, error) +} + +type ApiAddVolumeToServerRequest interface { + // Request a volume attachment creation. + AddVolumeToServerPayload(addVolumeToServerPayload AddVolumeToServerPayload) ApiAddVolumeToServerRequest + Execute() (*VolumeAttachment, error) +} + +type ApiCreateAffinityGroupRequest interface { + // Request a affinity group creation. + CreateAffinityGroupPayload(createAffinityGroupPayload CreateAffinityGroupPayload) ApiCreateAffinityGroupRequest + Execute() (*AffinityGroup, error) +} + +type ApiCreateBackupRequest interface { + // Request a backup creation. + CreateBackupPayload(createBackupPayload CreateBackupPayload) ApiCreateBackupRequest + Execute() (*Backup, error) +} + +type ApiCreateImageRequest interface { + // Request an image creation. + CreateImagePayload(createImagePayload CreateImagePayload) ApiCreateImageRequest + Execute() (*ImageCreateResponse, error) +} + +type ApiCreateIsolatedNetworkRequest interface { + // Request a single isolated network creation. + CreateIsolatedNetworkPayload(createIsolatedNetworkPayload CreateIsolatedNetworkPayload) ApiCreateIsolatedNetworkRequest + Execute() (*Network, error) +} + +type ApiCreateKeyPairRequest interface { + // Request a public key import. + CreateKeyPairPayload(createKeyPairPayload CreateKeyPairPayload) ApiCreateKeyPairRequest + Execute() (*Keypair, error) +} + +type ApiCreateNetworkRequest interface { + // Request a network creation. + CreateNetworkPayload(createNetworkPayload CreateNetworkPayload) ApiCreateNetworkRequest + Execute() (*Network, error) +} + +type ApiCreateNetworkAreaRequest interface { + // Request an Area creation. + CreateNetworkAreaPayload(createNetworkAreaPayload CreateNetworkAreaPayload) ApiCreateNetworkAreaRequest + Execute() (*NetworkArea, error) +} + +type ApiCreateNetworkAreaRangeRequest interface { + // Request an addition of network ranges to an area. + CreateNetworkAreaRangePayload(createNetworkAreaRangePayload CreateNetworkAreaRangePayload) ApiCreateNetworkAreaRangeRequest + Execute() (*NetworkRangeListResponse, error) +} + +type ApiCreateNetworkAreaRouteRequest interface { + // Request an addition of routes to an area. + CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload CreateNetworkAreaRoutePayload) ApiCreateNetworkAreaRouteRequest + Execute() (*RouteListResponse, error) +} + +type ApiCreateNicRequest interface { + // Request a network interface creation. + CreateNicPayload(createNicPayload CreateNicPayload) ApiCreateNicRequest + Execute() (*NIC, error) +} + +type ApiCreatePublicIPRequest interface { + // Request a public IP creation. + CreatePublicIPPayload(createPublicIPPayload CreatePublicIPPayload) ApiCreatePublicIPRequest + Execute() (*PublicIp, error) +} + +type ApiCreateSecurityGroupRequest interface { + // Request a security group creation. + CreateSecurityGroupPayload(createSecurityGroupPayload CreateSecurityGroupPayload) ApiCreateSecurityGroupRequest + Execute() (*SecurityGroup, error) +} + +type ApiCreateSecurityGroupRuleRequest interface { + // Request for a security group rule creation. + CreateSecurityGroupRulePayload(createSecurityGroupRulePayload CreateSecurityGroupRulePayload) ApiCreateSecurityGroupRuleRequest + Execute() (*SecurityGroupRule, error) +} + +type ApiCreateServerRequest interface { + // Request a server creation. + CreateServerPayload(createServerPayload CreateServerPayload) ApiCreateServerRequest + Execute() (*Server, error) +} + +type ApiCreateVolumeRequest interface { + // Request a volume creation. + CreateVolumePayload(createVolumePayload CreateVolumePayload) ApiCreateVolumeRequest + Execute() (*Volume, error) +} + +type ApiDeallocateServerRequest interface { + Execute() error +} + +type ApiDeleteAffinityGroupRequest interface { + Execute() error +} + +type ApiDeleteBackupRequest interface { + // Force action. + Force(force bool) ApiDeleteBackupRequest + Execute() error +} + +type ApiDeleteImageRequest interface { + Execute() error +} + +type ApiDeleteImageShareRequest interface { + Execute() error +} + +type ApiDeleteImageShareConsumerRequest interface { + Execute() error +} + +type ApiDeleteKeyPairRequest interface { + Execute() error +} + +type ApiDeleteNetworkRequest interface { + Execute() error +} + +type ApiDeleteNetworkAreaRequest interface { + Execute() error +} + +type ApiDeleteNetworkAreaRangeRequest interface { + Execute() error +} + +type ApiDeleteNetworkAreaRouteRequest interface { + Execute() error +} + +type ApiDeleteNicRequest interface { + Execute() error +} + +type ApiDeletePublicIPRequest interface { + Execute() error +} + +type ApiDeleteRouteFromRoutingTableRequest interface { + Execute() error +} + +type ApiDeleteRoutingTableFromAreaRequest interface { + Execute() error +} + +type ApiDeleteSecurityGroupRequest interface { + Execute() error +} + +type ApiDeleteSecurityGroupRuleRequest interface { + Execute() error +} + +type ApiDeleteServerRequest interface { + Execute() error +} + +type ApiDeleteVolumeRequest interface { + Execute() error +} + +type ApiGetAffinityGroupRequest interface { + Execute() (*AffinityGroup, error) +} + +type ApiGetAttachedVolumeRequest interface { + Execute() (*VolumeAttachment, error) +} + +type ApiGetBackupRequest interface { + Execute() (*Backup, error) +} + +type ApiGetImageRequest interface { + Execute() (*Image, error) +} + +type ApiGetImageShareRequest interface { + Execute() (*ImageShare, error) +} + +type ApiGetImageShareConsumerRequest interface { + Execute() (*ImageShareConsumer, error) +} + +type ApiGetKeyPairRequest interface { + Execute() (*Keypair, error) +} + +type ApiGetMachineTypeRequest interface { + Execute() (*MachineType, error) +} + +type ApiGetNetworkRequest interface { + Execute() (*Network, error) +} + +type ApiGetNetworkAreaRequest interface { + Execute() (*NetworkArea, error) +} + +type ApiGetNetworkAreaRangeRequest interface { + Execute() (*NetworkRange, error) +} + +type ApiGetNetworkAreaRouteRequest interface { + Execute() (*Route, error) +} + +type ApiGetNicRequest interface { + Execute() (*NIC, error) +} + +type ApiGetOrganizationRequestRequest interface { + Execute() (*Request, error) +} + +type ApiGetProjectDetailsRequest interface { + Execute() (*Project, error) +} + +type ApiGetProjectNICRequest interface { + Execute() (*NIC, error) +} + +type ApiGetProjectRequestRequest interface { + Execute() (*Request, error) +} + +type ApiGetPublicIPRequest interface { + Execute() (*PublicIp, error) +} + +type ApiGetRouteOfRoutingTableRequest interface { + Execute() (*Route, error) +} + +type ApiGetRoutingTableOfAreaRequest interface { + Execute() (*RoutingTable, error) +} + +type ApiGetSecurityGroupRequest interface { + Execute() (*SecurityGroup, error) +} + +type ApiGetSecurityGroupRuleRequest interface { + Execute() (*SecurityGroupRule, error) +} + +type ApiGetServerRequest interface { + // Show detailed information about server. + Details(details bool) ApiGetServerRequest + Execute() (*Server, error) +} + +type ApiGetServerConsoleRequest interface { + Execute() (*ServerConsoleUrl, error) +} + +type ApiGetServerLogRequest interface { + // Request the server log. By default the length is limited to 2000 lines. Set to 0 to retrieve the complete log. + Length(length int64) ApiGetServerLogRequest + Execute() (*GetServerLog200Response, error) +} + +type ApiGetVolumeRequest interface { + Execute() (*Volume, error) +} + +type ApiGetVolumePerformanceClassRequest interface { + Execute() (*VolumePerformanceClass, error) +} + +type ApiListAffinityGroupsRequest interface { + Execute() (*AffinityGroupListResponse, error) +} + +type ApiListAttachedVolumesRequest interface { + Execute() (*VolumeAttachmentListResponse, error) +} + +type ApiListAvailabilityZonesRequest interface { + Execute() (*AvailabilityZoneListResponse, error) +} + +type ApiListBackupsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListBackupsRequest + Execute() (*BackupListResponse, error) +} + +type ApiListImagesRequest interface { + // List all Images. + All(all bool) ApiListImagesRequest + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListImagesRequest + Execute() (*ImageListResponse, error) +} + +type ApiListKeyPairsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListKeyPairsRequest + Execute() (*KeyPairListResponse, error) +} + +type ApiListMachineTypesRequest interface { + // Filter resources by fields. A subset of expr-lang is supported. See https://expr-lang.org/docs/language-definition for usage details. + Filter(filter string) ApiListMachineTypesRequest + Execute() (*MachineTypeListResponse, error) +} + +type ApiListNetworkAreaProjectsRequest interface { + Execute() (*ProjectListResponse, error) +} + +type ApiListNetworkAreaRangesRequest interface { + Execute() (*NetworkRangeListResponse, error) +} + +type ApiListNetworkAreaRoutesRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListNetworkAreaRoutesRequest + Execute() (*RouteListResponse, error) +} + +type ApiListNetworkAreasRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListNetworkAreasRequest + Execute() (*NetworkAreaListResponse, error) +} + +type ApiListNetworksRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListNetworksRequest + Execute() (*NetworkListResponse, error) +} + +type ApiListNicsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListNicsRequest + Execute() (*NICListResponse, error) +} + +type ApiListProjectNICsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListProjectNICsRequest + Execute() (*NICListResponse, error) +} + +type ApiListPublicIPRangesRequest interface { + Execute() (*PublicNetworkListResponse, error) +} + +type ApiListPublicIPsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListPublicIPsRequest + Execute() (*PublicIpListResponse, error) +} + +type ApiListQuotasRequest interface { + Execute() (*QuotaListResponse, error) +} + +type ApiListRoutesOfRoutingTableRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListRoutesOfRoutingTableRequest + Execute() (*RouteListResponse, error) +} + +type ApiListRoutingTablesOfAreaRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListRoutingTablesOfAreaRequest + Execute() (*RoutingTableListResponse, error) +} + +type ApiListSecurityGroupRulesRequest interface { + Execute() (*SecurityGroupRuleListResponse, error) +} + +type ApiListSecurityGroupsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListSecurityGroupsRequest + Execute() (*SecurityGroupListResponse, error) +} + +type ApiListServerNICsRequest interface { + Execute() (*NICListResponse, error) +} + +type ApiListServerServiceAccountsRequest interface { + Execute() (*ServiceAccountMailListResponse, error) +} + +type ApiListServersRequest interface { + // Show detailed information about server. + Details(details bool) ApiListServersRequest + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListServersRequest + Execute() (*ServerListResponse, error) +} + +type ApiListVolumePerformanceClassesRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListVolumePerformanceClassesRequest + Execute() (*VolumePerformanceClassListResponse, error) +} + +type ApiListVolumesRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListVolumesRequest + Execute() (*VolumeListResponse, error) +} + +type ApiPartialUpdateNetworkRequest interface { + // Request an update of a network. + PartialUpdateNetworkPayload(partialUpdateNetworkPayload PartialUpdateNetworkPayload) ApiPartialUpdateNetworkRequest + Execute() error +} + +type ApiPartialUpdateNetworkAreaRequest interface { + // Request to update an Area. + PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload PartialUpdateNetworkAreaPayload) ApiPartialUpdateNetworkAreaRequest + Execute() (*NetworkArea, error) +} + +type ApiRebootServerRequest interface { + // Defines if it is a soft or a hard reboot. + Action(action string) ApiRebootServerRequest + Execute() error +} + +type ApiRemoveNetworkFromServerRequest interface { + Execute() error +} + +type ApiRemoveNicFromServerRequest interface { + Execute() error +} + +type ApiRemovePublicIpFromServerRequest interface { + Execute() error +} + +type ApiRemoveSecurityGroupFromServerRequest interface { + Execute() error +} + +type ApiRemoveServiceAccountFromServerRequest interface { + Execute() (*ServiceAccountMailListResponse, error) +} + +type ApiRemoveVolumeFromServerRequest interface { + Execute() error +} + +type ApiRescueServerRequest interface { + // Request a server rescue. + RescueServerPayload(rescueServerPayload RescueServerPayload) ApiRescueServerRequest + Execute() error +} + +type ApiResizeServerRequest interface { + // Request a resize of a server. + ResizeServerPayload(resizeServerPayload ResizeServerPayload) ApiResizeServerRequest + Execute() error +} + +type ApiResizeVolumeRequest interface { + // Request a volume resize. + ResizeVolumePayload(resizeVolumePayload ResizeVolumePayload) ApiResizeVolumeRequest + Execute() error +} + +type ApiRestoreBackupRequest interface { + Execute() error +} + +type ApiSetImageShareRequest interface { + // Settings for an Image Share. + SetImageSharePayload(setImageSharePayload SetImageSharePayload) ApiSetImageShareRequest + Execute() (*ImageShare, error) +} + +type ApiStartServerRequest interface { + Execute() error +} + +type ApiStopServerRequest interface { + Execute() error +} + +type ApiUnrescueServerRequest interface { + Execute() error +} + +type ApiUpdateAttachedVolumeRequest interface { + // Request a volume attachment update. + UpdateAttachedVolumePayload(updateAttachedVolumePayload UpdateAttachedVolumePayload) ApiUpdateAttachedVolumeRequest + Execute() (*VolumeAttachment, error) +} + +type ApiUpdateImageRequest interface { + // Request an update of an Image. + UpdateImagePayload(updateImagePayload UpdateImagePayload) ApiUpdateImageRequest + Execute() (*Image, error) +} + +type ApiUpdateImageShareRequest interface { + // Update an Image Share. + UpdateImageSharePayload(updateImageSharePayload UpdateImageSharePayload) ApiUpdateImageShareRequest + Execute() (*ImageShare, error) +} + +type ApiUpdateKeyPairRequest interface { + // Request an update of an SSH keypair. + UpdateKeyPairPayload(updateKeyPairPayload UpdateKeyPairPayload) ApiUpdateKeyPairRequest + Execute() (*Keypair, error) +} + +type ApiUpdateNicRequest interface { + // Request an update of a network interface. + UpdateNicPayload(updateNicPayload UpdateNicPayload) ApiUpdateNicRequest + Execute() (*NIC, error) +} + +type ApiUpdatePublicIPRequest interface { + // Request an update of a public IP. + UpdatePublicIPPayload(updatePublicIPPayload UpdatePublicIPPayload) ApiUpdatePublicIPRequest + Execute() (*PublicIp, error) +} + +type ApiUpdateRouteOfRoutingTableRequest interface { + // Request an update of a route in a routing table. + UpdateRouteOfRoutingTablePayload(updateRouteOfRoutingTablePayload UpdateRouteOfRoutingTablePayload) ApiUpdateRouteOfRoutingTableRequest + Execute() (*Route, error) +} + +type ApiUpdateRoutingTableOfAreaRequest interface { + // Request an update of a routing table. + UpdateRoutingTableOfAreaPayload(updateRoutingTableOfAreaPayload UpdateRoutingTableOfAreaPayload) ApiUpdateRoutingTableOfAreaRequest + Execute() (*RoutingTable, error) +} + +type ApiUpdateServerRequest interface { + // Request an update of a server. + UpdateServerPayload(updateServerPayload UpdateServerPayload) ApiUpdateServerRequest + Execute() (*Server, error) +} + +type ApiUpdateVolumeRequest interface { + // Request an update of a volume. + UpdateVolumePayload(updateVolumePayload UpdateVolumePayload) ApiUpdateVolumeRequest + Execute() (*Volume, error) +} + +type ApiV2beta1ConfigureNetworkAreaRegionRequest interface { + // Request to add a new regional network area configuration. + V2beta1ConfigureNetworkAreaRegionPayload(v2beta1ConfigureNetworkAreaRegionPayload V2beta1ConfigureNetworkAreaRegionPayload) ApiV2beta1ConfigureNetworkAreaRegionRequest + Execute() (*RegionalArea, error) +} + +type ApiV2beta1CreateSnapshotRequest interface { + // Request a snapshot creation. + V2beta1CreateSnapshotPayload(v2beta1CreateSnapshotPayload V2beta1CreateSnapshotPayload) ApiV2beta1CreateSnapshotRequest + Execute() (*Snapshot, error) +} + +type ApiV2beta1DeleteNetworkAreaRegionRequest interface { + Execute() error +} + +type ApiV2beta1DeleteSnapshotRequest interface { + Execute() error +} + +type ApiV2beta1GetAreaRegionRequest interface { + Execute() (*RegionalArea, error) +} + +type ApiV2beta1GetSnapshotRequest interface { + Execute() (*Snapshot, error) +} + +type ApiV2beta1ListAreaRegionsRequest interface { + Execute() (*RegionalAreaListResponse, error) +} + +type ApiV2beta1ListSnapshotsInProjectRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiV2beta1ListSnapshotsInProjectRequest + Execute() (*SnapshotListResponse, error) +} + +type ApiV2beta1UpdateBackupRequest interface { + // Request an update of a backup. + V2beta1UpdateBackupPayload(v2beta1UpdateBackupPayload V2beta1UpdateBackupPayload) ApiV2beta1UpdateBackupRequest + Execute() (*Backup, error) +} + +type ApiV2beta1UpdateNetworkAreaRegionRequest interface { + // Request an update of a regional network area. + V2beta1UpdateNetworkAreaRegionPayload(v2beta1UpdateNetworkAreaRegionPayload V2beta1UpdateNetworkAreaRegionPayload) ApiV2beta1UpdateNetworkAreaRegionRequest + Execute() (*RegionalArea, error) +} + +type ApiV2beta1UpdateRouteOfAreaRequest interface { + // Request an update of a network route. + V2beta1UpdateRouteOfAreaPayload(v2beta1UpdateRouteOfAreaPayload V2beta1UpdateRouteOfAreaPayload) ApiV2beta1UpdateRouteOfAreaRequest + Execute() (*Route, error) +} + +type ApiV2beta1UpdateSecurityGroupRequest interface { + // Request an update of a security group. + V2beta1UpdateSecurityGroupPayload(v2beta1UpdateSecurityGroupPayload V2beta1UpdateSecurityGroupPayload) ApiV2beta1UpdateSecurityGroupRequest + Execute() (*SecurityGroup, error) +} + +type ApiV2beta1UpdateSnapshotRequest interface { + // Request an update of a snapshot. + V2beta1UpdateSnapshotPayload(v2beta1UpdateSnapshotPayload V2beta1UpdateSnapshotPayload) ApiV2beta1UpdateSnapshotRequest + Execute() (*Snapshot, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type AddNetworkToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + networkId string +} + +func (r AddNetworkToServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddNetworkToServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +AddNetworkToServer: Create and attach a network interface from the specified network. + +Create and attach a network interface from the specified network to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiAddNetworkToServerRequest +*/ +func (a *APIClient) AddNetworkToServer(ctx context.Context, projectId string, region string, serverId string, networkId string) ApiAddNetworkToServerRequest { + return AddNetworkToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + networkId: networkId, + } +} + +func (a *APIClient) AddNetworkToServerExecute(ctx context.Context, projectId string, region string, serverId string, networkId string) error { + r := AddNetworkToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + networkId: networkId, + } + return r.Execute() +} + +type AddNicToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + nicId string +} + +func (r AddNicToServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddNicToServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +AddNicToServer: Attach an existing network interface. + +Attach an existing network interface to a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param nicId The identifier (ID) of a network interface. + @return ApiAddNicToServerRequest +*/ +func (a *APIClient) AddNicToServer(ctx context.Context, projectId string, region string, serverId string, nicId string) ApiAddNicToServerRequest { + return AddNicToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + nicId: nicId, + } +} + +func (a *APIClient) AddNicToServerExecute(ctx context.Context, projectId string, region string, serverId string, nicId string) error { + r := AddNicToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + nicId: nicId, + } + return r.Execute() +} + +type AddPublicIpToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + publicIpId string +} + +func (r AddPublicIpToServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddPublicIpToServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +AddPublicIpToServer: Associate a public IP to the server. + +Associate a public IP to a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiAddPublicIpToServerRequest +*/ +func (a *APIClient) AddPublicIpToServer(ctx context.Context, projectId string, region string, serverId string, publicIpId string) ApiAddPublicIpToServerRequest { + return AddPublicIpToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + publicIpId: publicIpId, + } +} + +func (a *APIClient) AddPublicIpToServerExecute(ctx context.Context, projectId string, region string, serverId string, publicIpId string) error { + r := AddPublicIpToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + publicIpId: publicIpId, + } + return r.Execute() +} + +type AddRoutesToRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + addRoutesToRoutingTablePayload *AddRoutesToRoutingTablePayload +} + +// Request an addition of routes to a routing table. + +func (r AddRoutesToRoutingTableRequest) AddRoutesToRoutingTablePayload(addRoutesToRoutingTablePayload AddRoutesToRoutingTablePayload) ApiAddRoutesToRoutingTableRequest { + r.addRoutesToRoutingTablePayload = &addRoutesToRoutingTablePayload + return r +} + +func (r AddRoutesToRoutingTableRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddRoutesToRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if r.addRoutesToRoutingTablePayload == nil { + return localVarReturnValue, fmt.Errorf("addRoutesToRoutingTablePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.addRoutesToRoutingTablePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +AddRoutesToRoutingTable: Create new routes in a routing table. + +Create new routes in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiAddRoutesToRoutingTableRequest +*/ +func (a *APIClient) AddRoutesToRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiAddRoutesToRoutingTableRequest { + return AddRoutesToRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) AddRoutesToRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) { + r := AddRoutesToRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type AddRoutingTableToAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + addRoutingTableToAreaPayload *AddRoutingTableToAreaPayload +} + +// Request an addition of a routing table to an area. + +func (r AddRoutingTableToAreaRequest) AddRoutingTableToAreaPayload(addRoutingTableToAreaPayload AddRoutingTableToAreaPayload) ApiAddRoutingTableToAreaRequest { + r.addRoutingTableToAreaPayload = &addRoutingTableToAreaPayload + return r +} + +func (r AddRoutingTableToAreaRequest) Execute() (*RoutingTable, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTable + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddRoutingTableToArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.addRoutingTableToAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("addRoutingTableToAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.addRoutingTableToAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +AddRoutingTableToArea: Create new routing table in a network area. + +Create a new routing table in an existing network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiAddRoutingTableToAreaRequest +*/ +func (a *APIClient) AddRoutingTableToArea(ctx context.Context, organizationId string, areaId string, region string) ApiAddRoutingTableToAreaRequest { + return AddRoutingTableToAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) AddRoutingTableToAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTable, error) { + r := AddRoutingTableToAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type AddSecurityGroupToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + securityGroupId string +} + +func (r AddSecurityGroupToServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddSecurityGroupToServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +AddSecurityGroupToServer: Add a server to a security group. + +Add an existing server to an existing security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiAddSecurityGroupToServerRequest +*/ +func (a *APIClient) AddSecurityGroupToServer(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) ApiAddSecurityGroupToServerRequest { + return AddSecurityGroupToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) AddSecurityGroupToServerExecute(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) error { + r := AddSecurityGroupToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type AddServiceAccountToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + serviceAccountMail string +} + +func (r AddServiceAccountToServerRequest) Execute() (*ServiceAccountMailListResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceAccountMailListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddServiceAccountToServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts/{serviceAccountMail}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountMail, "serviceAccountMail")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.serviceAccountMail) > 255 { + return localVarReturnValue, fmt.Errorf("serviceAccountMail must have less than 255 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +AddServiceAccountToServer: Attach service account to a server. + +Attach an additional service account to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ApiAddServiceAccountToServerRequest +*/ +func (a *APIClient) AddServiceAccountToServer(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) ApiAddServiceAccountToServerRequest { + return AddServiceAccountToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + serviceAccountMail: serviceAccountMail, + } +} + +func (a *APIClient) AddServiceAccountToServerExecute(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) { + r := AddServiceAccountToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + serviceAccountMail: serviceAccountMail, + } + return r.Execute() +} + +type AddVolumeToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + volumeId string + addVolumeToServerPayload *AddVolumeToServerPayload +} + +// Request a volume attachment creation. + +func (r AddVolumeToServerRequest) AddVolumeToServerPayload(addVolumeToServerPayload AddVolumeToServerPayload) ApiAddVolumeToServerRequest { + r.addVolumeToServerPayload = &addVolumeToServerPayload + return r +} + +func (r AddVolumeToServerRequest) Execute() (*VolumeAttachment, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddVolumeToServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.addVolumeToServerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +AddVolumeToServer: Attach a volume to a server. + +Attach an existing volume to an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiAddVolumeToServerRequest +*/ +func (a *APIClient) AddVolumeToServer(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiAddVolumeToServerRequest { + return AddVolumeToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) AddVolumeToServerExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := AddVolumeToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type CreateAffinityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createAffinityGroupPayload *CreateAffinityGroupPayload +} + +// Request a affinity group creation. + +func (r CreateAffinityGroupRequest) CreateAffinityGroupPayload(createAffinityGroupPayload CreateAffinityGroupPayload) ApiCreateAffinityGroupRequest { + r.createAffinityGroupPayload = &createAffinityGroupPayload + return r +} + +func (r CreateAffinityGroupRequest) Execute() (*AffinityGroup, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AffinityGroup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateAffinityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createAffinityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("createAffinityGroupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createAffinityGroupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateAffinityGroup: Create a new affinity group in a project. + +Create a new server affinity group in the given project ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateAffinityGroupRequest +*/ +func (a *APIClient) CreateAffinityGroup(ctx context.Context, projectId string, region string) ApiCreateAffinityGroupRequest { + return CreateAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateAffinityGroupExecute(ctx context.Context, projectId string, region string) (*AffinityGroup, error) { + r := CreateAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createBackupPayload *CreateBackupPayload +} + +// Request a backup creation. + +func (r CreateBackupRequest) CreateBackupPayload(createBackupPayload CreateBackupPayload) ApiCreateBackupRequest { + r.createBackupPayload = &createBackupPayload + return r +} + +func (r CreateBackupRequest) Execute() (*Backup, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Backup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateBackup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/backups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createBackupPayload == nil { + return localVarReturnValue, fmt.Errorf("createBackupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createBackupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateBackup: Create new Backup. + +Create a new Backup in a project. If a snapshot ID is provided create the backup from the snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateBackupRequest +*/ +func (a *APIClient) CreateBackup(ctx context.Context, projectId string, region string) ApiCreateBackupRequest { + return CreateBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateBackupExecute(ctx context.Context, projectId string, region string) (*Backup, error) { + r := CreateBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createImagePayload *CreateImagePayload +} + +// Request an image creation. + +func (r CreateImageRequest) CreateImagePayload(createImagePayload CreateImagePayload) ApiCreateImageRequest { + r.createImagePayload = &createImagePayload + return r +} + +func (r CreateImageRequest) Execute() (*ImageCreateResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageCreateResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateImage") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createImagePayload == nil { + return localVarReturnValue, fmt.Errorf("createImagePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createImagePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateImage: Create new Image. + +Create a new Image in a project. This call, if successful, returns a pre-signed URL for the customer to upload the image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateImageRequest +*/ +func (a *APIClient) CreateImage(ctx context.Context, projectId string, region string) ApiCreateImageRequest { + return CreateImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateImageExecute(ctx context.Context, projectId string, region string) (*ImageCreateResponse, error) { + r := CreateImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateIsolatedNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createIsolatedNetworkPayload *CreateIsolatedNetworkPayload +} + +// Request a single isolated network creation. + +func (r CreateIsolatedNetworkRequest) CreateIsolatedNetworkPayload(createIsolatedNetworkPayload CreateIsolatedNetworkPayload) ApiCreateIsolatedNetworkRequest { + r.createIsolatedNetworkPayload = &createIsolatedNetworkPayload + return r +} + +func (r CreateIsolatedNetworkRequest) Execute() (*Network, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Network + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateIsolatedNetwork") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/isolated-network" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createIsolatedNetworkPayload == nil { + return localVarReturnValue, fmt.Errorf("createIsolatedNetworkPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createIsolatedNetworkPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateIsolatedNetwork: Create a single isolated network. + +Creates an isolated network which is not connected to other networks in this project. We recommend using this endpoint only if you are fully aware of its purpose and the consequences of its execution. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateIsolatedNetworkRequest +*/ +func (a *APIClient) CreateIsolatedNetwork(ctx context.Context, projectId string, region string) ApiCreateIsolatedNetworkRequest { + return CreateIsolatedNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateIsolatedNetworkExecute(ctx context.Context, projectId string, region string) (*Network, error) { + r := CreateIsolatedNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + createKeyPairPayload *CreateKeyPairPayload +} + +// Request a public key import. + +func (r CreateKeyPairRequest) CreateKeyPairPayload(createKeyPairPayload CreateKeyPairPayload) ApiCreateKeyPairRequest { + r.createKeyPairPayload = &createKeyPairPayload + return r +} + +func (r CreateKeyPairRequest) Execute() (*Keypair, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Keypair + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateKeyPair") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/keypairs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createKeyPairPayload == nil { + return localVarReturnValue, fmt.Errorf("createKeyPairPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createKeyPairPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateKeyPair: Import a public key. + +Import a new public key for the requesting user based on provided public key material. The creation will fail if an SSH keypair with the same name already exists. If a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is also not present it will be the the MD5 fingerprint of the key. For autogenerated names invalid characters will be removed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateKeyPairRequest +*/ +func (a *APIClient) CreateKeyPair(ctx context.Context) ApiCreateKeyPairRequest { + return CreateKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +func (a *APIClient) CreateKeyPairExecute(ctx context.Context) (*Keypair, error) { + r := CreateKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + +type CreateNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createNetworkPayload *CreateNetworkPayload +} + +// Request a network creation. + +func (r CreateNetworkRequest) CreateNetworkPayload(createNetworkPayload CreateNetworkPayload) ApiCreateNetworkRequest { + r.createNetworkPayload = &createNetworkPayload + return r +} + +func (r CreateNetworkRequest) Execute() (*Network, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Network + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetwork") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createNetworkPayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNetworkPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNetwork: Create new network. + +Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkRequest +*/ +func (a *APIClient) CreateNetwork(ctx context.Context, projectId string, region string) ApiCreateNetworkRequest { + return CreateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateNetworkExecute(ctx context.Context, projectId string, region string) (*Network, error) { + r := CreateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + createNetworkAreaPayload *CreateNetworkAreaPayload +} + +// Request an Area creation. + +func (r CreateNetworkAreaRequest) CreateNetworkAreaPayload(createNetworkAreaPayload CreateNetworkAreaPayload) ApiCreateNetworkAreaRequest { + r.createNetworkAreaPayload = &createNetworkAreaPayload + return r +} + +func (r CreateNetworkAreaRequest) Execute() (*NetworkArea, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if r.createNetworkAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNetworkAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNetworkArea: Create new network area in an organization. + +Create a new network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiCreateNetworkAreaRequest +*/ +func (a *APIClient) CreateNetworkArea(ctx context.Context, organizationId string) ApiCreateNetworkAreaRequest { + return CreateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } +} + +func (a *APIClient) CreateNetworkAreaExecute(ctx context.Context, organizationId string) (*NetworkArea, error) { + r := CreateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } + return r.Execute() +} + +type CreateNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + createNetworkAreaRangePayload *CreateNetworkAreaRangePayload +} + +// Request an addition of network ranges to an area. + +func (r CreateNetworkAreaRangeRequest) CreateNetworkAreaRangePayload(createNetworkAreaRangePayload CreateNetworkAreaRangePayload) ApiCreateNetworkAreaRangeRequest { + r.createNetworkAreaRangePayload = &createNetworkAreaRangePayload + return r +} + +func (r CreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkRangeListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRange") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.createNetworkAreaRangePayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaRangePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNetworkAreaRangePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNetworkAreaRange: Create new network range in a network area. + +Create a new network range in an existing network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkAreaRangeRequest +*/ +func (a *APIClient) CreateNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string) ApiCreateNetworkAreaRangeRequest { + return CreateNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) CreateNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string) (*NetworkRangeListResponse, error) { + r := CreateNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type CreateNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + createNetworkAreaRoutePayload *CreateNetworkAreaRoutePayload +} + +// Request an addition of routes to an area. + +func (r CreateNetworkAreaRouteRequest) CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload CreateNetworkAreaRoutePayload) ApiCreateNetworkAreaRouteRequest { + r.createNetworkAreaRoutePayload = &createNetworkAreaRoutePayload + return r +} + +func (r CreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRoute") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.createNetworkAreaRoutePayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaRoutePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNetworkAreaRoutePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNetworkAreaRoute: Create new network routes. + +Create one or several new network routes in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkAreaRouteRequest +*/ +func (a *APIClient) CreateNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string) ApiCreateNetworkAreaRouteRequest { + return CreateNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) CreateNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string) (*RouteListResponse, error) { + r := CreateNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type CreateNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + createNicPayload *CreateNicPayload +} + +// Request a network interface creation. + +func (r CreateNicRequest) CreateNicPayload(createNicPayload CreateNicPayload) ApiCreateNicRequest { + r.createNicPayload = &createNicPayload + return r +} + +func (r CreateNicRequest) Execute() (*NIC, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNic") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if r.createNicPayload == nil { + return localVarReturnValue, fmt.Errorf("createNicPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNicPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNic: Create new network interface. + +Create a new network interface in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiCreateNicRequest +*/ +func (a *APIClient) CreateNic(ctx context.Context, projectId string, region string, networkId string) ApiCreateNicRequest { + return CreateNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) CreateNicExecute(ctx context.Context, projectId string, region string, networkId string) (*NIC, error) { + r := CreateNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type CreatePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createPublicIPPayload *CreatePublicIPPayload +} + +// Request a public IP creation. + +func (r CreatePublicIPRequest) CreatePublicIPPayload(createPublicIPPayload CreatePublicIPPayload) ApiCreatePublicIPRequest { + r.createPublicIPPayload = &createPublicIPPayload + return r +} + +func (r CreatePublicIPRequest) Execute() (*PublicIp, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIp + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreatePublicIP") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/public-ips" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createPublicIPPayload == nil { + return localVarReturnValue, fmt.Errorf("createPublicIPPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createPublicIPPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreatePublicIP: Create new public IP. + +Create a new public IP in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreatePublicIPRequest +*/ +func (a *APIClient) CreatePublicIP(ctx context.Context, projectId string, region string) ApiCreatePublicIPRequest { + return CreatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreatePublicIPExecute(ctx context.Context, projectId string, region string) (*PublicIp, error) { + r := CreatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createSecurityGroupPayload *CreateSecurityGroupPayload +} + +// Request a security group creation. + +func (r CreateSecurityGroupRequest) CreateSecurityGroupPayload(createSecurityGroupPayload CreateSecurityGroupPayload) ApiCreateSecurityGroupRequest { + r.createSecurityGroupPayload = &createSecurityGroupPayload + return r +} + +func (r CreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/security-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createSecurityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("createSecurityGroupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createSecurityGroupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateSecurityGroup: Create new security group. + +Create a new security group in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateSecurityGroupRequest +*/ +func (a *APIClient) CreateSecurityGroup(ctx context.Context, projectId string, region string) ApiCreateSecurityGroupRequest { + return CreateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateSecurityGroupExecute(ctx context.Context, projectId string, region string) (*SecurityGroup, error) { + r := CreateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string + createSecurityGroupRulePayload *CreateSecurityGroupRulePayload +} + +// Request for a security group rule creation. + +func (r CreateSecurityGroupRuleRequest) CreateSecurityGroupRulePayload(createSecurityGroupRulePayload CreateSecurityGroupRulePayload) ApiCreateSecurityGroupRuleRequest { + r.createSecurityGroupRulePayload = &createSecurityGroupRulePayload + return r +} + +func (r CreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupRule + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroupRule") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if r.createSecurityGroupRulePayload == nil { + return localVarReturnValue, fmt.Errorf("createSecurityGroupRulePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createSecurityGroupRulePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateSecurityGroupRule: Create new security group rule. + +Create a new security group rule in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiCreateSecurityGroupRuleRequest +*/ +func (a *APIClient) CreateSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string) ApiCreateSecurityGroupRuleRequest { + return CreateSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) CreateSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroupRule, error) { + r := CreateSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type CreateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createServerPayload *CreateServerPayload +} + +// Request a server creation. + +func (r CreateServerRequest) CreateServerPayload(createServerPayload CreateServerPayload) ApiCreateServerRequest { + r.createServerPayload = &createServerPayload + return r +} + +func (r CreateServerRequest) Execute() (*Server, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Server + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createServerPayload == nil { + return localVarReturnValue, fmt.Errorf("createServerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createServerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateServer: Create new server. + +Create a new server in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateServerRequest +*/ +func (a *APIClient) CreateServer(ctx context.Context, projectId string, region string) ApiCreateServerRequest { + return CreateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateServerExecute(ctx context.Context, projectId string, region string) (*Server, error) { + r := CreateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createVolumePayload *CreateVolumePayload +} + +// Request a volume creation. + +func (r CreateVolumeRequest) CreateVolumePayload(createVolumePayload CreateVolumePayload) ApiCreateVolumeRequest { + r.createVolumePayload = &createVolumePayload + return r +} + +func (r CreateVolumeRequest) Execute() (*Volume, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("createVolumePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createVolumePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateVolume: Create new volume. + +Create a new volume in a project. If a volume source is not provided, an empty volume will be created. The size property is required if no source or an image source is provided. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateVolumeRequest +*/ +func (a *APIClient) CreateVolume(ctx context.Context, projectId string, region string) ApiCreateVolumeRequest { + return CreateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateVolumeExecute(ctx context.Context, projectId string, region string) (*Volume, error) { + r := CreateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type DeallocateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r DeallocateServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeallocateServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/deallocate" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeallocateServer: Deallocate an existing server. + +Deallocate an existing server. The server will be removed from the hypervisor so only the volume will be billed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeallocateServerRequest +*/ +func (a *APIClient) DeallocateServer(ctx context.Context, projectId string, region string, serverId string) ApiDeallocateServerRequest { + return DeallocateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) DeallocateServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := DeallocateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type DeleteAffinityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + affinityGroupId string +} + +func (r DeleteAffinityGroupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAffinityGroup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups/{affinityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(r.affinityGroupId, "affinityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.affinityGroupId) < 36 { + return fmt.Errorf("affinityGroupId must have at least 36 elements") + } + if strlen(r.affinityGroupId) > 36 { + return fmt.Errorf("affinityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteAffinityGroup: Delete a affinity group in a project. + +Delete a affinity group in the given project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return ApiDeleteAffinityGroupRequest +*/ +func (a *APIClient) DeleteAffinityGroup(ctx context.Context, projectId string, region string, affinityGroupId string) ApiDeleteAffinityGroupRequest { + return DeleteAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + affinityGroupId: affinityGroupId, + } +} + +func (a *APIClient) DeleteAffinityGroupExecute(ctx context.Context, projectId string, region string, affinityGroupId string) error { + r := DeleteAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + affinityGroupId: affinityGroupId, + } + return r.Execute() +} + +type DeleteBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + backupId string + force *bool +} + +// Force action. + +func (r DeleteBackupRequest) Force(force bool) ApiDeleteBackupRequest { + r.force = &force + return r +} + +func (r DeleteBackupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteBackup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.backupId) < 36 { + return fmt.Errorf("backupId must have at least 36 elements") + } + if strlen(r.backupId) > 36 { + return fmt.Errorf("backupId must have less than 36 elements") + } + + if r.force != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "force", r.force, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteBackup: Delete a backup. + +Delete a backup that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiDeleteBackupRequest +*/ +func (a *APIClient) DeleteBackup(ctx context.Context, projectId string, region string, backupId string) ApiDeleteBackupRequest { + return DeleteBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } +} + +func (a *APIClient) DeleteBackupExecute(ctx context.Context, projectId string, region string, backupId string) error { + r := DeleteBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } + return r.Execute() +} + +type DeleteImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string +} + +func (r DeleteImageRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImage") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteImage: Delete an Image. + +Delete an image that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageRequest +*/ +func (a *APIClient) DeleteImage(ctx context.Context, projectId string, region string, imageId string) ApiDeleteImageRequest { + return DeleteImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) DeleteImageExecute(ctx context.Context, projectId string, region string, imageId string) error { + r := DeleteImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type DeleteImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string +} + +func (r DeleteImageShareRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImageShare") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteImageShare: Remove image share. + +Remove the image share. New scope will be local. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageShareRequest +*/ +func (a *APIClient) DeleteImageShare(ctx context.Context, projectId string, region string, imageId string) ApiDeleteImageShareRequest { + return DeleteImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) DeleteImageShareExecute(ctx context.Context, projectId string, region string, imageId string) error { + r := DeleteImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type DeleteImageShareConsumerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string + consumerProjectId string +} + +func (r DeleteImageShareConsumerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImageShareConsumer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share/{consumerProjectId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(r.consumerProjectId, "consumerProjectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") + } + if strlen(r.consumerProjectId) < 36 { + return fmt.Errorf("consumerProjectId must have at least 36 elements") + } + if strlen(r.consumerProjectId) > 36 { + return fmt.Errorf("consumerProjectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteImageShareConsumer: Remove an image share consumer. + +Remove consumer from a shared image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiDeleteImageShareConsumerRequest +*/ +func (a *APIClient) DeleteImageShareConsumer(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) ApiDeleteImageShareConsumerRequest { + return DeleteImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + consumerProjectId: consumerProjectId, + } +} + +func (a *APIClient) DeleteImageShareConsumerExecute(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) error { + r := DeleteImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + consumerProjectId: consumerProjectId, + } + return r.Execute() +} + +type DeleteKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string +} + +func (r DeleteKeyPairRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteKeyPair") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/keypairs/{keypairName}" + localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.keypairName) > 127 { + return fmt.Errorf("keypairName must have less than 127 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteKeyPair: Delete an SSH keypair. + +Delete an SSH keypair from a user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiDeleteKeyPairRequest +*/ +func (a *APIClient) DeleteKeyPair(ctx context.Context, keypairName string) ApiDeleteKeyPairRequest { + return DeleteKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } +} + +func (a *APIClient) DeleteKeyPairExecute(ctx context.Context, keypairName string) error { + r := DeleteKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } + return r.Execute() +} + +type DeleteNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string +} + +func (r DeleteNetworkRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetwork") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetwork: Delete network. + +Delete a network. If the network is still in use, the deletion will fail. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiDeleteNetworkRequest +*/ +func (a *APIClient) DeleteNetwork(ctx context.Context, projectId string, region string, networkId string) ApiDeleteNetworkRequest { + return DeleteNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) DeleteNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error { + r := DeleteNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type DeleteNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r DeleteNetworkAreaRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkArea") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetworkArea: Delete a network area. + +Delete an existing network area in an organization. This is only possible if no projects are using the area anymore. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiDeleteNetworkAreaRequest +*/ +func (a *APIClient) DeleteNetworkArea(ctx context.Context, organizationId string, areaId string) ApiDeleteNetworkAreaRequest { + return DeleteNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) DeleteNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) error { + r := DeleteNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type DeleteNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + networkRangeId string +} + +func (r DeleteNetworkAreaRangeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRange") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges/{networkRangeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(r.networkRangeId, "networkRangeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.networkRangeId) < 36 { + return fmt.Errorf("networkRangeId must have at least 36 elements") + } + if strlen(r.networkRangeId) > 36 { + return fmt.Errorf("networkRangeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetworkAreaRange: Delete a network range. + +Delete a network range of a network area. The deletion will fail if the network range is still used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiDeleteNetworkAreaRangeRequest +*/ +func (a *APIClient) DeleteNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) ApiDeleteNetworkAreaRangeRequest { + return DeleteNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + networkRangeId: networkRangeId, + } +} + +func (a *APIClient) DeleteNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) error { + r := DeleteNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + networkRangeId: networkRangeId, + } + return r.Execute() +} + +type DeleteNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routeId string +} + +func (r DeleteNetworkAreaRouteRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRoute") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetworkAreaRoute: Delete a network route. + +Delete a network route of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteNetworkAreaRouteRequest +*/ +func (a *APIClient) DeleteNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiDeleteNetworkAreaRouteRequest { + return DeleteNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } +} + +func (a *APIClient) DeleteNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) error { + r := DeleteNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } + return r.Execute() +} + +type DeleteNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + nicId string +} + +func (r DeleteNicRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNic") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNic: Delete a network interface. + +Delete a network interface that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiDeleteNicRequest +*/ +func (a *APIClient) DeleteNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiDeleteNicRequest { + return DeleteNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } +} + +func (a *APIClient) DeleteNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) error { + r := DeleteNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } + return r.Execute() +} + +type DeletePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + publicIpId string +} + +func (r DeletePublicIPRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeletePublicIP") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeletePublicIP: Delete a public IP. + +Delete a public IP that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiDeletePublicIPRequest +*/ +func (a *APIClient) DeletePublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiDeletePublicIPRequest { + return DeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } +} + +func (a *APIClient) DeletePublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) error { + r := DeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } + return r.Execute() +} + +type DeleteRouteFromRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + routeId string +} + +func (r DeleteRouteFromRoutingTableRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteRouteFromRoutingTable") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return fmt.Errorf("routingTableId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteRouteFromRoutingTable: Delete a route in a routing table. + +Delete a route in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteRouteFromRoutingTableRequest +*/ +func (a *APIClient) DeleteRouteFromRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiDeleteRouteFromRoutingTableRequest { + return DeleteRouteFromRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } +} + +func (a *APIClient) DeleteRouteFromRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) error { + r := DeleteRouteFromRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } + return r.Execute() +} + +type DeleteRoutingTableFromAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string +} + +func (r DeleteRoutingTableFromAreaRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteRoutingTableFromArea") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return fmt.Errorf("routingTableId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteRoutingTableFromArea: Delete a routing table. + +Delete a routing table of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiDeleteRoutingTableFromAreaRequest +*/ +func (a *APIClient) DeleteRoutingTableFromArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiDeleteRoutingTableFromAreaRequest { + return DeleteRoutingTableFromAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) DeleteRoutingTableFromAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) error { + r := DeleteRoutingTableFromAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type DeleteSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string +} + +func (r DeleteSecurityGroupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteSecurityGroup: Delete security group. + +Delete a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiDeleteSecurityGroupRequest +*/ +func (a *APIClient) DeleteSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiDeleteSecurityGroupRequest { + return DeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) DeleteSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) error { + r := DeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type DeleteSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string + securityGroupRuleId string +} + +func (r DeleteSecurityGroupRuleRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroupRule") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + if strlen(r.securityGroupRuleId) < 36 { + return fmt.Errorf("securityGroupRuleId must have at least 36 elements") + } + if strlen(r.securityGroupRuleId) > 36 { + return fmt.Errorf("securityGroupRuleId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteSecurityGroupRule: Delete security group rule. + +Delete a security group rule. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiDeleteSecurityGroupRuleRequest +*/ +func (a *APIClient) DeleteSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) ApiDeleteSecurityGroupRuleRequest { + return DeleteSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } +} + +func (a *APIClient) DeleteSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) error { + r := DeleteSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } + return r.Execute() +} + +type DeleteServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r DeleteServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteServer: Delete a server. + +Delete a server. Volumes won't be deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeleteServerRequest +*/ +func (a *APIClient) DeleteServer(ctx context.Context, projectId string, region string, serverId string) ApiDeleteServerRequest { + return DeleteServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) DeleteServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := DeleteServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type DeleteVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + volumeId string +} + +func (r DeleteVolumeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteVolume") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteVolume: Delete a volume. + +Delete a volume inside a project. The deletion will fail if the volume is still in use. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiDeleteVolumeRequest +*/ +func (a *APIClient) DeleteVolume(ctx context.Context, projectId string, region string, volumeId string) ApiDeleteVolumeRequest { + return DeleteVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } +} + +func (a *APIClient) DeleteVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) error { + r := DeleteVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } + return r.Execute() +} + +type GetAffinityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + affinityGroupId string +} + +func (r GetAffinityGroupRequest) Execute() (*AffinityGroup, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AffinityGroup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAffinityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups/{affinityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(r.affinityGroupId, "affinityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.affinityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("affinityGroupId must have at least 36 elements") + } + if strlen(r.affinityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("affinityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetAffinityGroup: Get the affinity group. + +Get the affinity group created in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return ApiGetAffinityGroupRequest +*/ +func (a *APIClient) GetAffinityGroup(ctx context.Context, projectId string, region string, affinityGroupId string) ApiGetAffinityGroupRequest { + return GetAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + affinityGroupId: affinityGroupId, + } +} + +func (a *APIClient) GetAffinityGroupExecute(ctx context.Context, projectId string, region string, affinityGroupId string) (*AffinityGroup, error) { + r := GetAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + affinityGroupId: affinityGroupId, + } + return r.Execute() +} + +type GetAttachedVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + volumeId string +} + +func (r GetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAttachedVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetAttachedVolume: Get Volume Attachment details. + +Get the details of an existing Volume Attachment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetAttachedVolumeRequest +*/ +func (a *APIClient) GetAttachedVolume(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiGetAttachedVolumeRequest { + return GetAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) GetAttachedVolumeExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := GetAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type GetBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + backupId string +} + +func (r GetBackupRequest) Execute() (*Backup, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Backup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetBackup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.backupId) < 36 { + return localVarReturnValue, fmt.Errorf("backupId must have at least 36 elements") + } + if strlen(r.backupId) > 36 { + return localVarReturnValue, fmt.Errorf("backupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetBackup: Get details about a backup. + +Get details about a block device backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiGetBackupRequest +*/ +func (a *APIClient) GetBackup(ctx context.Context, projectId string, region string, backupId string) ApiGetBackupRequest { + return GetBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } +} + +func (a *APIClient) GetBackupExecute(ctx context.Context, projectId string, region string, backupId string) (*Backup, error) { + r := GetBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } + return r.Execute() +} + +type GetImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string +} + +func (r GetImageRequest) Execute() (*Image, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Image + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImage") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetImage: Get details about an image. + +Get details about a specific Image inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageRequest +*/ +func (a *APIClient) GetImage(ctx context.Context, projectId string, region string, imageId string) ApiGetImageRequest { + return GetImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) GetImageExecute(ctx context.Context, projectId string, region string, imageId string) (*Image, error) { + r := GetImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type GetImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string +} + +func (r GetImageShareRequest) Execute() (*ImageShare, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShare + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImageShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetImageShare: Get share details of an image. + +Get share details about an shared image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageShareRequest +*/ +func (a *APIClient) GetImageShare(ctx context.Context, projectId string, region string, imageId string) ApiGetImageShareRequest { + return GetImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) GetImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) { + r := GetImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type GetImageShareConsumerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string + consumerProjectId string +} + +func (r GetImageShareConsumerRequest) Execute() (*ImageShareConsumer, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShareConsumer + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImageShareConsumer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share/{consumerProjectId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(r.consumerProjectId, "consumerProjectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + if strlen(r.consumerProjectId) < 36 { + return localVarReturnValue, fmt.Errorf("consumerProjectId must have at least 36 elements") + } + if strlen(r.consumerProjectId) > 36 { + return localVarReturnValue, fmt.Errorf("consumerProjectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetImageShareConsumer: Get image share consumer. + +Get details about an image share consumer. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiGetImageShareConsumerRequest +*/ +func (a *APIClient) GetImageShareConsumer(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) ApiGetImageShareConsumerRequest { + return GetImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + consumerProjectId: consumerProjectId, + } +} + +func (a *APIClient) GetImageShareConsumerExecute(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) (*ImageShareConsumer, error) { + r := GetImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + consumerProjectId: consumerProjectId, + } + return r.Execute() +} + +type GetKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string +} + +func (r GetKeyPairRequest) Execute() (*Keypair, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Keypair + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetKeyPair") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/keypairs/{keypairName}" + localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.keypairName) > 127 { + return localVarReturnValue, fmt.Errorf("keypairName must have less than 127 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetKeyPair: Get SSH keypair details. + +Get details about an SSH keypair. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiGetKeyPairRequest +*/ +func (a *APIClient) GetKeyPair(ctx context.Context, keypairName string) ApiGetKeyPairRequest { + return GetKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } +} + +func (a *APIClient) GetKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) { + r := GetKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } + return r.Execute() +} + +type GetMachineTypeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + machineType string +} + +func (r GetMachineTypeRequest) Execute() (*MachineType, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MachineType + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetMachineType") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/machine-types/{machineType}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(r.machineType, "machineType")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.machineType) > 127 { + return localVarReturnValue, fmt.Errorf("machineType must have less than 127 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetMachineType: Get details about a machine type. + +Get details about a specific machine type. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param machineType STACKIT machine type Name. + @return ApiGetMachineTypeRequest +*/ +func (a *APIClient) GetMachineType(ctx context.Context, projectId string, region string, machineType string) ApiGetMachineTypeRequest { + return GetMachineTypeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + machineType: machineType, + } +} + +func (a *APIClient) GetMachineTypeExecute(ctx context.Context, projectId string, region string, machineType string) (*MachineType, error) { + r := GetMachineTypeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + machineType: machineType, + } + return r.Execute() +} + +type GetNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string +} + +func (r GetNetworkRequest) Execute() (*Network, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Network + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetwork") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNetwork: Get network details. + +Get details about a network of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiGetNetworkRequest +*/ +func (a *APIClient) GetNetwork(ctx context.Context, projectId string, region string, networkId string) ApiGetNetworkRequest { + return GetNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) GetNetworkExecute(ctx context.Context, projectId string, region string, networkId string) (*Network, error) { + r := GetNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type GetNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r GetNetworkAreaRequest) Execute() (*NetworkArea, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNetworkArea: Get details about a network area. + +Get details about a network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiGetNetworkAreaRequest +*/ +func (a *APIClient) GetNetworkArea(ctx context.Context, organizationId string, areaId string) ApiGetNetworkAreaRequest { + return GetNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) GetNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { + r := GetNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type GetNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + networkRangeId string +} + +func (r GetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkRange + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRange") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges/{networkRangeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(r.networkRangeId, "networkRangeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.networkRangeId) < 36 { + return localVarReturnValue, fmt.Errorf("networkRangeId must have at least 36 elements") + } + if strlen(r.networkRangeId) > 36 { + return localVarReturnValue, fmt.Errorf("networkRangeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNetworkAreaRange: Get details about a network range. + +Get details about a network range in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiGetNetworkAreaRangeRequest +*/ +func (a *APIClient) GetNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) ApiGetNetworkAreaRangeRequest { + return GetNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + networkRangeId: networkRangeId, + } +} + +func (a *APIClient) GetNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) (*NetworkRange, error) { + r := GetNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + networkRangeId: networkRangeId, + } + return r.Execute() +} + +type GetNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routeId string +} + +func (r GetNetworkAreaRouteRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRoute") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNetworkAreaRoute: Get details about a network route. + +Get details about a network route defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetNetworkAreaRouteRequest +*/ +func (a *APIClient) GetNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiGetNetworkAreaRouteRequest { + return GetNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } +} + +func (a *APIClient) GetNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) (*Route, error) { + r := GetNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } + return r.Execute() +} + +type GetNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + nicId string +} + +func (r GetNicRequest) Execute() (*NIC, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNic") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNic: Get details about a network interface. + +Get details about a network interface inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiGetNicRequest +*/ +func (a *APIClient) GetNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiGetNicRequest { + return GetNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } +} + +func (a *APIClient) GetNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) (*NIC, error) { + r := GetNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } + return r.Execute() +} + +type GetOrganizationRequestRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + requestId string +} + +func (r GetOrganizationRequestRequest) Execute() (*Request, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Request + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetOrganizationRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/requests/{requestId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.requestId) < 36 { + return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") + } + if strlen(r.requestId) > 36 { + return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetOrganizationRequest: Lookup an organization request ID. + +Lookup an organization request ID from a previous request. This allows to find resource IDs of resources generated during a organization request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetOrganizationRequestRequest +*/ +func (a *APIClient) GetOrganizationRequest(ctx context.Context, organizationId string, requestId string) ApiGetOrganizationRequestRequest { + return GetOrganizationRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + requestId: requestId, + } +} + +func (a *APIClient) GetOrganizationRequestExecute(ctx context.Context, organizationId string, requestId string) (*Request, error) { + r := GetOrganizationRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + requestId: requestId, + } + return r.Execute() +} + +type GetProjectDetailsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r GetProjectDetailsRequest) Execute() (*Project, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Project + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectDetails") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetProjectDetails: Get project details. + +Get details about a STACKIT project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiGetProjectDetailsRequest +*/ +func (a *APIClient) GetProjectDetails(ctx context.Context, projectId string) ApiGetProjectDetailsRequest { + return GetProjectDetailsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) GetProjectDetailsExecute(ctx context.Context, projectId string) (*Project, error) { + r := GetProjectDetailsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type GetProjectNICRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + nicId string +} + +func (r GetProjectNICRequest) Execute() (*NIC, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectNIC") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetProjectNIC: Get details about a network interface of a project. + +Get details about a network interface inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param nicId The identifier (ID) of a network interface. + @return ApiGetProjectNICRequest +*/ +func (a *APIClient) GetProjectNIC(ctx context.Context, projectId string, region string, nicId string) ApiGetProjectNICRequest { + return GetProjectNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + nicId: nicId, + } +} + +func (a *APIClient) GetProjectNICExecute(ctx context.Context, projectId string, region string, nicId string) (*NIC, error) { + r := GetProjectNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + nicId: nicId, + } + return r.Execute() +} + +type GetProjectRequestRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + requestId string +} + +func (r GetProjectRequestRequest) Execute() (*Request, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Request + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/requests/{requestId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.requestId) < 36 { + return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") + } + if strlen(r.requestId) > 36 { + return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetProjectRequest: Lookup a project request ID. + +Lookup a project request ID from a previous request. This allows to find resource IDs of resources generated during a projects request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetProjectRequestRequest +*/ +func (a *APIClient) GetProjectRequest(ctx context.Context, projectId string, region string, requestId string) ApiGetProjectRequestRequest { + return GetProjectRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + requestId: requestId, + } +} + +func (a *APIClient) GetProjectRequestExecute(ctx context.Context, projectId string, region string, requestId string) (*Request, error) { + r := GetProjectRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + requestId: requestId, + } + return r.Execute() +} + +type GetPublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + publicIpId string +} + +func (r GetPublicIPRequest) Execute() (*PublicIp, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIp + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetPublicIP") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetPublicIP: Get details about a public IP. + +Get details about a public IP inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiGetPublicIPRequest +*/ +func (a *APIClient) GetPublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiGetPublicIPRequest { + return GetPublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } +} + +func (a *APIClient) GetPublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) (*PublicIp, error) { + r := GetPublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } + return r.Execute() +} + +type GetRouteOfRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + routeId string +} + +func (r GetRouteOfRoutingTableRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRouteOfRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetRouteOfRoutingTable: Get details about a route of a routing table. + +Get details about a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetRouteOfRoutingTableRequest +*/ +func (a *APIClient) GetRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiGetRouteOfRoutingTableRequest { + return GetRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } +} + +func (a *APIClient) GetRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) { + r := GetRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } + return r.Execute() +} + +type GetRoutingTableOfAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string +} + +func (r GetRoutingTableOfAreaRequest) Execute() (*RoutingTable, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTable + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRoutingTableOfArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetRoutingTableOfArea: Get details about a routing table. + +Get details about a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiGetRoutingTableOfAreaRequest +*/ +func (a *APIClient) GetRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiGetRoutingTableOfAreaRequest { + return GetRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) GetRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) { + r := GetRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type GetSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string +} + +func (r GetSecurityGroupRequest) Execute() (*SecurityGroup, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetSecurityGroup: Get security group details. + +Get details about a security group of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiGetSecurityGroupRequest +*/ +func (a *APIClient) GetSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiGetSecurityGroupRequest { + return GetSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) GetSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroup, error) { + r := GetSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type GetSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string + securityGroupRuleId string +} + +func (r GetSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupRule + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroupRule") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if strlen(r.securityGroupRuleId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have at least 36 elements") + } + if strlen(r.securityGroupRuleId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetSecurityGroupRule: Get security group rule details. + +Get details about a security group rule of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiGetSecurityGroupRuleRequest +*/ +func (a *APIClient) GetSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) ApiGetSecurityGroupRuleRequest { + return GetSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } +} + +func (a *APIClient) GetSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) (*SecurityGroupRule, error) { + r := GetSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } + return r.Execute() +} + +type GetServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + details *bool +} + +// Show detailed information about server. + +func (r GetServerRequest) Details(details bool) ApiGetServerRequest { + r.details = &details + return r +} + +func (r GetServerRequest) Execute() (*Server, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Server + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + if r.details != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetServer: Get server details. + +Get details about a server by its ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerRequest +*/ +func (a *APIClient) GetServer(ctx context.Context, projectId string, region string, serverId string) ApiGetServerRequest { + return GetServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) GetServerExecute(ctx context.Context, projectId string, region string, serverId string) (*Server, error) { + r := GetServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type GetServerConsoleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r GetServerConsoleRequest) Execute() (*ServerConsoleUrl, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServerConsoleUrl + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerConsole") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/console" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetServerConsole: Get server console. + +Get a URL for server remote console. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerConsoleRequest +*/ +func (a *APIClient) GetServerConsole(ctx context.Context, projectId string, region string, serverId string) ApiGetServerConsoleRequest { + return GetServerConsoleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) GetServerConsoleExecute(ctx context.Context, projectId string, region string, serverId string) (*ServerConsoleUrl, error) { + r := GetServerConsoleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type GetServerLogRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + length *int64 +} + +// Request the server log. By default the length is limited to 2000 lines. Set to 0 to retrieve the complete log. + +func (r GetServerLogRequest) Length(length int64) ApiGetServerLogRequest { + r.length = &length + return r +} + +func (r GetServerLogRequest) Execute() (*GetServerLog200Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetServerLog200Response + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerLog") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/log" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + if r.length != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "length", r.length, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetServerLog: Get server log. + +Get server console log. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerLogRequest +*/ +func (a *APIClient) GetServerLog(ctx context.Context, projectId string, region string, serverId string) ApiGetServerLogRequest { + return GetServerLogRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) GetServerLogExecute(ctx context.Context, projectId string, region string, serverId string) (*GetServerLog200Response, error) { + r := GetServerLogRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type GetVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + volumeId string +} + +func (r GetVolumeRequest) Execute() (*Volume, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetVolume: Get details about a volume. + +Get details about a block device volume. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetVolumeRequest +*/ +func (a *APIClient) GetVolume(ctx context.Context, projectId string, region string, volumeId string) ApiGetVolumeRequest { + return GetVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } +} + +func (a *APIClient) GetVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) (*Volume, error) { + r := GetVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } + return r.Execute() +} + +type GetVolumePerformanceClassRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + volumePerformanceClass string +} + +func (r GetVolumePerformanceClassRequest) Execute() (*VolumePerformanceClass, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumePerformanceClass + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolumePerformanceClass") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/volume-performance-classes/{volumePerformanceClass}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(r.volumePerformanceClass, "volumePerformanceClass")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumePerformanceClass) > 127 { + return localVarReturnValue, fmt.Errorf("volumePerformanceClass must have less than 127 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetVolumePerformanceClass: Get details about a volume performance class. + +Get details about a specific volume performance class. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumePerformanceClass The name of a STACKIT Volume performance class. + @return ApiGetVolumePerformanceClassRequest +*/ +func (a *APIClient) GetVolumePerformanceClass(ctx context.Context, projectId string, region string, volumePerformanceClass string) ApiGetVolumePerformanceClassRequest { + return GetVolumePerformanceClassRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumePerformanceClass: volumePerformanceClass, + } +} + +func (a *APIClient) GetVolumePerformanceClassExecute(ctx context.Context, projectId string, region string, volumePerformanceClass string) (*VolumePerformanceClass, error) { + r := GetVolumePerformanceClassRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumePerformanceClass: volumePerformanceClass, + } + return r.Execute() +} + +type ListAffinityGroupsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string +} + +func (r ListAffinityGroupsRequest) Execute() (*AffinityGroupListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AffinityGroupListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAffinityGroups") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListAffinityGroups: Get the affinity groups setup for a project. + +Get the affinity groups created in a project. Affinity groups are an indication of locality of a server relative to another group of servers. They can be either running on the same host (affinity) or on different ones (anti-affinity). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListAffinityGroupsRequest +*/ +func (a *APIClient) ListAffinityGroups(ctx context.Context, projectId string, region string) ApiListAffinityGroupsRequest { + return ListAffinityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListAffinityGroupsExecute(ctx context.Context, projectId string, region string) (*AffinityGroupListResponse, error) { + r := ListAffinityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListAttachedVolumesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r ListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachmentListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAttachedVolumes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListAttachedVolumes: List all volume attachments of a server. + +Get a list of all volume attachments of a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListAttachedVolumesRequest +*/ +func (a *APIClient) ListAttachedVolumes(ctx context.Context, projectId string, region string, serverId string) ApiListAttachedVolumesRequest { + return ListAttachedVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) ListAttachedVolumesExecute(ctx context.Context, projectId string, region string, serverId string) (*VolumeAttachmentListResponse, error) { + r := ListAttachedVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type ListAvailabilityZonesRequest struct { + ctx context.Context + apiService *DefaultApiService + region string +} + +func (r ListAvailabilityZonesRequest) Execute() (*AvailabilityZoneListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AvailabilityZoneListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAvailabilityZones") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/regions/{region}/availability-zones" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListAvailabilityZones: List all availability zones. + +Get a list of all availability zones. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region The STACKIT Region of the resources. + @return ApiListAvailabilityZonesRequest +*/ +func (a *APIClient) ListAvailabilityZones(ctx context.Context, region string) ApiListAvailabilityZonesRequest { + return ListAvailabilityZonesRequest{ + apiService: a.defaultApi, + ctx: ctx, + region: region, + } +} + +func (a *APIClient) ListAvailabilityZonesExecute(ctx context.Context, region string) (*AvailabilityZoneListResponse, error) { + r := ListAvailabilityZonesRequest{ + apiService: a.defaultApi, + ctx: ctx, + region: region, + } + return r.Execute() +} + +type ListBackupsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListBackupsRequest) LabelSelector(labelSelector string) ApiListBackupsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListBackupsRequest) Execute() (*BackupListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BackupListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListBackups") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/backups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListBackups: List all backups inside a project. + +Get a list of all backups inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListBackupsRequest +*/ +func (a *APIClient) ListBackups(ctx context.Context, projectId string, region string) ApiListBackupsRequest { + return ListBackupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListBackupsExecute(ctx context.Context, projectId string, region string) (*BackupListResponse, error) { + r := ListBackupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListImagesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + all *bool + labelSelector *string +} + +// List all Images. + +func (r ListImagesRequest) All(all bool) ApiListImagesRequest { + r.all = &all + return r +} + +// Filter resources by labels. + +func (r ListImagesRequest) LabelSelector(labelSelector string) ApiListImagesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListImagesRequest) Execute() (*ImageListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListImages") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.all != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "all", r.all, "") + } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListImages: List all Images inside a project. + +Get a list of all images inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListImagesRequest +*/ +func (a *APIClient) ListImages(ctx context.Context, projectId string, region string) ApiListImagesRequest { + return ListImagesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListImagesExecute(ctx context.Context, projectId string, region string) (*ImageListResponse, error) { + r := ListImagesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListKeyPairsRequest struct { + ctx context.Context + apiService *DefaultApiService + labelSelector *string +} + +// Filter resources by labels. + +func (r ListKeyPairsRequest) LabelSelector(labelSelector string) ApiListKeyPairsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListKeyPairsRequest) Execute() (*KeyPairListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *KeyPairListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListKeyPairs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/keypairs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListKeyPairs: List all SSH keypairs for the requesting user. + +Get a list of all SSH keypairs assigned to the requesting user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListKeyPairsRequest +*/ +func (a *APIClient) ListKeyPairs(ctx context.Context) ApiListKeyPairsRequest { + return ListKeyPairsRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +func (a *APIClient) ListKeyPairsExecute(ctx context.Context) (*KeyPairListResponse, error) { + r := ListKeyPairsRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + +type ListMachineTypesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + filter *string +} + +// Filter resources by fields. A subset of expr-lang is supported. See https://expr-lang.org/docs/language-definition for usage details. + +func (r ListMachineTypesRequest) Filter(filter string) ApiListMachineTypesRequest { + r.filter = &filter + return r +} + +func (r ListMachineTypesRequest) Execute() (*MachineTypeListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MachineTypeListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListMachineTypes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/machine-types" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.filter != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "filter", r.filter, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListMachineTypes: List all machine types available for a project. + +Get a list of all machine type available in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListMachineTypesRequest +*/ +func (a *APIClient) ListMachineTypes(ctx context.Context, projectId string, region string) ApiListMachineTypesRequest { + return ListMachineTypesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListMachineTypesExecute(ctx context.Context, projectId string, region string) (*MachineTypeListResponse, error) { + r := ListMachineTypesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListNetworkAreaProjectsRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r ListNetworkAreaProjectsRequest) Execute() (*ProjectListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ProjectListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaProjects") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/projects" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworkAreaProjects: List all projects using a network area. + +Get a list of all projects using a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaProjectsRequest +*/ +func (a *APIClient) ListNetworkAreaProjects(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaProjectsRequest { + return ListNetworkAreaProjectsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) ListNetworkAreaProjectsExecute(ctx context.Context, organizationId string, areaId string) (*ProjectListResponse, error) { + r := ListNetworkAreaProjectsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type ListNetworkAreaRangesRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string +} + +func (r ListNetworkAreaRangesRequest) Execute() (*NetworkRangeListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkRangeListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRanges") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworkAreaRanges: List all network ranges in a network area. + +Get a list of all network ranges in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListNetworkAreaRangesRequest +*/ +func (a *APIClient) ListNetworkAreaRanges(ctx context.Context, organizationId string, areaId string, region string) ApiListNetworkAreaRangesRequest { + return ListNetworkAreaRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) ListNetworkAreaRangesExecute(ctx context.Context, organizationId string, areaId string, region string) (*NetworkRangeListResponse, error) { + r := ListNetworkAreaRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type ListNetworkAreaRoutesRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListNetworkAreaRoutesRequest) LabelSelector(labelSelector string) ApiListNetworkAreaRoutesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRoutes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworkAreaRoutes: List all network routes in a network area. + +Get a list of all network routes defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListNetworkAreaRoutesRequest +*/ +func (a *APIClient) ListNetworkAreaRoutes(ctx context.Context, organizationId string, areaId string, region string) ApiListNetworkAreaRoutesRequest { + return ListNetworkAreaRoutesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) ListNetworkAreaRoutesExecute(ctx context.Context, organizationId string, areaId string, region string) (*RouteListResponse, error) { + r := ListNetworkAreaRoutesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type ListNetworkAreasRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListNetworkAreasRequest) LabelSelector(labelSelector string) ApiListNetworkAreasRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListNetworkAreasRequest) Execute() (*NetworkAreaListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkAreaListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreas") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworkAreas: List all network areas in an organization. + +Get a list of all visible network areas defined in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiListNetworkAreasRequest +*/ +func (a *APIClient) ListNetworkAreas(ctx context.Context, organizationId string) ApiListNetworkAreasRequest { + return ListNetworkAreasRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } +} + +func (a *APIClient) ListNetworkAreasExecute(ctx context.Context, organizationId string) (*NetworkAreaListResponse, error) { + r := ListNetworkAreasRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } + return r.Execute() +} + +type ListNetworksRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListNetworksRequest) LabelSelector(labelSelector string) ApiListNetworksRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListNetworksRequest) Execute() (*NetworkListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworks") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworks: List all networks inside a project. + +Get a list of all networks inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListNetworksRequest +*/ +func (a *APIClient) ListNetworks(ctx context.Context, projectId string, region string) ApiListNetworksRequest { + return ListNetworksRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListNetworksExecute(ctx context.Context, projectId string, region string) (*NetworkListResponse, error) { + r := ListNetworksRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListNicsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListNicsRequest) LabelSelector(labelSelector string) ApiListNicsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListNicsRequest) Execute() (*NICListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NICListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNics") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNics: List all network interfaces inside a network. + +Get a list of all network interfaces inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiListNicsRequest +*/ +func (a *APIClient) ListNics(ctx context.Context, projectId string, region string, networkId string) ApiListNicsRequest { + return ListNicsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) ListNicsExecute(ctx context.Context, projectId string, region string, networkId string) (*NICListResponse, error) { + r := ListNicsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type ListProjectNICsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListProjectNICsRequest) LabelSelector(labelSelector string) ApiListProjectNICsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListProjectNICsRequest) Execute() (*NICListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NICListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListProjectNICs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListProjectNICs: List all network interfaces inside a project. + +Get a list of all network interfaces inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListProjectNICsRequest +*/ +func (a *APIClient) ListProjectNICs(ctx context.Context, projectId string, region string) ApiListProjectNICsRequest { + return ListProjectNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListProjectNICsExecute(ctx context.Context, projectId string, region string) (*NICListResponse, error) { + r := ListProjectNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListPublicIPRangesRequest struct { + ctx context.Context + apiService *DefaultApiService +} + +func (r ListPublicIPRangesRequest) Execute() (*PublicNetworkListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicNetworkListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPublicIPRanges") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/networks/public-ip-ranges" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListPublicIPRanges: List all public IP ranges. + +Get a list of all public IP ranges that STACKIT uses. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListPublicIPRangesRequest +*/ +func (a *APIClient) ListPublicIPRanges(ctx context.Context) ApiListPublicIPRangesRequest { + return ListPublicIPRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +func (a *APIClient) ListPublicIPRangesExecute(ctx context.Context) (*PublicNetworkListResponse, error) { + r := ListPublicIPRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + +type ListPublicIPsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListPublicIPsRequest) LabelSelector(labelSelector string) ApiListPublicIPsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListPublicIPsRequest) Execute() (*PublicIpListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIpListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPublicIPs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/public-ips" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListPublicIPs: List all public IPs inside a project. + +Get a list of all public IPs inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListPublicIPsRequest +*/ +func (a *APIClient) ListPublicIPs(ctx context.Context, projectId string, region string) ApiListPublicIPsRequest { + return ListPublicIPsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListPublicIPsExecute(ctx context.Context, projectId string, region string) (*PublicIpListResponse, error) { + r := ListPublicIPsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListQuotasRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string +} + +func (r ListQuotasRequest) Execute() (*QuotaListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *QuotaListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListQuotas") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/quotas" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListQuotas: List project quotas. + +List quota limits and usage for project resources. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListQuotasRequest +*/ +func (a *APIClient) ListQuotas(ctx context.Context, projectId string, region string) ApiListQuotasRequest { + return ListQuotasRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListQuotasExecute(ctx context.Context, projectId string, region string) (*QuotaListResponse, error) { + r := ListQuotasRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListRoutesOfRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListRoutesOfRoutingTableRequest) LabelSelector(labelSelector string) ApiListRoutesOfRoutingTableRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListRoutesOfRoutingTableRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListRoutesOfRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListRoutesOfRoutingTable: List all routes in a routing table. + +Get a list of all routes in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiListRoutesOfRoutingTableRequest +*/ +func (a *APIClient) ListRoutesOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiListRoutesOfRoutingTableRequest { + return ListRoutesOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) ListRoutesOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) { + r := ListRoutesOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type ListRoutingTablesOfAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListRoutingTablesOfAreaRequest) LabelSelector(labelSelector string) ApiListRoutingTablesOfAreaRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListRoutingTablesOfAreaRequest) Execute() (*RoutingTableListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTableListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListRoutingTablesOfArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListRoutingTablesOfArea: List all routing tables in a network area. + +Get a list of all routing tables in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListRoutingTablesOfAreaRequest +*/ +func (a *APIClient) ListRoutingTablesOfArea(ctx context.Context, organizationId string, areaId string, region string) ApiListRoutingTablesOfAreaRequest { + return ListRoutingTablesOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) ListRoutingTablesOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTableListResponse, error) { + r := ListRoutingTablesOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type ListSecurityGroupRulesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string +} + +func (r ListSecurityGroupRulesRequest) Execute() (*SecurityGroupRuleListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupRuleListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSecurityGroupRules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListSecurityGroupRules: List all rules for a security group. + +Get a list of all rules inside a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiListSecurityGroupRulesRequest +*/ +func (a *APIClient) ListSecurityGroupRules(ctx context.Context, projectId string, region string, securityGroupId string) ApiListSecurityGroupRulesRequest { + return ListSecurityGroupRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) ListSecurityGroupRulesExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroupRuleListResponse, error) { + r := ListSecurityGroupRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type ListSecurityGroupsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListSecurityGroupsRequest) LabelSelector(labelSelector string) ApiListSecurityGroupsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListSecurityGroupsRequest) Execute() (*SecurityGroupListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSecurityGroups") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/security-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListSecurityGroups: List all security groups inside a project. + +Get a list of all security groups inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListSecurityGroupsRequest +*/ +func (a *APIClient) ListSecurityGroups(ctx context.Context, projectId string, region string) ApiListSecurityGroupsRequest { + return ListSecurityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListSecurityGroupsExecute(ctx context.Context, projectId string, region string) (*SecurityGroupListResponse, error) { + r := ListSecurityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListServerNICsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r ListServerNICsRequest) Execute() (*NICListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NICListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerNICs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListServerNICs: Get all network interfaces. + +Get all network interfaces attached to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerNICsRequest +*/ +func (a *APIClient) ListServerNICs(ctx context.Context, projectId string, region string, serverId string) ApiListServerNICsRequest { + return ListServerNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) ListServerNICsExecute(ctx context.Context, projectId string, region string, serverId string) (*NICListResponse, error) { + r := ListServerNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type ListServerServiceAccountsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r ListServerServiceAccountsRequest) Execute() (*ServiceAccountMailListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceAccountMailListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerServiceAccounts") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListServerServiceAccounts: List all service accounts of the Server. + +Get the list of the service accounts of the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerServiceAccountsRequest +*/ +func (a *APIClient) ListServerServiceAccounts(ctx context.Context, projectId string, region string, serverId string) ApiListServerServiceAccountsRequest { + return ListServerServiceAccountsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) ListServerServiceAccountsExecute(ctx context.Context, projectId string, region string, serverId string) (*ServiceAccountMailListResponse, error) { + r := ListServerServiceAccountsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type ListServersRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + details *bool + labelSelector *string +} + +// Show detailed information about server. + +func (r ListServersRequest) Details(details bool) ApiListServersRequest { + r.details = &details + return r +} + +// Filter resources by labels. + +func (r ListServersRequest) LabelSelector(labelSelector string) ApiListServersRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListServersRequest) Execute() (*ServerListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServerListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServers") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.details != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListServers: List all servers inside a project. + +Get a list of all servers inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListServersRequest +*/ +func (a *APIClient) ListServers(ctx context.Context, projectId string, region string) ApiListServersRequest { + return ListServersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListServersExecute(ctx context.Context, projectId string, region string) (*ServerListResponse, error) { + r := ListServersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListVolumePerformanceClassesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListVolumePerformanceClassesRequest) LabelSelector(labelSelector string) ApiListVolumePerformanceClassesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListVolumePerformanceClassesRequest) Execute() (*VolumePerformanceClassListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumePerformanceClassListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVolumePerformanceClasses") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/volume-performance-classes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListVolumePerformanceClasses: List all volume performance classes available for a project. + +Get a list of all volume performance classes available inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListVolumePerformanceClassesRequest +*/ +func (a *APIClient) ListVolumePerformanceClasses(ctx context.Context, projectId string, region string) ApiListVolumePerformanceClassesRequest { + return ListVolumePerformanceClassesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListVolumePerformanceClassesExecute(ctx context.Context, projectId string, region string) (*VolumePerformanceClassListResponse, error) { + r := ListVolumePerformanceClassesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListVolumesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListVolumesRequest) LabelSelector(labelSelector string) ApiListVolumesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListVolumesRequest) Execute() (*VolumeListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVolumes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListVolumes: List all volumes inside a project. + +Get a list of all volumes inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListVolumesRequest +*/ +func (a *APIClient) ListVolumes(ctx context.Context, projectId string, region string) ApiListVolumesRequest { + return ListVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListVolumesExecute(ctx context.Context, projectId string, region string) (*VolumeListResponse, error) { + r := ListVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type PartialUpdateNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + partialUpdateNetworkPayload *PartialUpdateNetworkPayload +} + +// Request an update of a network. + +func (r PartialUpdateNetworkRequest) PartialUpdateNetworkPayload(partialUpdateNetworkPayload PartialUpdateNetworkPayload) ApiPartialUpdateNetworkRequest { + r.partialUpdateNetworkPayload = &partialUpdateNetworkPayload + return r +} + +func (r PartialUpdateNetworkRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetwork") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + if r.partialUpdateNetworkPayload == nil { + return fmt.Errorf("partialUpdateNetworkPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.partialUpdateNetworkPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +PartialUpdateNetwork: Update network settings. + +Update the settings of a network inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiPartialUpdateNetworkRequest +*/ +func (a *APIClient) PartialUpdateNetwork(ctx context.Context, projectId string, region string, networkId string) ApiPartialUpdateNetworkRequest { + return PartialUpdateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) PartialUpdateNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error { + r := PartialUpdateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type PartialUpdateNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + partialUpdateNetworkAreaPayload *PartialUpdateNetworkAreaPayload +} + +// Request to update an Area. + +func (r PartialUpdateNetworkAreaRequest) PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload PartialUpdateNetworkAreaPayload) ApiPartialUpdateNetworkAreaRequest { + r.partialUpdateNetworkAreaPayload = &partialUpdateNetworkAreaPayload + return r +} + +func (r PartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetworkArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.partialUpdateNetworkAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("partialUpdateNetworkAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.partialUpdateNetworkAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +PartialUpdateNetworkArea: Update network area settings. + +Update the settings of a network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiPartialUpdateNetworkAreaRequest +*/ +func (a *APIClient) PartialUpdateNetworkArea(ctx context.Context, organizationId string, areaId string) ApiPartialUpdateNetworkAreaRequest { + return PartialUpdateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) PartialUpdateNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { + r := PartialUpdateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type RebootServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + action *string +} + +// Defines if it is a soft or a hard reboot. + +func (r RebootServerRequest) Action(action string) ApiRebootServerRequest { + r.action = &action + return r +} + +func (r RebootServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RebootServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/reboot" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + if r.action != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "action", r.action, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RebootServer: Reboot the server. + +Reboot the server. A soft reboot will attempt to gracefully shut down the server by passing the command to the operating system. A hard reboot will power cycle the server without waiting for the operating system to shutdown properly. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRebootServerRequest +*/ +func (a *APIClient) RebootServer(ctx context.Context, projectId string, region string, serverId string) ApiRebootServerRequest { + return RebootServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) RebootServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := RebootServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type RemoveNetworkFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + networkId string +} + +func (r RemoveNetworkFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNetworkFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemoveNetworkFromServer: Detach and delete all network interfaces associated with the specified network. + +Detach and delete all network interfaces associated with the specified network from the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiRemoveNetworkFromServerRequest +*/ +func (a *APIClient) RemoveNetworkFromServer(ctx context.Context, projectId string, region string, serverId string, networkId string) ApiRemoveNetworkFromServerRequest { + return RemoveNetworkFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + networkId: networkId, + } +} + +func (a *APIClient) RemoveNetworkFromServerExecute(ctx context.Context, projectId string, region string, serverId string, networkId string) error { + r := RemoveNetworkFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + networkId: networkId, + } + return r.Execute() +} + +type RemoveNicFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + nicId string +} + +func (r RemoveNicFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNicFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemoveNicFromServer: Detach a network interface. + +Detach a network interface from a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param nicId The identifier (ID) of a network interface. + @return ApiRemoveNicFromServerRequest +*/ +func (a *APIClient) RemoveNicFromServer(ctx context.Context, projectId string, region string, serverId string, nicId string) ApiRemoveNicFromServerRequest { + return RemoveNicFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + nicId: nicId, + } +} + +func (a *APIClient) RemoveNicFromServerExecute(ctx context.Context, projectId string, region string, serverId string, nicId string) error { + r := RemoveNicFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + nicId: nicId, + } + return r.Execute() +} + +type RemovePublicIpFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + publicIpId string +} + +func (r RemovePublicIpFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemovePublicIpFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemovePublicIpFromServer: Dissociate a public IP from a server. + +Dissociate a public IP on an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiRemovePublicIpFromServerRequest +*/ +func (a *APIClient) RemovePublicIpFromServer(ctx context.Context, projectId string, region string, serverId string, publicIpId string) ApiRemovePublicIpFromServerRequest { + return RemovePublicIpFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + publicIpId: publicIpId, + } +} + +func (a *APIClient) RemovePublicIpFromServerExecute(ctx context.Context, projectId string, region string, serverId string, publicIpId string) error { + r := RemovePublicIpFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + publicIpId: publicIpId, + } + return r.Execute() +} + +type RemoveSecurityGroupFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + securityGroupId string +} + +func (r RemoveSecurityGroupFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveSecurityGroupFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemoveSecurityGroupFromServer: Remove a server from a security group. + +Remove a server from a attached security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiRemoveSecurityGroupFromServerRequest +*/ +func (a *APIClient) RemoveSecurityGroupFromServer(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) ApiRemoveSecurityGroupFromServerRequest { + return RemoveSecurityGroupFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) RemoveSecurityGroupFromServerExecute(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) error { + r := RemoveSecurityGroupFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type RemoveServiceAccountFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + serviceAccountMail string +} + +func (r RemoveServiceAccountFromServerRequest) Execute() (*ServiceAccountMailListResponse, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceAccountMailListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveServiceAccountFromServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts/{serviceAccountMail}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountMail, "serviceAccountMail")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.serviceAccountMail) > 255 { + return localVarReturnValue, fmt.Errorf("serviceAccountMail must have less than 255 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +RemoveServiceAccountFromServer: Detach a service account from a server. + +Detach an additional service account from the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ApiRemoveServiceAccountFromServerRequest +*/ +func (a *APIClient) RemoveServiceAccountFromServer(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) ApiRemoveServiceAccountFromServerRequest { + return RemoveServiceAccountFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + serviceAccountMail: serviceAccountMail, + } +} + +func (a *APIClient) RemoveServiceAccountFromServerExecute(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) { + r := RemoveServiceAccountFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + serviceAccountMail: serviceAccountMail, + } + return r.Execute() +} + +type RemoveVolumeFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + volumeId string +} + +func (r RemoveVolumeFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveVolumeFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemoveVolumeFromServer: Detach a volume from a server. + +Detach an existing volume from an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiRemoveVolumeFromServerRequest +*/ +func (a *APIClient) RemoveVolumeFromServer(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiRemoveVolumeFromServerRequest { + return RemoveVolumeFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) RemoveVolumeFromServerExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) error { + r := RemoveVolumeFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type RescueServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + rescueServerPayload *RescueServerPayload +} + +// Request a server rescue. + +func (r RescueServerRequest) RescueServerPayload(rescueServerPayload RescueServerPayload) ApiRescueServerRequest { + r.rescueServerPayload = &rescueServerPayload + return r +} + +func (r RescueServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RescueServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/rescue" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if r.rescueServerPayload == nil { + return fmt.Errorf("rescueServerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.rescueServerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RescueServer: Rescue an existing server. + +Rescue an existing server. It is shutdown and the initial image is attached as the boot volume, while the boot volume is attached as secondary volume and the server is booted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRescueServerRequest +*/ +func (a *APIClient) RescueServer(ctx context.Context, projectId string, region string, serverId string) ApiRescueServerRequest { + return RescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) RescueServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := RescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type ResizeServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + resizeServerPayload *ResizeServerPayload +} + +// Request a resize of a server. + +func (r ResizeServerRequest) ResizeServerPayload(resizeServerPayload ResizeServerPayload) ApiResizeServerRequest { + r.resizeServerPayload = &resizeServerPayload + return r +} + +func (r ResizeServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResizeServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/resize" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if r.resizeServerPayload == nil { + return fmt.Errorf("resizeServerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.resizeServerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +ResizeServer: Resize a server. + +Resize the server to the given machine type. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiResizeServerRequest +*/ +func (a *APIClient) ResizeServer(ctx context.Context, projectId string, region string, serverId string) ApiResizeServerRequest { + return ResizeServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) ResizeServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := ResizeServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type ResizeVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + volumeId string + resizeVolumePayload *ResizeVolumePayload +} + +// Request a volume resize. + +func (r ResizeVolumeRequest) ResizeVolumePayload(resizeVolumePayload ResizeVolumePayload) ApiResizeVolumeRequest { + r.resizeVolumePayload = &resizeVolumePayload + return r +} + +func (r ResizeVolumeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResizeVolume") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}/resize" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.resizeVolumePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +ResizeVolume: Update the size of a volume. + +Update the size of a block device volume. The new volume size must be larger than the current size. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiResizeVolumeRequest +*/ +func (a *APIClient) ResizeVolume(ctx context.Context, projectId string, region string, volumeId string) ApiResizeVolumeRequest { + return ResizeVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } +} + +func (a *APIClient) ResizeVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) error { + r := ResizeVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } + return r.Execute() +} + +type RestoreBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + backupId string +} + +func (r RestoreBackupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RestoreBackup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}/restore" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.backupId) < 36 { + return fmt.Errorf("backupId must have at least 36 elements") + } + if strlen(r.backupId) > 36 { + return fmt.Errorf("backupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RestoreBackup: Restore Backup to the referenced source Volume. + +Restores a Backup to the existing Volume it references to. The use of this endpoint is disruptive as the volume needs to be detached. If a new volume is to be created use the volumes endpoint with the option to create from backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiRestoreBackupRequest +*/ +func (a *APIClient) RestoreBackup(ctx context.Context, projectId string, region string, backupId string) ApiRestoreBackupRequest { + return RestoreBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } +} + +func (a *APIClient) RestoreBackupExecute(ctx context.Context, projectId string, region string, backupId string) error { + r := RestoreBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } + return r.Execute() +} + +type SetImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string + setImageSharePayload *SetImageSharePayload +} + +// Settings for an Image Share. + +func (r SetImageShareRequest) SetImageSharePayload(setImageSharePayload SetImageSharePayload) ApiSetImageShareRequest { + r.setImageSharePayload = &setImageSharePayload + return r +} + +func (r SetImageShareRequest) Execute() (*ImageShare, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShare + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.SetImageShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + if r.setImageSharePayload == nil { + return localVarReturnValue, fmt.Errorf("setImageSharePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.setImageSharePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +SetImageShare: Set image share. + +Set share of an Image. New Options will replace existing settings. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiSetImageShareRequest +*/ +func (a *APIClient) SetImageShare(ctx context.Context, projectId string, region string, imageId string) ApiSetImageShareRequest { + return SetImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) SetImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) { + r := SetImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type StartServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r StartServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StartServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/start" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +StartServer: Boot up a server. + +Start an existing server or allocates the server if deallocated. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiStartServerRequest +*/ +func (a *APIClient) StartServer(ctx context.Context, projectId string, region string, serverId string) ApiStartServerRequest { + return StartServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) StartServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := StartServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type StopServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r StopServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StopServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/stop" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +StopServer: Stop an existing server. + +Stops an existing server. The server will remain on the Hypervisor and will be charged full price for all resources attached to it. The attached resources will remain reserved. Useful particularly for vGPU servers. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiStopServerRequest +*/ +func (a *APIClient) StopServer(ctx context.Context, projectId string, region string, serverId string) ApiStopServerRequest { + return StopServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) StopServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := StopServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type UnrescueServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r UnrescueServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UnrescueServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/unrescue" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +UnrescueServer: Unrescue an existing server. + +Unrescue an existing server. The original boot volume is attached as boot volume of the server and the server is booted up. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUnrescueServerRequest +*/ +func (a *APIClient) UnrescueServer(ctx context.Context, projectId string, region string, serverId string) ApiUnrescueServerRequest { + return UnrescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) UnrescueServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := UnrescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type UpdateAttachedVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + volumeId string + updateAttachedVolumePayload *UpdateAttachedVolumePayload +} + +// Request a volume attachment update. + +func (r UpdateAttachedVolumeRequest) UpdateAttachedVolumePayload(updateAttachedVolumePayload UpdateAttachedVolumePayload) ApiUpdateAttachedVolumeRequest { + r.updateAttachedVolumePayload = &updateAttachedVolumePayload + return r +} + +func (r UpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAttachedVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + if r.updateAttachedVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("updateAttachedVolumePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateAttachedVolumePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateAttachedVolume: Update Volume Attachment Parameters. + +Update the properties of an existing Volume Attachment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateAttachedVolumeRequest +*/ +func (a *APIClient) UpdateAttachedVolume(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiUpdateAttachedVolumeRequest { + return UpdateAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) UpdateAttachedVolumeExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := UpdateAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type UpdateImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string + updateImagePayload *UpdateImagePayload +} + +// Request an update of an Image. + +func (r UpdateImageRequest) UpdateImagePayload(updateImagePayload UpdateImagePayload) ApiUpdateImageRequest { + r.updateImagePayload = &updateImagePayload + return r +} + +func (r UpdateImageRequest) Execute() (*Image, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Image + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateImage") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + if r.updateImagePayload == nil { + return localVarReturnValue, fmt.Errorf("updateImagePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateImagePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateImage: Update Image Parameters. + +Update the properties of an existing Image inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageRequest +*/ +func (a *APIClient) UpdateImage(ctx context.Context, projectId string, region string, imageId string) ApiUpdateImageRequest { + return UpdateImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) UpdateImageExecute(ctx context.Context, projectId string, region string, imageId string) (*Image, error) { + r := UpdateImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type UpdateImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string + updateImageSharePayload *UpdateImageSharePayload +} + +// Update an Image Share. + +func (r UpdateImageShareRequest) UpdateImageSharePayload(updateImageSharePayload UpdateImageSharePayload) ApiUpdateImageShareRequest { + r.updateImageSharePayload = &updateImageSharePayload + return r +} + +func (r UpdateImageShareRequest) Execute() (*ImageShare, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShare + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateImageShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + if r.updateImageSharePayload == nil { + return localVarReturnValue, fmt.Errorf("updateImageSharePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateImageSharePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateImageShare: Update image share. + +Update share of an Image. Projects will be appended to existing list. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageShareRequest +*/ +func (a *APIClient) UpdateImageShare(ctx context.Context, projectId string, region string, imageId string) ApiUpdateImageShareRequest { + return UpdateImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) UpdateImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) { + r := UpdateImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type UpdateKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string + updateKeyPairPayload *UpdateKeyPairPayload +} + +// Request an update of an SSH keypair. + +func (r UpdateKeyPairRequest) UpdateKeyPairPayload(updateKeyPairPayload UpdateKeyPairPayload) ApiUpdateKeyPairRequest { + r.updateKeyPairPayload = &updateKeyPairPayload + return r +} + +func (r UpdateKeyPairRequest) Execute() (*Keypair, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Keypair + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateKeyPair") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/keypairs/{keypairName}" + localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.keypairName) > 127 { + return localVarReturnValue, fmt.Errorf("keypairName must have less than 127 elements") + } + if r.updateKeyPairPayload == nil { + return localVarReturnValue, fmt.Errorf("updateKeyPairPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateKeyPairPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateKeyPair: Update information of an SSH keypair. + +Update labels of the SSH keypair. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiUpdateKeyPairRequest +*/ +func (a *APIClient) UpdateKeyPair(ctx context.Context, keypairName string) ApiUpdateKeyPairRequest { + return UpdateKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } +} + +func (a *APIClient) UpdateKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) { + r := UpdateKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } + return r.Execute() +} + +type UpdateNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + nicId string + updateNicPayload *UpdateNicPayload +} + +// Request an update of a network interface. + +func (r UpdateNicRequest) UpdateNicPayload(updateNicPayload UpdateNicPayload) ApiUpdateNicRequest { + r.updateNicPayload = &updateNicPayload + return r +} + +func (r UpdateNicRequest) Execute() (*NIC, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateNic") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") + } + if r.updateNicPayload == nil { + return localVarReturnValue, fmt.Errorf("updateNicPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateNicPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateNic: Update a network interface. + +Update the properties of an existing network interface inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiUpdateNicRequest +*/ +func (a *APIClient) UpdateNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiUpdateNicRequest { + return UpdateNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } +} + +func (a *APIClient) UpdateNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) (*NIC, error) { + r := UpdateNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } + return r.Execute() +} + +type UpdatePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + publicIpId string + updatePublicIPPayload *UpdatePublicIPPayload +} + +// Request an update of a public IP. + +func (r UpdatePublicIPRequest) UpdatePublicIPPayload(updatePublicIPPayload UpdatePublicIPPayload) ApiUpdatePublicIPRequest { + r.updatePublicIPPayload = &updatePublicIPPayload + return r +} + +func (r UpdatePublicIPRequest) Execute() (*PublicIp, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIp + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdatePublicIP") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have less than 36 elements") + } + if r.updatePublicIPPayload == nil { + return localVarReturnValue, fmt.Errorf("updatePublicIPPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updatePublicIPPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdatePublicIP: Update a public IP. + +Update the properties of an existing public IP inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiUpdatePublicIPRequest +*/ +func (a *APIClient) UpdatePublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiUpdatePublicIPRequest { + return UpdatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } +} + +func (a *APIClient) UpdatePublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) (*PublicIp, error) { + r := UpdatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } + return r.Execute() +} + +type UpdateRouteOfRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + routeId string + updateRouteOfRoutingTablePayload *UpdateRouteOfRoutingTablePayload +} + +// Request an update of a route in a routing table. + +func (r UpdateRouteOfRoutingTableRequest) UpdateRouteOfRoutingTablePayload(updateRouteOfRoutingTablePayload UpdateRouteOfRoutingTablePayload) ApiUpdateRouteOfRoutingTableRequest { + r.updateRouteOfRoutingTablePayload = &updateRouteOfRoutingTablePayload + return r +} + +func (r UpdateRouteOfRoutingTableRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateRouteOfRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + if r.updateRouteOfRoutingTablePayload == nil { + return localVarReturnValue, fmt.Errorf("updateRouteOfRoutingTablePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateRouteOfRoutingTablePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateRouteOfRoutingTable: Update a route of a routing table. + +Update a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiUpdateRouteOfRoutingTableRequest +*/ +func (a *APIClient) UpdateRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiUpdateRouteOfRoutingTableRequest { + return UpdateRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } +} + +func (a *APIClient) UpdateRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) { + r := UpdateRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } + return r.Execute() +} + +type UpdateRoutingTableOfAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + updateRoutingTableOfAreaPayload *UpdateRoutingTableOfAreaPayload +} + +// Request an update of a routing table. + +func (r UpdateRoutingTableOfAreaRequest) UpdateRoutingTableOfAreaPayload(updateRoutingTableOfAreaPayload UpdateRoutingTableOfAreaPayload) ApiUpdateRoutingTableOfAreaRequest { + r.updateRoutingTableOfAreaPayload = &updateRoutingTableOfAreaPayload + return r +} + +func (r UpdateRoutingTableOfAreaRequest) Execute() (*RoutingTable, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTable + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateRoutingTableOfArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if r.updateRoutingTableOfAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("updateRoutingTableOfAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateRoutingTableOfAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateRoutingTableOfArea: Update a routing table. + +Update a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiUpdateRoutingTableOfAreaRequest +*/ +func (a *APIClient) UpdateRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiUpdateRoutingTableOfAreaRequest { + return UpdateRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) UpdateRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) { + r := UpdateRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type UpdateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + updateServerPayload *UpdateServerPayload +} + +// Request an update of a server. + +func (r UpdateServerRequest) UpdateServerPayload(updateServerPayload UpdateServerPayload) ApiUpdateServerRequest { + r.updateServerPayload = &updateServerPayload + return r +} + +func (r UpdateServerRequest) Execute() (*Server, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Server + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if r.updateServerPayload == nil { + return localVarReturnValue, fmt.Errorf("updateServerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateServerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateServer: Update information of a server. + +Update name or labels of the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUpdateServerRequest +*/ +func (a *APIClient) UpdateServer(ctx context.Context, projectId string, region string, serverId string) ApiUpdateServerRequest { + return UpdateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) UpdateServerExecute(ctx context.Context, projectId string, region string, serverId string) (*Server, error) { + r := UpdateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type UpdateVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + volumeId string + updateVolumePayload *UpdateVolumePayload +} + +// Request an update of a volume. + +func (r UpdateVolumeRequest) UpdateVolumePayload(updateVolumePayload UpdateVolumePayload) ApiUpdateVolumeRequest { + r.updateVolumePayload = &updateVolumePayload + return r +} + +func (r UpdateVolumeRequest) Execute() (*Volume, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + if r.updateVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("updateVolumePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateVolumePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateVolume: Update information of a volume. + +Update name, description or labels of the volume. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateVolumeRequest +*/ +func (a *APIClient) UpdateVolume(ctx context.Context, projectId string, region string, volumeId string) ApiUpdateVolumeRequest { + return UpdateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } +} + +func (a *APIClient) UpdateVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) (*Volume, error) { + r := UpdateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } + return r.Execute() +} + +type V2beta1ConfigureNetworkAreaRegionRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + v2beta1ConfigureNetworkAreaRegionPayload *V2beta1ConfigureNetworkAreaRegionPayload +} + +// Request to add a new regional network area configuration. + +func (r V2beta1ConfigureNetworkAreaRegionRequest) V2beta1ConfigureNetworkAreaRegionPayload(v2beta1ConfigureNetworkAreaRegionPayload V2beta1ConfigureNetworkAreaRegionPayload) ApiV2beta1ConfigureNetworkAreaRegionRequest { + r.v2beta1ConfigureNetworkAreaRegionPayload = &v2beta1ConfigureNetworkAreaRegionPayload + return r +} + +func (r V2beta1ConfigureNetworkAreaRegionRequest) Execute() (*RegionalArea, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegionalArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1ConfigureNetworkAreaRegion") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.v2beta1ConfigureNetworkAreaRegionPayload == nil { + return localVarReturnValue, fmt.Errorf("v2beta1ConfigureNetworkAreaRegionPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.v2beta1ConfigureNetworkAreaRegionPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1ConfigureNetworkAreaRegion: Configure a region for a network area. + +Configure a new region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiV2beta1ConfigureNetworkAreaRegionRequest +*/ +func (a *APIClient) V2beta1ConfigureNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1ConfigureNetworkAreaRegionRequest { + return V2beta1ConfigureNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) V2beta1ConfigureNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) { + r := V2beta1ConfigureNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type V2beta1CreateSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + v2beta1CreateSnapshotPayload *V2beta1CreateSnapshotPayload +} + +// Request a snapshot creation. + +func (r V2beta1CreateSnapshotRequest) V2beta1CreateSnapshotPayload(v2beta1CreateSnapshotPayload V2beta1CreateSnapshotPayload) ApiV2beta1CreateSnapshotRequest { + r.v2beta1CreateSnapshotPayload = &v2beta1CreateSnapshotPayload + return r +} + +func (r V2beta1CreateSnapshotRequest) Execute() (*Snapshot, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Snapshot + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1CreateSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/snapshots" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.v2beta1CreateSnapshotPayload == nil { + return localVarReturnValue, fmt.Errorf("v2beta1CreateSnapshotPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.v2beta1CreateSnapshotPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1CreateSnapshot: Create new Snapshot. + +Create a new Snapshot from a Volume in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiV2beta1CreateSnapshotRequest +*/ +func (a *APIClient) V2beta1CreateSnapshot(ctx context.Context, projectId string, region string) ApiV2beta1CreateSnapshotRequest { + return V2beta1CreateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) V2beta1CreateSnapshotExecute(ctx context.Context, projectId string, region string) (*Snapshot, error) { + r := V2beta1CreateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type V2beta1DeleteNetworkAreaRegionRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string +} + +func (r V2beta1DeleteNetworkAreaRegionRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1DeleteNetworkAreaRegion") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +V2beta1DeleteNetworkAreaRegion: Delete a configuration of region for a network area. + +Delete a current configuration of region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiV2beta1DeleteNetworkAreaRegionRequest +*/ +func (a *APIClient) V2beta1DeleteNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1DeleteNetworkAreaRegionRequest { + return V2beta1DeleteNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) V2beta1DeleteNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) error { + r := V2beta1DeleteNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type V2beta1DeleteSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + snapshotId string +} + +func (r V2beta1DeleteSnapshotRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1DeleteSnapshot") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(r.snapshotId, "snapshotId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.snapshotId) < 36 { + return fmt.Errorf("snapshotId must have at least 36 elements") + } + if strlen(r.snapshotId) > 36 { + return fmt.Errorf("snapshotId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +V2beta1DeleteSnapshot: Delete a snapshot. + +Delete a snapshot that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiV2beta1DeleteSnapshotRequest +*/ +func (a *APIClient) V2beta1DeleteSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1DeleteSnapshotRequest { + return V2beta1DeleteSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } +} + +func (a *APIClient) V2beta1DeleteSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) error { + r := V2beta1DeleteSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } + return r.Execute() +} + +type V2beta1GetAreaRegionRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string +} + +func (r V2beta1GetAreaRegionRequest) Execute() (*RegionalArea, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegionalArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1GetAreaRegion") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1GetAreaRegion: Get details about a configured region. + +Get details about a configured region in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiV2beta1GetAreaRegionRequest +*/ +func (a *APIClient) V2beta1GetAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1GetAreaRegionRequest { + return V2beta1GetAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) V2beta1GetAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) { + r := V2beta1GetAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type V2beta1GetSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + snapshotId string +} + +func (r V2beta1GetSnapshotRequest) Execute() (*Snapshot, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Snapshot + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1GetSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(r.snapshotId, "snapshotId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.snapshotId) < 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have at least 36 elements") + } + if strlen(r.snapshotId) > 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1GetSnapshot: Get details about a snapshot. + +Get details about a block device snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiV2beta1GetSnapshotRequest +*/ +func (a *APIClient) V2beta1GetSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1GetSnapshotRequest { + return V2beta1GetSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } +} + +func (a *APIClient) V2beta1GetSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error) { + r := V2beta1GetSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } + return r.Execute() +} + +type V2beta1ListAreaRegionsRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r V2beta1ListAreaRegionsRequest) Execute() (*RegionalAreaListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegionalAreaListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1ListAreaRegions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1ListAreaRegions: List all configured regions in a network area. + +Get a list of all configured regions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiV2beta1ListAreaRegionsRequest +*/ +func (a *APIClient) V2beta1ListAreaRegions(ctx context.Context, organizationId string, areaId string) ApiV2beta1ListAreaRegionsRequest { + return V2beta1ListAreaRegionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) V2beta1ListAreaRegionsExecute(ctx context.Context, organizationId string, areaId string) (*RegionalAreaListResponse, error) { + r := V2beta1ListAreaRegionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type V2beta1ListSnapshotsInProjectRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r V2beta1ListSnapshotsInProjectRequest) LabelSelector(labelSelector string) ApiV2beta1ListSnapshotsInProjectRequest { + r.labelSelector = &labelSelector + return r +} + +func (r V2beta1ListSnapshotsInProjectRequest) Execute() (*SnapshotListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SnapshotListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1ListSnapshotsInProject") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/snapshots" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1ListSnapshotsInProject: List all snapshots inside a project. + +Get a list of all snapshots inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiV2beta1ListSnapshotsInProjectRequest +*/ +func (a *APIClient) V2beta1ListSnapshotsInProject(ctx context.Context, projectId string, region string) ApiV2beta1ListSnapshotsInProjectRequest { + return V2beta1ListSnapshotsInProjectRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) V2beta1ListSnapshotsInProjectExecute(ctx context.Context, projectId string, region string) (*SnapshotListResponse, error) { + r := V2beta1ListSnapshotsInProjectRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type V2beta1UpdateBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + backupId string + v2beta1UpdateBackupPayload *V2beta1UpdateBackupPayload +} + +// Request an update of a backup. + +func (r V2beta1UpdateBackupRequest) V2beta1UpdateBackupPayload(v2beta1UpdateBackupPayload V2beta1UpdateBackupPayload) ApiV2beta1UpdateBackupRequest { + r.v2beta1UpdateBackupPayload = &v2beta1UpdateBackupPayload + return r +} + +func (r V2beta1UpdateBackupRequest) Execute() (*Backup, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Backup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1UpdateBackup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.backupId) < 36 { + return localVarReturnValue, fmt.Errorf("backupId must have at least 36 elements") + } + if strlen(r.backupId) > 36 { + return localVarReturnValue, fmt.Errorf("backupId must have less than 36 elements") + } + if r.v2beta1UpdateBackupPayload == nil { + return localVarReturnValue, fmt.Errorf("v2beta1UpdateBackupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.v2beta1UpdateBackupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1UpdateBackup: Update information of a backup. + +Update name or labels of the backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiV2beta1UpdateBackupRequest +*/ +func (a *APIClient) V2beta1UpdateBackup(ctx context.Context, projectId string, region string, backupId string) ApiV2beta1UpdateBackupRequest { + return V2beta1UpdateBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } +} + +func (a *APIClient) V2beta1UpdateBackupExecute(ctx context.Context, projectId string, region string, backupId string) (*Backup, error) { + r := V2beta1UpdateBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } + return r.Execute() +} + +type V2beta1UpdateNetworkAreaRegionRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + v2beta1UpdateNetworkAreaRegionPayload *V2beta1UpdateNetworkAreaRegionPayload +} + +// Request an update of a regional network area. + +func (r V2beta1UpdateNetworkAreaRegionRequest) V2beta1UpdateNetworkAreaRegionPayload(v2beta1UpdateNetworkAreaRegionPayload V2beta1UpdateNetworkAreaRegionPayload) ApiV2beta1UpdateNetworkAreaRegionRequest { + r.v2beta1UpdateNetworkAreaRegionPayload = &v2beta1UpdateNetworkAreaRegionPayload + return r +} + +func (r V2beta1UpdateNetworkAreaRegionRequest) Execute() (*RegionalArea, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegionalArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1UpdateNetworkAreaRegion") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.v2beta1UpdateNetworkAreaRegionPayload == nil { + return localVarReturnValue, fmt.Errorf("v2beta1UpdateNetworkAreaRegionPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.v2beta1UpdateNetworkAreaRegionPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1UpdateNetworkAreaRegion: Update a region for a network area. + +Update a new region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiV2beta1UpdateNetworkAreaRegionRequest +*/ +func (a *APIClient) V2beta1UpdateNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1UpdateNetworkAreaRegionRequest { + return V2beta1UpdateNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) V2beta1UpdateNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) { + r := V2beta1UpdateNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type V2beta1UpdateRouteOfAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routeId string + v2beta1UpdateRouteOfAreaPayload *V2beta1UpdateRouteOfAreaPayload +} + +// Request an update of a network route. + +func (r V2beta1UpdateRouteOfAreaRequest) V2beta1UpdateRouteOfAreaPayload(v2beta1UpdateRouteOfAreaPayload V2beta1UpdateRouteOfAreaPayload) ApiV2beta1UpdateRouteOfAreaRequest { + r.v2beta1UpdateRouteOfAreaPayload = &v2beta1UpdateRouteOfAreaPayload + return r +} + +func (r V2beta1UpdateRouteOfAreaRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1UpdateRouteOfArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + if r.v2beta1UpdateRouteOfAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("v2beta1UpdateRouteOfAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.v2beta1UpdateRouteOfAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1UpdateRouteOfArea: Update a network route. + +Update a network route defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiV2beta1UpdateRouteOfAreaRequest +*/ +func (a *APIClient) V2beta1UpdateRouteOfArea(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiV2beta1UpdateRouteOfAreaRequest { + return V2beta1UpdateRouteOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } +} + +func (a *APIClient) V2beta1UpdateRouteOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) (*Route, error) { + r := V2beta1UpdateRouteOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } + return r.Execute() +} + +type V2beta1UpdateSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string + v2beta1UpdateSecurityGroupPayload *V2beta1UpdateSecurityGroupPayload +} + +// Request an update of a security group. + +func (r V2beta1UpdateSecurityGroupRequest) V2beta1UpdateSecurityGroupPayload(v2beta1UpdateSecurityGroupPayload V2beta1UpdateSecurityGroupPayload) ApiV2beta1UpdateSecurityGroupRequest { + r.v2beta1UpdateSecurityGroupPayload = &v2beta1UpdateSecurityGroupPayload + return r +} + +func (r V2beta1UpdateSecurityGroupRequest) Execute() (*SecurityGroup, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1UpdateSecurityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if r.v2beta1UpdateSecurityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("v2beta1UpdateSecurityGroupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.v2beta1UpdateSecurityGroupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1UpdateSecurityGroup: Update information of a security group. + +Update labels of the security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiV2beta1UpdateSecurityGroupRequest +*/ +func (a *APIClient) V2beta1UpdateSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiV2beta1UpdateSecurityGroupRequest { + return V2beta1UpdateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) V2beta1UpdateSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroup, error) { + r := V2beta1UpdateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type V2beta1UpdateSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + snapshotId string + v2beta1UpdateSnapshotPayload *V2beta1UpdateSnapshotPayload +} + +// Request an update of a snapshot. + +func (r V2beta1UpdateSnapshotRequest) V2beta1UpdateSnapshotPayload(v2beta1UpdateSnapshotPayload V2beta1UpdateSnapshotPayload) ApiV2beta1UpdateSnapshotRequest { + r.v2beta1UpdateSnapshotPayload = &v2beta1UpdateSnapshotPayload + return r +} + +func (r V2beta1UpdateSnapshotRequest) Execute() (*Snapshot, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Snapshot + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.V2beta1UpdateSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(r.snapshotId, "snapshotId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.snapshotId) < 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have at least 36 elements") + } + if strlen(r.snapshotId) > 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have less than 36 elements") + } + if r.v2beta1UpdateSnapshotPayload == nil { + return localVarReturnValue, fmt.Errorf("v2beta1UpdateSnapshotPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.v2beta1UpdateSnapshotPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +V2beta1UpdateSnapshot: Update information of the snapshot. + +Update information like name or labels of the snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiV2beta1UpdateSnapshotRequest +*/ +func (a *APIClient) V2beta1UpdateSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1UpdateSnapshotRequest { + return V2beta1UpdateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } +} + +func (a *APIClient) V2beta1UpdateSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error) { + r := V2beta1UpdateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } + return r.Execute() +} diff --git a/pkg/iaasbeta/api_default_test.go b/pkg/iaasbeta/api_default_test.go new file mode 100644 index 00000000..e36ae66c --- /dev/null +++ b/pkg/iaasbeta/api_default_test.go @@ -0,0 +1,7614 @@ +/* +STACKIT IaaS API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package iaasbeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_iaasbeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService AddNetworkToServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/networks/{networkId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + networkId := networkIdValue + + reqErr := apiClient.AddNetworkToServer(context.Background(), projectId, region, serverId, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService AddNicToServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics/{nicId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + nicIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + nicId := nicIdValue + + reqErr := apiClient.AddNicToServer(context.Background(), projectId, region, serverId, nicId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService AddPublicIpToServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/public-ips/{publicIpId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + publicIpIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + publicIpId := publicIpIdValue + + reqErr := apiClient.AddPublicIpToServer(context.Background(), projectId, region, serverId, publicIpId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService AddRoutesToRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RouteListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + addRoutesToRoutingTablePayload := AddRoutesToRoutingTablePayload{} + + resp, reqErr := apiClient.AddRoutesToRoutingTable(context.Background(), organizationId, areaId, region, routingTableId).AddRoutesToRoutingTablePayload(addRoutesToRoutingTablePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService AddRoutingTableToArea", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RoutingTable{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + addRoutingTableToAreaPayload := AddRoutingTableToAreaPayload{} + + resp, reqErr := apiClient.AddRoutingTableToArea(context.Background(), organizationId, areaId, region).AddRoutingTableToAreaPayload(addRoutingTableToAreaPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService AddSecurityGroupToServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/security-groups/{securityGroupId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + securityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + securityGroupId := securityGroupIdValue + + reqErr := apiClient.AddSecurityGroupToServer(context.Background(), projectId, region, serverId, securityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService AddServiceAccountToServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts/{serviceAccountMail}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + serviceAccountMailValue := randString(255) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ServiceAccountMailListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + serviceAccountMail := serviceAccountMailValue + + resp, reqErr := apiClient.AddServiceAccountToServer(context.Background(), projectId, region, serverId, serviceAccountMail).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService AddVolumeToServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + volumeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := VolumeAttachment{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + volumeId := volumeIdValue + + resp, reqErr := apiClient.AddVolumeToServer(context.Background(), projectId, region, serverId, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateAffinityGroup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AffinityGroup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createAffinityGroupPayload := CreateAffinityGroupPayload{} + + resp, reqErr := apiClient.CreateAffinityGroup(context.Background(), projectId, region).CreateAffinityGroupPayload(createAffinityGroupPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateBackup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Backup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createBackupPayload := CreateBackupPayload{} + + resp, reqErr := apiClient.CreateBackup(context.Background(), projectId, region).CreateBackupPayload(createBackupPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateImage", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ImageCreateResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createImagePayload := CreateImagePayload{} + + resp, reqErr := apiClient.CreateImage(context.Background(), projectId, region).CreateImagePayload(createImagePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateIsolatedNetwork", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/isolated-network" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Network{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createIsolatedNetworkPayload := CreateIsolatedNetworkPayload{} + + resp, reqErr := apiClient.CreateIsolatedNetwork(context.Background(), projectId, region).CreateIsolatedNetworkPayload(createIsolatedNetworkPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateKeyPair", func(t *testing.T) { + _apiUrlPath := "/v2beta1/keypairs" + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Keypair{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + createKeyPairPayload := CreateKeyPairPayload{} + + resp, reqErr := apiClient.CreateKeyPair(context.Background()).CreateKeyPairPayload(createKeyPairPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateNetwork", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Network{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createNetworkPayload := CreateNetworkPayload{} + + resp, reqErr := apiClient.CreateNetwork(context.Background(), projectId, region).CreateNetworkPayload(createNetworkPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateNetworkArea", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NetworkArea{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + createNetworkAreaPayload := CreateNetworkAreaPayload{} + + resp, reqErr := apiClient.CreateNetworkArea(context.Background(), organizationId).CreateNetworkAreaPayload(createNetworkAreaPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateNetworkAreaRange", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NetworkRangeListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + createNetworkAreaRangePayload := CreateNetworkAreaRangePayload{} + + resp, reqErr := apiClient.CreateNetworkAreaRange(context.Background(), organizationId, areaId, region).CreateNetworkAreaRangePayload(createNetworkAreaRangePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateNetworkAreaRoute", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RouteListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + createNetworkAreaRoutePayload := CreateNetworkAreaRoutePayload{} + + resp, reqErr := apiClient.CreateNetworkAreaRoute(context.Background(), organizationId, areaId, region).CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateNic", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NIC{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + createNicPayload := CreateNicPayload{} + + resp, reqErr := apiClient.CreateNic(context.Background(), projectId, region, networkId).CreateNicPayload(createNicPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreatePublicIP", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/public-ips" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := PublicIp{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createPublicIPPayload := CreatePublicIPPayload{} + + resp, reqErr := apiClient.CreatePublicIP(context.Background(), projectId, region).CreatePublicIPPayload(createPublicIPPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateSecurityGroup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createSecurityGroupPayload := CreateSecurityGroupPayload{} + + resp, reqErr := apiClient.CreateSecurityGroup(context.Background(), projectId, region).CreateSecurityGroupPayload(createSecurityGroupPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateSecurityGroupRule", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + securityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroupRule{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + securityGroupId := securityGroupIdValue + createSecurityGroupRulePayload := CreateSecurityGroupRulePayload{} + + resp, reqErr := apiClient.CreateSecurityGroupRule(context.Background(), projectId, region, securityGroupId).CreateSecurityGroupRulePayload(createSecurityGroupRulePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Server{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createServerPayload := CreateServerPayload{} + + resp, reqErr := apiClient.CreateServer(context.Background(), projectId, region).CreateServerPayload(createServerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateVolume", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Volume{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createVolumePayload := CreateVolumePayload{} + + resp, reqErr := apiClient.CreateVolume(context.Background(), projectId, region).CreateVolumePayload(createVolumePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeallocateServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/deallocate" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + reqErr := apiClient.DeallocateServer(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteAffinityGroup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups/{affinityGroupId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + affinityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(affinityGroupIdValue, "affinityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + affinityGroupId := affinityGroupIdValue + + reqErr := apiClient.DeleteAffinityGroup(context.Background(), projectId, region, affinityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteBackup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + backupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + backupId := backupIdValue + + reqErr := apiClient.DeleteBackup(context.Background(), projectId, region, backupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteImage", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + imageIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + imageId := imageIdValue + + reqErr := apiClient.DeleteImage(context.Background(), projectId, region, imageId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteImageShare", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + imageIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + imageId := imageIdValue + + reqErr := apiClient.DeleteImageShare(context.Background(), projectId, region, imageId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteImageShareConsumer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share/{consumerProjectId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + imageIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + consumerProjectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(consumerProjectIdValue, "consumerProjectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + imageId := imageIdValue + consumerProjectId := consumerProjectIdValue + + reqErr := apiClient.DeleteImageShareConsumer(context.Background(), projectId, region, imageId, consumerProjectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteKeyPair", func(t *testing.T) { + _apiUrlPath := "/v2beta1/keypairs/{keypairName}" + keypairNameValue := randString(127) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + keypairName := keypairNameValue + + reqErr := apiClient.DeleteKeyPair(context.Background(), keypairName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetwork", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + + reqErr := apiClient.DeleteNetwork(context.Background(), projectId, region, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetworkArea", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + + reqErr := apiClient.DeleteNetworkArea(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetworkAreaRange", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges/{networkRangeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkRangeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + networkRangeId := networkRangeIdValue + + reqErr := apiClient.DeleteNetworkAreaRange(context.Background(), organizationId, areaId, region, networkRangeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNetworkAreaRoute", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routeId := routeIdValue + + reqErr := apiClient.DeleteNetworkAreaRoute(context.Background(), organizationId, areaId, region, routeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteNic", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + nicIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + nicId := nicIdValue + + reqErr := apiClient.DeleteNic(context.Background(), projectId, region, networkId, nicId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeletePublicIP", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + publicIpIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + publicIpId := publicIpIdValue + + reqErr := apiClient.DeletePublicIP(context.Background(), projectId, region, publicIpId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteRouteFromRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + routeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + routeId := routeIdValue + + reqErr := apiClient.DeleteRouteFromRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteRoutingTableFromArea", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + + reqErr := apiClient.DeleteRoutingTableFromArea(context.Background(), organizationId, areaId, region, routingTableId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteSecurityGroup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + securityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + securityGroupId := securityGroupIdValue + + reqErr := apiClient.DeleteSecurityGroup(context.Background(), projectId, region, securityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteSecurityGroupRule", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + securityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + securityGroupRuleIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(securityGroupRuleIdValue, "securityGroupRuleId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + securityGroupId := securityGroupIdValue + securityGroupRuleId := securityGroupRuleIdValue + + reqErr := apiClient.DeleteSecurityGroupRule(context.Background(), projectId, region, securityGroupId, securityGroupRuleId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + reqErr := apiClient.DeleteServer(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteVolume", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + volumeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + volumeId := volumeIdValue + + reqErr := apiClient.DeleteVolume(context.Background(), projectId, region, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetAffinityGroup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups/{affinityGroupId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + affinityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(affinityGroupIdValue, "affinityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AffinityGroup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + affinityGroupId := affinityGroupIdValue + + resp, reqErr := apiClient.GetAffinityGroup(context.Background(), projectId, region, affinityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetAttachedVolume", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + volumeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := VolumeAttachment{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + volumeId := volumeIdValue + + resp, reqErr := apiClient.GetAttachedVolume(context.Background(), projectId, region, serverId, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetBackup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + backupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Backup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + backupId := backupIdValue + + resp, reqErr := apiClient.GetBackup(context.Background(), projectId, region, backupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetImage", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + imageIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Image{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + imageId := imageIdValue + + resp, reqErr := apiClient.GetImage(context.Background(), projectId, region, imageId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetImageShare", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + imageIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ImageShare{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + imageId := imageIdValue + + resp, reqErr := apiClient.GetImageShare(context.Background(), projectId, region, imageId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetImageShareConsumer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share/{consumerProjectId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + imageIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + consumerProjectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(consumerProjectIdValue, "consumerProjectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ImageShareConsumer{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + imageId := imageIdValue + consumerProjectId := consumerProjectIdValue + + resp, reqErr := apiClient.GetImageShareConsumer(context.Background(), projectId, region, imageId, consumerProjectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetKeyPair", func(t *testing.T) { + _apiUrlPath := "/v2beta1/keypairs/{keypairName}" + keypairNameValue := randString(127) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Keypair{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + keypairName := keypairNameValue + + resp, reqErr := apiClient.GetKeyPair(context.Background(), keypairName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetMachineType", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/machine-types/{machineType}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + machineTypeValue := randString(127) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(machineTypeValue, "machineType")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := MachineType{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + machineType := machineTypeValue + + resp, reqErr := apiClient.GetMachineType(context.Background(), projectId, region, machineType).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetwork", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Network{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + + resp, reqErr := apiClient.GetNetwork(context.Background(), projectId, region, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetworkArea", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NetworkArea{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + + resp, reqErr := apiClient.GetNetworkArea(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetworkAreaRange", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges/{networkRangeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkRangeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(networkRangeIdValue, "networkRangeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NetworkRange{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + networkRangeId := networkRangeIdValue + + resp, reqErr := apiClient.GetNetworkAreaRange(context.Background(), organizationId, areaId, region, networkRangeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNetworkAreaRoute", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Route{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routeId := routeIdValue + + resp, reqErr := apiClient.GetNetworkAreaRoute(context.Background(), organizationId, areaId, region, routeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetNic", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + nicIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NIC{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + nicId := nicIdValue + + resp, reqErr := apiClient.GetNic(context.Background(), projectId, region, networkId, nicId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetOrganizationRequest", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/requests/{requestId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + requestIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Request{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + requestId := requestIdValue + + resp, reqErr := apiClient.GetOrganizationRequest(context.Background(), organizationId, requestId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetProjectDetails", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Project{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + + resp, reqErr := apiClient.GetProjectDetails(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetProjectNIC", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/nics/{nicId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + nicIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NIC{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + nicId := nicIdValue + + resp, reqErr := apiClient.GetProjectNIC(context.Background(), projectId, region, nicId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetProjectRequest", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/requests/{requestId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + requestIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(requestIdValue, "requestId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Request{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + requestId := requestIdValue + + resp, reqErr := apiClient.GetProjectRequest(context.Background(), projectId, region, requestId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetPublicIP", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + publicIpIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := PublicIp{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + publicIpId := publicIpIdValue + + resp, reqErr := apiClient.GetPublicIP(context.Background(), projectId, region, publicIpId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetRouteOfRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + routeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Route{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + routeId := routeIdValue + + resp, reqErr := apiClient.GetRouteOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetRoutingTableOfArea", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RoutingTable{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + + resp, reqErr := apiClient.GetRoutingTableOfArea(context.Background(), organizationId, areaId, region, routingTableId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetSecurityGroup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + securityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + securityGroupId := securityGroupIdValue + + resp, reqErr := apiClient.GetSecurityGroup(context.Background(), projectId, region, securityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetSecurityGroupRule", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + securityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + securityGroupRuleIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(securityGroupRuleIdValue, "securityGroupRuleId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroupRule{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + securityGroupId := securityGroupIdValue + securityGroupRuleId := securityGroupRuleIdValue + + resp, reqErr := apiClient.GetSecurityGroupRule(context.Background(), projectId, region, securityGroupId, securityGroupRuleId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Server{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + resp, reqErr := apiClient.GetServer(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetServerConsole", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/console" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ServerConsoleUrl{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + resp, reqErr := apiClient.GetServerConsole(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetServerLog", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/log" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetServerLog200Response{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + resp, reqErr := apiClient.GetServerLog(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetVolume", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + volumeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Volume{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + volumeId := volumeIdValue + + resp, reqErr := apiClient.GetVolume(context.Background(), projectId, region, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetVolumePerformanceClass", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volume-performance-classes/{volumePerformanceClass}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + volumePerformanceClassValue := randString(127) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(volumePerformanceClassValue, "volumePerformanceClass")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := VolumePerformanceClass{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + volumePerformanceClass := volumePerformanceClassValue + + resp, reqErr := apiClient.GetVolumePerformanceClass(context.Background(), projectId, region, volumePerformanceClass).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListAffinityGroups", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/affinity-groups" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AffinityGroupListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListAffinityGroups(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListAttachedVolumes", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := VolumeAttachmentListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + resp, reqErr := apiClient.ListAttachedVolumes(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListAvailabilityZones", func(t *testing.T) { + _apiUrlPath := "/v2beta1/regions/{region}/availability-zones" + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AvailabilityZoneListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + region := regionValue + + resp, reqErr := apiClient.ListAvailabilityZones(context.Background(), region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListBackups", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := BackupListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListBackups(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListImages", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ImageListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListImages(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListKeyPairs", func(t *testing.T) { + _apiUrlPath := "/v2beta1/keypairs" + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := KeyPairListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + resp, reqErr := apiClient.ListKeyPairs(context.Background()).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListMachineTypes", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/machine-types" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := MachineTypeListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListMachineTypes(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworkAreaProjects", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/projects" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ProjectListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + + resp, reqErr := apiClient.ListNetworkAreaProjects(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworkAreaRanges", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NetworkRangeListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + + resp, reqErr := apiClient.ListNetworkAreaRanges(context.Background(), organizationId, areaId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworkAreaRoutes", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RouteListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + + resp, reqErr := apiClient.ListNetworkAreaRoutes(context.Background(), organizationId, areaId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworkAreas", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NetworkAreaListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + + resp, reqErr := apiClient.ListNetworkAreas(context.Background(), organizationId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNetworks", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NetworkListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListNetworks(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListNics", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NICListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + + resp, reqErr := apiClient.ListNics(context.Background(), projectId, region, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListProjectNICs", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/nics" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NICListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListProjectNICs(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListPublicIPRanges", func(t *testing.T) { + _apiUrlPath := "/v2beta1/networks/public-ip-ranges" + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := PublicNetworkListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + resp, reqErr := apiClient.ListPublicIPRanges(context.Background()).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListPublicIPs", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/public-ips" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := PublicIpListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListPublicIPs(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListQuotas", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/quotas" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := QuotaListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListQuotas(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListRoutesOfRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RouteListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + + resp, reqErr := apiClient.ListRoutesOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListRoutingTablesOfArea", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RoutingTableListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + + resp, reqErr := apiClient.ListRoutingTablesOfArea(context.Background(), organizationId, areaId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListSecurityGroupRules", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + securityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroupRuleListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + securityGroupId := securityGroupIdValue + + resp, reqErr := apiClient.ListSecurityGroupRules(context.Background(), projectId, region, securityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListSecurityGroups", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroupListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListSecurityGroups(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListServerNICs", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NICListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + resp, reqErr := apiClient.ListServerNICs(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListServerServiceAccounts", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ServiceAccountMailListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + resp, reqErr := apiClient.ListServerServiceAccounts(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListServers", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ServerListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListServers(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListVolumePerformanceClasses", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volume-performance-classes" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := VolumePerformanceClassListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListVolumePerformanceClasses(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListVolumes", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := VolumeListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListVolumes(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService PartialUpdateNetwork", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + partialUpdateNetworkPayload := PartialUpdateNetworkPayload{} + + reqErr := apiClient.PartialUpdateNetwork(context.Background(), projectId, region, networkId).PartialUpdateNetworkPayload(partialUpdateNetworkPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService PartialUpdateNetworkArea", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NetworkArea{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + partialUpdateNetworkAreaPayload := PartialUpdateNetworkAreaPayload{} + + resp, reqErr := apiClient.PartialUpdateNetworkArea(context.Background(), organizationId, areaId).PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService RebootServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/reboot" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + reqErr := apiClient.RebootServer(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService RemoveNetworkFromServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/networks/{networkId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + networkId := networkIdValue + + reqErr := apiClient.RemoveNetworkFromServer(context.Background(), projectId, region, serverId, networkId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService RemoveNicFromServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/nics/{nicId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + nicIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + nicId := nicIdValue + + reqErr := apiClient.RemoveNicFromServer(context.Background(), projectId, region, serverId, nicId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService RemovePublicIpFromServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/public-ips/{publicIpId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + publicIpIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + publicIpId := publicIpIdValue + + reqErr := apiClient.RemovePublicIpFromServer(context.Background(), projectId, region, serverId, publicIpId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService RemoveSecurityGroupFromServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/security-groups/{securityGroupId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + securityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + securityGroupId := securityGroupIdValue + + reqErr := apiClient.RemoveSecurityGroupFromServer(context.Background(), projectId, region, serverId, securityGroupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService RemoveServiceAccountFromServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts/{serviceAccountMail}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + serviceAccountMailValue := randString(255) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(serviceAccountMailValue, "serviceAccountMail")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ServiceAccountMailListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + serviceAccountMail := serviceAccountMailValue + + resp, reqErr := apiClient.RemoveServiceAccountFromServer(context.Background(), projectId, region, serverId, serviceAccountMail).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService RemoveVolumeFromServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + volumeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + volumeId := volumeIdValue + + reqErr := apiClient.RemoveVolumeFromServer(context.Background(), projectId, region, serverId, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService RescueServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/rescue" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + rescueServerPayload := RescueServerPayload{} + + reqErr := apiClient.RescueServer(context.Background(), projectId, region, serverId).RescueServerPayload(rescueServerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService ResizeServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/resize" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + resizeServerPayload := ResizeServerPayload{} + + reqErr := apiClient.ResizeServer(context.Background(), projectId, region, serverId).ResizeServerPayload(resizeServerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService ResizeVolume", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}/resize" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + volumeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + volumeId := volumeIdValue + + reqErr := apiClient.ResizeVolume(context.Background(), projectId, region, volumeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService RestoreBackup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}/restore" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + backupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + backupId := backupIdValue + + reqErr := apiClient.RestoreBackup(context.Background(), projectId, region, backupId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService SetImageShare", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + imageIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ImageShare{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + imageId := imageIdValue + setImageSharePayload := SetImageSharePayload{} + + resp, reqErr := apiClient.SetImageShare(context.Background(), projectId, region, imageId).SetImageSharePayload(setImageSharePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService StartServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/start" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + reqErr := apiClient.StartServer(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService StopServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/stop" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + reqErr := apiClient.StopServer(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService UnrescueServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/unrescue" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + + reqErr := apiClient.UnrescueServer(context.Background(), projectId, region, serverId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService UpdateAttachedVolume", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + volumeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := VolumeAttachment{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + volumeId := volumeIdValue + updateAttachedVolumePayload := UpdateAttachedVolumePayload{} + + resp, reqErr := apiClient.UpdateAttachedVolume(context.Background(), projectId, region, serverId, volumeId).UpdateAttachedVolumePayload(updateAttachedVolumePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateImage", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + imageIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Image{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + imageId := imageIdValue + updateImagePayload := UpdateImagePayload{} + + resp, reqErr := apiClient.UpdateImage(context.Background(), projectId, region, imageId).UpdateImagePayload(updateImagePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateImageShare", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/images/{imageId}/share" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + imageIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(imageIdValue, "imageId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ImageShare{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + imageId := imageIdValue + updateImageSharePayload := UpdateImageSharePayload{} + + resp, reqErr := apiClient.UpdateImageShare(context.Background(), projectId, region, imageId).UpdateImageSharePayload(updateImageSharePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateKeyPair", func(t *testing.T) { + _apiUrlPath := "/v2beta1/keypairs/{keypairName}" + keypairNameValue := randString(127) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(keypairNameValue, "keypairName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Keypair{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + keypairName := keypairNameValue + updateKeyPairPayload := UpdateKeyPairPayload{} + + resp, reqErr := apiClient.UpdateKeyPair(context.Background(), keypairName).UpdateKeyPairPayload(updateKeyPairPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateNic", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + networkIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(networkIdValue, "networkId")), -1) + nicIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(nicIdValue, "nicId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NIC{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + networkId := networkIdValue + nicId := nicIdValue + updateNicPayload := UpdateNicPayload{} + + resp, reqErr := apiClient.UpdateNic(context.Background(), projectId, region, networkId, nicId).UpdateNicPayload(updateNicPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdatePublicIP", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + publicIpIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(publicIpIdValue, "publicIpId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := PublicIp{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + publicIpId := publicIpIdValue + updatePublicIPPayload := UpdatePublicIPPayload{} + + resp, reqErr := apiClient.UpdatePublicIP(context.Background(), projectId, region, publicIpId).UpdatePublicIPPayload(updatePublicIPPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateRouteOfRoutingTable", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + routeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Route{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + routeId := routeIdValue + updateRouteOfRoutingTablePayload := UpdateRouteOfRoutingTablePayload{} + + resp, reqErr := apiClient.UpdateRouteOfRoutingTable(context.Background(), organizationId, areaId, region, routingTableId, routeId).UpdateRouteOfRoutingTablePayload(updateRouteOfRoutingTablePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateRoutingTableOfArea", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routingTableIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(routingTableIdValue, "routingTableId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RoutingTable{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routingTableId := routingTableIdValue + updateRoutingTableOfAreaPayload := UpdateRoutingTableOfAreaPayload{} + + resp, reqErr := apiClient.UpdateRoutingTableOfArea(context.Background(), organizationId, areaId, region, routingTableId).UpdateRoutingTableOfAreaPayload(updateRoutingTableOfAreaPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateServer", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/servers/{serverId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Server{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + updateServerPayload := UpdateServerPayload{} + + resp, reqErr := apiClient.UpdateServer(context.Background(), projectId, region, serverId).UpdateServerPayload(updateServerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateVolume", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/volumes/{volumeId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + volumeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(volumeIdValue, "volumeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Volume{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + volumeId := volumeIdValue + updateVolumePayload := UpdateVolumePayload{} + + resp, reqErr := apiClient.UpdateVolume(context.Background(), projectId, region, volumeId).UpdateVolumePayload(updateVolumePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1ConfigureNetworkAreaRegion", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RegionalArea{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + v2beta1ConfigureNetworkAreaRegionPayload := V2beta1ConfigureNetworkAreaRegionPayload{} + + resp, reqErr := apiClient.V2beta1ConfigureNetworkAreaRegion(context.Background(), organizationId, areaId, region).V2beta1ConfigureNetworkAreaRegionPayload(v2beta1ConfigureNetworkAreaRegionPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1CreateSnapshot", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/snapshots" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Snapshot{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + v2beta1CreateSnapshotPayload := V2beta1CreateSnapshotPayload{} + + resp, reqErr := apiClient.V2beta1CreateSnapshot(context.Background(), projectId, region).V2beta1CreateSnapshotPayload(v2beta1CreateSnapshotPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1DeleteNetworkAreaRegion", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + + reqErr := apiClient.V2beta1DeleteNetworkAreaRegion(context.Background(), organizationId, areaId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService V2beta1DeleteSnapshot", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + snapshotIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(snapshotIdValue, "snapshotId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + snapshotId := snapshotIdValue + + reqErr := apiClient.V2beta1DeleteSnapshot(context.Background(), projectId, region, snapshotId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService V2beta1GetAreaRegion", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RegionalArea{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + + resp, reqErr := apiClient.V2beta1GetAreaRegion(context.Background(), organizationId, areaId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1GetSnapshot", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + snapshotIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(snapshotIdValue, "snapshotId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Snapshot{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + snapshotId := snapshotIdValue + + resp, reqErr := apiClient.V2beta1GetSnapshot(context.Background(), projectId, region, snapshotId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1ListAreaRegions", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RegionalAreaListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + + resp, reqErr := apiClient.V2beta1ListAreaRegions(context.Background(), organizationId, areaId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1ListSnapshotsInProject", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/snapshots" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := SnapshotListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.V2beta1ListSnapshotsInProject(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1UpdateBackup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/backups/{backupId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + backupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Backup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + backupId := backupIdValue + v2beta1UpdateBackupPayload := V2beta1UpdateBackupPayload{} + + resp, reqErr := apiClient.V2beta1UpdateBackup(context.Background(), projectId, region, backupId).V2beta1UpdateBackupPayload(v2beta1UpdateBackupPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1UpdateNetworkAreaRegion", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RegionalArea{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + v2beta1UpdateNetworkAreaRegionPayload := V2beta1UpdateNetworkAreaRegionPayload{} + + resp, reqErr := apiClient.V2beta1UpdateNetworkAreaRegion(context.Background(), organizationId, areaId, region).V2beta1UpdateNetworkAreaRegionPayload(v2beta1UpdateNetworkAreaRegionPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1UpdateRouteOfArea", func(t *testing.T) { + _apiUrlPath := "/v2beta1/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + organizationIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + areaIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(areaIdValue, "areaId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + routeIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(routeIdValue, "routeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Route{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + organizationId := organizationIdValue + areaId := areaIdValue + region := regionValue + routeId := routeIdValue + v2beta1UpdateRouteOfAreaPayload := V2beta1UpdateRouteOfAreaPayload{} + + resp, reqErr := apiClient.V2beta1UpdateRouteOfArea(context.Background(), organizationId, areaId, region, routeId).V2beta1UpdateRouteOfAreaPayload(v2beta1UpdateRouteOfAreaPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1UpdateSecurityGroup", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + securityGroupIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(securityGroupIdValue, "securityGroupId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := SecurityGroup{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + securityGroupId := securityGroupIdValue + v2beta1UpdateSecurityGroupPayload := V2beta1UpdateSecurityGroupPayload{} + + resp, reqErr := apiClient.V2beta1UpdateSecurityGroup(context.Background(), projectId, region, securityGroupId).V2beta1UpdateSecurityGroupPayload(v2beta1UpdateSecurityGroupPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService V2beta1UpdateSnapshot", func(t *testing.T) { + _apiUrlPath := "/v2beta1/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + projectIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + snapshotIdValue := randString(36) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(snapshotIdValue, "snapshotId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Snapshot{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaasbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + snapshotId := snapshotIdValue + v2beta1UpdateSnapshotPayload := V2beta1UpdateSnapshotPayload{} + + resp, reqErr := apiClient.V2beta1UpdateSnapshot(context.Background(), projectId, region, snapshotId).V2beta1UpdateSnapshotPayload(v2beta1UpdateSnapshotPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/iaasbeta/client.go b/pkg/iaasbeta/client.go new file mode 100644 index 00000000..e4377132 --- /dev/null +++ b/pkg/iaasbeta/client.go @@ -0,0 +1,628 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT IaaS API API v2beta1 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/iaasbeta/configuration.go b/pkg/iaasbeta/configuration.go new file mode 100644 index 00000000..bfe0bb73 --- /dev/null +++ b/pkg/iaasbeta/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/iaasbeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://iaas.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/iaasbeta/model_add_routes_to_routing_table_payload.go b/pkg/iaasbeta/model_add_routes_to_routing_table_payload.go new file mode 100644 index 00000000..b0eff1b4 --- /dev/null +++ b/pkg/iaasbeta/model_add_routes_to_routing_table_payload.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the AddRoutesToRoutingTablePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddRoutesToRoutingTablePayload{} + +/* + types and functions for items +*/ + +// isArray +type AddRoutesToRoutingTablePayloadGetItemsAttributeType = *[]Route +type AddRoutesToRoutingTablePayloadGetItemsArgType = []Route +type AddRoutesToRoutingTablePayloadGetItemsRetType = []Route + +func getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(arg AddRoutesToRoutingTablePayloadGetItemsAttributeType) (ret AddRoutesToRoutingTablePayloadGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutesToRoutingTablePayloadGetItemsAttributeType(arg *AddRoutesToRoutingTablePayloadGetItemsAttributeType, val AddRoutesToRoutingTablePayloadGetItemsRetType) { + *arg = &val +} + +// AddRoutesToRoutingTablePayload Object represents a request to add network routes. +type AddRoutesToRoutingTablePayload struct { + // A list of routes. + // REQUIRED + Items AddRoutesToRoutingTablePayloadGetItemsAttributeType `json:"items" required:"true"` +} + +type _AddRoutesToRoutingTablePayload AddRoutesToRoutingTablePayload + +// NewAddRoutesToRoutingTablePayload instantiates a new AddRoutesToRoutingTablePayload 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 NewAddRoutesToRoutingTablePayload(items AddRoutesToRoutingTablePayloadGetItemsArgType) *AddRoutesToRoutingTablePayload { + this := AddRoutesToRoutingTablePayload{} + setAddRoutesToRoutingTablePayloadGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewAddRoutesToRoutingTablePayloadWithDefaults instantiates a new AddRoutesToRoutingTablePayload 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 NewAddRoutesToRoutingTablePayloadWithDefaults() *AddRoutesToRoutingTablePayload { + this := AddRoutesToRoutingTablePayload{} + return &this +} + +// GetItems returns the Items field value +func (o *AddRoutesToRoutingTablePayload) GetItems() (ret AddRoutesToRoutingTablePayloadGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *AddRoutesToRoutingTablePayload) GetItemsOk() (ret AddRoutesToRoutingTablePayloadGetItemsRetType, ok bool) { + return getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *AddRoutesToRoutingTablePayload) SetItems(v AddRoutesToRoutingTablePayloadGetItemsRetType) { + setAddRoutesToRoutingTablePayloadGetItemsAttributeType(&o.Items, v) +} + +func (o AddRoutesToRoutingTablePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableAddRoutesToRoutingTablePayload struct { + value *AddRoutesToRoutingTablePayload + isSet bool +} + +func (v NullableAddRoutesToRoutingTablePayload) Get() *AddRoutesToRoutingTablePayload { + return v.value +} + +func (v *NullableAddRoutesToRoutingTablePayload) Set(val *AddRoutesToRoutingTablePayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddRoutesToRoutingTablePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddRoutesToRoutingTablePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddRoutesToRoutingTablePayload(val *AddRoutesToRoutingTablePayload) *NullableAddRoutesToRoutingTablePayload { + return &NullableAddRoutesToRoutingTablePayload{value: val, isSet: true} +} + +func (v NullableAddRoutesToRoutingTablePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddRoutesToRoutingTablePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_add_routes_to_routing_table_payload_test.go b/pkg/iaasbeta/model_add_routes_to_routing_table_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_add_routes_to_routing_table_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_add_routing_table_to_area_payload.go b/pkg/iaasbeta/model_add_routing_table_to_area_payload.go new file mode 100644 index 00000000..cb4c92a7 --- /dev/null +++ b/pkg/iaasbeta/model_add_routing_table_to_area_payload.go @@ -0,0 +1,518 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the AddRoutingTableToAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddRoutingTableToAreaPayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type AddRoutingTableToAreaPayloadGetCreatedAtAttributeType = *time.Time +type AddRoutingTableToAreaPayloadGetCreatedAtArgType = time.Time +type AddRoutingTableToAreaPayloadGetCreatedAtRetType = time.Time + +func getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetCreatedAtAttributeType) (ret AddRoutingTableToAreaPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetCreatedAtAttributeType(arg *AddRoutingTableToAreaPayloadGetCreatedAtAttributeType, val AddRoutingTableToAreaPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for default +*/ + +// isBoolean +type AddRoutingTableToAreaPayloadgetDefaultAttributeType = *bool +type AddRoutingTableToAreaPayloadgetDefaultArgType = bool +type AddRoutingTableToAreaPayloadgetDefaultRetType = bool + +func getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetDefaultAttributeType) (ret AddRoutingTableToAreaPayloadgetDefaultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadgetDefaultAttributeType(arg *AddRoutingTableToAreaPayloadgetDefaultAttributeType, val AddRoutingTableToAreaPayloadgetDefaultRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type AddRoutingTableToAreaPayloadGetDescriptionAttributeType = *string + +func getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetDescriptionAttributeType) (ret AddRoutingTableToAreaPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetDescriptionAttributeType(arg *AddRoutingTableToAreaPayloadGetDescriptionAttributeType, val AddRoutingTableToAreaPayloadGetDescriptionRetType) { + *arg = &val +} + +type AddRoutingTableToAreaPayloadGetDescriptionArgType = string +type AddRoutingTableToAreaPayloadGetDescriptionRetType = string + +/* + types and functions for dynamicRoutes +*/ + +// isBoolean +type AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType = *bool +type AddRoutingTableToAreaPayloadgetDynamicRoutesArgType = bool +type AddRoutingTableToAreaPayloadgetDynamicRoutesRetType = bool + +func getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType) (ret AddRoutingTableToAreaPayloadgetDynamicRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType(arg *AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType, val AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type AddRoutingTableToAreaPayloadGetIdAttributeType = *string + +func getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetIdAttributeType) (ret AddRoutingTableToAreaPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetIdAttributeType(arg *AddRoutingTableToAreaPayloadGetIdAttributeType, val AddRoutingTableToAreaPayloadGetIdRetType) { + *arg = &val +} + +type AddRoutingTableToAreaPayloadGetIdArgType = string +type AddRoutingTableToAreaPayloadGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type AddRoutingTableToAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type AddRoutingTableToAreaPayloadGetLabelsArgType = map[string]interface{} +type AddRoutingTableToAreaPayloadGetLabelsRetType = map[string]interface{} + +func getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetLabelsAttributeType) (ret AddRoutingTableToAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetLabelsAttributeType(arg *AddRoutingTableToAreaPayloadGetLabelsAttributeType, val AddRoutingTableToAreaPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type AddRoutingTableToAreaPayloadGetNameAttributeType = *string + +func getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetNameAttributeType) (ret AddRoutingTableToAreaPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetNameAttributeType(arg *AddRoutingTableToAreaPayloadGetNameAttributeType, val AddRoutingTableToAreaPayloadGetNameRetType) { + *arg = &val +} + +type AddRoutingTableToAreaPayloadGetNameArgType = string +type AddRoutingTableToAreaPayloadGetNameRetType = string + +/* + types and functions for systemRoutes +*/ + +// isBoolean +type AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType = *bool +type AddRoutingTableToAreaPayloadgetSystemRoutesArgType = bool +type AddRoutingTableToAreaPayloadgetSystemRoutesRetType = bool + +func getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType) (ret AddRoutingTableToAreaPayloadgetSystemRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadgetSystemRoutesAttributeType(arg *AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType, val AddRoutingTableToAreaPayloadgetSystemRoutesRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType = *time.Time +type AddRoutingTableToAreaPayloadGetUpdatedAtArgType = time.Time +type AddRoutingTableToAreaPayloadGetUpdatedAtRetType = time.Time + +func getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType) (ret AddRoutingTableToAreaPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetUpdatedAtAttributeType(arg *AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType, val AddRoutingTableToAreaPayloadGetUpdatedAtRetType) { + *arg = &val +} + +// AddRoutingTableToAreaPayload An object representing a routing table. +type AddRoutingTableToAreaPayload struct { + // Date-time when resource was created. + CreatedAt AddRoutingTableToAreaPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // This is the default routing table. It can't be deleted and is used if the user does not specify it otherwise. + Default AddRoutingTableToAreaPayloadgetDefaultAttributeType `json:"default,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description AddRoutingTableToAreaPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // A config setting for a routing table which allows propagation of dynamic routes to this routing table. + DynamicRoutes AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"` + // Universally Unique Identifier (UUID). + Id AddRoutingTableToAreaPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels AddRoutingTableToAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name AddRoutingTableToAreaPayloadGetNameAttributeType `json:"name" required:"true"` + // A config setting for a routing table which allows installation of automatic system routes for connectivity between projects in the same SNA. + SystemRoutes AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType `json:"systemRoutes,omitempty"` + // Date-time when resource was last updated. + UpdatedAt AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _AddRoutingTableToAreaPayload AddRoutingTableToAreaPayload + +// NewAddRoutingTableToAreaPayload instantiates a new AddRoutingTableToAreaPayload 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 NewAddRoutingTableToAreaPayload(name AddRoutingTableToAreaPayloadGetNameArgType) *AddRoutingTableToAreaPayload { + this := AddRoutingTableToAreaPayload{} + setAddRoutingTableToAreaPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewAddRoutingTableToAreaPayloadWithDefaults instantiates a new AddRoutingTableToAreaPayload 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 NewAddRoutingTableToAreaPayloadWithDefaults() *AddRoutingTableToAreaPayload { + this := AddRoutingTableToAreaPayload{} + var dynamicRoutes bool = true + this.DynamicRoutes = &dynamicRoutes + var systemRoutes bool = true + this.SystemRoutes = &systemRoutes + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetCreatedAt() (res AddRoutingTableToAreaPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetCreatedAtOk() (ret AddRoutingTableToAreaPayloadGetCreatedAtRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *AddRoutingTableToAreaPayload) SetCreatedAt(v AddRoutingTableToAreaPayloadGetCreatedAtRetType) { + setAddRoutingTableToAreaPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetDefault() (res AddRoutingTableToAreaPayloadgetDefaultRetType) { + res, _ = o.GetDefaultOk() + return +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetDefaultOk() (ret AddRoutingTableToAreaPayloadgetDefaultRetType, ok bool) { + return getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(o.Default) +} + +// HasDefault returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasDefault() bool { + _, ok := o.GetDefaultOk() + return ok +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *AddRoutingTableToAreaPayload) SetDefault(v AddRoutingTableToAreaPayloadgetDefaultRetType) { + setAddRoutingTableToAreaPayloadgetDefaultAttributeType(&o.Default, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetDescription() (res AddRoutingTableToAreaPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetDescriptionOk() (ret AddRoutingTableToAreaPayloadGetDescriptionRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AddRoutingTableToAreaPayload) SetDescription(v AddRoutingTableToAreaPayloadGetDescriptionRetType) { + setAddRoutingTableToAreaPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetDynamicRoutes() (res AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) { + res, _ = o.GetDynamicRoutesOk() + return +} + +// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetDynamicRoutesOk() (ret AddRoutingTableToAreaPayloadgetDynamicRoutesRetType, ok bool) { + return getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes) +} + +// HasDynamicRoutes returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasDynamicRoutes() bool { + _, ok := o.GetDynamicRoutesOk() + return ok +} + +// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field. +func (o *AddRoutingTableToAreaPayload) SetDynamicRoutes(v AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) { + setAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType(&o.DynamicRoutes, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetId() (res AddRoutingTableToAreaPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetIdOk() (ret AddRoutingTableToAreaPayloadGetIdRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AddRoutingTableToAreaPayload) SetId(v AddRoutingTableToAreaPayloadGetIdRetType) { + setAddRoutingTableToAreaPayloadGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetLabels() (res AddRoutingTableToAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetLabelsOk() (ret AddRoutingTableToAreaPayloadGetLabelsRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *AddRoutingTableToAreaPayload) SetLabels(v AddRoutingTableToAreaPayloadGetLabelsRetType) { + setAddRoutingTableToAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *AddRoutingTableToAreaPayload) GetName() (ret AddRoutingTableToAreaPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetNameOk() (ret AddRoutingTableToAreaPayloadGetNameRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *AddRoutingTableToAreaPayload) SetName(v AddRoutingTableToAreaPayloadGetNameRetType) { + setAddRoutingTableToAreaPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetSystemRoutes() (res AddRoutingTableToAreaPayloadgetSystemRoutesRetType) { + res, _ = o.GetSystemRoutesOk() + return +} + +// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetSystemRoutesOk() (ret AddRoutingTableToAreaPayloadgetSystemRoutesRetType, ok bool) { + return getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes) +} + +// HasSystemRoutes returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasSystemRoutes() bool { + _, ok := o.GetSystemRoutesOk() + return ok +} + +// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field. +func (o *AddRoutingTableToAreaPayload) SetSystemRoutes(v AddRoutingTableToAreaPayloadgetSystemRoutesRetType) { + setAddRoutingTableToAreaPayloadgetSystemRoutesAttributeType(&o.SystemRoutes, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetUpdatedAt() (res AddRoutingTableToAreaPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetUpdatedAtOk() (ret AddRoutingTableToAreaPayloadGetUpdatedAtRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *AddRoutingTableToAreaPayload) SetUpdatedAt(v AddRoutingTableToAreaPayloadGetUpdatedAtRetType) { + setAddRoutingTableToAreaPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o AddRoutingTableToAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(o.Default); ok { + toSerialize["Default"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok { + toSerialize["DynamicRoutes"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok { + toSerialize["SystemRoutes"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableAddRoutingTableToAreaPayload struct { + value *AddRoutingTableToAreaPayload + isSet bool +} + +func (v NullableAddRoutingTableToAreaPayload) Get() *AddRoutingTableToAreaPayload { + return v.value +} + +func (v *NullableAddRoutingTableToAreaPayload) Set(val *AddRoutingTableToAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddRoutingTableToAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddRoutingTableToAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddRoutingTableToAreaPayload(val *AddRoutingTableToAreaPayload) *NullableAddRoutingTableToAreaPayload { + return &NullableAddRoutingTableToAreaPayload{value: val, isSet: true} +} + +func (v NullableAddRoutingTableToAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddRoutingTableToAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_add_routing_table_to_area_payload_test.go b/pkg/iaasbeta/model_add_routing_table_to_area_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_add_routing_table_to_area_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_add_volume_to_server_payload.go b/pkg/iaasbeta/model_add_volume_to_server_payload.go new file mode 100644 index 00000000..e6e1e6be --- /dev/null +++ b/pkg/iaasbeta/model_add_volume_to_server_payload.go @@ -0,0 +1,226 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the AddVolumeToServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddVolumeToServerPayload{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type AddVolumeToServerPayloadgetDeleteOnTerminationAttributeType = *bool +type AddVolumeToServerPayloadgetDeleteOnTerminationArgType = bool +type AddVolumeToServerPayloadgetDeleteOnTerminationRetType = bool + +func getAddVolumeToServerPayloadgetDeleteOnTerminationAttributeTypeOk(arg AddVolumeToServerPayloadgetDeleteOnTerminationAttributeType) (ret AddVolumeToServerPayloadgetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddVolumeToServerPayloadgetDeleteOnTerminationAttributeType(arg *AddVolumeToServerPayloadgetDeleteOnTerminationAttributeType, val AddVolumeToServerPayloadgetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for serverId +*/ + +// isNotNullableString +type AddVolumeToServerPayloadGetServerIdAttributeType = *string + +func getAddVolumeToServerPayloadGetServerIdAttributeTypeOk(arg AddVolumeToServerPayloadGetServerIdAttributeType) (ret AddVolumeToServerPayloadGetServerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddVolumeToServerPayloadGetServerIdAttributeType(arg *AddVolumeToServerPayloadGetServerIdAttributeType, val AddVolumeToServerPayloadGetServerIdRetType) { + *arg = &val +} + +type AddVolumeToServerPayloadGetServerIdArgType = string +type AddVolumeToServerPayloadGetServerIdRetType = string + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type AddVolumeToServerPayloadGetVolumeIdAttributeType = *string + +func getAddVolumeToServerPayloadGetVolumeIdAttributeTypeOk(arg AddVolumeToServerPayloadGetVolumeIdAttributeType) (ret AddVolumeToServerPayloadGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddVolumeToServerPayloadGetVolumeIdAttributeType(arg *AddVolumeToServerPayloadGetVolumeIdAttributeType, val AddVolumeToServerPayloadGetVolumeIdRetType) { + *arg = &val +} + +type AddVolumeToServerPayloadGetVolumeIdArgType = string +type AddVolumeToServerPayloadGetVolumeIdRetType = string + +// AddVolumeToServerPayload Object that represents a Volume attachment to a server. +type AddVolumeToServerPayload struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination AddVolumeToServerPayloadgetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + ServerId AddVolumeToServerPayloadGetServerIdAttributeType `json:"serverId,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId AddVolumeToServerPayloadGetVolumeIdAttributeType `json:"volumeId,omitempty"` +} + +// NewAddVolumeToServerPayload instantiates a new AddVolumeToServerPayload 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 NewAddVolumeToServerPayload() *AddVolumeToServerPayload { + this := AddVolumeToServerPayload{} + return &this +} + +// NewAddVolumeToServerPayloadWithDefaults instantiates a new AddVolumeToServerPayload 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 NewAddVolumeToServerPayloadWithDefaults() *AddVolumeToServerPayload { + this := AddVolumeToServerPayload{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *AddVolumeToServerPayload) GetDeleteOnTermination() (res AddVolumeToServerPayloadgetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddVolumeToServerPayload) GetDeleteOnTerminationOk() (ret AddVolumeToServerPayloadgetDeleteOnTerminationRetType, ok bool) { + return getAddVolumeToServerPayloadgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *AddVolumeToServerPayload) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *AddVolumeToServerPayload) SetDeleteOnTermination(v AddVolumeToServerPayloadgetDeleteOnTerminationRetType) { + setAddVolumeToServerPayloadgetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *AddVolumeToServerPayload) GetServerId() (res AddVolumeToServerPayloadGetServerIdRetType) { + res, _ = o.GetServerIdOk() + return +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddVolumeToServerPayload) GetServerIdOk() (ret AddVolumeToServerPayloadGetServerIdRetType, ok bool) { + return getAddVolumeToServerPayloadGetServerIdAttributeTypeOk(o.ServerId) +} + +// HasServerId returns a boolean if a field has been set. +func (o *AddVolumeToServerPayload) HasServerId() bool { + _, ok := o.GetServerIdOk() + return ok +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *AddVolumeToServerPayload) SetServerId(v AddVolumeToServerPayloadGetServerIdRetType) { + setAddVolumeToServerPayloadGetServerIdAttributeType(&o.ServerId, v) +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *AddVolumeToServerPayload) GetVolumeId() (res AddVolumeToServerPayloadGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddVolumeToServerPayload) GetVolumeIdOk() (ret AddVolumeToServerPayloadGetVolumeIdRetType, ok bool) { + return getAddVolumeToServerPayloadGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *AddVolumeToServerPayload) HasVolumeId() bool { + _, ok := o.GetVolumeIdOk() + return ok +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *AddVolumeToServerPayload) SetVolumeId(v AddVolumeToServerPayloadGetVolumeIdRetType) { + setAddVolumeToServerPayloadGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o AddVolumeToServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAddVolumeToServerPayloadgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getAddVolumeToServerPayloadGetServerIdAttributeTypeOk(o.ServerId); ok { + toSerialize["ServerId"] = val + } + if val, ok := getAddVolumeToServerPayloadGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableAddVolumeToServerPayload struct { + value *AddVolumeToServerPayload + isSet bool +} + +func (v NullableAddVolumeToServerPayload) Get() *AddVolumeToServerPayload { + return v.value +} + +func (v *NullableAddVolumeToServerPayload) Set(val *AddVolumeToServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddVolumeToServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddVolumeToServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddVolumeToServerPayload(val *AddVolumeToServerPayload) *NullableAddVolumeToServerPayload { + return &NullableAddVolumeToServerPayload{value: val, isSet: true} +} + +func (v NullableAddVolumeToServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddVolumeToServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_add_volume_to_server_payload_test.go b/pkg/iaasbeta/model_add_volume_to_server_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_add_volume_to_server_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_affinity_group.go b/pkg/iaasbeta/model_affinity_group.go new file mode 100644 index 00000000..67106127 --- /dev/null +++ b/pkg/iaasbeta/model_affinity_group.go @@ -0,0 +1,269 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the AffinityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AffinityGroup{} + +/* + types and functions for id +*/ + +// isNotNullableString +type AffinityGroupGetIdAttributeType = *string + +func getAffinityGroupGetIdAttributeTypeOk(arg AffinityGroupGetIdAttributeType) (ret AffinityGroupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAffinityGroupGetIdAttributeType(arg *AffinityGroupGetIdAttributeType, val AffinityGroupGetIdRetType) { + *arg = &val +} + +type AffinityGroupGetIdArgType = string +type AffinityGroupGetIdRetType = string + +/* + types and functions for members +*/ + +// isArray +type AffinityGroupGetMembersAttributeType = *[]string +type AffinityGroupGetMembersArgType = []string +type AffinityGroupGetMembersRetType = []string + +func getAffinityGroupGetMembersAttributeTypeOk(arg AffinityGroupGetMembersAttributeType) (ret AffinityGroupGetMembersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAffinityGroupGetMembersAttributeType(arg *AffinityGroupGetMembersAttributeType, val AffinityGroupGetMembersRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type AffinityGroupGetNameAttributeType = *string + +func getAffinityGroupGetNameAttributeTypeOk(arg AffinityGroupGetNameAttributeType) (ret AffinityGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAffinityGroupGetNameAttributeType(arg *AffinityGroupGetNameAttributeType, val AffinityGroupGetNameRetType) { + *arg = &val +} + +type AffinityGroupGetNameArgType = string +type AffinityGroupGetNameRetType = string + +/* + types and functions for policy +*/ + +// isNotNullableString +type AffinityGroupGetPolicyAttributeType = *string + +func getAffinityGroupGetPolicyAttributeTypeOk(arg AffinityGroupGetPolicyAttributeType) (ret AffinityGroupGetPolicyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAffinityGroupGetPolicyAttributeType(arg *AffinityGroupGetPolicyAttributeType, val AffinityGroupGetPolicyRetType) { + *arg = &val +} + +type AffinityGroupGetPolicyArgType = string +type AffinityGroupGetPolicyRetType = string + +// AffinityGroup Definition of an affinity group. +type AffinityGroup struct { + // Universally Unique Identifier (UUID). + Id AffinityGroupGetIdAttributeType `json:"id,omitempty"` + // The servers that are part of the affinity group. + Members AffinityGroupGetMembersAttributeType `json:"members,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name AffinityGroupGetNameAttributeType `json:"name" required:"true"` + // The affinity group policy. `hard-affinity`: All servers in this group will be hosted on the same compute node. `soft-affinity`: All servers in this group will be hosted on as few compute nodes as possible. `hard-anti-affinity`: All servers in this group will be hosted on different compute nodes. `soft-anti-affinity`: All servers in this group will be hosted on as many compute nodes as possible. Possible values: `hard-anti-affinity`, `hard-affinity`, `soft-anti-affinity`, `soft-affinity`. + // REQUIRED + Policy AffinityGroupGetPolicyAttributeType `json:"policy" required:"true"` +} + +type _AffinityGroup AffinityGroup + +// NewAffinityGroup instantiates a new AffinityGroup 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 NewAffinityGroup(name AffinityGroupGetNameArgType, policy AffinityGroupGetPolicyArgType) *AffinityGroup { + this := AffinityGroup{} + setAffinityGroupGetNameAttributeType(&this.Name, name) + setAffinityGroupGetPolicyAttributeType(&this.Policy, policy) + return &this +} + +// NewAffinityGroupWithDefaults instantiates a new AffinityGroup 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 NewAffinityGroupWithDefaults() *AffinityGroup { + this := AffinityGroup{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AffinityGroup) GetId() (res AffinityGroupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetIdOk() (ret AffinityGroupGetIdRetType, ok bool) { + return getAffinityGroupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *AffinityGroup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AffinityGroup) SetId(v AffinityGroupGetIdRetType) { + setAffinityGroupGetIdAttributeType(&o.Id, v) +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *AffinityGroup) GetMembers() (res AffinityGroupGetMembersRetType) { + res, _ = o.GetMembersOk() + return +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetMembersOk() (ret AffinityGroupGetMembersRetType, ok bool) { + return getAffinityGroupGetMembersAttributeTypeOk(o.Members) +} + +// HasMembers returns a boolean if a field has been set. +func (o *AffinityGroup) HasMembers() bool { + _, ok := o.GetMembersOk() + return ok +} + +// SetMembers gets a reference to the given []string and assigns it to the Members field. +func (o *AffinityGroup) SetMembers(v AffinityGroupGetMembersRetType) { + setAffinityGroupGetMembersAttributeType(&o.Members, v) +} + +// GetName returns the Name field value +func (o *AffinityGroup) GetName() (ret AffinityGroupGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetNameOk() (ret AffinityGroupGetNameRetType, ok bool) { + return getAffinityGroupGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *AffinityGroup) SetName(v AffinityGroupGetNameRetType) { + setAffinityGroupGetNameAttributeType(&o.Name, v) +} + +// GetPolicy returns the Policy field value +func (o *AffinityGroup) GetPolicy() (ret AffinityGroupGetPolicyRetType) { + ret, _ = o.GetPolicyOk() + return ret +} + +// GetPolicyOk returns a tuple with the Policy field value +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetPolicyOk() (ret AffinityGroupGetPolicyRetType, ok bool) { + return getAffinityGroupGetPolicyAttributeTypeOk(o.Policy) +} + +// SetPolicy sets field value +func (o *AffinityGroup) SetPolicy(v AffinityGroupGetPolicyRetType) { + setAffinityGroupGetPolicyAttributeType(&o.Policy, v) +} + +func (o AffinityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAffinityGroupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getAffinityGroupGetMembersAttributeTypeOk(o.Members); ok { + toSerialize["Members"] = val + } + if val, ok := getAffinityGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getAffinityGroupGetPolicyAttributeTypeOk(o.Policy); ok { + toSerialize["Policy"] = val + } + return toSerialize, nil +} + +type NullableAffinityGroup struct { + value *AffinityGroup + isSet bool +} + +func (v NullableAffinityGroup) Get() *AffinityGroup { + return v.value +} + +func (v *NullableAffinityGroup) Set(val *AffinityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableAffinityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableAffinityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAffinityGroup(val *AffinityGroup) *NullableAffinityGroup { + return &NullableAffinityGroup{value: val, isSet: true} +} + +func (v NullableAffinityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAffinityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_affinity_group_list_response.go b/pkg/iaasbeta/model_affinity_group_list_response.go new file mode 100644 index 00000000..5a0ca722 --- /dev/null +++ b/pkg/iaasbeta/model_affinity_group_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the AffinityGroupListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AffinityGroupListResponse{} + +/* + types and functions for items +*/ + +// isArray +type AffinityGroupListResponseGetItemsAttributeType = *[]AffinityGroup +type AffinityGroupListResponseGetItemsArgType = []AffinityGroup +type AffinityGroupListResponseGetItemsRetType = []AffinityGroup + +func getAffinityGroupListResponseGetItemsAttributeTypeOk(arg AffinityGroupListResponseGetItemsAttributeType) (ret AffinityGroupListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAffinityGroupListResponseGetItemsAttributeType(arg *AffinityGroupListResponseGetItemsAttributeType, val AffinityGroupListResponseGetItemsRetType) { + *arg = &val +} + +// AffinityGroupListResponse Response object for affinity group list request. +type AffinityGroupListResponse struct { + // A list of affinity groups. + // REQUIRED + Items AffinityGroupListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _AffinityGroupListResponse AffinityGroupListResponse + +// NewAffinityGroupListResponse instantiates a new AffinityGroupListResponse 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 NewAffinityGroupListResponse(items AffinityGroupListResponseGetItemsArgType) *AffinityGroupListResponse { + this := AffinityGroupListResponse{} + setAffinityGroupListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewAffinityGroupListResponseWithDefaults instantiates a new AffinityGroupListResponse 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 NewAffinityGroupListResponseWithDefaults() *AffinityGroupListResponse { + this := AffinityGroupListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *AffinityGroupListResponse) GetItems() (ret AffinityGroupListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *AffinityGroupListResponse) GetItemsOk() (ret AffinityGroupListResponseGetItemsRetType, ok bool) { + return getAffinityGroupListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *AffinityGroupListResponse) SetItems(v AffinityGroupListResponseGetItemsRetType) { + setAffinityGroupListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o AffinityGroupListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAffinityGroupListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableAffinityGroupListResponse struct { + value *AffinityGroupListResponse + isSet bool +} + +func (v NullableAffinityGroupListResponse) Get() *AffinityGroupListResponse { + return v.value +} + +func (v *NullableAffinityGroupListResponse) Set(val *AffinityGroupListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAffinityGroupListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAffinityGroupListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAffinityGroupListResponse(val *AffinityGroupListResponse) *NullableAffinityGroupListResponse { + return &NullableAffinityGroupListResponse{value: val, isSet: true} +} + +func (v NullableAffinityGroupListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAffinityGroupListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_affinity_group_list_response_test.go b/pkg/iaasbeta/model_affinity_group_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_affinity_group_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_affinity_group_test.go b/pkg/iaasbeta/model_affinity_group_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_affinity_group_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_allowed_addresses_inner.go b/pkg/iaasbeta/model_allowed_addresses_inner.go new file mode 100644 index 00000000..d7a7fdee --- /dev/null +++ b/pkg/iaasbeta/model_allowed_addresses_inner.go @@ -0,0 +1,138 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "fmt" + "regexp" +) + +// AllowedAddressesInner - struct for AllowedAddressesInner +type AllowedAddressesInner struct { + String *string +} + +// stringAsAllowedAddressesInner is a convenience function that returns string wrapped in AllowedAddressesInner +func StringAsAllowedAddressesInner(v *string) AllowedAddressesInner { + return AllowedAddressesInner{ + String: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *AllowedAddressesInner) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into String + dstAllowedAddressesInner1 := &AllowedAddressesInner{} + err = json.Unmarshal(data, &dstAllowedAddressesInner1.String) + if err == nil { + jsonString, _ := json.Marshal(&dstAllowedAddressesInner1.String) + regex := `/((^\\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\\s*$)|(^\\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$))/` + regex = regexp.MustCompile("^\\/|\\/$").ReplaceAllString(regex, "$1") // Remove beginning slash and ending slash + regex = regexp.MustCompile("\\\\(.)").ReplaceAllString(regex, "$1") // Remove duplicate escaping char for dots + rawString := regexp.MustCompile(`^"|"$`).ReplaceAllString(*dstAllowedAddressesInner1.String, "$1") // Remove quotes + isMatched, _ := regexp.MatchString(regex, rawString) + if string(jsonString) != "{}" && isMatched { // empty struct + dst.String = dstAllowedAddressesInner1.String + match++ + } + } + + // try to unmarshal data into String + dstAllowedAddressesInner2 := &AllowedAddressesInner{} + err = json.Unmarshal(data, &dstAllowedAddressesInner2.String) + if err == nil { + jsonString, _ := json.Marshal(&dstAllowedAddressesInner2.String) + regex := `/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/(3[0-2]|2[0-9]|1[0-9]|[0-9]))$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(\/((1(1[0-9]|2[0-8]))|([0-9][0-9])|([0-9])))?$/` + regex = regexp.MustCompile("^\\/|\\/$").ReplaceAllString(regex, "$1") // Remove beginning slash and ending slash + regex = regexp.MustCompile("\\\\(.)").ReplaceAllString(regex, "$1") // Remove duplicate escaping char for dots + rawString := regexp.MustCompile(`^"|"$`).ReplaceAllString(*dstAllowedAddressesInner2.String, "$1") // Remove quotes + isMatched, _ := regexp.MatchString(regex, rawString) + if string(jsonString) != "{}" && isMatched { // empty struct + dst.String = dstAllowedAddressesInner2.String + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(AllowedAddressesInner)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(AllowedAddressesInner)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src AllowedAddressesInner) MarshalJSON() ([]byte, error) { + if src.String != nil { + return json.Marshal(&src.String) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *AllowedAddressesInner) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +type NullableAllowedAddressesInner struct { + value *AllowedAddressesInner + isSet bool +} + +func (v NullableAllowedAddressesInner) Get() *AllowedAddressesInner { + return v.value +} + +func (v *NullableAllowedAddressesInner) Set(val *AllowedAddressesInner) { + v.value = val + v.isSet = true +} + +func (v NullableAllowedAddressesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableAllowedAddressesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAllowedAddressesInner(val *AllowedAddressesInner) *NullableAllowedAddressesInner { + return &NullableAllowedAddressesInner{value: val, isSet: true} +} + +func (v NullableAllowedAddressesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAllowedAddressesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_allowed_addresses_inner_test.go b/pkg/iaasbeta/model_allowed_addresses_inner_test.go new file mode 100644 index 00000000..a2fd68f6 --- /dev/null +++ b/pkg/iaasbeta/model_allowed_addresses_inner_test.go @@ -0,0 +1,60 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "testing" +) + +// isOneOf + +func TestAllowedAddressesInner_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + + { + name: "success - string 10.1.2.10", + args: args{ + src: []byte(`"10.1.2.10"`), + }, + wantErr: false, + }, + + { + name: "success - string 192.168.0.0/24", + args: args{ + src: []byte(`"192.168.0.0/24"`), + }, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := &AllowedAddressesInner{} + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + marshalJson, err := v.MarshalJSON() + if err != nil { + t.Fatalf("failed marshalling AllowedAddressesInner: %v", err) + } + if string(marshalJson) != string(tt.args.src) { + t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson) + } + }) + } +} diff --git a/pkg/iaasbeta/model_area_id.go b/pkg/iaasbeta/model_area_id.go new file mode 100644 index 00000000..204d1ee0 --- /dev/null +++ b/pkg/iaasbeta/model_area_id.go @@ -0,0 +1,150 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "fmt" + "regexp" +) + +// AreaId - The identifier (ID) of an area. +type AreaId struct { + StaticAreaID *StaticAreaID + String *string +} + +// StaticAreaIDAsAreaId is a convenience function that returns StaticAreaID wrapped in AreaId +func StaticAreaIDAsAreaId(v *StaticAreaID) AreaId { + return AreaId{ + StaticAreaID: v, + } +} + +// stringAsAreaId is a convenience function that returns string wrapped in AreaId +func StringAsAreaId(v *string) AreaId { + return AreaId{ + String: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *AreaId) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into String + dstAreaId1 := &AreaId{} + err = json.Unmarshal(data, &dstAreaId1.String) + if err == nil { + jsonString, _ := json.Marshal(&dstAreaId1.String) + regex := `/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/` + regex = regexp.MustCompile("^\\/|\\/$").ReplaceAllString(regex, "$1") // Remove beginning slash and ending slash + regex = regexp.MustCompile("\\\\(.)").ReplaceAllString(regex, "$1") // Remove duplicate escaping char for dots + rawString := regexp.MustCompile(`^"|"$`).ReplaceAllString(*dstAreaId1.String, "$1") // Remove quotes + isMatched, _ := regexp.MatchString(regex, rawString) + if string(jsonString) != "{}" && isMatched { // empty struct + dst.String = dstAreaId1.String + match++ + } + } + + // try to unmarshal data into StaticAreaID + dstAreaId2 := &AreaId{} + err = json.Unmarshal(data, &dstAreaId2.StaticAreaID) + if err == nil { + jsonStaticAreaID, _ := json.Marshal(&dstAreaId2.StaticAreaID) + if string(jsonStaticAreaID) != "{}" { // empty struct + dst.StaticAreaID = dstAreaId2.StaticAreaID + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.StaticAreaID = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(AreaId)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(AreaId)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src AreaId) MarshalJSON() ([]byte, error) { + if src.StaticAreaID != nil { + return json.Marshal(&src.StaticAreaID) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *AreaId) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.StaticAreaID != nil { + return obj.StaticAreaID + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +type NullableAreaId struct { + value *AreaId + isSet bool +} + +func (v NullableAreaId) Get() *AreaId { + return v.value +} + +func (v *NullableAreaId) Set(val *AreaId) { + v.value = val + v.isSet = true +} + +func (v NullableAreaId) IsSet() bool { + return v.isSet +} + +func (v *NullableAreaId) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAreaId(val *AreaId) *NullableAreaId { + return &NullableAreaId{value: val, isSet: true} +} + +func (v NullableAreaId) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAreaId) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_area_id_test.go b/pkg/iaasbeta/model_area_id_test.go new file mode 100644 index 00000000..0332c71e --- /dev/null +++ b/pkg/iaasbeta/model_area_id_test.go @@ -0,0 +1,67 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "testing" +) + +// isOneOf + +func TestAreaId_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + + { + name: "success - string d61a8564-c8dd-4ffb-bc15-143e7d0c85ed", + args: args{ + src: []byte(`"d61a8564-c8dd-4ffb-bc15-143e7d0c85ed"`), + }, + wantErr: false, + }, + + { + name: "success - StaticAreaID PUBLIC", + args: args{ + src: []byte(`"PUBLIC"`), + }, + wantErr: false, + }, + { + name: "success - StaticAreaID SCHWARZ", + args: args{ + src: []byte(`"SCHWARZ"`), + }, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := &AreaId{} + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + marshalJson, err := v.MarshalJSON() + if err != nil { + t.Fatalf("failed marshalling AreaId: %v", err) + } + if string(marshalJson) != string(tt.args.src) { + t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson) + } + }) + } +} diff --git a/pkg/iaasbeta/model_availability_zone_list_response.go b/pkg/iaasbeta/model_availability_zone_list_response.go new file mode 100644 index 00000000..1f9ecbb3 --- /dev/null +++ b/pkg/iaasbeta/model_availability_zone_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the AvailabilityZoneListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AvailabilityZoneListResponse{} + +/* + types and functions for items +*/ + +// isArray +type AvailabilityZoneListResponseGetItemsAttributeType = *[]string +type AvailabilityZoneListResponseGetItemsArgType = []string +type AvailabilityZoneListResponseGetItemsRetType = []string + +func getAvailabilityZoneListResponseGetItemsAttributeTypeOk(arg AvailabilityZoneListResponseGetItemsAttributeType) (ret AvailabilityZoneListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAvailabilityZoneListResponseGetItemsAttributeType(arg *AvailabilityZoneListResponseGetItemsAttributeType, val AvailabilityZoneListResponseGetItemsRetType) { + *arg = &val +} + +// AvailabilityZoneListResponse Availability Zone list response. +type AvailabilityZoneListResponse struct { + // A list of availability zones. + // REQUIRED + Items AvailabilityZoneListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _AvailabilityZoneListResponse AvailabilityZoneListResponse + +// NewAvailabilityZoneListResponse instantiates a new AvailabilityZoneListResponse 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 NewAvailabilityZoneListResponse(items AvailabilityZoneListResponseGetItemsArgType) *AvailabilityZoneListResponse { + this := AvailabilityZoneListResponse{} + setAvailabilityZoneListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewAvailabilityZoneListResponseWithDefaults instantiates a new AvailabilityZoneListResponse 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 NewAvailabilityZoneListResponseWithDefaults() *AvailabilityZoneListResponse { + this := AvailabilityZoneListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *AvailabilityZoneListResponse) GetItems() (ret AvailabilityZoneListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *AvailabilityZoneListResponse) GetItemsOk() (ret AvailabilityZoneListResponseGetItemsRetType, ok bool) { + return getAvailabilityZoneListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *AvailabilityZoneListResponse) SetItems(v AvailabilityZoneListResponseGetItemsRetType) { + setAvailabilityZoneListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o AvailabilityZoneListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAvailabilityZoneListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableAvailabilityZoneListResponse struct { + value *AvailabilityZoneListResponse + isSet bool +} + +func (v NullableAvailabilityZoneListResponse) Get() *AvailabilityZoneListResponse { + return v.value +} + +func (v *NullableAvailabilityZoneListResponse) Set(val *AvailabilityZoneListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAvailabilityZoneListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAvailabilityZoneListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAvailabilityZoneListResponse(val *AvailabilityZoneListResponse) *NullableAvailabilityZoneListResponse { + return &NullableAvailabilityZoneListResponse{value: val, isSet: true} +} + +func (v NullableAvailabilityZoneListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAvailabilityZoneListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_availability_zone_list_response_test.go b/pkg/iaasbeta/model_availability_zone_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_availability_zone_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_backup.go b/pkg/iaasbeta/model_backup.go new file mode 100644 index 00000000..f9a35fed --- /dev/null +++ b/pkg/iaasbeta/model_backup.go @@ -0,0 +1,615 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Backup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Backup{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type BackupGetAvailabilityZoneAttributeType = *string + +func getBackupGetAvailabilityZoneAttributeTypeOk(arg BackupGetAvailabilityZoneAttributeType) (ret BackupGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetAvailabilityZoneAttributeType(arg *BackupGetAvailabilityZoneAttributeType, val BackupGetAvailabilityZoneRetType) { + *arg = &val +} + +type BackupGetAvailabilityZoneArgType = string +type BackupGetAvailabilityZoneRetType = string + +/* + types and functions for createdAt +*/ + +// isDateTime +type BackupGetCreatedAtAttributeType = *time.Time +type BackupGetCreatedAtArgType = time.Time +type BackupGetCreatedAtRetType = time.Time + +func getBackupGetCreatedAtAttributeTypeOk(arg BackupGetCreatedAtAttributeType) (ret BackupGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetCreatedAtAttributeType(arg *BackupGetCreatedAtAttributeType, val BackupGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for encrypted +*/ + +// isBoolean +type BackupgetEncryptedAttributeType = *bool +type BackupgetEncryptedArgType = bool +type BackupgetEncryptedRetType = bool + +func getBackupgetEncryptedAttributeTypeOk(arg BackupgetEncryptedAttributeType) (ret BackupgetEncryptedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupgetEncryptedAttributeType(arg *BackupgetEncryptedAttributeType, val BackupgetEncryptedRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type BackupGetIdAttributeType = *string + +func getBackupGetIdAttributeTypeOk(arg BackupGetIdAttributeType) (ret BackupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetIdAttributeType(arg *BackupGetIdAttributeType, val BackupGetIdRetType) { + *arg = &val +} + +type BackupGetIdArgType = string +type BackupGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type BackupGetLabelsAttributeType = *map[string]interface{} +type BackupGetLabelsArgType = map[string]interface{} +type BackupGetLabelsRetType = map[string]interface{} + +func getBackupGetLabelsAttributeTypeOk(arg BackupGetLabelsAttributeType) (ret BackupGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetLabelsAttributeType(arg *BackupGetLabelsAttributeType, val BackupGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type BackupGetNameAttributeType = *string + +func getBackupGetNameAttributeTypeOk(arg BackupGetNameAttributeType) (ret BackupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetNameAttributeType(arg *BackupGetNameAttributeType, val BackupGetNameRetType) { + *arg = &val +} + +type BackupGetNameArgType = string +type BackupGetNameRetType = string + +/* + types and functions for size +*/ + +// isLong +type BackupGetSizeAttributeType = *int64 +type BackupGetSizeArgType = int64 +type BackupGetSizeRetType = int64 + +func getBackupGetSizeAttributeTypeOk(arg BackupGetSizeAttributeType) (ret BackupGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetSizeAttributeType(arg *BackupGetSizeAttributeType, val BackupGetSizeRetType) { + *arg = &val +} + +/* + types and functions for snapshotId +*/ + +// isNotNullableString +type BackupGetSnapshotIdAttributeType = *string + +func getBackupGetSnapshotIdAttributeTypeOk(arg BackupGetSnapshotIdAttributeType) (ret BackupGetSnapshotIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetSnapshotIdAttributeType(arg *BackupGetSnapshotIdAttributeType, val BackupGetSnapshotIdRetType) { + *arg = &val +} + +type BackupGetSnapshotIdArgType = string +type BackupGetSnapshotIdRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type BackupGetStatusAttributeType = *string + +func getBackupGetStatusAttributeTypeOk(arg BackupGetStatusAttributeType) (ret BackupGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetStatusAttributeType(arg *BackupGetStatusAttributeType, val BackupGetStatusRetType) { + *arg = &val +} + +type BackupGetStatusArgType = string +type BackupGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type BackupGetUpdatedAtAttributeType = *time.Time +type BackupGetUpdatedAtArgType = time.Time +type BackupGetUpdatedAtRetType = time.Time + +func getBackupGetUpdatedAtAttributeTypeOk(arg BackupGetUpdatedAtAttributeType) (ret BackupGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetUpdatedAtAttributeType(arg *BackupGetUpdatedAtAttributeType, val BackupGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type BackupGetVolumeIdAttributeType = *string + +func getBackupGetVolumeIdAttributeTypeOk(arg BackupGetVolumeIdAttributeType) (ret BackupGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetVolumeIdAttributeType(arg *BackupGetVolumeIdAttributeType, val BackupGetVolumeIdRetType) { + *arg = &val +} + +type BackupGetVolumeIdArgType = string +type BackupGetVolumeIdRetType = string + +// Backup Object that represents a backup. +type Backup struct { + // Object that represents an availability zone. + AvailabilityZone BackupGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + // Date-time when resource was created. + CreatedAt BackupGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Indicates if a volume is encrypted. + Encrypted BackupgetEncryptedAttributeType `json:"encrypted,omitempty"` + // Universally Unique Identifier (UUID). + Id BackupGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels BackupGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name BackupGetNameAttributeType `json:"name,omitempty"` + // Size in Gigabyte. + Size BackupGetSizeAttributeType `json:"size,omitempty"` + // Universally Unique Identifier (UUID). + SnapshotId BackupGetSnapshotIdAttributeType `json:"snapshotId,omitempty"` + // The status of a backup object. Possible values: `AVAILABLE`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`. + Status BackupGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt BackupGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId BackupGetVolumeIdAttributeType `json:"volumeId,omitempty"` +} + +// NewBackup instantiates a new Backup 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 NewBackup() *Backup { + this := Backup{} + return &this +} + +// NewBackupWithDefaults instantiates a new Backup 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 NewBackupWithDefaults() *Backup { + this := Backup{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *Backup) GetAvailabilityZone() (res BackupGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetAvailabilityZoneOk() (ret BackupGetAvailabilityZoneRetType, ok bool) { + return getBackupGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *Backup) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *Backup) SetAvailabilityZone(v BackupGetAvailabilityZoneRetType) { + setBackupGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Backup) GetCreatedAt() (res BackupGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetCreatedAtOk() (ret BackupGetCreatedAtRetType, ok bool) { + return getBackupGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Backup) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Backup) SetCreatedAt(v BackupGetCreatedAtRetType) { + setBackupGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetEncrypted returns the Encrypted field value if set, zero value otherwise. +func (o *Backup) GetEncrypted() (res BackupgetEncryptedRetType) { + res, _ = o.GetEncryptedOk() + return +} + +// GetEncryptedOk returns a tuple with the Encrypted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetEncryptedOk() (ret BackupgetEncryptedRetType, ok bool) { + return getBackupgetEncryptedAttributeTypeOk(o.Encrypted) +} + +// HasEncrypted returns a boolean if a field has been set. +func (o *Backup) HasEncrypted() bool { + _, ok := o.GetEncryptedOk() + return ok +} + +// SetEncrypted gets a reference to the given bool and assigns it to the Encrypted field. +func (o *Backup) SetEncrypted(v BackupgetEncryptedRetType) { + setBackupgetEncryptedAttributeType(&o.Encrypted, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Backup) GetId() (res BackupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetIdOk() (ret BackupGetIdRetType, ok bool) { + return getBackupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Backup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Backup) SetId(v BackupGetIdRetType) { + setBackupGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Backup) GetLabels() (res BackupGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetLabelsOk() (ret BackupGetLabelsRetType, ok bool) { + return getBackupGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Backup) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Backup) SetLabels(v BackupGetLabelsRetType) { + setBackupGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Backup) GetName() (res BackupGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetNameOk() (ret BackupGetNameRetType, ok bool) { + return getBackupGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Backup) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Backup) SetName(v BackupGetNameRetType) { + setBackupGetNameAttributeType(&o.Name, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Backup) GetSize() (res BackupGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetSizeOk() (ret BackupGetSizeRetType, ok bool) { + return getBackupGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *Backup) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Backup) SetSize(v BackupGetSizeRetType) { + setBackupGetSizeAttributeType(&o.Size, v) +} + +// GetSnapshotId returns the SnapshotId field value if set, zero value otherwise. +func (o *Backup) GetSnapshotId() (res BackupGetSnapshotIdRetType) { + res, _ = o.GetSnapshotIdOk() + return +} + +// GetSnapshotIdOk returns a tuple with the SnapshotId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetSnapshotIdOk() (ret BackupGetSnapshotIdRetType, ok bool) { + return getBackupGetSnapshotIdAttributeTypeOk(o.SnapshotId) +} + +// HasSnapshotId returns a boolean if a field has been set. +func (o *Backup) HasSnapshotId() bool { + _, ok := o.GetSnapshotIdOk() + return ok +} + +// SetSnapshotId gets a reference to the given string and assigns it to the SnapshotId field. +func (o *Backup) SetSnapshotId(v BackupGetSnapshotIdRetType) { + setBackupGetSnapshotIdAttributeType(&o.SnapshotId, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Backup) GetStatus() (res BackupGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetStatusOk() (ret BackupGetStatusRetType, ok bool) { + return getBackupGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Backup) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Backup) SetStatus(v BackupGetStatusRetType) { + setBackupGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Backup) GetUpdatedAt() (res BackupGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetUpdatedAtOk() (ret BackupGetUpdatedAtRetType, ok bool) { + return getBackupGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Backup) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Backup) SetUpdatedAt(v BackupGetUpdatedAtRetType) { + setBackupGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *Backup) GetVolumeId() (res BackupGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetVolumeIdOk() (ret BackupGetVolumeIdRetType, ok bool) { + return getBackupGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *Backup) HasVolumeId() bool { + _, ok := o.GetVolumeIdOk() + return ok +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *Backup) SetVolumeId(v BackupGetVolumeIdRetType) { + setBackupGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o Backup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBackupGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getBackupGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getBackupgetEncryptedAttributeTypeOk(o.Encrypted); ok { + toSerialize["Encrypted"] = val + } + if val, ok := getBackupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBackupGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getBackupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getBackupGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getBackupGetSnapshotIdAttributeTypeOk(o.SnapshotId); ok { + toSerialize["SnapshotId"] = val + } + if val, ok := getBackupGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getBackupGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getBackupGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableBackup struct { + value *Backup + isSet bool +} + +func (v NullableBackup) Get() *Backup { + return v.value +} + +func (v *NullableBackup) Set(val *Backup) { + v.value = val + v.isSet = true +} + +func (v NullableBackup) IsSet() bool { + return v.isSet +} + +func (v *NullableBackup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackup(val *Backup) *NullableBackup { + return &NullableBackup{value: val, isSet: true} +} + +func (v NullableBackup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_backup_list_response.go b/pkg/iaasbeta/model_backup_list_response.go new file mode 100644 index 00000000..c9138b74 --- /dev/null +++ b/pkg/iaasbeta/model_backup_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the BackupListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupListResponse{} + +/* + types and functions for items +*/ + +// isArray +type BackupListResponseGetItemsAttributeType = *[]Backup +type BackupListResponseGetItemsArgType = []Backup +type BackupListResponseGetItemsRetType = []Backup + +func getBackupListResponseGetItemsAttributeTypeOk(arg BackupListResponseGetItemsAttributeType) (ret BackupListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupListResponseGetItemsAttributeType(arg *BackupListResponseGetItemsAttributeType, val BackupListResponseGetItemsRetType) { + *arg = &val +} + +// BackupListResponse Backup list response. +type BackupListResponse struct { + // A list containing backup objects. + // REQUIRED + Items BackupListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _BackupListResponse BackupListResponse + +// NewBackupListResponse instantiates a new BackupListResponse 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 NewBackupListResponse(items BackupListResponseGetItemsArgType) *BackupListResponse { + this := BackupListResponse{} + setBackupListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewBackupListResponseWithDefaults instantiates a new BackupListResponse 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 NewBackupListResponseWithDefaults() *BackupListResponse { + this := BackupListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *BackupListResponse) GetItems() (ret BackupListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *BackupListResponse) GetItemsOk() (ret BackupListResponseGetItemsRetType, ok bool) { + return getBackupListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *BackupListResponse) SetItems(v BackupListResponseGetItemsRetType) { + setBackupListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o BackupListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBackupListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableBackupListResponse struct { + value *BackupListResponse + isSet bool +} + +func (v NullableBackupListResponse) Get() *BackupListResponse { + return v.value +} + +func (v *NullableBackupListResponse) Set(val *BackupListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBackupListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupListResponse(val *BackupListResponse) *NullableBackupListResponse { + return &NullableBackupListResponse{value: val, isSet: true} +} + +func (v NullableBackupListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_backup_list_response_test.go b/pkg/iaasbeta/model_backup_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_backup_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_backup_source.go b/pkg/iaasbeta/model_backup_source.go new file mode 100644 index 00000000..6fc45073 --- /dev/null +++ b/pkg/iaasbeta/model_backup_source.go @@ -0,0 +1,172 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the BackupSource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupSource{} + +/* + types and functions for id +*/ + +// isNotNullableString +type BackupSourceGetIdAttributeType = *string + +func getBackupSourceGetIdAttributeTypeOk(arg BackupSourceGetIdAttributeType) (ret BackupSourceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupSourceGetIdAttributeType(arg *BackupSourceGetIdAttributeType, val BackupSourceGetIdRetType) { + *arg = &val +} + +type BackupSourceGetIdArgType = string +type BackupSourceGetIdRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type BackupSourceGetTypeAttributeType = *string + +func getBackupSourceGetTypeAttributeTypeOk(arg BackupSourceGetTypeAttributeType) (ret BackupSourceGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupSourceGetTypeAttributeType(arg *BackupSourceGetTypeAttributeType, val BackupSourceGetTypeRetType) { + *arg = &val +} + +type BackupSourceGetTypeArgType = string +type BackupSourceGetTypeRetType = string + +// BackupSource The source object of a backup. +type BackupSource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id BackupSourceGetIdAttributeType `json:"id" required:"true"` + // The source types of a backup. Possible values: `volume`, `snapshot`. + // REQUIRED + Type BackupSourceGetTypeAttributeType `json:"type" required:"true"` +} + +type _BackupSource BackupSource + +// NewBackupSource instantiates a new BackupSource 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 NewBackupSource(id BackupSourceGetIdArgType, types BackupSourceGetTypeArgType) *BackupSource { + this := BackupSource{} + setBackupSourceGetIdAttributeType(&this.Id, id) + setBackupSourceGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewBackupSourceWithDefaults instantiates a new BackupSource 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 NewBackupSourceWithDefaults() *BackupSource { + this := BackupSource{} + return &this +} + +// GetId returns the Id field value +func (o *BackupSource) GetId() (ret BackupSourceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *BackupSource) GetIdOk() (ret BackupSourceGetIdRetType, ok bool) { + return getBackupSourceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *BackupSource) SetId(v BackupSourceGetIdRetType) { + setBackupSourceGetIdAttributeType(&o.Id, v) +} + +// GetType returns the Type field value +func (o *BackupSource) GetType() (ret BackupSourceGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *BackupSource) GetTypeOk() (ret BackupSourceGetTypeRetType, ok bool) { + return getBackupSourceGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *BackupSource) SetType(v BackupSourceGetTypeRetType) { + setBackupSourceGetTypeAttributeType(&o.Type, v) +} + +func (o BackupSource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBackupSourceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBackupSourceGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableBackupSource struct { + value *BackupSource + isSet bool +} + +func (v NullableBackupSource) Get() *BackupSource { + return v.value +} + +func (v *NullableBackupSource) Set(val *BackupSource) { + v.value = val + v.isSet = true +} + +func (v NullableBackupSource) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupSource(val *BackupSource) *NullableBackupSource { + return &NullableBackupSource{value: val, isSet: true} +} + +func (v NullableBackupSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_backup_source_test.go b/pkg/iaasbeta/model_backup_source_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_backup_source_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_backup_test.go b/pkg/iaasbeta/model_backup_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_backup_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_base_security_group_rule.go b/pkg/iaasbeta/model_base_security_group_rule.go new file mode 100644 index 00000000..38142de9 --- /dev/null +++ b/pkg/iaasbeta/model_base_security_group_rule.go @@ -0,0 +1,614 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the BaseSecurityGroupRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseSecurityGroupRule{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type BaseSecurityGroupRuleGetCreatedAtAttributeType = *time.Time +type BaseSecurityGroupRuleGetCreatedAtArgType = time.Time +type BaseSecurityGroupRuleGetCreatedAtRetType = time.Time + +func getBaseSecurityGroupRuleGetCreatedAtAttributeTypeOk(arg BaseSecurityGroupRuleGetCreatedAtAttributeType) (ret BaseSecurityGroupRuleGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetCreatedAtAttributeType(arg *BaseSecurityGroupRuleGetCreatedAtAttributeType, val BaseSecurityGroupRuleGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetDescriptionAttributeType = *string + +func getBaseSecurityGroupRuleGetDescriptionAttributeTypeOk(arg BaseSecurityGroupRuleGetDescriptionAttributeType) (ret BaseSecurityGroupRuleGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetDescriptionAttributeType(arg *BaseSecurityGroupRuleGetDescriptionAttributeType, val BaseSecurityGroupRuleGetDescriptionRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetDescriptionArgType = string +type BaseSecurityGroupRuleGetDescriptionRetType = string + +/* + types and functions for direction +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetDirectionAttributeType = *string + +func getBaseSecurityGroupRuleGetDirectionAttributeTypeOk(arg BaseSecurityGroupRuleGetDirectionAttributeType) (ret BaseSecurityGroupRuleGetDirectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetDirectionAttributeType(arg *BaseSecurityGroupRuleGetDirectionAttributeType, val BaseSecurityGroupRuleGetDirectionRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetDirectionArgType = string +type BaseSecurityGroupRuleGetDirectionRetType = string + +/* + types and functions for ethertype +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetEthertypeAttributeType = *string + +func getBaseSecurityGroupRuleGetEthertypeAttributeTypeOk(arg BaseSecurityGroupRuleGetEthertypeAttributeType) (ret BaseSecurityGroupRuleGetEthertypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetEthertypeAttributeType(arg *BaseSecurityGroupRuleGetEthertypeAttributeType, val BaseSecurityGroupRuleGetEthertypeRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetEthertypeArgType = string +type BaseSecurityGroupRuleGetEthertypeRetType = string + +/* + types and functions for icmpParameters +*/ + +// isModel +type BaseSecurityGroupRuleGetIcmpParametersAttributeType = *ICMPParameters +type BaseSecurityGroupRuleGetIcmpParametersArgType = ICMPParameters +type BaseSecurityGroupRuleGetIcmpParametersRetType = ICMPParameters + +func getBaseSecurityGroupRuleGetIcmpParametersAttributeTypeOk(arg BaseSecurityGroupRuleGetIcmpParametersAttributeType) (ret BaseSecurityGroupRuleGetIcmpParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetIcmpParametersAttributeType(arg *BaseSecurityGroupRuleGetIcmpParametersAttributeType, val BaseSecurityGroupRuleGetIcmpParametersRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetIdAttributeType = *string + +func getBaseSecurityGroupRuleGetIdAttributeTypeOk(arg BaseSecurityGroupRuleGetIdAttributeType) (ret BaseSecurityGroupRuleGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetIdAttributeType(arg *BaseSecurityGroupRuleGetIdAttributeType, val BaseSecurityGroupRuleGetIdRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetIdArgType = string +type BaseSecurityGroupRuleGetIdRetType = string + +/* + types and functions for ipRange +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetIpRangeAttributeType = *string + +func getBaseSecurityGroupRuleGetIpRangeAttributeTypeOk(arg BaseSecurityGroupRuleGetIpRangeAttributeType) (ret BaseSecurityGroupRuleGetIpRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetIpRangeAttributeType(arg *BaseSecurityGroupRuleGetIpRangeAttributeType, val BaseSecurityGroupRuleGetIpRangeRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetIpRangeArgType = string +type BaseSecurityGroupRuleGetIpRangeRetType = string + +/* + types and functions for portRange +*/ + +// isModel +type BaseSecurityGroupRuleGetPortRangeAttributeType = *PortRange +type BaseSecurityGroupRuleGetPortRangeArgType = PortRange +type BaseSecurityGroupRuleGetPortRangeRetType = PortRange + +func getBaseSecurityGroupRuleGetPortRangeAttributeTypeOk(arg BaseSecurityGroupRuleGetPortRangeAttributeType) (ret BaseSecurityGroupRuleGetPortRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetPortRangeAttributeType(arg *BaseSecurityGroupRuleGetPortRangeAttributeType, val BaseSecurityGroupRuleGetPortRangeRetType) { + *arg = &val +} + +/* + types and functions for remoteSecurityGroupId +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType = *string + +func getBaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(arg BaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType) (ret BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType(arg *BaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType, val BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetRemoteSecurityGroupIdArgType = string +type BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType = string + +/* + types and functions for securityGroupId +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetSecurityGroupIdAttributeType = *string + +func getBaseSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(arg BaseSecurityGroupRuleGetSecurityGroupIdAttributeType) (ret BaseSecurityGroupRuleGetSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetSecurityGroupIdAttributeType(arg *BaseSecurityGroupRuleGetSecurityGroupIdAttributeType, val BaseSecurityGroupRuleGetSecurityGroupIdRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetSecurityGroupIdArgType = string +type BaseSecurityGroupRuleGetSecurityGroupIdRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type BaseSecurityGroupRuleGetUpdatedAtAttributeType = *time.Time +type BaseSecurityGroupRuleGetUpdatedAtArgType = time.Time +type BaseSecurityGroupRuleGetUpdatedAtRetType = time.Time + +func getBaseSecurityGroupRuleGetUpdatedAtAttributeTypeOk(arg BaseSecurityGroupRuleGetUpdatedAtAttributeType) (ret BaseSecurityGroupRuleGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetUpdatedAtAttributeType(arg *BaseSecurityGroupRuleGetUpdatedAtAttributeType, val BaseSecurityGroupRuleGetUpdatedAtRetType) { + *arg = &val +} + +// BaseSecurityGroupRule The base schema for a security group rule. +type BaseSecurityGroupRule struct { + // Date-time when resource was created. + CreatedAt BaseSecurityGroupRuleGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description BaseSecurityGroupRuleGetDescriptionAttributeType `json:"description,omitempty"` + // The direction of the traffic which the rule should match. Possible values: `ingress`, `egress`. + // REQUIRED + Direction BaseSecurityGroupRuleGetDirectionAttributeType `json:"direction" required:"true"` + // The ethertype which the rule should match. Possible values: `IPv4`, `IPv6`. + Ethertype BaseSecurityGroupRuleGetEthertypeAttributeType `json:"ethertype,omitempty"` + IcmpParameters BaseSecurityGroupRuleGetIcmpParametersAttributeType `json:"icmpParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id BaseSecurityGroupRuleGetIdAttributeType `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + IpRange BaseSecurityGroupRuleGetIpRangeAttributeType `json:"ipRange,omitempty"` + PortRange BaseSecurityGroupRuleGetPortRangeAttributeType `json:"portRange,omitempty"` + // Universally Unique Identifier (UUID). + RemoteSecurityGroupId BaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType `json:"remoteSecurityGroupId,omitempty"` + // Universally Unique Identifier (UUID). + SecurityGroupId BaseSecurityGroupRuleGetSecurityGroupIdAttributeType `json:"securityGroupId,omitempty"` + // Date-time when resource was last updated. + UpdatedAt BaseSecurityGroupRuleGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _BaseSecurityGroupRule BaseSecurityGroupRule + +// NewBaseSecurityGroupRule instantiates a new BaseSecurityGroupRule 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 NewBaseSecurityGroupRule(direction BaseSecurityGroupRuleGetDirectionArgType) *BaseSecurityGroupRule { + this := BaseSecurityGroupRule{} + setBaseSecurityGroupRuleGetDirectionAttributeType(&this.Direction, direction) + return &this +} + +// NewBaseSecurityGroupRuleWithDefaults instantiates a new BaseSecurityGroupRule 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 NewBaseSecurityGroupRuleWithDefaults() *BaseSecurityGroupRule { + this := BaseSecurityGroupRule{} + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetCreatedAt() (res BaseSecurityGroupRuleGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetCreatedAtOk() (ret BaseSecurityGroupRuleGetCreatedAtRetType, ok bool) { + return getBaseSecurityGroupRuleGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *BaseSecurityGroupRule) SetCreatedAt(v BaseSecurityGroupRuleGetCreatedAtRetType) { + setBaseSecurityGroupRuleGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetDescription() (res BaseSecurityGroupRuleGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetDescriptionOk() (ret BaseSecurityGroupRuleGetDescriptionRetType, ok bool) { + return getBaseSecurityGroupRuleGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *BaseSecurityGroupRule) SetDescription(v BaseSecurityGroupRuleGetDescriptionRetType) { + setBaseSecurityGroupRuleGetDescriptionAttributeType(&o.Description, v) +} + +// GetDirection returns the Direction field value +func (o *BaseSecurityGroupRule) GetDirection() (ret BaseSecurityGroupRuleGetDirectionRetType) { + ret, _ = o.GetDirectionOk() + return ret +} + +// GetDirectionOk returns a tuple with the Direction field value +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetDirectionOk() (ret BaseSecurityGroupRuleGetDirectionRetType, ok bool) { + return getBaseSecurityGroupRuleGetDirectionAttributeTypeOk(o.Direction) +} + +// SetDirection sets field value +func (o *BaseSecurityGroupRule) SetDirection(v BaseSecurityGroupRuleGetDirectionRetType) { + setBaseSecurityGroupRuleGetDirectionAttributeType(&o.Direction, v) +} + +// GetEthertype returns the Ethertype field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetEthertype() (res BaseSecurityGroupRuleGetEthertypeRetType) { + res, _ = o.GetEthertypeOk() + return +} + +// GetEthertypeOk returns a tuple with the Ethertype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetEthertypeOk() (ret BaseSecurityGroupRuleGetEthertypeRetType, ok bool) { + return getBaseSecurityGroupRuleGetEthertypeAttributeTypeOk(o.Ethertype) +} + +// HasEthertype returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasEthertype() bool { + _, ok := o.GetEthertypeOk() + return ok +} + +// SetEthertype gets a reference to the given string and assigns it to the Ethertype field. +func (o *BaseSecurityGroupRule) SetEthertype(v BaseSecurityGroupRuleGetEthertypeRetType) { + setBaseSecurityGroupRuleGetEthertypeAttributeType(&o.Ethertype, v) +} + +// GetIcmpParameters returns the IcmpParameters field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetIcmpParameters() (res BaseSecurityGroupRuleGetIcmpParametersRetType) { + res, _ = o.GetIcmpParametersOk() + return +} + +// GetIcmpParametersOk returns a tuple with the IcmpParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetIcmpParametersOk() (ret BaseSecurityGroupRuleGetIcmpParametersRetType, ok bool) { + return getBaseSecurityGroupRuleGetIcmpParametersAttributeTypeOk(o.IcmpParameters) +} + +// HasIcmpParameters returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasIcmpParameters() bool { + _, ok := o.GetIcmpParametersOk() + return ok +} + +// SetIcmpParameters gets a reference to the given ICMPParameters and assigns it to the IcmpParameters field. +func (o *BaseSecurityGroupRule) SetIcmpParameters(v BaseSecurityGroupRuleGetIcmpParametersRetType) { + setBaseSecurityGroupRuleGetIcmpParametersAttributeType(&o.IcmpParameters, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetId() (res BaseSecurityGroupRuleGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetIdOk() (ret BaseSecurityGroupRuleGetIdRetType, ok bool) { + return getBaseSecurityGroupRuleGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BaseSecurityGroupRule) SetId(v BaseSecurityGroupRuleGetIdRetType) { + setBaseSecurityGroupRuleGetIdAttributeType(&o.Id, v) +} + +// GetIpRange returns the IpRange field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetIpRange() (res BaseSecurityGroupRuleGetIpRangeRetType) { + res, _ = o.GetIpRangeOk() + return +} + +// GetIpRangeOk returns a tuple with the IpRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetIpRangeOk() (ret BaseSecurityGroupRuleGetIpRangeRetType, ok bool) { + return getBaseSecurityGroupRuleGetIpRangeAttributeTypeOk(o.IpRange) +} + +// HasIpRange returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasIpRange() bool { + _, ok := o.GetIpRangeOk() + return ok +} + +// SetIpRange gets a reference to the given string and assigns it to the IpRange field. +func (o *BaseSecurityGroupRule) SetIpRange(v BaseSecurityGroupRuleGetIpRangeRetType) { + setBaseSecurityGroupRuleGetIpRangeAttributeType(&o.IpRange, v) +} + +// GetPortRange returns the PortRange field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetPortRange() (res BaseSecurityGroupRuleGetPortRangeRetType) { + res, _ = o.GetPortRangeOk() + return +} + +// GetPortRangeOk returns a tuple with the PortRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetPortRangeOk() (ret BaseSecurityGroupRuleGetPortRangeRetType, ok bool) { + return getBaseSecurityGroupRuleGetPortRangeAttributeTypeOk(o.PortRange) +} + +// HasPortRange returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasPortRange() bool { + _, ok := o.GetPortRangeOk() + return ok +} + +// SetPortRange gets a reference to the given PortRange and assigns it to the PortRange field. +func (o *BaseSecurityGroupRule) SetPortRange(v BaseSecurityGroupRuleGetPortRangeRetType) { + setBaseSecurityGroupRuleGetPortRangeAttributeType(&o.PortRange, v) +} + +// GetRemoteSecurityGroupId returns the RemoteSecurityGroupId field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetRemoteSecurityGroupId() (res BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + res, _ = o.GetRemoteSecurityGroupIdOk() + return +} + +// GetRemoteSecurityGroupIdOk returns a tuple with the RemoteSecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetRemoteSecurityGroupIdOk() (ret BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType, ok bool) { + return getBaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId) +} + +// HasRemoteSecurityGroupId returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasRemoteSecurityGroupId() bool { + _, ok := o.GetRemoteSecurityGroupIdOk() + return ok +} + +// SetRemoteSecurityGroupId gets a reference to the given string and assigns it to the RemoteSecurityGroupId field. +func (o *BaseSecurityGroupRule) SetRemoteSecurityGroupId(v BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + setBaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType(&o.RemoteSecurityGroupId, v) +} + +// GetSecurityGroupId returns the SecurityGroupId field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetSecurityGroupId() (res BaseSecurityGroupRuleGetSecurityGroupIdRetType) { + res, _ = o.GetSecurityGroupIdOk() + return +} + +// GetSecurityGroupIdOk returns a tuple with the SecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetSecurityGroupIdOk() (ret BaseSecurityGroupRuleGetSecurityGroupIdRetType, ok bool) { + return getBaseSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId) +} + +// HasSecurityGroupId returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasSecurityGroupId() bool { + _, ok := o.GetSecurityGroupIdOk() + return ok +} + +// SetSecurityGroupId gets a reference to the given string and assigns it to the SecurityGroupId field. +func (o *BaseSecurityGroupRule) SetSecurityGroupId(v BaseSecurityGroupRuleGetSecurityGroupIdRetType) { + setBaseSecurityGroupRuleGetSecurityGroupIdAttributeType(&o.SecurityGroupId, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetUpdatedAt() (res BaseSecurityGroupRuleGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetUpdatedAtOk() (ret BaseSecurityGroupRuleGetUpdatedAtRetType, ok bool) { + return getBaseSecurityGroupRuleGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *BaseSecurityGroupRule) SetUpdatedAt(v BaseSecurityGroupRuleGetUpdatedAtRetType) { + setBaseSecurityGroupRuleGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o BaseSecurityGroupRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBaseSecurityGroupRuleGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getBaseSecurityGroupRuleGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getBaseSecurityGroupRuleGetDirectionAttributeTypeOk(o.Direction); ok { + toSerialize["Direction"] = val + } + if val, ok := getBaseSecurityGroupRuleGetEthertypeAttributeTypeOk(o.Ethertype); ok { + toSerialize["Ethertype"] = val + } + if val, ok := getBaseSecurityGroupRuleGetIcmpParametersAttributeTypeOk(o.IcmpParameters); ok { + toSerialize["IcmpParameters"] = val + } + if val, ok := getBaseSecurityGroupRuleGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBaseSecurityGroupRuleGetIpRangeAttributeTypeOk(o.IpRange); ok { + toSerialize["IpRange"] = val + } + if val, ok := getBaseSecurityGroupRuleGetPortRangeAttributeTypeOk(o.PortRange); ok { + toSerialize["PortRange"] = val + } + if val, ok := getBaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId); ok { + toSerialize["RemoteSecurityGroupId"] = val + } + if val, ok := getBaseSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId); ok { + toSerialize["SecurityGroupId"] = val + } + if val, ok := getBaseSecurityGroupRuleGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableBaseSecurityGroupRule struct { + value *BaseSecurityGroupRule + isSet bool +} + +func (v NullableBaseSecurityGroupRule) Get() *BaseSecurityGroupRule { + return v.value +} + +func (v *NullableBaseSecurityGroupRule) Set(val *BaseSecurityGroupRule) { + v.value = val + v.isSet = true +} + +func (v NullableBaseSecurityGroupRule) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseSecurityGroupRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseSecurityGroupRule(val *BaseSecurityGroupRule) *NullableBaseSecurityGroupRule { + return &NullableBaseSecurityGroupRule{value: val, isSet: true} +} + +func (v NullableBaseSecurityGroupRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseSecurityGroupRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_base_security_group_rule_test.go b/pkg/iaasbeta/model_base_security_group_rule_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_base_security_group_rule_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_boot_volume.go b/pkg/iaasbeta/model_boot_volume.go new file mode 100644 index 00000000..2cbafcfb --- /dev/null +++ b/pkg/iaasbeta/model_boot_volume.go @@ -0,0 +1,321 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the BootVolume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BootVolume{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type BootVolumegetDeleteOnTerminationAttributeType = *bool +type BootVolumegetDeleteOnTerminationArgType = bool +type BootVolumegetDeleteOnTerminationRetType = bool + +func getBootVolumegetDeleteOnTerminationAttributeTypeOk(arg BootVolumegetDeleteOnTerminationAttributeType) (ret BootVolumegetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumegetDeleteOnTerminationAttributeType(arg *BootVolumegetDeleteOnTerminationAttributeType, val BootVolumegetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type BootVolumeGetIdAttributeType = *string + +func getBootVolumeGetIdAttributeTypeOk(arg BootVolumeGetIdAttributeType) (ret BootVolumeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeGetIdAttributeType(arg *BootVolumeGetIdAttributeType, val BootVolumeGetIdRetType) { + *arg = &val +} + +type BootVolumeGetIdArgType = string +type BootVolumeGetIdRetType = string + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type BootVolumeGetPerformanceClassAttributeType = *string + +func getBootVolumeGetPerformanceClassAttributeTypeOk(arg BootVolumeGetPerformanceClassAttributeType) (ret BootVolumeGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeGetPerformanceClassAttributeType(arg *BootVolumeGetPerformanceClassAttributeType, val BootVolumeGetPerformanceClassRetType) { + *arg = &val +} + +type BootVolumeGetPerformanceClassArgType = string +type BootVolumeGetPerformanceClassRetType = string + +/* + types and functions for size +*/ + +// isLong +type BootVolumeGetSizeAttributeType = *int64 +type BootVolumeGetSizeArgType = int64 +type BootVolumeGetSizeRetType = int64 + +func getBootVolumeGetSizeAttributeTypeOk(arg BootVolumeGetSizeAttributeType) (ret BootVolumeGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeGetSizeAttributeType(arg *BootVolumeGetSizeAttributeType, val BootVolumeGetSizeRetType) { + *arg = &val +} + +/* + types and functions for source +*/ + +// isModel +type BootVolumeGetSourceAttributeType = *BootVolumeSource +type BootVolumeGetSourceArgType = BootVolumeSource +type BootVolumeGetSourceRetType = BootVolumeSource + +func getBootVolumeGetSourceAttributeTypeOk(arg BootVolumeGetSourceAttributeType) (ret BootVolumeGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeGetSourceAttributeType(arg *BootVolumeGetSourceAttributeType, val BootVolumeGetSourceRetType) { + *arg = &val +} + +// BootVolume The boot device for the server. +type BootVolume struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination BootVolumegetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + Id BootVolumeGetIdAttributeType `json:"id,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass BootVolumeGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Size in Gigabyte. + Size BootVolumeGetSizeAttributeType `json:"size,omitempty"` + Source BootVolumeGetSourceAttributeType `json:"source,omitempty"` +} + +// NewBootVolume instantiates a new BootVolume 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 NewBootVolume() *BootVolume { + this := BootVolume{} + return &this +} + +// NewBootVolumeWithDefaults instantiates a new BootVolume 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 NewBootVolumeWithDefaults() *BootVolume { + this := BootVolume{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *BootVolume) GetDeleteOnTermination() (res BootVolumegetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetDeleteOnTerminationOk() (ret BootVolumegetDeleteOnTerminationRetType, ok bool) { + return getBootVolumegetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *BootVolume) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *BootVolume) SetDeleteOnTermination(v BootVolumegetDeleteOnTerminationRetType) { + setBootVolumegetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BootVolume) GetId() (res BootVolumeGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetIdOk() (ret BootVolumeGetIdRetType, ok bool) { + return getBootVolumeGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *BootVolume) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BootVolume) SetId(v BootVolumeGetIdRetType) { + setBootVolumeGetIdAttributeType(&o.Id, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *BootVolume) GetPerformanceClass() (res BootVolumeGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetPerformanceClassOk() (ret BootVolumeGetPerformanceClassRetType, ok bool) { + return getBootVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *BootVolume) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *BootVolume) SetPerformanceClass(v BootVolumeGetPerformanceClassRetType) { + setBootVolumeGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *BootVolume) GetSize() (res BootVolumeGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetSizeOk() (ret BootVolumeGetSizeRetType, ok bool) { + return getBootVolumeGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *BootVolume) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *BootVolume) SetSize(v BootVolumeGetSizeRetType) { + setBootVolumeGetSizeAttributeType(&o.Size, v) +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *BootVolume) GetSource() (res BootVolumeGetSourceRetType) { + res, _ = o.GetSourceOk() + return +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetSourceOk() (ret BootVolumeGetSourceRetType, ok bool) { + return getBootVolumeGetSourceAttributeTypeOk(o.Source) +} + +// HasSource returns a boolean if a field has been set. +func (o *BootVolume) HasSource() bool { + _, ok := o.GetSourceOk() + return ok +} + +// SetSource gets a reference to the given BootVolumeSource and assigns it to the Source field. +func (o *BootVolume) SetSource(v BootVolumeGetSourceRetType) { + setBootVolumeGetSourceAttributeType(&o.Source, v) +} + +func (o BootVolume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBootVolumegetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getBootVolumeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBootVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getBootVolumeGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getBootVolumeGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + return toSerialize, nil +} + +type NullableBootVolume struct { + value *BootVolume + isSet bool +} + +func (v NullableBootVolume) Get() *BootVolume { + return v.value +} + +func (v *NullableBootVolume) Set(val *BootVolume) { + v.value = val + v.isSet = true +} + +func (v NullableBootVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableBootVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBootVolume(val *BootVolume) *NullableBootVolume { + return &NullableBootVolume{value: val, isSet: true} +} + +func (v NullableBootVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBootVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_boot_volume_source.go b/pkg/iaasbeta/model_boot_volume_source.go new file mode 100644 index 00000000..5ae36f53 --- /dev/null +++ b/pkg/iaasbeta/model_boot_volume_source.go @@ -0,0 +1,172 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the BootVolumeSource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BootVolumeSource{} + +/* + types and functions for id +*/ + +// isNotNullableString +type BootVolumeSourceGetIdAttributeType = *string + +func getBootVolumeSourceGetIdAttributeTypeOk(arg BootVolumeSourceGetIdAttributeType) (ret BootVolumeSourceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeSourceGetIdAttributeType(arg *BootVolumeSourceGetIdAttributeType, val BootVolumeSourceGetIdRetType) { + *arg = &val +} + +type BootVolumeSourceGetIdArgType = string +type BootVolumeSourceGetIdRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type BootVolumeSourceGetTypeAttributeType = *string + +func getBootVolumeSourceGetTypeAttributeTypeOk(arg BootVolumeSourceGetTypeAttributeType) (ret BootVolumeSourceGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeSourceGetTypeAttributeType(arg *BootVolumeSourceGetTypeAttributeType, val BootVolumeSourceGetTypeRetType) { + *arg = &val +} + +type BootVolumeSourceGetTypeArgType = string +type BootVolumeSourceGetTypeRetType = string + +// BootVolumeSource struct for BootVolumeSource +type BootVolumeSource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id BootVolumeSourceGetIdAttributeType `json:"id" required:"true"` + // The source types of a boot volume. Possible values: `image`, `volume`. + // REQUIRED + Type BootVolumeSourceGetTypeAttributeType `json:"type" required:"true"` +} + +type _BootVolumeSource BootVolumeSource + +// NewBootVolumeSource instantiates a new BootVolumeSource 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 NewBootVolumeSource(id BootVolumeSourceGetIdArgType, types BootVolumeSourceGetTypeArgType) *BootVolumeSource { + this := BootVolumeSource{} + setBootVolumeSourceGetIdAttributeType(&this.Id, id) + setBootVolumeSourceGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewBootVolumeSourceWithDefaults instantiates a new BootVolumeSource 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 NewBootVolumeSourceWithDefaults() *BootVolumeSource { + this := BootVolumeSource{} + return &this +} + +// GetId returns the Id field value +func (o *BootVolumeSource) GetId() (ret BootVolumeSourceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *BootVolumeSource) GetIdOk() (ret BootVolumeSourceGetIdRetType, ok bool) { + return getBootVolumeSourceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *BootVolumeSource) SetId(v BootVolumeSourceGetIdRetType) { + setBootVolumeSourceGetIdAttributeType(&o.Id, v) +} + +// GetType returns the Type field value +func (o *BootVolumeSource) GetType() (ret BootVolumeSourceGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *BootVolumeSource) GetTypeOk() (ret BootVolumeSourceGetTypeRetType, ok bool) { + return getBootVolumeSourceGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *BootVolumeSource) SetType(v BootVolumeSourceGetTypeRetType) { + setBootVolumeSourceGetTypeAttributeType(&o.Type, v) +} + +func (o BootVolumeSource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBootVolumeSourceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBootVolumeSourceGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableBootVolumeSource struct { + value *BootVolumeSource + isSet bool +} + +func (v NullableBootVolumeSource) Get() *BootVolumeSource { + return v.value +} + +func (v *NullableBootVolumeSource) Set(val *BootVolumeSource) { + v.value = val + v.isSet = true +} + +func (v NullableBootVolumeSource) IsSet() bool { + return v.isSet +} + +func (v *NullableBootVolumeSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBootVolumeSource(val *BootVolumeSource) *NullableBootVolumeSource { + return &NullableBootVolumeSource{value: val, isSet: true} +} + +func (v NullableBootVolumeSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBootVolumeSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_boot_volume_source_test.go b/pkg/iaasbeta/model_boot_volume_source_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_boot_volume_source_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_boot_volume_test.go b/pkg/iaasbeta/model_boot_volume_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_boot_volume_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_affinity_group_payload.go b/pkg/iaasbeta/model_create_affinity_group_payload.go new file mode 100644 index 00000000..194b9666 --- /dev/null +++ b/pkg/iaasbeta/model_create_affinity_group_payload.go @@ -0,0 +1,269 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateAffinityGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAffinityGroupPayload{} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateAffinityGroupPayloadGetIdAttributeType = *string + +func getCreateAffinityGroupPayloadGetIdAttributeTypeOk(arg CreateAffinityGroupPayloadGetIdAttributeType) (ret CreateAffinityGroupPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAffinityGroupPayloadGetIdAttributeType(arg *CreateAffinityGroupPayloadGetIdAttributeType, val CreateAffinityGroupPayloadGetIdRetType) { + *arg = &val +} + +type CreateAffinityGroupPayloadGetIdArgType = string +type CreateAffinityGroupPayloadGetIdRetType = string + +/* + types and functions for members +*/ + +// isArray +type CreateAffinityGroupPayloadGetMembersAttributeType = *[]string +type CreateAffinityGroupPayloadGetMembersArgType = []string +type CreateAffinityGroupPayloadGetMembersRetType = []string + +func getCreateAffinityGroupPayloadGetMembersAttributeTypeOk(arg CreateAffinityGroupPayloadGetMembersAttributeType) (ret CreateAffinityGroupPayloadGetMembersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAffinityGroupPayloadGetMembersAttributeType(arg *CreateAffinityGroupPayloadGetMembersAttributeType, val CreateAffinityGroupPayloadGetMembersRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateAffinityGroupPayloadGetNameAttributeType = *string + +func getCreateAffinityGroupPayloadGetNameAttributeTypeOk(arg CreateAffinityGroupPayloadGetNameAttributeType) (ret CreateAffinityGroupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAffinityGroupPayloadGetNameAttributeType(arg *CreateAffinityGroupPayloadGetNameAttributeType, val CreateAffinityGroupPayloadGetNameRetType) { + *arg = &val +} + +type CreateAffinityGroupPayloadGetNameArgType = string +type CreateAffinityGroupPayloadGetNameRetType = string + +/* + types and functions for policy +*/ + +// isNotNullableString +type CreateAffinityGroupPayloadGetPolicyAttributeType = *string + +func getCreateAffinityGroupPayloadGetPolicyAttributeTypeOk(arg CreateAffinityGroupPayloadGetPolicyAttributeType) (ret CreateAffinityGroupPayloadGetPolicyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAffinityGroupPayloadGetPolicyAttributeType(arg *CreateAffinityGroupPayloadGetPolicyAttributeType, val CreateAffinityGroupPayloadGetPolicyRetType) { + *arg = &val +} + +type CreateAffinityGroupPayloadGetPolicyArgType = string +type CreateAffinityGroupPayloadGetPolicyRetType = string + +// CreateAffinityGroupPayload Definition of an affinity group. +type CreateAffinityGroupPayload struct { + // Universally Unique Identifier (UUID). + Id CreateAffinityGroupPayloadGetIdAttributeType `json:"id,omitempty"` + // The servers that are part of the affinity group. + Members CreateAffinityGroupPayloadGetMembersAttributeType `json:"members,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name CreateAffinityGroupPayloadGetNameAttributeType `json:"name" required:"true"` + // The affinity group policy. `hard-affinity`: All servers in this group will be hosted on the same compute node. `soft-affinity`: All servers in this group will be hosted on as few compute nodes as possible. `hard-anti-affinity`: All servers in this group will be hosted on different compute nodes. `soft-anti-affinity`: All servers in this group will be hosted on as many compute nodes as possible. Possible values: `hard-anti-affinity`, `hard-affinity`, `soft-anti-affinity`, `soft-affinity`. + // REQUIRED + Policy CreateAffinityGroupPayloadGetPolicyAttributeType `json:"policy" required:"true"` +} + +type _CreateAffinityGroupPayload CreateAffinityGroupPayload + +// NewCreateAffinityGroupPayload instantiates a new CreateAffinityGroupPayload 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 NewCreateAffinityGroupPayload(name CreateAffinityGroupPayloadGetNameArgType, policy CreateAffinityGroupPayloadGetPolicyArgType) *CreateAffinityGroupPayload { + this := CreateAffinityGroupPayload{} + setCreateAffinityGroupPayloadGetNameAttributeType(&this.Name, name) + setCreateAffinityGroupPayloadGetPolicyAttributeType(&this.Policy, policy) + return &this +} + +// NewCreateAffinityGroupPayloadWithDefaults instantiates a new CreateAffinityGroupPayload 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 NewCreateAffinityGroupPayloadWithDefaults() *CreateAffinityGroupPayload { + this := CreateAffinityGroupPayload{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateAffinityGroupPayload) GetId() (res CreateAffinityGroupPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetIdOk() (ret CreateAffinityGroupPayloadGetIdRetType, ok bool) { + return getCreateAffinityGroupPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateAffinityGroupPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateAffinityGroupPayload) SetId(v CreateAffinityGroupPayloadGetIdRetType) { + setCreateAffinityGroupPayloadGetIdAttributeType(&o.Id, v) +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *CreateAffinityGroupPayload) GetMembers() (res CreateAffinityGroupPayloadGetMembersRetType) { + res, _ = o.GetMembersOk() + return +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetMembersOk() (ret CreateAffinityGroupPayloadGetMembersRetType, ok bool) { + return getCreateAffinityGroupPayloadGetMembersAttributeTypeOk(o.Members) +} + +// HasMembers returns a boolean if a field has been set. +func (o *CreateAffinityGroupPayload) HasMembers() bool { + _, ok := o.GetMembersOk() + return ok +} + +// SetMembers gets a reference to the given []string and assigns it to the Members field. +func (o *CreateAffinityGroupPayload) SetMembers(v CreateAffinityGroupPayloadGetMembersRetType) { + setCreateAffinityGroupPayloadGetMembersAttributeType(&o.Members, v) +} + +// GetName returns the Name field value +func (o *CreateAffinityGroupPayload) GetName() (ret CreateAffinityGroupPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetNameOk() (ret CreateAffinityGroupPayloadGetNameRetType, ok bool) { + return getCreateAffinityGroupPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateAffinityGroupPayload) SetName(v CreateAffinityGroupPayloadGetNameRetType) { + setCreateAffinityGroupPayloadGetNameAttributeType(&o.Name, v) +} + +// GetPolicy returns the Policy field value +func (o *CreateAffinityGroupPayload) GetPolicy() (ret CreateAffinityGroupPayloadGetPolicyRetType) { + ret, _ = o.GetPolicyOk() + return ret +} + +// GetPolicyOk returns a tuple with the Policy field value +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetPolicyOk() (ret CreateAffinityGroupPayloadGetPolicyRetType, ok bool) { + return getCreateAffinityGroupPayloadGetPolicyAttributeTypeOk(o.Policy) +} + +// SetPolicy sets field value +func (o *CreateAffinityGroupPayload) SetPolicy(v CreateAffinityGroupPayloadGetPolicyRetType) { + setCreateAffinityGroupPayloadGetPolicyAttributeType(&o.Policy, v) +} + +func (o CreateAffinityGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateAffinityGroupPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateAffinityGroupPayloadGetMembersAttributeTypeOk(o.Members); ok { + toSerialize["Members"] = val + } + if val, ok := getCreateAffinityGroupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateAffinityGroupPayloadGetPolicyAttributeTypeOk(o.Policy); ok { + toSerialize["Policy"] = val + } + return toSerialize, nil +} + +type NullableCreateAffinityGroupPayload struct { + value *CreateAffinityGroupPayload + isSet bool +} + +func (v NullableCreateAffinityGroupPayload) Get() *CreateAffinityGroupPayload { + return v.value +} + +func (v *NullableCreateAffinityGroupPayload) Set(val *CreateAffinityGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAffinityGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAffinityGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAffinityGroupPayload(val *CreateAffinityGroupPayload) *NullableCreateAffinityGroupPayload { + return &NullableCreateAffinityGroupPayload{value: val, isSet: true} +} + +func (v NullableCreateAffinityGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAffinityGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_affinity_group_payload_test.go b/pkg/iaasbeta/model_create_affinity_group_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_affinity_group_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_backup_payload.go b/pkg/iaasbeta/model_create_backup_payload.go new file mode 100644 index 00000000..c3d4262f --- /dev/null +++ b/pkg/iaasbeta/model_create_backup_payload.go @@ -0,0 +1,222 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateBackupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateBackupPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateBackupPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateBackupPayloadGetLabelsArgType = map[string]interface{} +type CreateBackupPayloadGetLabelsRetType = map[string]interface{} + +func getCreateBackupPayloadGetLabelsAttributeTypeOk(arg CreateBackupPayloadGetLabelsAttributeType) (ret CreateBackupPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupPayloadGetLabelsAttributeType(arg *CreateBackupPayloadGetLabelsAttributeType, val CreateBackupPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateBackupPayloadGetNameAttributeType = *string + +func getCreateBackupPayloadGetNameAttributeTypeOk(arg CreateBackupPayloadGetNameAttributeType) (ret CreateBackupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupPayloadGetNameAttributeType(arg *CreateBackupPayloadGetNameAttributeType, val CreateBackupPayloadGetNameRetType) { + *arg = &val +} + +type CreateBackupPayloadGetNameArgType = string +type CreateBackupPayloadGetNameRetType = string + +/* + types and functions for source +*/ + +// isModel +type CreateBackupPayloadGetSourceAttributeType = *BackupSource +type CreateBackupPayloadGetSourceArgType = BackupSource +type CreateBackupPayloadGetSourceRetType = BackupSource + +func getCreateBackupPayloadGetSourceAttributeTypeOk(arg CreateBackupPayloadGetSourceAttributeType) (ret CreateBackupPayloadGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupPayloadGetSourceAttributeType(arg *CreateBackupPayloadGetSourceAttributeType, val CreateBackupPayloadGetSourceRetType) { + *arg = &val +} + +// CreateBackupPayload Object that represents a backup create request body. +type CreateBackupPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateBackupPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name CreateBackupPayloadGetNameAttributeType `json:"name,omitempty"` + // REQUIRED + Source CreateBackupPayloadGetSourceAttributeType `json:"source" required:"true"` +} + +type _CreateBackupPayload CreateBackupPayload + +// NewCreateBackupPayload instantiates a new CreateBackupPayload 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 NewCreateBackupPayload(source CreateBackupPayloadGetSourceArgType) *CreateBackupPayload { + this := CreateBackupPayload{} + setCreateBackupPayloadGetSourceAttributeType(&this.Source, source) + return &this +} + +// NewCreateBackupPayloadWithDefaults instantiates a new CreateBackupPayload 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 NewCreateBackupPayloadWithDefaults() *CreateBackupPayload { + this := CreateBackupPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateBackupPayload) GetLabels() (res CreateBackupPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateBackupPayload) GetLabelsOk() (ret CreateBackupPayloadGetLabelsRetType, ok bool) { + return getCreateBackupPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateBackupPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateBackupPayload) SetLabels(v CreateBackupPayloadGetLabelsRetType) { + setCreateBackupPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateBackupPayload) GetName() (res CreateBackupPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateBackupPayload) GetNameOk() (ret CreateBackupPayloadGetNameRetType, ok bool) { + return getCreateBackupPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateBackupPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateBackupPayload) SetName(v CreateBackupPayloadGetNameRetType) { + setCreateBackupPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSource returns the Source field value +func (o *CreateBackupPayload) GetSource() (ret CreateBackupPayloadGetSourceRetType) { + ret, _ = o.GetSourceOk() + return ret +} + +// GetSourceOk returns a tuple with the Source field value +// and a boolean to check if the value has been set. +func (o *CreateBackupPayload) GetSourceOk() (ret CreateBackupPayloadGetSourceRetType, ok bool) { + return getCreateBackupPayloadGetSourceAttributeTypeOk(o.Source) +} + +// SetSource sets field value +func (o *CreateBackupPayload) SetSource(v CreateBackupPayloadGetSourceRetType) { + setCreateBackupPayloadGetSourceAttributeType(&o.Source, v) +} + +func (o CreateBackupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateBackupPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateBackupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateBackupPayloadGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + return toSerialize, nil +} + +type NullableCreateBackupPayload struct { + value *CreateBackupPayload + isSet bool +} + +func (v NullableCreateBackupPayload) Get() *CreateBackupPayload { + return v.value +} + +func (v *NullableCreateBackupPayload) Set(val *CreateBackupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateBackupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateBackupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateBackupPayload(val *CreateBackupPayload) *NullableCreateBackupPayload { + return &NullableCreateBackupPayload{value: val, isSet: true} +} + +func (v NullableCreateBackupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateBackupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_backup_payload_test.go b/pkg/iaasbeta/model_create_backup_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_backup_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_image_payload.go b/pkg/iaasbeta/model_create_image_payload.go new file mode 100644 index 00000000..febd9669 --- /dev/null +++ b/pkg/iaasbeta/model_create_image_payload.go @@ -0,0 +1,894 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the CreateImagePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateImagePayload{} + +/* + types and functions for agent +*/ + +// isModel +type CreateImagePayloadGetAgentAttributeType = *ImageAgent +type CreateImagePayloadGetAgentArgType = ImageAgent +type CreateImagePayloadGetAgentRetType = ImageAgent + +func getCreateImagePayloadGetAgentAttributeTypeOk(arg CreateImagePayloadGetAgentAttributeType) (ret CreateImagePayloadGetAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetAgentAttributeType(arg *CreateImagePayloadGetAgentAttributeType, val CreateImagePayloadGetAgentRetType) { + *arg = &val +} + +/* + types and functions for checksum +*/ + +// isModel +type CreateImagePayloadGetChecksumAttributeType = *ImageChecksum +type CreateImagePayloadGetChecksumArgType = ImageChecksum +type CreateImagePayloadGetChecksumRetType = ImageChecksum + +func getCreateImagePayloadGetChecksumAttributeTypeOk(arg CreateImagePayloadGetChecksumAttributeType) (ret CreateImagePayloadGetChecksumRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetChecksumAttributeType(arg *CreateImagePayloadGetChecksumAttributeType, val CreateImagePayloadGetChecksumRetType) { + *arg = &val +} + +/* + types and functions for config +*/ + +// isModel +type CreateImagePayloadGetConfigAttributeType = *ImageConfig +type CreateImagePayloadGetConfigArgType = ImageConfig +type CreateImagePayloadGetConfigRetType = ImageConfig + +func getCreateImagePayloadGetConfigAttributeTypeOk(arg CreateImagePayloadGetConfigAttributeType) (ret CreateImagePayloadGetConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetConfigAttributeType(arg *CreateImagePayloadGetConfigAttributeType, val CreateImagePayloadGetConfigRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateImagePayloadGetCreatedAtAttributeType = *time.Time +type CreateImagePayloadGetCreatedAtArgType = time.Time +type CreateImagePayloadGetCreatedAtRetType = time.Time + +func getCreateImagePayloadGetCreatedAtAttributeTypeOk(arg CreateImagePayloadGetCreatedAtAttributeType) (ret CreateImagePayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetCreatedAtAttributeType(arg *CreateImagePayloadGetCreatedAtAttributeType, val CreateImagePayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for diskFormat +*/ + +// isNotNullableString +type CreateImagePayloadGetDiskFormatAttributeType = *string + +func getCreateImagePayloadGetDiskFormatAttributeTypeOk(arg CreateImagePayloadGetDiskFormatAttributeType) (ret CreateImagePayloadGetDiskFormatRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetDiskFormatAttributeType(arg *CreateImagePayloadGetDiskFormatAttributeType, val CreateImagePayloadGetDiskFormatRetType) { + *arg = &val +} + +type CreateImagePayloadGetDiskFormatArgType = string +type CreateImagePayloadGetDiskFormatRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateImagePayloadGetIdAttributeType = *string + +func getCreateImagePayloadGetIdAttributeTypeOk(arg CreateImagePayloadGetIdAttributeType) (ret CreateImagePayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetIdAttributeType(arg *CreateImagePayloadGetIdAttributeType, val CreateImagePayloadGetIdRetType) { + *arg = &val +} + +type CreateImagePayloadGetIdArgType = string +type CreateImagePayloadGetIdRetType = string + +/* + types and functions for importProgress +*/ + +// isLong +type CreateImagePayloadGetImportProgressAttributeType = *int64 +type CreateImagePayloadGetImportProgressArgType = int64 +type CreateImagePayloadGetImportProgressRetType = int64 + +func getCreateImagePayloadGetImportProgressAttributeTypeOk(arg CreateImagePayloadGetImportProgressAttributeType) (ret CreateImagePayloadGetImportProgressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetImportProgressAttributeType(arg *CreateImagePayloadGetImportProgressAttributeType, val CreateImagePayloadGetImportProgressRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateImagePayloadGetLabelsAttributeType = *map[string]interface{} +type CreateImagePayloadGetLabelsArgType = map[string]interface{} +type CreateImagePayloadGetLabelsRetType = map[string]interface{} + +func getCreateImagePayloadGetLabelsAttributeTypeOk(arg CreateImagePayloadGetLabelsAttributeType) (ret CreateImagePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetLabelsAttributeType(arg *CreateImagePayloadGetLabelsAttributeType, val CreateImagePayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for minDiskSize +*/ + +// isLong +type CreateImagePayloadGetMinDiskSizeAttributeType = *int64 +type CreateImagePayloadGetMinDiskSizeArgType = int64 +type CreateImagePayloadGetMinDiskSizeRetType = int64 + +func getCreateImagePayloadGetMinDiskSizeAttributeTypeOk(arg CreateImagePayloadGetMinDiskSizeAttributeType) (ret CreateImagePayloadGetMinDiskSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetMinDiskSizeAttributeType(arg *CreateImagePayloadGetMinDiskSizeAttributeType, val CreateImagePayloadGetMinDiskSizeRetType) { + *arg = &val +} + +/* + types and functions for minRam +*/ + +// isLong +type CreateImagePayloadGetMinRamAttributeType = *int64 +type CreateImagePayloadGetMinRamArgType = int64 +type CreateImagePayloadGetMinRamRetType = int64 + +func getCreateImagePayloadGetMinRamAttributeTypeOk(arg CreateImagePayloadGetMinRamAttributeType) (ret CreateImagePayloadGetMinRamRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetMinRamAttributeType(arg *CreateImagePayloadGetMinRamAttributeType, val CreateImagePayloadGetMinRamRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateImagePayloadGetNameAttributeType = *string + +func getCreateImagePayloadGetNameAttributeTypeOk(arg CreateImagePayloadGetNameAttributeType) (ret CreateImagePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetNameAttributeType(arg *CreateImagePayloadGetNameAttributeType, val CreateImagePayloadGetNameRetType) { + *arg = &val +} + +type CreateImagePayloadGetNameArgType = string +type CreateImagePayloadGetNameRetType = string + +/* + types and functions for owner +*/ + +// isNotNullableString +type CreateImagePayloadGetOwnerAttributeType = *string + +func getCreateImagePayloadGetOwnerAttributeTypeOk(arg CreateImagePayloadGetOwnerAttributeType) (ret CreateImagePayloadGetOwnerRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetOwnerAttributeType(arg *CreateImagePayloadGetOwnerAttributeType, val CreateImagePayloadGetOwnerRetType) { + *arg = &val +} + +type CreateImagePayloadGetOwnerArgType = string +type CreateImagePayloadGetOwnerRetType = string + +/* + types and functions for protected +*/ + +// isBoolean +type CreateImagePayloadgetProtectedAttributeType = *bool +type CreateImagePayloadgetProtectedArgType = bool +type CreateImagePayloadgetProtectedRetType = bool + +func getCreateImagePayloadgetProtectedAttributeTypeOk(arg CreateImagePayloadgetProtectedAttributeType) (ret CreateImagePayloadgetProtectedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadgetProtectedAttributeType(arg *CreateImagePayloadgetProtectedAttributeType, val CreateImagePayloadgetProtectedRetType) { + *arg = &val +} + +/* + types and functions for scope +*/ + +// isNotNullableString +type CreateImagePayloadGetScopeAttributeType = *string + +func getCreateImagePayloadGetScopeAttributeTypeOk(arg CreateImagePayloadGetScopeAttributeType) (ret CreateImagePayloadGetScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetScopeAttributeType(arg *CreateImagePayloadGetScopeAttributeType, val CreateImagePayloadGetScopeRetType) { + *arg = &val +} + +type CreateImagePayloadGetScopeArgType = string +type CreateImagePayloadGetScopeRetType = string + +/* + types and functions for size +*/ + +// isLong +type CreateImagePayloadGetSizeAttributeType = *int64 +type CreateImagePayloadGetSizeArgType = int64 +type CreateImagePayloadGetSizeRetType = int64 + +func getCreateImagePayloadGetSizeAttributeTypeOk(arg CreateImagePayloadGetSizeAttributeType) (ret CreateImagePayloadGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetSizeAttributeType(arg *CreateImagePayloadGetSizeAttributeType, val CreateImagePayloadGetSizeRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type CreateImagePayloadGetStatusAttributeType = *string + +func getCreateImagePayloadGetStatusAttributeTypeOk(arg CreateImagePayloadGetStatusAttributeType) (ret CreateImagePayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetStatusAttributeType(arg *CreateImagePayloadGetStatusAttributeType, val CreateImagePayloadGetStatusRetType) { + *arg = &val +} + +type CreateImagePayloadGetStatusArgType = string +type CreateImagePayloadGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateImagePayloadGetUpdatedAtAttributeType = *time.Time +type CreateImagePayloadGetUpdatedAtArgType = time.Time +type CreateImagePayloadGetUpdatedAtRetType = time.Time + +func getCreateImagePayloadGetUpdatedAtAttributeTypeOk(arg CreateImagePayloadGetUpdatedAtAttributeType) (ret CreateImagePayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetUpdatedAtAttributeType(arg *CreateImagePayloadGetUpdatedAtAttributeType, val CreateImagePayloadGetUpdatedAtRetType) { + *arg = &val +} + +// CreateImagePayload Object that represents an Image and its parameters. Used for Creating and returning (get/list). +type CreateImagePayload struct { + Agent CreateImagePayloadGetAgentAttributeType `json:"agent,omitempty"` + Checksum CreateImagePayloadGetChecksumAttributeType `json:"checksum,omitempty"` + Config CreateImagePayloadGetConfigAttributeType `json:"config,omitempty"` + // Date-time when resource was created. + CreatedAt CreateImagePayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`. + // REQUIRED + DiskFormat CreateImagePayloadGetDiskFormatAttributeType `json:"diskFormat" required:"true"` + // Universally Unique Identifier (UUID). + Id CreateImagePayloadGetIdAttributeType `json:"id,omitempty"` + // Indicates Image Import Progress in percent. + ImportProgress CreateImagePayloadGetImportProgressAttributeType `json:"importProgress,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateImagePayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize CreateImagePayloadGetMinDiskSizeAttributeType `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam CreateImagePayloadGetMinRamAttributeType `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name CreateImagePayloadGetNameAttributeType `json:"name" required:"true"` + // Universally Unique Identifier (UUID). + Owner CreateImagePayloadGetOwnerAttributeType `json:"owner,omitempty"` + // When true the image is prevented from being deleted. + Protected CreateImagePayloadgetProtectedAttributeType `json:"protected,omitempty"` + // Scope of an Image. Possible values: `public`, `local`, `projects`, `organization`. + Scope CreateImagePayloadGetScopeAttributeType `json:"scope,omitempty"` + // Size in bytes. + Size CreateImagePayloadGetSizeAttributeType `json:"size,omitempty"` + // The status of an image object. Possible values: `AVAILABLE`, `CREATING`, `DEACTIVATED`, `DELETED`, `DELETING`, `ERROR`. + Status CreateImagePayloadGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateImagePayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _CreateImagePayload CreateImagePayload + +// NewCreateImagePayload instantiates a new CreateImagePayload 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 NewCreateImagePayload(diskFormat CreateImagePayloadGetDiskFormatArgType, name CreateImagePayloadGetNameArgType) *CreateImagePayload { + this := CreateImagePayload{} + setCreateImagePayloadGetDiskFormatAttributeType(&this.DiskFormat, diskFormat) + setCreateImagePayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateImagePayloadWithDefaults instantiates a new CreateImagePayload 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 NewCreateImagePayloadWithDefaults() *CreateImagePayload { + this := CreateImagePayload{} + return &this +} + +// GetAgent returns the Agent field value if set, zero value otherwise. +func (o *CreateImagePayload) GetAgent() (res CreateImagePayloadGetAgentRetType) { + res, _ = o.GetAgentOk() + return +} + +// GetAgentOk returns a tuple with the Agent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetAgentOk() (ret CreateImagePayloadGetAgentRetType, ok bool) { + return getCreateImagePayloadGetAgentAttributeTypeOk(o.Agent) +} + +// HasAgent returns a boolean if a field has been set. +func (o *CreateImagePayload) HasAgent() bool { + _, ok := o.GetAgentOk() + return ok +} + +// SetAgent gets a reference to the given ImageAgent and assigns it to the Agent field. +func (o *CreateImagePayload) SetAgent(v CreateImagePayloadGetAgentRetType) { + setCreateImagePayloadGetAgentAttributeType(&o.Agent, v) +} + +// GetChecksum returns the Checksum field value if set, zero value otherwise. +func (o *CreateImagePayload) GetChecksum() (res CreateImagePayloadGetChecksumRetType) { + res, _ = o.GetChecksumOk() + return +} + +// GetChecksumOk returns a tuple with the Checksum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetChecksumOk() (ret CreateImagePayloadGetChecksumRetType, ok bool) { + return getCreateImagePayloadGetChecksumAttributeTypeOk(o.Checksum) +} + +// HasChecksum returns a boolean if a field has been set. +func (o *CreateImagePayload) HasChecksum() bool { + _, ok := o.GetChecksumOk() + return ok +} + +// SetChecksum gets a reference to the given ImageChecksum and assigns it to the Checksum field. +func (o *CreateImagePayload) SetChecksum(v CreateImagePayloadGetChecksumRetType) { + setCreateImagePayloadGetChecksumAttributeType(&o.Checksum, v) +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *CreateImagePayload) GetConfig() (res CreateImagePayloadGetConfigRetType) { + res, _ = o.GetConfigOk() + return +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetConfigOk() (ret CreateImagePayloadGetConfigRetType, ok bool) { + return getCreateImagePayloadGetConfigAttributeTypeOk(o.Config) +} + +// HasConfig returns a boolean if a field has been set. +func (o *CreateImagePayload) HasConfig() bool { + _, ok := o.GetConfigOk() + return ok +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *CreateImagePayload) SetConfig(v CreateImagePayloadGetConfigRetType) { + setCreateImagePayloadGetConfigAttributeType(&o.Config, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateImagePayload) GetCreatedAt() (res CreateImagePayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetCreatedAtOk() (ret CreateImagePayloadGetCreatedAtRetType, ok bool) { + return getCreateImagePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateImagePayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateImagePayload) SetCreatedAt(v CreateImagePayloadGetCreatedAtRetType) { + setCreateImagePayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDiskFormat returns the DiskFormat field value +func (o *CreateImagePayload) GetDiskFormat() (ret CreateImagePayloadGetDiskFormatRetType) { + ret, _ = o.GetDiskFormatOk() + return ret +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetDiskFormatOk() (ret CreateImagePayloadGetDiskFormatRetType, ok bool) { + return getCreateImagePayloadGetDiskFormatAttributeTypeOk(o.DiskFormat) +} + +// SetDiskFormat sets field value +func (o *CreateImagePayload) SetDiskFormat(v CreateImagePayloadGetDiskFormatRetType) { + setCreateImagePayloadGetDiskFormatAttributeType(&o.DiskFormat, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateImagePayload) GetId() (res CreateImagePayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetIdOk() (ret CreateImagePayloadGetIdRetType, ok bool) { + return getCreateImagePayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateImagePayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateImagePayload) SetId(v CreateImagePayloadGetIdRetType) { + setCreateImagePayloadGetIdAttributeType(&o.Id, v) +} + +// GetImportProgress returns the ImportProgress field value if set, zero value otherwise. +func (o *CreateImagePayload) GetImportProgress() (res CreateImagePayloadGetImportProgressRetType) { + res, _ = o.GetImportProgressOk() + return +} + +// GetImportProgressOk returns a tuple with the ImportProgress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetImportProgressOk() (ret CreateImagePayloadGetImportProgressRetType, ok bool) { + return getCreateImagePayloadGetImportProgressAttributeTypeOk(o.ImportProgress) +} + +// HasImportProgress returns a boolean if a field has been set. +func (o *CreateImagePayload) HasImportProgress() bool { + _, ok := o.GetImportProgressOk() + return ok +} + +// SetImportProgress gets a reference to the given int64 and assigns it to the ImportProgress field. +func (o *CreateImagePayload) SetImportProgress(v CreateImagePayloadGetImportProgressRetType) { + setCreateImagePayloadGetImportProgressAttributeType(&o.ImportProgress, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateImagePayload) GetLabels() (res CreateImagePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetLabelsOk() (ret CreateImagePayloadGetLabelsRetType, ok bool) { + return getCreateImagePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateImagePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateImagePayload) SetLabels(v CreateImagePayloadGetLabelsRetType) { + setCreateImagePayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *CreateImagePayload) GetMinDiskSize() (res CreateImagePayloadGetMinDiskSizeRetType) { + res, _ = o.GetMinDiskSizeOk() + return +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetMinDiskSizeOk() (ret CreateImagePayloadGetMinDiskSizeRetType, ok bool) { + return getCreateImagePayloadGetMinDiskSizeAttributeTypeOk(o.MinDiskSize) +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *CreateImagePayload) HasMinDiskSize() bool { + _, ok := o.GetMinDiskSizeOk() + return ok +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *CreateImagePayload) SetMinDiskSize(v CreateImagePayloadGetMinDiskSizeRetType) { + setCreateImagePayloadGetMinDiskSizeAttributeType(&o.MinDiskSize, v) +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *CreateImagePayload) GetMinRam() (res CreateImagePayloadGetMinRamRetType) { + res, _ = o.GetMinRamOk() + return +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetMinRamOk() (ret CreateImagePayloadGetMinRamRetType, ok bool) { + return getCreateImagePayloadGetMinRamAttributeTypeOk(o.MinRam) +} + +// HasMinRam returns a boolean if a field has been set. +func (o *CreateImagePayload) HasMinRam() bool { + _, ok := o.GetMinRamOk() + return ok +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *CreateImagePayload) SetMinRam(v CreateImagePayloadGetMinRamRetType) { + setCreateImagePayloadGetMinRamAttributeType(&o.MinRam, v) +} + +// GetName returns the Name field value +func (o *CreateImagePayload) GetName() (ret CreateImagePayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetNameOk() (ret CreateImagePayloadGetNameRetType, ok bool) { + return getCreateImagePayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateImagePayload) SetName(v CreateImagePayloadGetNameRetType) { + setCreateImagePayloadGetNameAttributeType(&o.Name, v) +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *CreateImagePayload) GetOwner() (res CreateImagePayloadGetOwnerRetType) { + res, _ = o.GetOwnerOk() + return +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetOwnerOk() (ret CreateImagePayloadGetOwnerRetType, ok bool) { + return getCreateImagePayloadGetOwnerAttributeTypeOk(o.Owner) +} + +// HasOwner returns a boolean if a field has been set. +func (o *CreateImagePayload) HasOwner() bool { + _, ok := o.GetOwnerOk() + return ok +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *CreateImagePayload) SetOwner(v CreateImagePayloadGetOwnerRetType) { + setCreateImagePayloadGetOwnerAttributeType(&o.Owner, v) +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *CreateImagePayload) GetProtected() (res CreateImagePayloadgetProtectedRetType) { + res, _ = o.GetProtectedOk() + return +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetProtectedOk() (ret CreateImagePayloadgetProtectedRetType, ok bool) { + return getCreateImagePayloadgetProtectedAttributeTypeOk(o.Protected) +} + +// HasProtected returns a boolean if a field has been set. +func (o *CreateImagePayload) HasProtected() bool { + _, ok := o.GetProtectedOk() + return ok +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *CreateImagePayload) SetProtected(v CreateImagePayloadgetProtectedRetType) { + setCreateImagePayloadgetProtectedAttributeType(&o.Protected, v) +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *CreateImagePayload) GetScope() (res CreateImagePayloadGetScopeRetType) { + res, _ = o.GetScopeOk() + return +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetScopeOk() (ret CreateImagePayloadGetScopeRetType, ok bool) { + return getCreateImagePayloadGetScopeAttributeTypeOk(o.Scope) +} + +// HasScope returns a boolean if a field has been set. +func (o *CreateImagePayload) HasScope() bool { + _, ok := o.GetScopeOk() + return ok +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *CreateImagePayload) SetScope(v CreateImagePayloadGetScopeRetType) { + setCreateImagePayloadGetScopeAttributeType(&o.Scope, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *CreateImagePayload) GetSize() (res CreateImagePayloadGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetSizeOk() (ret CreateImagePayloadGetSizeRetType, ok bool) { + return getCreateImagePayloadGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *CreateImagePayload) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *CreateImagePayload) SetSize(v CreateImagePayloadGetSizeRetType) { + setCreateImagePayloadGetSizeAttributeType(&o.Size, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateImagePayload) GetStatus() (res CreateImagePayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetStatusOk() (ret CreateImagePayloadGetStatusRetType, ok bool) { + return getCreateImagePayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateImagePayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateImagePayload) SetStatus(v CreateImagePayloadGetStatusRetType) { + setCreateImagePayloadGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateImagePayload) GetUpdatedAt() (res CreateImagePayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetUpdatedAtOk() (ret CreateImagePayloadGetUpdatedAtRetType, ok bool) { + return getCreateImagePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateImagePayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateImagePayload) SetUpdatedAt(v CreateImagePayloadGetUpdatedAtRetType) { + setCreateImagePayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o CreateImagePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateImagePayloadGetAgentAttributeTypeOk(o.Agent); ok { + toSerialize["Agent"] = val + } + if val, ok := getCreateImagePayloadGetChecksumAttributeTypeOk(o.Checksum); ok { + toSerialize["Checksum"] = val + } + if val, ok := getCreateImagePayloadGetConfigAttributeTypeOk(o.Config); ok { + toSerialize["Config"] = val + } + if val, ok := getCreateImagePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateImagePayloadGetDiskFormatAttributeTypeOk(o.DiskFormat); ok { + toSerialize["DiskFormat"] = val + } + if val, ok := getCreateImagePayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateImagePayloadGetImportProgressAttributeTypeOk(o.ImportProgress); ok { + toSerialize["ImportProgress"] = val + } + if val, ok := getCreateImagePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateImagePayloadGetMinDiskSizeAttributeTypeOk(o.MinDiskSize); ok { + toSerialize["MinDiskSize"] = val + } + if val, ok := getCreateImagePayloadGetMinRamAttributeTypeOk(o.MinRam); ok { + toSerialize["MinRam"] = val + } + if val, ok := getCreateImagePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateImagePayloadGetOwnerAttributeTypeOk(o.Owner); ok { + toSerialize["Owner"] = val + } + if val, ok := getCreateImagePayloadgetProtectedAttributeTypeOk(o.Protected); ok { + toSerialize["Protected"] = val + } + if val, ok := getCreateImagePayloadGetScopeAttributeTypeOk(o.Scope); ok { + toSerialize["Scope"] = val + } + if val, ok := getCreateImagePayloadGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getCreateImagePayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getCreateImagePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableCreateImagePayload struct { + value *CreateImagePayload + isSet bool +} + +func (v NullableCreateImagePayload) Get() *CreateImagePayload { + return v.value +} + +func (v *NullableCreateImagePayload) Set(val *CreateImagePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateImagePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateImagePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateImagePayload(val *CreateImagePayload) *NullableCreateImagePayload { + return &NullableCreateImagePayload{value: val, isSet: true} +} + +func (v NullableCreateImagePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateImagePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_image_payload_test.go b/pkg/iaasbeta/model_create_image_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_image_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_isolated_network_payload.go b/pkg/iaasbeta/model_create_isolated_network_payload.go new file mode 100644 index 00000000..4d208225 --- /dev/null +++ b/pkg/iaasbeta/model_create_isolated_network_payload.go @@ -0,0 +1,272 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateIsolatedNetworkPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateIsolatedNetworkPayload{} + +/* + types and functions for dhcp +*/ + +// isBoolean +type CreateIsolatedNetworkPayloadgetDhcpAttributeType = *bool +type CreateIsolatedNetworkPayloadgetDhcpArgType = bool +type CreateIsolatedNetworkPayloadgetDhcpRetType = bool + +func getCreateIsolatedNetworkPayloadgetDhcpAttributeTypeOk(arg CreateIsolatedNetworkPayloadgetDhcpAttributeType) (ret CreateIsolatedNetworkPayloadgetDhcpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIsolatedNetworkPayloadgetDhcpAttributeType(arg *CreateIsolatedNetworkPayloadgetDhcpAttributeType, val CreateIsolatedNetworkPayloadgetDhcpRetType) { + *arg = &val +} + +/* + types and functions for ipv4 +*/ + +// isModel +type CreateIsolatedNetworkPayloadGetIpv4AttributeType = *CreateNetworkIPv4 +type CreateIsolatedNetworkPayloadGetIpv4ArgType = CreateNetworkIPv4 +type CreateIsolatedNetworkPayloadGetIpv4RetType = CreateNetworkIPv4 + +func getCreateIsolatedNetworkPayloadGetIpv4AttributeTypeOk(arg CreateIsolatedNetworkPayloadGetIpv4AttributeType) (ret CreateIsolatedNetworkPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIsolatedNetworkPayloadGetIpv4AttributeType(arg *CreateIsolatedNetworkPayloadGetIpv4AttributeType, val CreateIsolatedNetworkPayloadGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateIsolatedNetworkPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateIsolatedNetworkPayloadGetLabelsArgType = map[string]interface{} +type CreateIsolatedNetworkPayloadGetLabelsRetType = map[string]interface{} + +func getCreateIsolatedNetworkPayloadGetLabelsAttributeTypeOk(arg CreateIsolatedNetworkPayloadGetLabelsAttributeType) (ret CreateIsolatedNetworkPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIsolatedNetworkPayloadGetLabelsAttributeType(arg *CreateIsolatedNetworkPayloadGetLabelsAttributeType, val CreateIsolatedNetworkPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateIsolatedNetworkPayloadGetNameAttributeType = *string + +func getCreateIsolatedNetworkPayloadGetNameAttributeTypeOk(arg CreateIsolatedNetworkPayloadGetNameAttributeType) (ret CreateIsolatedNetworkPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIsolatedNetworkPayloadGetNameAttributeType(arg *CreateIsolatedNetworkPayloadGetNameAttributeType, val CreateIsolatedNetworkPayloadGetNameRetType) { + *arg = &val +} + +type CreateIsolatedNetworkPayloadGetNameArgType = string +type CreateIsolatedNetworkPayloadGetNameRetType = string + +// CreateIsolatedNetworkPayload Object that represents the request body for a single isolated network create. +type CreateIsolatedNetworkPayload struct { + // Enable or disable DHCP for a network. + Dhcp CreateIsolatedNetworkPayloadgetDhcpAttributeType `json:"dhcp,omitempty"` + Ipv4 CreateIsolatedNetworkPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateIsolatedNetworkPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name CreateIsolatedNetworkPayloadGetNameAttributeType `json:"name" required:"true"` +} + +type _CreateIsolatedNetworkPayload CreateIsolatedNetworkPayload + +// NewCreateIsolatedNetworkPayload instantiates a new CreateIsolatedNetworkPayload 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 NewCreateIsolatedNetworkPayload(name CreateIsolatedNetworkPayloadGetNameArgType) *CreateIsolatedNetworkPayload { + this := CreateIsolatedNetworkPayload{} + setCreateIsolatedNetworkPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateIsolatedNetworkPayloadWithDefaults instantiates a new CreateIsolatedNetworkPayload 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 NewCreateIsolatedNetworkPayloadWithDefaults() *CreateIsolatedNetworkPayload { + this := CreateIsolatedNetworkPayload{} + var dhcp bool = true + this.Dhcp = &dhcp + return &this +} + +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *CreateIsolatedNetworkPayload) GetDhcp() (res CreateIsolatedNetworkPayloadgetDhcpRetType) { + res, _ = o.GetDhcpOk() + return +} + +// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIsolatedNetworkPayload) GetDhcpOk() (ret CreateIsolatedNetworkPayloadgetDhcpRetType, ok bool) { + return getCreateIsolatedNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp) +} + +// HasDhcp returns a boolean if a field has been set. +func (o *CreateIsolatedNetworkPayload) HasDhcp() bool { + _, ok := o.GetDhcpOk() + return ok +} + +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *CreateIsolatedNetworkPayload) SetDhcp(v CreateIsolatedNetworkPayloadgetDhcpRetType) { + setCreateIsolatedNetworkPayloadgetDhcpAttributeType(&o.Dhcp, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateIsolatedNetworkPayload) GetIpv4() (res CreateIsolatedNetworkPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIsolatedNetworkPayload) GetIpv4Ok() (ret CreateIsolatedNetworkPayloadGetIpv4RetType, ok bool) { + return getCreateIsolatedNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateIsolatedNetworkPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given CreateNetworkIPv4 and assigns it to the Ipv4 field. +func (o *CreateIsolatedNetworkPayload) SetIpv4(v CreateIsolatedNetworkPayloadGetIpv4RetType) { + setCreateIsolatedNetworkPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateIsolatedNetworkPayload) GetLabels() (res CreateIsolatedNetworkPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIsolatedNetworkPayload) GetLabelsOk() (ret CreateIsolatedNetworkPayloadGetLabelsRetType, ok bool) { + return getCreateIsolatedNetworkPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateIsolatedNetworkPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateIsolatedNetworkPayload) SetLabels(v CreateIsolatedNetworkPayloadGetLabelsRetType) { + setCreateIsolatedNetworkPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *CreateIsolatedNetworkPayload) GetName() (ret CreateIsolatedNetworkPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateIsolatedNetworkPayload) GetNameOk() (ret CreateIsolatedNetworkPayloadGetNameRetType, ok bool) { + return getCreateIsolatedNetworkPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateIsolatedNetworkPayload) SetName(v CreateIsolatedNetworkPayloadGetNameRetType) { + setCreateIsolatedNetworkPayloadGetNameAttributeType(&o.Name, v) +} + +func (o CreateIsolatedNetworkPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateIsolatedNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp); ok { + toSerialize["Dhcp"] = val + } + if val, ok := getCreateIsolatedNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getCreateIsolatedNetworkPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateIsolatedNetworkPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableCreateIsolatedNetworkPayload struct { + value *CreateIsolatedNetworkPayload + isSet bool +} + +func (v NullableCreateIsolatedNetworkPayload) Get() *CreateIsolatedNetworkPayload { + return v.value +} + +func (v *NullableCreateIsolatedNetworkPayload) Set(val *CreateIsolatedNetworkPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateIsolatedNetworkPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateIsolatedNetworkPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateIsolatedNetworkPayload(val *CreateIsolatedNetworkPayload) *NullableCreateIsolatedNetworkPayload { + return &NullableCreateIsolatedNetworkPayload{value: val, isSet: true} +} + +func (v NullableCreateIsolatedNetworkPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateIsolatedNetworkPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_isolated_network_payload_test.go b/pkg/iaasbeta/model_create_isolated_network_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_isolated_network_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_key_pair_payload.go b/pkg/iaasbeta/model_create_key_pair_payload.go new file mode 100644 index 00000000..d727784a --- /dev/null +++ b/pkg/iaasbeta/model_create_key_pair_payload.go @@ -0,0 +1,370 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the CreateKeyPairPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateKeyPairPayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateKeyPairPayloadGetCreatedAtAttributeType = *time.Time +type CreateKeyPairPayloadGetCreatedAtArgType = time.Time +type CreateKeyPairPayloadGetCreatedAtRetType = time.Time + +func getCreateKeyPairPayloadGetCreatedAtAttributeTypeOk(arg CreateKeyPairPayloadGetCreatedAtAttributeType) (ret CreateKeyPairPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetCreatedAtAttributeType(arg *CreateKeyPairPayloadGetCreatedAtAttributeType, val CreateKeyPairPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for fingerprint +*/ + +// isNotNullableString +type CreateKeyPairPayloadGetFingerprintAttributeType = *string + +func getCreateKeyPairPayloadGetFingerprintAttributeTypeOk(arg CreateKeyPairPayloadGetFingerprintAttributeType) (ret CreateKeyPairPayloadGetFingerprintRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetFingerprintAttributeType(arg *CreateKeyPairPayloadGetFingerprintAttributeType, val CreateKeyPairPayloadGetFingerprintRetType) { + *arg = &val +} + +type CreateKeyPairPayloadGetFingerprintArgType = string +type CreateKeyPairPayloadGetFingerprintRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateKeyPairPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateKeyPairPayloadGetLabelsArgType = map[string]interface{} +type CreateKeyPairPayloadGetLabelsRetType = map[string]interface{} + +func getCreateKeyPairPayloadGetLabelsAttributeTypeOk(arg CreateKeyPairPayloadGetLabelsAttributeType) (ret CreateKeyPairPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetLabelsAttributeType(arg *CreateKeyPairPayloadGetLabelsAttributeType, val CreateKeyPairPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateKeyPairPayloadGetNameAttributeType = *string + +func getCreateKeyPairPayloadGetNameAttributeTypeOk(arg CreateKeyPairPayloadGetNameAttributeType) (ret CreateKeyPairPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetNameAttributeType(arg *CreateKeyPairPayloadGetNameAttributeType, val CreateKeyPairPayloadGetNameRetType) { + *arg = &val +} + +type CreateKeyPairPayloadGetNameArgType = string +type CreateKeyPairPayloadGetNameRetType = string + +/* + types and functions for publicKey +*/ + +// isNotNullableString +type CreateKeyPairPayloadGetPublicKeyAttributeType = *string + +func getCreateKeyPairPayloadGetPublicKeyAttributeTypeOk(arg CreateKeyPairPayloadGetPublicKeyAttributeType) (ret CreateKeyPairPayloadGetPublicKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetPublicKeyAttributeType(arg *CreateKeyPairPayloadGetPublicKeyAttributeType, val CreateKeyPairPayloadGetPublicKeyRetType) { + *arg = &val +} + +type CreateKeyPairPayloadGetPublicKeyArgType = string +type CreateKeyPairPayloadGetPublicKeyRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateKeyPairPayloadGetUpdatedAtAttributeType = *time.Time +type CreateKeyPairPayloadGetUpdatedAtArgType = time.Time +type CreateKeyPairPayloadGetUpdatedAtRetType = time.Time + +func getCreateKeyPairPayloadGetUpdatedAtAttributeTypeOk(arg CreateKeyPairPayloadGetUpdatedAtAttributeType) (ret CreateKeyPairPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetUpdatedAtAttributeType(arg *CreateKeyPairPayloadGetUpdatedAtAttributeType, val CreateKeyPairPayloadGetUpdatedAtRetType) { + *arg = &val +} + +// CreateKeyPairPayload Object that represents the public key of an SSH keypair and its name. +type CreateKeyPairPayload struct { + // Date-time when resource was created. + CreatedAt CreateKeyPairPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Object that represents an SSH keypair MD5 fingerprint. + Fingerprint CreateKeyPairPayloadGetFingerprintAttributeType `json:"fingerprint,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateKeyPairPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. + Name CreateKeyPairPayloadGetNameAttributeType `json:"name,omitempty"` + // Object that represents a public SSH key. + // REQUIRED + PublicKey CreateKeyPairPayloadGetPublicKeyAttributeType `json:"publicKey" required:"true"` + // Date-time when resource was last updated. + UpdatedAt CreateKeyPairPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _CreateKeyPairPayload CreateKeyPairPayload + +// NewCreateKeyPairPayload instantiates a new CreateKeyPairPayload 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 NewCreateKeyPairPayload(publicKey CreateKeyPairPayloadGetPublicKeyArgType) *CreateKeyPairPayload { + this := CreateKeyPairPayload{} + setCreateKeyPairPayloadGetPublicKeyAttributeType(&this.PublicKey, publicKey) + return &this +} + +// NewCreateKeyPairPayloadWithDefaults instantiates a new CreateKeyPairPayload 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 NewCreateKeyPairPayloadWithDefaults() *CreateKeyPairPayload { + this := CreateKeyPairPayload{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) GetCreatedAt() (res CreateKeyPairPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetCreatedAtOk() (ret CreateKeyPairPayloadGetCreatedAtRetType, ok bool) { + return getCreateKeyPairPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateKeyPairPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateKeyPairPayload) SetCreatedAt(v CreateKeyPairPayloadGetCreatedAtRetType) { + setCreateKeyPairPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetFingerprint returns the Fingerprint field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) GetFingerprint() (res CreateKeyPairPayloadGetFingerprintRetType) { + res, _ = o.GetFingerprintOk() + return +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetFingerprintOk() (ret CreateKeyPairPayloadGetFingerprintRetType, ok bool) { + return getCreateKeyPairPayloadGetFingerprintAttributeTypeOk(o.Fingerprint) +} + +// HasFingerprint returns a boolean if a field has been set. +func (o *CreateKeyPairPayload) HasFingerprint() bool { + _, ok := o.GetFingerprintOk() + return ok +} + +// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field. +func (o *CreateKeyPairPayload) SetFingerprint(v CreateKeyPairPayloadGetFingerprintRetType) { + setCreateKeyPairPayloadGetFingerprintAttributeType(&o.Fingerprint, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) GetLabels() (res CreateKeyPairPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetLabelsOk() (ret CreateKeyPairPayloadGetLabelsRetType, ok bool) { + return getCreateKeyPairPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateKeyPairPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateKeyPairPayload) SetLabels(v CreateKeyPairPayloadGetLabelsRetType) { + setCreateKeyPairPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) GetName() (res CreateKeyPairPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetNameOk() (ret CreateKeyPairPayloadGetNameRetType, ok bool) { + return getCreateKeyPairPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateKeyPairPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateKeyPairPayload) SetName(v CreateKeyPairPayloadGetNameRetType) { + setCreateKeyPairPayloadGetNameAttributeType(&o.Name, v) +} + +// GetPublicKey returns the PublicKey field value +func (o *CreateKeyPairPayload) GetPublicKey() (ret CreateKeyPairPayloadGetPublicKeyRetType) { + ret, _ = o.GetPublicKeyOk() + return ret +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetPublicKeyOk() (ret CreateKeyPairPayloadGetPublicKeyRetType, ok bool) { + return getCreateKeyPairPayloadGetPublicKeyAttributeTypeOk(o.PublicKey) +} + +// SetPublicKey sets field value +func (o *CreateKeyPairPayload) SetPublicKey(v CreateKeyPairPayloadGetPublicKeyRetType) { + setCreateKeyPairPayloadGetPublicKeyAttributeType(&o.PublicKey, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) GetUpdatedAt() (res CreateKeyPairPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetUpdatedAtOk() (ret CreateKeyPairPayloadGetUpdatedAtRetType, ok bool) { + return getCreateKeyPairPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateKeyPairPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateKeyPairPayload) SetUpdatedAt(v CreateKeyPairPayloadGetUpdatedAtRetType) { + setCreateKeyPairPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o CreateKeyPairPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateKeyPairPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateKeyPairPayloadGetFingerprintAttributeTypeOk(o.Fingerprint); ok { + toSerialize["Fingerprint"] = val + } + if val, ok := getCreateKeyPairPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateKeyPairPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateKeyPairPayloadGetPublicKeyAttributeTypeOk(o.PublicKey); ok { + toSerialize["PublicKey"] = val + } + if val, ok := getCreateKeyPairPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableCreateKeyPairPayload struct { + value *CreateKeyPairPayload + isSet bool +} + +func (v NullableCreateKeyPairPayload) Get() *CreateKeyPairPayload { + return v.value +} + +func (v *NullableCreateKeyPairPayload) Set(val *CreateKeyPairPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateKeyPairPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateKeyPairPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateKeyPairPayload(val *CreateKeyPairPayload) *NullableCreateKeyPairPayload { + return &NullableCreateKeyPairPayload{value: val, isSet: true} +} + +func (v NullableCreateKeyPairPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateKeyPairPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_key_pair_payload_test.go b/pkg/iaasbeta/model_create_key_pair_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_key_pair_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_network_area_payload.go b/pkg/iaasbeta/model_create_network_area_payload.go new file mode 100644 index 00000000..f7a0eb2f --- /dev/null +++ b/pkg/iaasbeta/model_create_network_area_payload.go @@ -0,0 +1,174 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateNetworkAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkAreaPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateNetworkAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateNetworkAreaPayloadGetLabelsArgType = map[string]interface{} +type CreateNetworkAreaPayloadGetLabelsRetType = map[string]interface{} + +func getCreateNetworkAreaPayloadGetLabelsAttributeTypeOk(arg CreateNetworkAreaPayloadGetLabelsAttributeType) (ret CreateNetworkAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAreaPayloadGetLabelsAttributeType(arg *CreateNetworkAreaPayloadGetLabelsAttributeType, val CreateNetworkAreaPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateNetworkAreaPayloadGetNameAttributeType = *string + +func getCreateNetworkAreaPayloadGetNameAttributeTypeOk(arg CreateNetworkAreaPayloadGetNameAttributeType) (ret CreateNetworkAreaPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAreaPayloadGetNameAttributeType(arg *CreateNetworkAreaPayloadGetNameAttributeType, val CreateNetworkAreaPayloadGetNameRetType) { + *arg = &val +} + +type CreateNetworkAreaPayloadGetNameArgType = string +type CreateNetworkAreaPayloadGetNameRetType = string + +// CreateNetworkAreaPayload Object that represents the network area create request. +type CreateNetworkAreaPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateNetworkAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Name CreateNetworkAreaPayloadGetNameAttributeType `json:"name" required:"true"` +} + +type _CreateNetworkAreaPayload CreateNetworkAreaPayload + +// NewCreateNetworkAreaPayload instantiates a new CreateNetworkAreaPayload 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 NewCreateNetworkAreaPayload(name CreateNetworkAreaPayloadGetNameArgType) *CreateNetworkAreaPayload { + this := CreateNetworkAreaPayload{} + setCreateNetworkAreaPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateNetworkAreaPayloadWithDefaults instantiates a new CreateNetworkAreaPayload 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 NewCreateNetworkAreaPayloadWithDefaults() *CreateNetworkAreaPayload { + this := CreateNetworkAreaPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateNetworkAreaPayload) GetLabels() (res CreateNetworkAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkAreaPayload) GetLabelsOk() (ret CreateNetworkAreaPayloadGetLabelsRetType, ok bool) { + return getCreateNetworkAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateNetworkAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateNetworkAreaPayload) SetLabels(v CreateNetworkAreaPayloadGetLabelsRetType) { + setCreateNetworkAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *CreateNetworkAreaPayload) GetName() (ret CreateNetworkAreaPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkAreaPayload) GetNameOk() (ret CreateNetworkAreaPayloadGetNameRetType, ok bool) { + return getCreateNetworkAreaPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateNetworkAreaPayload) SetName(v CreateNetworkAreaPayloadGetNameRetType) { + setCreateNetworkAreaPayloadGetNameAttributeType(&o.Name, v) +} + +func (o CreateNetworkAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateNetworkAreaPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkAreaPayload struct { + value *CreateNetworkAreaPayload + isSet bool +} + +func (v NullableCreateNetworkAreaPayload) Get() *CreateNetworkAreaPayload { + return v.value +} + +func (v *NullableCreateNetworkAreaPayload) Set(val *CreateNetworkAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkAreaPayload(val *CreateNetworkAreaPayload) *NullableCreateNetworkAreaPayload { + return &NullableCreateNetworkAreaPayload{value: val, isSet: true} +} + +func (v NullableCreateNetworkAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_network_area_payload_test.go b/pkg/iaasbeta/model_create_network_area_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_area_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_network_area_range_payload.go b/pkg/iaasbeta/model_create_network_area_range_payload.go new file mode 100644 index 00000000..507f1ec7 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_area_range_payload.go @@ -0,0 +1,128 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateNetworkAreaRangePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkAreaRangePayload{} + +/* + types and functions for ipv4 +*/ + +// isArray +type CreateNetworkAreaRangePayloadGetIpv4AttributeType = *[]NetworkRange +type CreateNetworkAreaRangePayloadGetIpv4ArgType = []NetworkRange +type CreateNetworkAreaRangePayloadGetIpv4RetType = []NetworkRange + +func getCreateNetworkAreaRangePayloadGetIpv4AttributeTypeOk(arg CreateNetworkAreaRangePayloadGetIpv4AttributeType) (ret CreateNetworkAreaRangePayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAreaRangePayloadGetIpv4AttributeType(arg *CreateNetworkAreaRangePayloadGetIpv4AttributeType, val CreateNetworkAreaRangePayloadGetIpv4RetType) { + *arg = &val +} + +// CreateNetworkAreaRangePayload struct for CreateNetworkAreaRangePayload +type CreateNetworkAreaRangePayload struct { + // A list of network ranges. + Ipv4 CreateNetworkAreaRangePayloadGetIpv4AttributeType `json:"ipv4,omitempty"` +} + +// NewCreateNetworkAreaRangePayload instantiates a new CreateNetworkAreaRangePayload 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 NewCreateNetworkAreaRangePayload() *CreateNetworkAreaRangePayload { + this := CreateNetworkAreaRangePayload{} + return &this +} + +// NewCreateNetworkAreaRangePayloadWithDefaults instantiates a new CreateNetworkAreaRangePayload 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 NewCreateNetworkAreaRangePayloadWithDefaults() *CreateNetworkAreaRangePayload { + this := CreateNetworkAreaRangePayload{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateNetworkAreaRangePayload) GetIpv4() (res CreateNetworkAreaRangePayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkAreaRangePayload) GetIpv4Ok() (ret CreateNetworkAreaRangePayloadGetIpv4RetType, ok bool) { + return getCreateNetworkAreaRangePayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateNetworkAreaRangePayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given []NetworkRange and assigns it to the Ipv4 field. +func (o *CreateNetworkAreaRangePayload) SetIpv4(v CreateNetworkAreaRangePayloadGetIpv4RetType) { + setCreateNetworkAreaRangePayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +func (o CreateNetworkAreaRangePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkAreaRangePayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkAreaRangePayload struct { + value *CreateNetworkAreaRangePayload + isSet bool +} + +func (v NullableCreateNetworkAreaRangePayload) Get() *CreateNetworkAreaRangePayload { + return v.value +} + +func (v *NullableCreateNetworkAreaRangePayload) Set(val *CreateNetworkAreaRangePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkAreaRangePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkAreaRangePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkAreaRangePayload(val *CreateNetworkAreaRangePayload) *NullableCreateNetworkAreaRangePayload { + return &NullableCreateNetworkAreaRangePayload{value: val, isSet: true} +} + +func (v NullableCreateNetworkAreaRangePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkAreaRangePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_network_area_range_payload_test.go b/pkg/iaasbeta/model_create_network_area_range_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_area_range_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_network_area_route_payload.go b/pkg/iaasbeta/model_create_network_area_route_payload.go new file mode 100644 index 00000000..ee1d00d7 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_area_route_payload.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateNetworkAreaRoutePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkAreaRoutePayload{} + +/* + types and functions for items +*/ + +// isArray +type CreateNetworkAreaRoutePayloadGetItemsAttributeType = *[]Route +type CreateNetworkAreaRoutePayloadGetItemsArgType = []Route +type CreateNetworkAreaRoutePayloadGetItemsRetType = []Route + +func getCreateNetworkAreaRoutePayloadGetItemsAttributeTypeOk(arg CreateNetworkAreaRoutePayloadGetItemsAttributeType) (ret CreateNetworkAreaRoutePayloadGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAreaRoutePayloadGetItemsAttributeType(arg *CreateNetworkAreaRoutePayloadGetItemsAttributeType, val CreateNetworkAreaRoutePayloadGetItemsRetType) { + *arg = &val +} + +// CreateNetworkAreaRoutePayload Object represents a request to add network routes. +type CreateNetworkAreaRoutePayload struct { + // A list of routes. + // REQUIRED + Items CreateNetworkAreaRoutePayloadGetItemsAttributeType `json:"items" required:"true"` +} + +type _CreateNetworkAreaRoutePayload CreateNetworkAreaRoutePayload + +// NewCreateNetworkAreaRoutePayload instantiates a new CreateNetworkAreaRoutePayload 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 NewCreateNetworkAreaRoutePayload(items CreateNetworkAreaRoutePayloadGetItemsArgType) *CreateNetworkAreaRoutePayload { + this := CreateNetworkAreaRoutePayload{} + setCreateNetworkAreaRoutePayloadGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewCreateNetworkAreaRoutePayloadWithDefaults instantiates a new CreateNetworkAreaRoutePayload 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 NewCreateNetworkAreaRoutePayloadWithDefaults() *CreateNetworkAreaRoutePayload { + this := CreateNetworkAreaRoutePayload{} + return &this +} + +// GetItems returns the Items field value +func (o *CreateNetworkAreaRoutePayload) GetItems() (ret CreateNetworkAreaRoutePayloadGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkAreaRoutePayload) GetItemsOk() (ret CreateNetworkAreaRoutePayloadGetItemsRetType, ok bool) { + return getCreateNetworkAreaRoutePayloadGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *CreateNetworkAreaRoutePayload) SetItems(v CreateNetworkAreaRoutePayloadGetItemsRetType) { + setCreateNetworkAreaRoutePayloadGetItemsAttributeType(&o.Items, v) +} + +func (o CreateNetworkAreaRoutePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkAreaRoutePayloadGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkAreaRoutePayload struct { + value *CreateNetworkAreaRoutePayload + isSet bool +} + +func (v NullableCreateNetworkAreaRoutePayload) Get() *CreateNetworkAreaRoutePayload { + return v.value +} + +func (v *NullableCreateNetworkAreaRoutePayload) Set(val *CreateNetworkAreaRoutePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkAreaRoutePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkAreaRoutePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkAreaRoutePayload(val *CreateNetworkAreaRoutePayload) *NullableCreateNetworkAreaRoutePayload { + return &NullableCreateNetworkAreaRoutePayload{value: val, isSet: true} +} + +func (v NullableCreateNetworkAreaRoutePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkAreaRoutePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_network_area_route_payload_test.go b/pkg/iaasbeta/model_create_network_area_route_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_area_route_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_network_ipv4.go b/pkg/iaasbeta/model_create_network_ipv4.go new file mode 100644 index 00000000..376a8c91 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv4.go @@ -0,0 +1,144 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "fmt" +) + +// CreateNetworkIPv4 - The create request for an IPv4 network. +type CreateNetworkIPv4 struct { + CreateNetworkIPv4WithPrefix *CreateNetworkIPv4WithPrefix + CreateNetworkIPv4WithPrefixLength *CreateNetworkIPv4WithPrefixLength +} + +// CreateNetworkIPv4WithPrefixAsCreateNetworkIPv4 is a convenience function that returns CreateNetworkIPv4WithPrefix wrapped in CreateNetworkIPv4 +func CreateNetworkIPv4WithPrefixAsCreateNetworkIPv4(v *CreateNetworkIPv4WithPrefix) CreateNetworkIPv4 { + return CreateNetworkIPv4{ + CreateNetworkIPv4WithPrefix: v, + } +} + +// CreateNetworkIPv4WithPrefixLengthAsCreateNetworkIPv4 is a convenience function that returns CreateNetworkIPv4WithPrefixLength wrapped in CreateNetworkIPv4 +func CreateNetworkIPv4WithPrefixLengthAsCreateNetworkIPv4(v *CreateNetworkIPv4WithPrefixLength) CreateNetworkIPv4 { + return CreateNetworkIPv4{ + CreateNetworkIPv4WithPrefixLength: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateNetworkIPv4) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateNetworkIPv4WithPrefix + dstCreateNetworkIPv41 := &CreateNetworkIPv4{} + err = json.Unmarshal(data, &dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix) + if err == nil { + jsonCreateNetworkIPv4WithPrefix, _ := json.Marshal(&dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix) + if string(jsonCreateNetworkIPv4WithPrefix) != "{}" { // empty struct + dst.CreateNetworkIPv4WithPrefix = dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix + match++ + } + } + + // try to unmarshal data into CreateNetworkIPv4WithPrefixLength + dstCreateNetworkIPv42 := &CreateNetworkIPv4{} + err = json.Unmarshal(data, &dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength) + if err == nil { + jsonCreateNetworkIPv4WithPrefixLength, _ := json.Marshal(&dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength) + if string(jsonCreateNetworkIPv4WithPrefixLength) != "{}" { // empty struct + dst.CreateNetworkIPv4WithPrefixLength = dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateNetworkIPv4WithPrefix = nil + dst.CreateNetworkIPv4WithPrefixLength = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateNetworkIPv4)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateNetworkIPv4)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateNetworkIPv4) MarshalJSON() ([]byte, error) { + if src.CreateNetworkIPv4WithPrefix != nil { + return json.Marshal(&src.CreateNetworkIPv4WithPrefix) + } + + if src.CreateNetworkIPv4WithPrefixLength != nil { + return json.Marshal(&src.CreateNetworkIPv4WithPrefixLength) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateNetworkIPv4) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateNetworkIPv4WithPrefix != nil { + return obj.CreateNetworkIPv4WithPrefix + } + + if obj.CreateNetworkIPv4WithPrefixLength != nil { + return obj.CreateNetworkIPv4WithPrefixLength + } + + // all schemas are nil + return nil +} + +type NullableCreateNetworkIPv4 struct { + value *CreateNetworkIPv4 + isSet bool +} + +func (v NullableCreateNetworkIPv4) Get() *CreateNetworkIPv4 { + return v.value +} + +func (v *NullableCreateNetworkIPv4) Set(val *CreateNetworkIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv4(val *CreateNetworkIPv4) *NullableCreateNetworkIPv4 { + return &NullableCreateNetworkIPv4{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_network_ipv4_test.go b/pkg/iaasbeta/model_create_network_ipv4_test.go new file mode 100644 index 00000000..aaa78e93 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv4_test.go @@ -0,0 +1,43 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "testing" +) + +// isOneOf + +func TestCreateNetworkIPv4_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := &CreateNetworkIPv4{} + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + marshalJson, err := v.MarshalJSON() + if err != nil { + t.Fatalf("failed marshalling CreateNetworkIPv4: %v", err) + } + if string(marshalJson) != string(tt.args.src) { + t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson) + } + }) + } +} diff --git a/pkg/iaasbeta/model_create_network_ipv4_with_prefix.go b/pkg/iaasbeta/model_create_network_ipv4_with_prefix.go new file mode 100644 index 00000000..34515651 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv4_with_prefix.go @@ -0,0 +1,239 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv4WithPrefix type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv4WithPrefix{} + +/* + types and functions for gateway +*/ + +// isNullableString +type CreateNetworkIPv4WithPrefixGetGatewayAttributeType = *NullableString + +func getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetGatewayAttributeType) (ret CreateNetworkIPv4WithPrefixGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateNetworkIPv4WithPrefixGetGatewayAttributeType(arg *CreateNetworkIPv4WithPrefixGetGatewayAttributeType, val CreateNetworkIPv4WithPrefixGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateNetworkIPv4WithPrefixGetGatewayArgType = *string +type CreateNetworkIPv4WithPrefixGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv4WithPrefixGetNameserversAttributeType = *[]string +type CreateNetworkIPv4WithPrefixGetNameserversArgType = []string +type CreateNetworkIPv4WithPrefixGetNameserversRetType = []string + +func getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetNameserversAttributeType) (ret CreateNetworkIPv4WithPrefixGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixGetNameserversAttributeType(arg *CreateNetworkIPv4WithPrefixGetNameserversAttributeType, val CreateNetworkIPv4WithPrefixGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefix +*/ + +// isNotNullableString +type CreateNetworkIPv4WithPrefixGetPrefixAttributeType = *string + +func getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetPrefixAttributeType) (ret CreateNetworkIPv4WithPrefixGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(arg *CreateNetworkIPv4WithPrefixGetPrefixAttributeType, val CreateNetworkIPv4WithPrefixGetPrefixRetType) { + *arg = &val +} + +type CreateNetworkIPv4WithPrefixGetPrefixArgType = string +type CreateNetworkIPv4WithPrefixGetPrefixRetType = string + +// CreateNetworkIPv4WithPrefix The create request for an IPv4 network with a specified prefix. +type CreateNetworkIPv4WithPrefix struct { + // The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway CreateNetworkIPv4WithPrefixGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers CreateNetworkIPv4WithPrefixGetNameserversAttributeType `json:"nameservers,omitempty"` + // IPv4 Classless Inter-Domain Routing (CIDR). + // REQUIRED + Prefix CreateNetworkIPv4WithPrefixGetPrefixAttributeType `json:"prefix" required:"true"` +} + +type _CreateNetworkIPv4WithPrefix CreateNetworkIPv4WithPrefix + +// NewCreateNetworkIPv4WithPrefix instantiates a new CreateNetworkIPv4WithPrefix 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 NewCreateNetworkIPv4WithPrefix(prefix CreateNetworkIPv4WithPrefixGetPrefixArgType) *CreateNetworkIPv4WithPrefix { + this := CreateNetworkIPv4WithPrefix{} + setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(&this.Prefix, prefix) + return &this +} + +// NewCreateNetworkIPv4WithPrefixWithDefaults instantiates a new CreateNetworkIPv4WithPrefix 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 NewCreateNetworkIPv4WithPrefixWithDefaults() *CreateNetworkIPv4WithPrefix { + this := CreateNetworkIPv4WithPrefix{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateNetworkIPv4WithPrefix) GetGateway() (res CreateNetworkIPv4WithPrefixGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateNetworkIPv4WithPrefix) GetGatewayOk() (ret CreateNetworkIPv4WithPrefixGetGatewayRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *CreateNetworkIPv4WithPrefix) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *CreateNetworkIPv4WithPrefix) SetGateway(v CreateNetworkIPv4WithPrefixGetGatewayRetType) { + setCreateNetworkIPv4WithPrefixGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *CreateNetworkIPv4WithPrefix) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *CreateNetworkIPv4WithPrefix) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv4WithPrefix) GetNameservers() (res CreateNetworkIPv4WithPrefixGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefix) GetNameserversOk() (ret CreateNetworkIPv4WithPrefixGetNameserversRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv4WithPrefix) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv4WithPrefix) SetNameservers(v CreateNetworkIPv4WithPrefixGetNameserversRetType) { + setCreateNetworkIPv4WithPrefixGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefix returns the Prefix field value +func (o *CreateNetworkIPv4WithPrefix) GetPrefix() (ret CreateNetworkIPv4WithPrefixGetPrefixRetType) { + ret, _ = o.GetPrefixOk() + return ret +} + +// GetPrefixOk returns a tuple with the Prefix field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefix) GetPrefixOk() (ret CreateNetworkIPv4WithPrefixGetPrefixRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(o.Prefix) +} + +// SetPrefix sets field value +func (o *CreateNetworkIPv4WithPrefix) SetPrefix(v CreateNetworkIPv4WithPrefixGetPrefixRetType) { + setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(&o.Prefix, v) +} + +func (o CreateNetworkIPv4WithPrefix) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv4WithPrefix struct { + value *CreateNetworkIPv4WithPrefix + isSet bool +} + +func (v NullableCreateNetworkIPv4WithPrefix) Get() *CreateNetworkIPv4WithPrefix { + return v.value +} + +func (v *NullableCreateNetworkIPv4WithPrefix) Set(val *CreateNetworkIPv4WithPrefix) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv4WithPrefix) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv4WithPrefix) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv4WithPrefix(val *CreateNetworkIPv4WithPrefix) *NullableCreateNetworkIPv4WithPrefix { + return &NullableCreateNetworkIPv4WithPrefix{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv4WithPrefix) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv4WithPrefix) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_network_ipv4_with_prefix_length.go b/pkg/iaasbeta/model_create_network_ipv4_with_prefix_length.go new file mode 100644 index 00000000..a5dec40c --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv4_with_prefix_length.go @@ -0,0 +1,173 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv4WithPrefixLength type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv4WithPrefixLength{} + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType = *[]string +type CreateNetworkIPv4WithPrefixLengthGetNameserversArgType = []string +type CreateNetworkIPv4WithPrefixLengthGetNameserversRetType = []string + +func getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(arg CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType) (ret CreateNetworkIPv4WithPrefixLengthGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType(arg *CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType, val CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixLength +*/ + +// isLong +type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType = *int64 +type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthArgType = int64 +type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType = int64 + +func getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(arg CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType) (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(arg *CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType, val CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) { + *arg = &val +} + +// CreateNetworkIPv4WithPrefixLength The create request for an IPv4 network with a wanted prefix length. +type CreateNetworkIPv4WithPrefixLength struct { + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + PrefixLength CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType `json:"prefixLength" required:"true"` +} + +type _CreateNetworkIPv4WithPrefixLength CreateNetworkIPv4WithPrefixLength + +// NewCreateNetworkIPv4WithPrefixLength instantiates a new CreateNetworkIPv4WithPrefixLength 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 NewCreateNetworkIPv4WithPrefixLength(prefixLength CreateNetworkIPv4WithPrefixLengthGetPrefixLengthArgType) *CreateNetworkIPv4WithPrefixLength { + this := CreateNetworkIPv4WithPrefixLength{} + setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(&this.PrefixLength, prefixLength) + return &this +} + +// NewCreateNetworkIPv4WithPrefixLengthWithDefaults instantiates a new CreateNetworkIPv4WithPrefixLength 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 NewCreateNetworkIPv4WithPrefixLengthWithDefaults() *CreateNetworkIPv4WithPrefixLength { + this := CreateNetworkIPv4WithPrefixLength{} + return &this +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv4WithPrefixLength) GetNameservers() (res CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefixLength) GetNameserversOk() (ret CreateNetworkIPv4WithPrefixLengthGetNameserversRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv4WithPrefixLength) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv4WithPrefixLength) SetNameservers(v CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) { + setCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixLength returns the PrefixLength field value +func (o *CreateNetworkIPv4WithPrefixLength) GetPrefixLength() (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) { + ret, _ = o.GetPrefixLengthOk() + return ret +} + +// GetPrefixLengthOk returns a tuple with the PrefixLength field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefixLength) GetPrefixLengthOk() (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength) +} + +// SetPrefixLength sets field value +func (o *CreateNetworkIPv4WithPrefixLength) SetPrefixLength(v CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) { + setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(&o.PrefixLength, v) +} + +func (o CreateNetworkIPv4WithPrefixLength) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength); ok { + toSerialize["PrefixLength"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv4WithPrefixLength struct { + value *CreateNetworkIPv4WithPrefixLength + isSet bool +} + +func (v NullableCreateNetworkIPv4WithPrefixLength) Get() *CreateNetworkIPv4WithPrefixLength { + return v.value +} + +func (v *NullableCreateNetworkIPv4WithPrefixLength) Set(val *CreateNetworkIPv4WithPrefixLength) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv4WithPrefixLength) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv4WithPrefixLength) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv4WithPrefixLength(val *CreateNetworkIPv4WithPrefixLength) *NullableCreateNetworkIPv4WithPrefixLength { + return &NullableCreateNetworkIPv4WithPrefixLength{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv4WithPrefixLength) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv4WithPrefixLength) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_network_ipv4_with_prefix_length_test.go b/pkg/iaasbeta/model_create_network_ipv4_with_prefix_length_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv4_with_prefix_length_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_network_ipv4_with_prefix_test.go b/pkg/iaasbeta/model_create_network_ipv4_with_prefix_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv4_with_prefix_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_network_ipv6.go b/pkg/iaasbeta/model_create_network_ipv6.go new file mode 100644 index 00000000..ab1a83f8 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv6.go @@ -0,0 +1,144 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "fmt" +) + +// CreateNetworkIPv6 - The create request for an IPv6 network. +type CreateNetworkIPv6 struct { + CreateNetworkIPv6WithPrefix *CreateNetworkIPv6WithPrefix + CreateNetworkIPv6WithPrefixLength *CreateNetworkIPv6WithPrefixLength +} + +// CreateNetworkIPv6WithPrefixAsCreateNetworkIPv6 is a convenience function that returns CreateNetworkIPv6WithPrefix wrapped in CreateNetworkIPv6 +func CreateNetworkIPv6WithPrefixAsCreateNetworkIPv6(v *CreateNetworkIPv6WithPrefix) CreateNetworkIPv6 { + return CreateNetworkIPv6{ + CreateNetworkIPv6WithPrefix: v, + } +} + +// CreateNetworkIPv6WithPrefixLengthAsCreateNetworkIPv6 is a convenience function that returns CreateNetworkIPv6WithPrefixLength wrapped in CreateNetworkIPv6 +func CreateNetworkIPv6WithPrefixLengthAsCreateNetworkIPv6(v *CreateNetworkIPv6WithPrefixLength) CreateNetworkIPv6 { + return CreateNetworkIPv6{ + CreateNetworkIPv6WithPrefixLength: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateNetworkIPv6) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateNetworkIPv6WithPrefix + dstCreateNetworkIPv61 := &CreateNetworkIPv6{} + err = json.Unmarshal(data, &dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix) + if err == nil { + jsonCreateNetworkIPv6WithPrefix, _ := json.Marshal(&dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix) + if string(jsonCreateNetworkIPv6WithPrefix) != "{}" { // empty struct + dst.CreateNetworkIPv6WithPrefix = dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix + match++ + } + } + + // try to unmarshal data into CreateNetworkIPv6WithPrefixLength + dstCreateNetworkIPv62 := &CreateNetworkIPv6{} + err = json.Unmarshal(data, &dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength) + if err == nil { + jsonCreateNetworkIPv6WithPrefixLength, _ := json.Marshal(&dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength) + if string(jsonCreateNetworkIPv6WithPrefixLength) != "{}" { // empty struct + dst.CreateNetworkIPv6WithPrefixLength = dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateNetworkIPv6WithPrefix = nil + dst.CreateNetworkIPv6WithPrefixLength = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateNetworkIPv6)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateNetworkIPv6)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateNetworkIPv6) MarshalJSON() ([]byte, error) { + if src.CreateNetworkIPv6WithPrefix != nil { + return json.Marshal(&src.CreateNetworkIPv6WithPrefix) + } + + if src.CreateNetworkIPv6WithPrefixLength != nil { + return json.Marshal(&src.CreateNetworkIPv6WithPrefixLength) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateNetworkIPv6) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateNetworkIPv6WithPrefix != nil { + return obj.CreateNetworkIPv6WithPrefix + } + + if obj.CreateNetworkIPv6WithPrefixLength != nil { + return obj.CreateNetworkIPv6WithPrefixLength + } + + // all schemas are nil + return nil +} + +type NullableCreateNetworkIPv6 struct { + value *CreateNetworkIPv6 + isSet bool +} + +func (v NullableCreateNetworkIPv6) Get() *CreateNetworkIPv6 { + return v.value +} + +func (v *NullableCreateNetworkIPv6) Set(val *CreateNetworkIPv6) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv6) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv6(val *CreateNetworkIPv6) *NullableCreateNetworkIPv6 { + return &NullableCreateNetworkIPv6{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_network_ipv6_test.go b/pkg/iaasbeta/model_create_network_ipv6_test.go new file mode 100644 index 00000000..2d91d31e --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv6_test.go @@ -0,0 +1,43 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "testing" +) + +// isOneOf + +func TestCreateNetworkIPv6_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := &CreateNetworkIPv6{} + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + marshalJson, err := v.MarshalJSON() + if err != nil { + t.Fatalf("failed marshalling CreateNetworkIPv6: %v", err) + } + if string(marshalJson) != string(tt.args.src) { + t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson) + } + }) + } +} diff --git a/pkg/iaasbeta/model_create_network_ipv6_with_prefix.go b/pkg/iaasbeta/model_create_network_ipv6_with_prefix.go new file mode 100644 index 00000000..6812c787 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv6_with_prefix.go @@ -0,0 +1,239 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv6WithPrefix type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv6WithPrefix{} + +/* + types and functions for gateway +*/ + +// isNullableString +type CreateNetworkIPv6WithPrefixGetGatewayAttributeType = *NullableString + +func getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetGatewayAttributeType) (ret CreateNetworkIPv6WithPrefixGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateNetworkIPv6WithPrefixGetGatewayAttributeType(arg *CreateNetworkIPv6WithPrefixGetGatewayAttributeType, val CreateNetworkIPv6WithPrefixGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateNetworkIPv6WithPrefixGetGatewayArgType = *string +type CreateNetworkIPv6WithPrefixGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv6WithPrefixGetNameserversAttributeType = *[]string +type CreateNetworkIPv6WithPrefixGetNameserversArgType = []string +type CreateNetworkIPv6WithPrefixGetNameserversRetType = []string + +func getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetNameserversAttributeType) (ret CreateNetworkIPv6WithPrefixGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixGetNameserversAttributeType(arg *CreateNetworkIPv6WithPrefixGetNameserversAttributeType, val CreateNetworkIPv6WithPrefixGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefix +*/ + +// isNotNullableString +type CreateNetworkIPv6WithPrefixGetPrefixAttributeType = *string + +func getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetPrefixAttributeType) (ret CreateNetworkIPv6WithPrefixGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(arg *CreateNetworkIPv6WithPrefixGetPrefixAttributeType, val CreateNetworkIPv6WithPrefixGetPrefixRetType) { + *arg = &val +} + +type CreateNetworkIPv6WithPrefixGetPrefixArgType = string +type CreateNetworkIPv6WithPrefixGetPrefixRetType = string + +// CreateNetworkIPv6WithPrefix The create request for an IPv6 network with a specified prefix. +type CreateNetworkIPv6WithPrefix struct { + // The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway CreateNetworkIPv6WithPrefixGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers CreateNetworkIPv6WithPrefixGetNameserversAttributeType `json:"nameservers,omitempty"` + // Classless Inter-Domain Routing (CIDR) for IPv6. + // REQUIRED + Prefix CreateNetworkIPv6WithPrefixGetPrefixAttributeType `json:"prefix" required:"true"` +} + +type _CreateNetworkIPv6WithPrefix CreateNetworkIPv6WithPrefix + +// NewCreateNetworkIPv6WithPrefix instantiates a new CreateNetworkIPv6WithPrefix 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 NewCreateNetworkIPv6WithPrefix(prefix CreateNetworkIPv6WithPrefixGetPrefixArgType) *CreateNetworkIPv6WithPrefix { + this := CreateNetworkIPv6WithPrefix{} + setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(&this.Prefix, prefix) + return &this +} + +// NewCreateNetworkIPv6WithPrefixWithDefaults instantiates a new CreateNetworkIPv6WithPrefix 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 NewCreateNetworkIPv6WithPrefixWithDefaults() *CreateNetworkIPv6WithPrefix { + this := CreateNetworkIPv6WithPrefix{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateNetworkIPv6WithPrefix) GetGateway() (res CreateNetworkIPv6WithPrefixGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateNetworkIPv6WithPrefix) GetGatewayOk() (ret CreateNetworkIPv6WithPrefixGetGatewayRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *CreateNetworkIPv6WithPrefix) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *CreateNetworkIPv6WithPrefix) SetGateway(v CreateNetworkIPv6WithPrefixGetGatewayRetType) { + setCreateNetworkIPv6WithPrefixGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *CreateNetworkIPv6WithPrefix) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *CreateNetworkIPv6WithPrefix) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv6WithPrefix) GetNameservers() (res CreateNetworkIPv6WithPrefixGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefix) GetNameserversOk() (ret CreateNetworkIPv6WithPrefixGetNameserversRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv6WithPrefix) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv6WithPrefix) SetNameservers(v CreateNetworkIPv6WithPrefixGetNameserversRetType) { + setCreateNetworkIPv6WithPrefixGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefix returns the Prefix field value +func (o *CreateNetworkIPv6WithPrefix) GetPrefix() (ret CreateNetworkIPv6WithPrefixGetPrefixRetType) { + ret, _ = o.GetPrefixOk() + return ret +} + +// GetPrefixOk returns a tuple with the Prefix field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefix) GetPrefixOk() (ret CreateNetworkIPv6WithPrefixGetPrefixRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(o.Prefix) +} + +// SetPrefix sets field value +func (o *CreateNetworkIPv6WithPrefix) SetPrefix(v CreateNetworkIPv6WithPrefixGetPrefixRetType) { + setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(&o.Prefix, v) +} + +func (o CreateNetworkIPv6WithPrefix) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv6WithPrefix struct { + value *CreateNetworkIPv6WithPrefix + isSet bool +} + +func (v NullableCreateNetworkIPv6WithPrefix) Get() *CreateNetworkIPv6WithPrefix { + return v.value +} + +func (v *NullableCreateNetworkIPv6WithPrefix) Set(val *CreateNetworkIPv6WithPrefix) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv6WithPrefix) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv6WithPrefix) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv6WithPrefix(val *CreateNetworkIPv6WithPrefix) *NullableCreateNetworkIPv6WithPrefix { + return &NullableCreateNetworkIPv6WithPrefix{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv6WithPrefix) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv6WithPrefix) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_network_ipv6_with_prefix_length.go b/pkg/iaasbeta/model_create_network_ipv6_with_prefix_length.go new file mode 100644 index 00000000..645766ec --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv6_with_prefix_length.go @@ -0,0 +1,173 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv6WithPrefixLength type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv6WithPrefixLength{} + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType = *[]string +type CreateNetworkIPv6WithPrefixLengthGetNameserversArgType = []string +type CreateNetworkIPv6WithPrefixLengthGetNameserversRetType = []string + +func getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(arg CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType) (ret CreateNetworkIPv6WithPrefixLengthGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType(arg *CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType, val CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixLength +*/ + +// isLong +type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType = *int64 +type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthArgType = int64 +type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType = int64 + +func getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(arg CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType) (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(arg *CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType, val CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) { + *arg = &val +} + +// CreateNetworkIPv6WithPrefixLength The create request for an IPv6 network with a wanted prefix length. +type CreateNetworkIPv6WithPrefixLength struct { + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + PrefixLength CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType `json:"prefixLength" required:"true"` +} + +type _CreateNetworkIPv6WithPrefixLength CreateNetworkIPv6WithPrefixLength + +// NewCreateNetworkIPv6WithPrefixLength instantiates a new CreateNetworkIPv6WithPrefixLength 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 NewCreateNetworkIPv6WithPrefixLength(prefixLength CreateNetworkIPv6WithPrefixLengthGetPrefixLengthArgType) *CreateNetworkIPv6WithPrefixLength { + this := CreateNetworkIPv6WithPrefixLength{} + setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(&this.PrefixLength, prefixLength) + return &this +} + +// NewCreateNetworkIPv6WithPrefixLengthWithDefaults instantiates a new CreateNetworkIPv6WithPrefixLength 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 NewCreateNetworkIPv6WithPrefixLengthWithDefaults() *CreateNetworkIPv6WithPrefixLength { + this := CreateNetworkIPv6WithPrefixLength{} + return &this +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv6WithPrefixLength) GetNameservers() (res CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefixLength) GetNameserversOk() (ret CreateNetworkIPv6WithPrefixLengthGetNameserversRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv6WithPrefixLength) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv6WithPrefixLength) SetNameservers(v CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) { + setCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixLength returns the PrefixLength field value +func (o *CreateNetworkIPv6WithPrefixLength) GetPrefixLength() (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) { + ret, _ = o.GetPrefixLengthOk() + return ret +} + +// GetPrefixLengthOk returns a tuple with the PrefixLength field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefixLength) GetPrefixLengthOk() (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength) +} + +// SetPrefixLength sets field value +func (o *CreateNetworkIPv6WithPrefixLength) SetPrefixLength(v CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) { + setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(&o.PrefixLength, v) +} + +func (o CreateNetworkIPv6WithPrefixLength) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength); ok { + toSerialize["PrefixLength"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv6WithPrefixLength struct { + value *CreateNetworkIPv6WithPrefixLength + isSet bool +} + +func (v NullableCreateNetworkIPv6WithPrefixLength) Get() *CreateNetworkIPv6WithPrefixLength { + return v.value +} + +func (v *NullableCreateNetworkIPv6WithPrefixLength) Set(val *CreateNetworkIPv6WithPrefixLength) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv6WithPrefixLength) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv6WithPrefixLength) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv6WithPrefixLength(val *CreateNetworkIPv6WithPrefixLength) *NullableCreateNetworkIPv6WithPrefixLength { + return &NullableCreateNetworkIPv6WithPrefixLength{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv6WithPrefixLength) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv6WithPrefixLength) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_network_ipv6_with_prefix_length_test.go b/pkg/iaasbeta/model_create_network_ipv6_with_prefix_length_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv6_with_prefix_length_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_network_ipv6_with_prefix_test.go b/pkg/iaasbeta/model_create_network_ipv6_with_prefix_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_ipv6_with_prefix_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_network_payload.go b/pkg/iaasbeta/model_create_network_payload.go new file mode 100644 index 00000000..8782a911 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_payload.go @@ -0,0 +1,416 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateNetworkPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkPayload{} + +/* + types and functions for dhcp +*/ + +// isBoolean +type CreateNetworkPayloadgetDhcpAttributeType = *bool +type CreateNetworkPayloadgetDhcpArgType = bool +type CreateNetworkPayloadgetDhcpRetType = bool + +func getCreateNetworkPayloadgetDhcpAttributeTypeOk(arg CreateNetworkPayloadgetDhcpAttributeType) (ret CreateNetworkPayloadgetDhcpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadgetDhcpAttributeType(arg *CreateNetworkPayloadgetDhcpAttributeType, val CreateNetworkPayloadgetDhcpRetType) { + *arg = &val +} + +/* + types and functions for ipv4 +*/ + +// isModel +type CreateNetworkPayloadGetIpv4AttributeType = *CreateNetworkIPv4 +type CreateNetworkPayloadGetIpv4ArgType = CreateNetworkIPv4 +type CreateNetworkPayloadGetIpv4RetType = CreateNetworkIPv4 + +func getCreateNetworkPayloadGetIpv4AttributeTypeOk(arg CreateNetworkPayloadGetIpv4AttributeType) (ret CreateNetworkPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetIpv4AttributeType(arg *CreateNetworkPayloadGetIpv4AttributeType, val CreateNetworkPayloadGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type CreateNetworkPayloadGetIpv6AttributeType = *CreateNetworkIPv6 +type CreateNetworkPayloadGetIpv6ArgType = CreateNetworkIPv6 +type CreateNetworkPayloadGetIpv6RetType = CreateNetworkIPv6 + +func getCreateNetworkPayloadGetIpv6AttributeTypeOk(arg CreateNetworkPayloadGetIpv6AttributeType) (ret CreateNetworkPayloadGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetIpv6AttributeType(arg *CreateNetworkPayloadGetIpv6AttributeType, val CreateNetworkPayloadGetIpv6RetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateNetworkPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateNetworkPayloadGetLabelsArgType = map[string]interface{} +type CreateNetworkPayloadGetLabelsRetType = map[string]interface{} + +func getCreateNetworkPayloadGetLabelsAttributeTypeOk(arg CreateNetworkPayloadGetLabelsAttributeType) (ret CreateNetworkPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetLabelsAttributeType(arg *CreateNetworkPayloadGetLabelsAttributeType, val CreateNetworkPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateNetworkPayloadGetNameAttributeType = *string + +func getCreateNetworkPayloadGetNameAttributeTypeOk(arg CreateNetworkPayloadGetNameAttributeType) (ret CreateNetworkPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetNameAttributeType(arg *CreateNetworkPayloadGetNameAttributeType, val CreateNetworkPayloadGetNameRetType) { + *arg = &val +} + +type CreateNetworkPayloadGetNameArgType = string +type CreateNetworkPayloadGetNameRetType = string + +/* + types and functions for routed +*/ + +// isBoolean +type CreateNetworkPayloadgetRoutedAttributeType = *bool +type CreateNetworkPayloadgetRoutedArgType = bool +type CreateNetworkPayloadgetRoutedRetType = bool + +func getCreateNetworkPayloadgetRoutedAttributeTypeOk(arg CreateNetworkPayloadgetRoutedAttributeType) (ret CreateNetworkPayloadgetRoutedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadgetRoutedAttributeType(arg *CreateNetworkPayloadgetRoutedAttributeType, val CreateNetworkPayloadgetRoutedRetType) { + *arg = &val +} + +/* + types and functions for routingTableId +*/ + +// isNotNullableString +type CreateNetworkPayloadGetRoutingTableIdAttributeType = *string + +func getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(arg CreateNetworkPayloadGetRoutingTableIdAttributeType) (ret CreateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetRoutingTableIdAttributeType(arg *CreateNetworkPayloadGetRoutingTableIdAttributeType, val CreateNetworkPayloadGetRoutingTableIdRetType) { + *arg = &val +} + +type CreateNetworkPayloadGetRoutingTableIdArgType = string +type CreateNetworkPayloadGetRoutingTableIdRetType = string + +// CreateNetworkPayload Object that represents the request body for a network create. +type CreateNetworkPayload struct { + // Enable or disable DHCP for a network. + Dhcp CreateNetworkPayloadgetDhcpAttributeType `json:"dhcp,omitempty"` + Ipv4 CreateNetworkPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 CreateNetworkPayloadGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateNetworkPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name CreateNetworkPayloadGetNameAttributeType `json:"name" required:"true"` + // Shows if the network is routed and therefore accessible from other networks. + Routed CreateNetworkPayloadgetRoutedAttributeType `json:"routed,omitempty"` + // Universally Unique Identifier (UUID). + RoutingTableId CreateNetworkPayloadGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"` +} + +type _CreateNetworkPayload CreateNetworkPayload + +// NewCreateNetworkPayload instantiates a new CreateNetworkPayload 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 NewCreateNetworkPayload(name CreateNetworkPayloadGetNameArgType) *CreateNetworkPayload { + this := CreateNetworkPayload{} + setCreateNetworkPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateNetworkPayloadWithDefaults instantiates a new CreateNetworkPayload 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 NewCreateNetworkPayloadWithDefaults() *CreateNetworkPayload { + this := CreateNetworkPayload{} + var dhcp bool = true + this.Dhcp = &dhcp + return &this +} + +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetDhcp() (res CreateNetworkPayloadgetDhcpRetType) { + res, _ = o.GetDhcpOk() + return +} + +// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetDhcpOk() (ret CreateNetworkPayloadgetDhcpRetType, ok bool) { + return getCreateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp) +} + +// HasDhcp returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasDhcp() bool { + _, ok := o.GetDhcpOk() + return ok +} + +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *CreateNetworkPayload) SetDhcp(v CreateNetworkPayloadgetDhcpRetType) { + setCreateNetworkPayloadgetDhcpAttributeType(&o.Dhcp, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetIpv4() (res CreateNetworkPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetIpv4Ok() (ret CreateNetworkPayloadGetIpv4RetType, ok bool) { + return getCreateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given CreateNetworkIPv4 and assigns it to the Ipv4 field. +func (o *CreateNetworkPayload) SetIpv4(v CreateNetworkPayloadGetIpv4RetType) { + setCreateNetworkPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetIpv6() (res CreateNetworkPayloadGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetIpv6Ok() (ret CreateNetworkPayloadGetIpv6RetType, ok bool) { + return getCreateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given CreateNetworkIPv6 and assigns it to the Ipv6 field. +func (o *CreateNetworkPayload) SetIpv6(v CreateNetworkPayloadGetIpv6RetType) { + setCreateNetworkPayloadGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetLabels() (res CreateNetworkPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetLabelsOk() (ret CreateNetworkPayloadGetLabelsRetType, ok bool) { + return getCreateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateNetworkPayload) SetLabels(v CreateNetworkPayloadGetLabelsRetType) { + setCreateNetworkPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *CreateNetworkPayload) GetName() (ret CreateNetworkPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetNameOk() (ret CreateNetworkPayloadGetNameRetType, ok bool) { + return getCreateNetworkPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateNetworkPayload) SetName(v CreateNetworkPayloadGetNameRetType) { + setCreateNetworkPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRouted returns the Routed field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetRouted() (res CreateNetworkPayloadgetRoutedRetType) { + res, _ = o.GetRoutedOk() + return +} + +// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetRoutedOk() (ret CreateNetworkPayloadgetRoutedRetType, ok bool) { + return getCreateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed) +} + +// HasRouted returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasRouted() bool { + _, ok := o.GetRoutedOk() + return ok +} + +// SetRouted gets a reference to the given bool and assigns it to the Routed field. +func (o *CreateNetworkPayload) SetRouted(v CreateNetworkPayloadgetRoutedRetType) { + setCreateNetworkPayloadgetRoutedAttributeType(&o.Routed, v) +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetRoutingTableId() (res CreateNetworkPayloadGetRoutingTableIdRetType) { + res, _ = o.GetRoutingTableIdOk() + return +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetRoutingTableIdOk() (ret CreateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + return getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId) +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasRoutingTableId() bool { + _, ok := o.GetRoutingTableIdOk() + return ok +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *CreateNetworkPayload) SetRoutingTableId(v CreateNetworkPayloadGetRoutingTableIdRetType) { + setCreateNetworkPayloadGetRoutingTableIdAttributeType(&o.RoutingTableId, v) +} + +func (o CreateNetworkPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp); ok { + toSerialize["Dhcp"] = val + } + if val, ok := getCreateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getCreateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getCreateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateNetworkPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed); ok { + toSerialize["Routed"] = val + } + if val, ok := getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok { + toSerialize["RoutingTableId"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkPayload struct { + value *CreateNetworkPayload + isSet bool +} + +func (v NullableCreateNetworkPayload) Get() *CreateNetworkPayload { + return v.value +} + +func (v *NullableCreateNetworkPayload) Set(val *CreateNetworkPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkPayload(val *CreateNetworkPayload) *NullableCreateNetworkPayload { + return &NullableCreateNetworkPayload{value: val, isSet: true} +} + +func (v NullableCreateNetworkPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_network_payload_test.go b/pkg/iaasbeta/model_create_network_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_network_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_nic_payload.go b/pkg/iaasbeta/model_create_nic_payload.go new file mode 100644 index 00000000..2632512e --- /dev/null +++ b/pkg/iaasbeta/model_create_nic_payload.go @@ -0,0 +1,764 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateNicPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNicPayload{} + +/* + types and functions for allowedAddresses +*/ + +// isArray +type CreateNicPayloadGetAllowedAddressesAttributeType = *[]AllowedAddressesInner +type CreateNicPayloadGetAllowedAddressesArgType = []AllowedAddressesInner +type CreateNicPayloadGetAllowedAddressesRetType = []AllowedAddressesInner + +func getCreateNicPayloadGetAllowedAddressesAttributeTypeOk(arg CreateNicPayloadGetAllowedAddressesAttributeType) (ret CreateNicPayloadGetAllowedAddressesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetAllowedAddressesAttributeType(arg *CreateNicPayloadGetAllowedAddressesAttributeType, val CreateNicPayloadGetAllowedAddressesRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateNicPayloadGetDescriptionAttributeType = *string + +func getCreateNicPayloadGetDescriptionAttributeTypeOk(arg CreateNicPayloadGetDescriptionAttributeType) (ret CreateNicPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetDescriptionAttributeType(arg *CreateNicPayloadGetDescriptionAttributeType, val CreateNicPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateNicPayloadGetDescriptionArgType = string +type CreateNicPayloadGetDescriptionRetType = string + +/* + types and functions for device +*/ + +// isNotNullableString +type CreateNicPayloadGetDeviceAttributeType = *string + +func getCreateNicPayloadGetDeviceAttributeTypeOk(arg CreateNicPayloadGetDeviceAttributeType) (ret CreateNicPayloadGetDeviceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetDeviceAttributeType(arg *CreateNicPayloadGetDeviceAttributeType, val CreateNicPayloadGetDeviceRetType) { + *arg = &val +} + +type CreateNicPayloadGetDeviceArgType = string +type CreateNicPayloadGetDeviceRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateNicPayloadGetIdAttributeType = *string + +func getCreateNicPayloadGetIdAttributeTypeOk(arg CreateNicPayloadGetIdAttributeType) (ret CreateNicPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetIdAttributeType(arg *CreateNicPayloadGetIdAttributeType, val CreateNicPayloadGetIdRetType) { + *arg = &val +} + +type CreateNicPayloadGetIdArgType = string +type CreateNicPayloadGetIdRetType = string + +/* + types and functions for ipv4 +*/ + +// isNotNullableString +type CreateNicPayloadGetIpv4AttributeType = *string + +func getCreateNicPayloadGetIpv4AttributeTypeOk(arg CreateNicPayloadGetIpv4AttributeType) (ret CreateNicPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetIpv4AttributeType(arg *CreateNicPayloadGetIpv4AttributeType, val CreateNicPayloadGetIpv4RetType) { + *arg = &val +} + +type CreateNicPayloadGetIpv4ArgType = string +type CreateNicPayloadGetIpv4RetType = string + +/* + types and functions for ipv6 +*/ + +// isNotNullableString +type CreateNicPayloadGetIpv6AttributeType = *string + +func getCreateNicPayloadGetIpv6AttributeTypeOk(arg CreateNicPayloadGetIpv6AttributeType) (ret CreateNicPayloadGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetIpv6AttributeType(arg *CreateNicPayloadGetIpv6AttributeType, val CreateNicPayloadGetIpv6RetType) { + *arg = &val +} + +type CreateNicPayloadGetIpv6ArgType = string +type CreateNicPayloadGetIpv6RetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateNicPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateNicPayloadGetLabelsArgType = map[string]interface{} +type CreateNicPayloadGetLabelsRetType = map[string]interface{} + +func getCreateNicPayloadGetLabelsAttributeTypeOk(arg CreateNicPayloadGetLabelsAttributeType) (ret CreateNicPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetLabelsAttributeType(arg *CreateNicPayloadGetLabelsAttributeType, val CreateNicPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mac +*/ + +// isNotNullableString +type CreateNicPayloadGetMacAttributeType = *string + +func getCreateNicPayloadGetMacAttributeTypeOk(arg CreateNicPayloadGetMacAttributeType) (ret CreateNicPayloadGetMacRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetMacAttributeType(arg *CreateNicPayloadGetMacAttributeType, val CreateNicPayloadGetMacRetType) { + *arg = &val +} + +type CreateNicPayloadGetMacArgType = string +type CreateNicPayloadGetMacRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateNicPayloadGetNameAttributeType = *string + +func getCreateNicPayloadGetNameAttributeTypeOk(arg CreateNicPayloadGetNameAttributeType) (ret CreateNicPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetNameAttributeType(arg *CreateNicPayloadGetNameAttributeType, val CreateNicPayloadGetNameRetType) { + *arg = &val +} + +type CreateNicPayloadGetNameArgType = string +type CreateNicPayloadGetNameRetType = string + +/* + types and functions for networkId +*/ + +// isNotNullableString +type CreateNicPayloadGetNetworkIdAttributeType = *string + +func getCreateNicPayloadGetNetworkIdAttributeTypeOk(arg CreateNicPayloadGetNetworkIdAttributeType) (ret CreateNicPayloadGetNetworkIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetNetworkIdAttributeType(arg *CreateNicPayloadGetNetworkIdAttributeType, val CreateNicPayloadGetNetworkIdRetType) { + *arg = &val +} + +type CreateNicPayloadGetNetworkIdArgType = string +type CreateNicPayloadGetNetworkIdRetType = string + +/* + types and functions for nicSecurity +*/ + +// isBoolean +type CreateNicPayloadgetNicSecurityAttributeType = *bool +type CreateNicPayloadgetNicSecurityArgType = bool +type CreateNicPayloadgetNicSecurityRetType = bool + +func getCreateNicPayloadgetNicSecurityAttributeTypeOk(arg CreateNicPayloadgetNicSecurityAttributeType) (ret CreateNicPayloadgetNicSecurityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadgetNicSecurityAttributeType(arg *CreateNicPayloadgetNicSecurityAttributeType, val CreateNicPayloadgetNicSecurityRetType) { + *arg = &val +} + +/* + types and functions for securityGroups +*/ + +// isArray +type CreateNicPayloadGetSecurityGroupsAttributeType = *[]string +type CreateNicPayloadGetSecurityGroupsArgType = []string +type CreateNicPayloadGetSecurityGroupsRetType = []string + +func getCreateNicPayloadGetSecurityGroupsAttributeTypeOk(arg CreateNicPayloadGetSecurityGroupsAttributeType) (ret CreateNicPayloadGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetSecurityGroupsAttributeType(arg *CreateNicPayloadGetSecurityGroupsAttributeType, val CreateNicPayloadGetSecurityGroupsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type CreateNicPayloadGetStatusAttributeType = *string + +func getCreateNicPayloadGetStatusAttributeTypeOk(arg CreateNicPayloadGetStatusAttributeType) (ret CreateNicPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetStatusAttributeType(arg *CreateNicPayloadGetStatusAttributeType, val CreateNicPayloadGetStatusRetType) { + *arg = &val +} + +type CreateNicPayloadGetStatusArgType = string +type CreateNicPayloadGetStatusRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type CreateNicPayloadGetTypeAttributeType = *string + +func getCreateNicPayloadGetTypeAttributeTypeOk(arg CreateNicPayloadGetTypeAttributeType) (ret CreateNicPayloadGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetTypeAttributeType(arg *CreateNicPayloadGetTypeAttributeType, val CreateNicPayloadGetTypeRetType) { + *arg = &val +} + +type CreateNicPayloadGetTypeArgType = string +type CreateNicPayloadGetTypeRetType = string + +// CreateNicPayload Object that represents a network interface. +type CreateNicPayload struct { + // A list of IPs or CIDR notations. + AllowedAddresses CreateNicPayloadGetAllowedAddressesAttributeType `json:"allowedAddresses,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description CreateNicPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Device CreateNicPayloadGetDeviceAttributeType `json:"device,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateNicPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents an IP address. + Ipv4 CreateNicPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + // String that represents an IPv6 address. + Ipv6 CreateNicPayloadGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateNicPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Object that represents an MAC address. + Mac CreateNicPayloadGetMacAttributeType `json:"mac,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name CreateNicPayloadGetNameAttributeType `json:"name,omitempty"` + // Universally Unique Identifier (UUID). + NetworkId CreateNicPayloadGetNetworkIdAttributeType `json:"networkId,omitempty"` + // If this is set to false, then no security groups will apply to this network interface. + NicSecurity CreateNicPayloadgetNicSecurityAttributeType `json:"nicSecurity,omitempty"` + // A list of UUIDs. + SecurityGroups CreateNicPayloadGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` + // Possible values: `ACTIVE`, `DOWN`. + Status CreateNicPayloadGetStatusAttributeType `json:"status,omitempty"` + // Possible values: `server`, `metadata`, `gateway`, `none`. + Type CreateNicPayloadGetTypeAttributeType `json:"type,omitempty"` +} + +// NewCreateNicPayload instantiates a new CreateNicPayload 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 NewCreateNicPayload() *CreateNicPayload { + this := CreateNicPayload{} + return &this +} + +// NewCreateNicPayloadWithDefaults instantiates a new CreateNicPayload 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 NewCreateNicPayloadWithDefaults() *CreateNicPayload { + this := CreateNicPayload{} + var nicSecurity bool = true + this.NicSecurity = &nicSecurity + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *CreateNicPayload) GetAllowedAddresses() (res CreateNicPayloadGetAllowedAddressesRetType) { + res, _ = o.GetAllowedAddressesOk() + return +} + +// GetAllowedAddressesOk returns a tuple with the AllowedAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetAllowedAddressesOk() (ret CreateNicPayloadGetAllowedAddressesRetType, ok bool) { + return getCreateNicPayloadGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses) +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *CreateNicPayload) HasAllowedAddresses() bool { + _, ok := o.GetAllowedAddressesOk() + return ok +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +func (o *CreateNicPayload) SetAllowedAddresses(v CreateNicPayloadGetAllowedAddressesRetType) { + setCreateNicPayloadGetAllowedAddressesAttributeType(&o.AllowedAddresses, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateNicPayload) GetDescription() (res CreateNicPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetDescriptionOk() (ret CreateNicPayloadGetDescriptionRetType, ok bool) { + return getCreateNicPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateNicPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateNicPayload) SetDescription(v CreateNicPayloadGetDescriptionRetType) { + setCreateNicPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *CreateNicPayload) GetDevice() (res CreateNicPayloadGetDeviceRetType) { + res, _ = o.GetDeviceOk() + return +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetDeviceOk() (ret CreateNicPayloadGetDeviceRetType, ok bool) { + return getCreateNicPayloadGetDeviceAttributeTypeOk(o.Device) +} + +// HasDevice returns a boolean if a field has been set. +func (o *CreateNicPayload) HasDevice() bool { + _, ok := o.GetDeviceOk() + return ok +} + +// SetDevice gets a reference to the given string and assigns it to the Device field. +func (o *CreateNicPayload) SetDevice(v CreateNicPayloadGetDeviceRetType) { + setCreateNicPayloadGetDeviceAttributeType(&o.Device, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateNicPayload) GetId() (res CreateNicPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetIdOk() (ret CreateNicPayloadGetIdRetType, ok bool) { + return getCreateNicPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateNicPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateNicPayload) SetId(v CreateNicPayloadGetIdRetType) { + setCreateNicPayloadGetIdAttributeType(&o.Id, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateNicPayload) GetIpv4() (res CreateNicPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetIpv4Ok() (ret CreateNicPayloadGetIpv4RetType, ok bool) { + return getCreateNicPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateNicPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given string and assigns it to the Ipv4 field. +func (o *CreateNicPayload) SetIpv4(v CreateNicPayloadGetIpv4RetType) { + setCreateNicPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *CreateNicPayload) GetIpv6() (res CreateNicPayloadGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetIpv6Ok() (ret CreateNicPayloadGetIpv6RetType, ok bool) { + return getCreateNicPayloadGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *CreateNicPayload) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given string and assigns it to the Ipv6 field. +func (o *CreateNicPayload) SetIpv6(v CreateNicPayloadGetIpv6RetType) { + setCreateNicPayloadGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateNicPayload) GetLabels() (res CreateNicPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetLabelsOk() (ret CreateNicPayloadGetLabelsRetType, ok bool) { + return getCreateNicPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateNicPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateNicPayload) SetLabels(v CreateNicPayloadGetLabelsRetType) { + setCreateNicPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetMac returns the Mac field value if set, zero value otherwise. +func (o *CreateNicPayload) GetMac() (res CreateNicPayloadGetMacRetType) { + res, _ = o.GetMacOk() + return +} + +// GetMacOk returns a tuple with the Mac field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetMacOk() (ret CreateNicPayloadGetMacRetType, ok bool) { + return getCreateNicPayloadGetMacAttributeTypeOk(o.Mac) +} + +// HasMac returns a boolean if a field has been set. +func (o *CreateNicPayload) HasMac() bool { + _, ok := o.GetMacOk() + return ok +} + +// SetMac gets a reference to the given string and assigns it to the Mac field. +func (o *CreateNicPayload) SetMac(v CreateNicPayloadGetMacRetType) { + setCreateNicPayloadGetMacAttributeType(&o.Mac, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateNicPayload) GetName() (res CreateNicPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetNameOk() (ret CreateNicPayloadGetNameRetType, ok bool) { + return getCreateNicPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateNicPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateNicPayload) SetName(v CreateNicPayloadGetNameRetType) { + setCreateNicPayloadGetNameAttributeType(&o.Name, v) +} + +// GetNetworkId returns the NetworkId field value if set, zero value otherwise. +func (o *CreateNicPayload) GetNetworkId() (res CreateNicPayloadGetNetworkIdRetType) { + res, _ = o.GetNetworkIdOk() + return +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetNetworkIdOk() (ret CreateNicPayloadGetNetworkIdRetType, ok bool) { + return getCreateNicPayloadGetNetworkIdAttributeTypeOk(o.NetworkId) +} + +// HasNetworkId returns a boolean if a field has been set. +func (o *CreateNicPayload) HasNetworkId() bool { + _, ok := o.GetNetworkIdOk() + return ok +} + +// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. +func (o *CreateNicPayload) SetNetworkId(v CreateNicPayloadGetNetworkIdRetType) { + setCreateNicPayloadGetNetworkIdAttributeType(&o.NetworkId, v) +} + +// GetNicSecurity returns the NicSecurity field value if set, zero value otherwise. +func (o *CreateNicPayload) GetNicSecurity() (res CreateNicPayloadgetNicSecurityRetType) { + res, _ = o.GetNicSecurityOk() + return +} + +// GetNicSecurityOk returns a tuple with the NicSecurity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetNicSecurityOk() (ret CreateNicPayloadgetNicSecurityRetType, ok bool) { + return getCreateNicPayloadgetNicSecurityAttributeTypeOk(o.NicSecurity) +} + +// HasNicSecurity returns a boolean if a field has been set. +func (o *CreateNicPayload) HasNicSecurity() bool { + _, ok := o.GetNicSecurityOk() + return ok +} + +// SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. +func (o *CreateNicPayload) SetNicSecurity(v CreateNicPayloadgetNicSecurityRetType) { + setCreateNicPayloadgetNicSecurityAttributeType(&o.NicSecurity, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *CreateNicPayload) GetSecurityGroups() (res CreateNicPayloadGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// 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 *CreateNicPayload) GetSecurityGroupsOk() (ret CreateNicPayloadGetSecurityGroupsRetType, ok bool) { + return getCreateNicPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *CreateNicPayload) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *CreateNicPayload) SetSecurityGroups(v CreateNicPayloadGetSecurityGroupsRetType) { + setCreateNicPayloadGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateNicPayload) GetStatus() (res CreateNicPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetStatusOk() (ret CreateNicPayloadGetStatusRetType, ok bool) { + return getCreateNicPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateNicPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateNicPayload) SetStatus(v CreateNicPayloadGetStatusRetType) { + setCreateNicPayloadGetStatusAttributeType(&o.Status, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CreateNicPayload) GetType() (res CreateNicPayloadGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetTypeOk() (ret CreateNicPayloadGetTypeRetType, ok bool) { + return getCreateNicPayloadGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *CreateNicPayload) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CreateNicPayload) SetType(v CreateNicPayloadGetTypeRetType) { + setCreateNicPayloadGetTypeAttributeType(&o.Type, v) +} + +func (o CreateNicPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNicPayloadGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses); ok { + toSerialize["AllowedAddresses"] = val + } + if val, ok := getCreateNicPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateNicPayloadGetDeviceAttributeTypeOk(o.Device); ok { + toSerialize["Device"] = val + } + if val, ok := getCreateNicPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateNicPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getCreateNicPayloadGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getCreateNicPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateNicPayloadGetMacAttributeTypeOk(o.Mac); ok { + toSerialize["Mac"] = val + } + if val, ok := getCreateNicPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateNicPayloadGetNetworkIdAttributeTypeOk(o.NetworkId); ok { + toSerialize["NetworkId"] = val + } + if val, ok := getCreateNicPayloadgetNicSecurityAttributeTypeOk(o.NicSecurity); ok { + toSerialize["NicSecurity"] = val + } + if val, ok := getCreateNicPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + if val, ok := getCreateNicPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getCreateNicPayloadGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableCreateNicPayload struct { + value *CreateNicPayload + isSet bool +} + +func (v NullableCreateNicPayload) Get() *CreateNicPayload { + return v.value +} + +func (v *NullableCreateNicPayload) Set(val *CreateNicPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNicPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNicPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNicPayload(val *CreateNicPayload) *NullableCreateNicPayload { + return &NullableCreateNicPayload{value: val, isSet: true} +} + +func (v NullableCreateNicPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNicPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_nic_payload_test.go b/pkg/iaasbeta/model_create_nic_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_nic_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_protocol.go b/pkg/iaasbeta/model_create_protocol.go new file mode 100644 index 00000000..1120bbea --- /dev/null +++ b/pkg/iaasbeta/model_create_protocol.go @@ -0,0 +1,144 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "fmt" +) + +// CreateProtocol - The schema for a protocol when creating a security group rule. +type CreateProtocol struct { + Int64 *int64 + String *string +} + +// int64AsCreateProtocol is a convenience function that returns int64 wrapped in CreateProtocol +func Int64AsCreateProtocol(v *int64) CreateProtocol { + return CreateProtocol{ + Int64: v, + } +} + +// stringAsCreateProtocol is a convenience function that returns string wrapped in CreateProtocol +func StringAsCreateProtocol(v *string) CreateProtocol { + return CreateProtocol{ + String: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateProtocol) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into Int64 + dstCreateProtocol1 := &CreateProtocol{} + err = json.Unmarshal(data, &dstCreateProtocol1.Int64) + if err == nil { + jsonInt64, _ := json.Marshal(&dstCreateProtocol1.Int64) + if string(jsonInt64) != "{}" { // empty struct + dst.Int64 = dstCreateProtocol1.Int64 + match++ + } + } + + // try to unmarshal data into String + dstCreateProtocol2 := &CreateProtocol{} + err = json.Unmarshal(data, &dstCreateProtocol2.String) + if err == nil { + jsonString, _ := json.Marshal(&dstCreateProtocol2.String) + if string(jsonString) != "{}" { // empty struct + dst.String = dstCreateProtocol2.String + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.Int64 = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateProtocol)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateProtocol)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateProtocol) MarshalJSON() ([]byte, error) { + if src.Int64 != nil { + return json.Marshal(&src.Int64) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateProtocol) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.Int64 != nil { + return obj.Int64 + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +type NullableCreateProtocol struct { + value *CreateProtocol + isSet bool +} + +func (v NullableCreateProtocol) Get() *CreateProtocol { + return v.value +} + +func (v *NullableCreateProtocol) Set(val *CreateProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableCreateProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateProtocol(val *CreateProtocol) *NullableCreateProtocol { + return &NullableCreateProtocol{value: val, isSet: true} +} + +func (v NullableCreateProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_protocol_test.go b/pkg/iaasbeta/model_create_protocol_test.go new file mode 100644 index 00000000..e06364b5 --- /dev/null +++ b/pkg/iaasbeta/model_create_protocol_test.go @@ -0,0 +1,60 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "testing" +) + +// isOneOf + +func TestCreateProtocol_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + + { + name: "success - int64 1", + args: args{ + src: []byte(`"1"`), + }, + wantErr: false, + }, + + { + name: "success - string null", + args: args{ + src: []byte(`"null"`), + }, + wantErr: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := &CreateProtocol{} + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + marshalJson, err := v.MarshalJSON() + if err != nil { + t.Fatalf("failed marshalling CreateProtocol: %v", err) + } + if string(marshalJson) != string(tt.args.src) { + t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson) + } + }) + } +} diff --git a/pkg/iaasbeta/model_create_public_ip_payload.go b/pkg/iaasbeta/model_create_public_ip_payload.go new file mode 100644 index 00000000..4bdbf743 --- /dev/null +++ b/pkg/iaasbeta/model_create_public_ip_payload.go @@ -0,0 +1,290 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreatePublicIPPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreatePublicIPPayload{} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreatePublicIPPayloadGetIdAttributeType = *string + +func getCreatePublicIPPayloadGetIdAttributeTypeOk(arg CreatePublicIPPayloadGetIdAttributeType) (ret CreatePublicIPPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreatePublicIPPayloadGetIdAttributeType(arg *CreatePublicIPPayloadGetIdAttributeType, val CreatePublicIPPayloadGetIdRetType) { + *arg = &val +} + +type CreatePublicIPPayloadGetIdArgType = string +type CreatePublicIPPayloadGetIdRetType = string + +/* + types and functions for ip +*/ + +// isNotNullableString +type CreatePublicIPPayloadGetIpAttributeType = *string + +func getCreatePublicIPPayloadGetIpAttributeTypeOk(arg CreatePublicIPPayloadGetIpAttributeType) (ret CreatePublicIPPayloadGetIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreatePublicIPPayloadGetIpAttributeType(arg *CreatePublicIPPayloadGetIpAttributeType, val CreatePublicIPPayloadGetIpRetType) { + *arg = &val +} + +type CreatePublicIPPayloadGetIpArgType = string +type CreatePublicIPPayloadGetIpRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreatePublicIPPayloadGetLabelsAttributeType = *map[string]interface{} +type CreatePublicIPPayloadGetLabelsArgType = map[string]interface{} +type CreatePublicIPPayloadGetLabelsRetType = map[string]interface{} + +func getCreatePublicIPPayloadGetLabelsAttributeTypeOk(arg CreatePublicIPPayloadGetLabelsAttributeType) (ret CreatePublicIPPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreatePublicIPPayloadGetLabelsAttributeType(arg *CreatePublicIPPayloadGetLabelsAttributeType, val CreatePublicIPPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for networkInterface +*/ + +// isNullableString +type CreatePublicIPPayloadGetNetworkInterfaceAttributeType = *NullableString + +func getCreatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(arg CreatePublicIPPayloadGetNetworkInterfaceAttributeType) (ret CreatePublicIPPayloadGetNetworkInterfaceRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreatePublicIPPayloadGetNetworkInterfaceAttributeType(arg *CreatePublicIPPayloadGetNetworkInterfaceAttributeType, val CreatePublicIPPayloadGetNetworkInterfaceRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreatePublicIPPayloadGetNetworkInterfaceArgType = *string +type CreatePublicIPPayloadGetNetworkInterfaceRetType = *string + +// CreatePublicIPPayload Object that represents a public IP. +type CreatePublicIPPayload struct { + // Universally Unique Identifier (UUID). + Id CreatePublicIPPayloadGetIdAttributeType `json:"id,omitempty"` + // String that represents an IPv4 address. + Ip CreatePublicIPPayloadGetIpAttributeType `json:"ip,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreatePublicIPPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Universally Unique Identifier (UUID). + NetworkInterface CreatePublicIPPayloadGetNetworkInterfaceAttributeType `json:"networkInterface,omitempty"` +} + +// NewCreatePublicIPPayload instantiates a new CreatePublicIPPayload 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 NewCreatePublicIPPayload() *CreatePublicIPPayload { + this := CreatePublicIPPayload{} + return &this +} + +// NewCreatePublicIPPayloadWithDefaults instantiates a new CreatePublicIPPayload 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 NewCreatePublicIPPayloadWithDefaults() *CreatePublicIPPayload { + this := CreatePublicIPPayload{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreatePublicIPPayload) GetId() (res CreatePublicIPPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreatePublicIPPayload) GetIdOk() (ret CreatePublicIPPayloadGetIdRetType, ok bool) { + return getCreatePublicIPPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreatePublicIPPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreatePublicIPPayload) SetId(v CreatePublicIPPayloadGetIdRetType) { + setCreatePublicIPPayloadGetIdAttributeType(&o.Id, v) +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *CreatePublicIPPayload) GetIp() (res CreatePublicIPPayloadGetIpRetType) { + res, _ = o.GetIpOk() + return +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreatePublicIPPayload) GetIpOk() (ret CreatePublicIPPayloadGetIpRetType, ok bool) { + return getCreatePublicIPPayloadGetIpAttributeTypeOk(o.Ip) +} + +// HasIp returns a boolean if a field has been set. +func (o *CreatePublicIPPayload) HasIp() bool { + _, ok := o.GetIpOk() + return ok +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *CreatePublicIPPayload) SetIp(v CreatePublicIPPayloadGetIpRetType) { + setCreatePublicIPPayloadGetIpAttributeType(&o.Ip, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreatePublicIPPayload) GetLabels() (res CreatePublicIPPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreatePublicIPPayload) GetLabelsOk() (ret CreatePublicIPPayloadGetLabelsRetType, ok bool) { + return getCreatePublicIPPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreatePublicIPPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreatePublicIPPayload) SetLabels(v CreatePublicIPPayloadGetLabelsRetType) { + setCreatePublicIPPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreatePublicIPPayload) GetNetworkInterface() (res CreatePublicIPPayloadGetNetworkInterfaceRetType) { + res, _ = o.GetNetworkInterfaceOk() + return +} + +// GetNetworkInterfaceOk returns a tuple with the NetworkInterface field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreatePublicIPPayload) GetNetworkInterfaceOk() (ret CreatePublicIPPayloadGetNetworkInterfaceRetType, ok bool) { + return getCreatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface) +} + +// HasNetworkInterface returns a boolean if a field has been set. +func (o *CreatePublicIPPayload) HasNetworkInterface() bool { + _, ok := o.GetNetworkInterfaceOk() + return ok +} + +// SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. +func (o *CreatePublicIPPayload) SetNetworkInterface(v CreatePublicIPPayloadGetNetworkInterfaceRetType) { + setCreatePublicIPPayloadGetNetworkInterfaceAttributeType(&o.NetworkInterface, v) +} + +// SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil +func (o *CreatePublicIPPayload) SetNetworkInterfaceNil() { + o.NetworkInterface = nil +} + +// UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil +func (o *CreatePublicIPPayload) UnsetNetworkInterface() { + o.NetworkInterface = nil +} + +func (o CreatePublicIPPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreatePublicIPPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreatePublicIPPayloadGetIpAttributeTypeOk(o.Ip); ok { + toSerialize["Ip"] = val + } + if val, ok := getCreatePublicIPPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface); ok { + toSerialize["NetworkInterface"] = val + } + return toSerialize, nil +} + +type NullableCreatePublicIPPayload struct { + value *CreatePublicIPPayload + isSet bool +} + +func (v NullableCreatePublicIPPayload) Get() *CreatePublicIPPayload { + return v.value +} + +func (v *NullableCreatePublicIPPayload) Set(val *CreatePublicIPPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreatePublicIPPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreatePublicIPPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreatePublicIPPayload(val *CreatePublicIPPayload) *NullableCreatePublicIPPayload { + return &NullableCreatePublicIPPayload{value: val, isSet: true} +} + +func (v NullableCreatePublicIPPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreatePublicIPPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_public_ip_payload_test.go b/pkg/iaasbeta/model_create_public_ip_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_public_ip_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_security_group_payload.go b/pkg/iaasbeta/model_create_security_group_payload.go new file mode 100644 index 00000000..7f6fb69f --- /dev/null +++ b/pkg/iaasbeta/model_create_security_group_payload.go @@ -0,0 +1,468 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the CreateSecurityGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSecurityGroupPayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateSecurityGroupPayloadGetCreatedAtAttributeType = *time.Time +type CreateSecurityGroupPayloadGetCreatedAtArgType = time.Time +type CreateSecurityGroupPayloadGetCreatedAtRetType = time.Time + +func getCreateSecurityGroupPayloadGetCreatedAtAttributeTypeOk(arg CreateSecurityGroupPayloadGetCreatedAtAttributeType) (ret CreateSecurityGroupPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetCreatedAtAttributeType(arg *CreateSecurityGroupPayloadGetCreatedAtAttributeType, val CreateSecurityGroupPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateSecurityGroupPayloadGetDescriptionAttributeType = *string + +func getCreateSecurityGroupPayloadGetDescriptionAttributeTypeOk(arg CreateSecurityGroupPayloadGetDescriptionAttributeType) (ret CreateSecurityGroupPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetDescriptionAttributeType(arg *CreateSecurityGroupPayloadGetDescriptionAttributeType, val CreateSecurityGroupPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateSecurityGroupPayloadGetDescriptionArgType = string +type CreateSecurityGroupPayloadGetDescriptionRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateSecurityGroupPayloadGetIdAttributeType = *string + +func getCreateSecurityGroupPayloadGetIdAttributeTypeOk(arg CreateSecurityGroupPayloadGetIdAttributeType) (ret CreateSecurityGroupPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetIdAttributeType(arg *CreateSecurityGroupPayloadGetIdAttributeType, val CreateSecurityGroupPayloadGetIdRetType) { + *arg = &val +} + +type CreateSecurityGroupPayloadGetIdArgType = string +type CreateSecurityGroupPayloadGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateSecurityGroupPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateSecurityGroupPayloadGetLabelsArgType = map[string]interface{} +type CreateSecurityGroupPayloadGetLabelsRetType = map[string]interface{} + +func getCreateSecurityGroupPayloadGetLabelsAttributeTypeOk(arg CreateSecurityGroupPayloadGetLabelsAttributeType) (ret CreateSecurityGroupPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetLabelsAttributeType(arg *CreateSecurityGroupPayloadGetLabelsAttributeType, val CreateSecurityGroupPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateSecurityGroupPayloadGetNameAttributeType = *string + +func getCreateSecurityGroupPayloadGetNameAttributeTypeOk(arg CreateSecurityGroupPayloadGetNameAttributeType) (ret CreateSecurityGroupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetNameAttributeType(arg *CreateSecurityGroupPayloadGetNameAttributeType, val CreateSecurityGroupPayloadGetNameRetType) { + *arg = &val +} + +type CreateSecurityGroupPayloadGetNameArgType = string +type CreateSecurityGroupPayloadGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type CreateSecurityGroupPayloadGetRulesAttributeType = *[]SecurityGroupRule +type CreateSecurityGroupPayloadGetRulesArgType = []SecurityGroupRule +type CreateSecurityGroupPayloadGetRulesRetType = []SecurityGroupRule + +func getCreateSecurityGroupPayloadGetRulesAttributeTypeOk(arg CreateSecurityGroupPayloadGetRulesAttributeType) (ret CreateSecurityGroupPayloadGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetRulesAttributeType(arg *CreateSecurityGroupPayloadGetRulesAttributeType, val CreateSecurityGroupPayloadGetRulesRetType) { + *arg = &val +} + +/* + types and functions for stateful +*/ + +// isBoolean +type CreateSecurityGroupPayloadgetStatefulAttributeType = *bool +type CreateSecurityGroupPayloadgetStatefulArgType = bool +type CreateSecurityGroupPayloadgetStatefulRetType = bool + +func getCreateSecurityGroupPayloadgetStatefulAttributeTypeOk(arg CreateSecurityGroupPayloadgetStatefulAttributeType) (ret CreateSecurityGroupPayloadgetStatefulRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadgetStatefulAttributeType(arg *CreateSecurityGroupPayloadgetStatefulAttributeType, val CreateSecurityGroupPayloadgetStatefulRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateSecurityGroupPayloadGetUpdatedAtAttributeType = *time.Time +type CreateSecurityGroupPayloadGetUpdatedAtArgType = time.Time +type CreateSecurityGroupPayloadGetUpdatedAtRetType = time.Time + +func getCreateSecurityGroupPayloadGetUpdatedAtAttributeTypeOk(arg CreateSecurityGroupPayloadGetUpdatedAtAttributeType) (ret CreateSecurityGroupPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetUpdatedAtAttributeType(arg *CreateSecurityGroupPayloadGetUpdatedAtAttributeType, val CreateSecurityGroupPayloadGetUpdatedAtRetType) { + *arg = &val +} + +// CreateSecurityGroupPayload Object that represents a security group. +type CreateSecurityGroupPayload struct { + // Date-time when resource was created. + CreatedAt CreateSecurityGroupPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description CreateSecurityGroupPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateSecurityGroupPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateSecurityGroupPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name CreateSecurityGroupPayloadGetNameAttributeType `json:"name" required:"true"` + // A list containing security group rule objects. + Rules CreateSecurityGroupPayloadGetRulesAttributeType `json:"rules,omitempty"` + // Shows if a security group is stateful or stateless. You can only have one type of security groups per network interface/server. + Stateful CreateSecurityGroupPayloadgetStatefulAttributeType `json:"stateful,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateSecurityGroupPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _CreateSecurityGroupPayload CreateSecurityGroupPayload + +// NewCreateSecurityGroupPayload instantiates a new CreateSecurityGroupPayload 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 NewCreateSecurityGroupPayload(name CreateSecurityGroupPayloadGetNameArgType) *CreateSecurityGroupPayload { + this := CreateSecurityGroupPayload{} + setCreateSecurityGroupPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateSecurityGroupPayloadWithDefaults instantiates a new CreateSecurityGroupPayload 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 NewCreateSecurityGroupPayloadWithDefaults() *CreateSecurityGroupPayload { + this := CreateSecurityGroupPayload{} + var stateful bool = true + this.Stateful = &stateful + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetCreatedAt() (res CreateSecurityGroupPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetCreatedAtOk() (ret CreateSecurityGroupPayloadGetCreatedAtRetType, ok bool) { + return getCreateSecurityGroupPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateSecurityGroupPayload) SetCreatedAt(v CreateSecurityGroupPayloadGetCreatedAtRetType) { + setCreateSecurityGroupPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetDescription() (res CreateSecurityGroupPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetDescriptionOk() (ret CreateSecurityGroupPayloadGetDescriptionRetType, ok bool) { + return getCreateSecurityGroupPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateSecurityGroupPayload) SetDescription(v CreateSecurityGroupPayloadGetDescriptionRetType) { + setCreateSecurityGroupPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetId() (res CreateSecurityGroupPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetIdOk() (ret CreateSecurityGroupPayloadGetIdRetType, ok bool) { + return getCreateSecurityGroupPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateSecurityGroupPayload) SetId(v CreateSecurityGroupPayloadGetIdRetType) { + setCreateSecurityGroupPayloadGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetLabels() (res CreateSecurityGroupPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetLabelsOk() (ret CreateSecurityGroupPayloadGetLabelsRetType, ok bool) { + return getCreateSecurityGroupPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateSecurityGroupPayload) SetLabels(v CreateSecurityGroupPayloadGetLabelsRetType) { + setCreateSecurityGroupPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *CreateSecurityGroupPayload) GetName() (ret CreateSecurityGroupPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetNameOk() (ret CreateSecurityGroupPayloadGetNameRetType, ok bool) { + return getCreateSecurityGroupPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateSecurityGroupPayload) SetName(v CreateSecurityGroupPayloadGetNameRetType) { + setCreateSecurityGroupPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetRules() (res CreateSecurityGroupPayloadGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetRulesOk() (ret CreateSecurityGroupPayloadGetRulesRetType, ok bool) { + return getCreateSecurityGroupPayloadGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given []SecurityGroupRule and assigns it to the Rules field. +func (o *CreateSecurityGroupPayload) SetRules(v CreateSecurityGroupPayloadGetRulesRetType) { + setCreateSecurityGroupPayloadGetRulesAttributeType(&o.Rules, v) +} + +// GetStateful returns the Stateful field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetStateful() (res CreateSecurityGroupPayloadgetStatefulRetType) { + res, _ = o.GetStatefulOk() + return +} + +// GetStatefulOk returns a tuple with the Stateful field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetStatefulOk() (ret CreateSecurityGroupPayloadgetStatefulRetType, ok bool) { + return getCreateSecurityGroupPayloadgetStatefulAttributeTypeOk(o.Stateful) +} + +// HasStateful returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasStateful() bool { + _, ok := o.GetStatefulOk() + return ok +} + +// SetStateful gets a reference to the given bool and assigns it to the Stateful field. +func (o *CreateSecurityGroupPayload) SetStateful(v CreateSecurityGroupPayloadgetStatefulRetType) { + setCreateSecurityGroupPayloadgetStatefulAttributeType(&o.Stateful, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetUpdatedAt() (res CreateSecurityGroupPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetUpdatedAtOk() (ret CreateSecurityGroupPayloadGetUpdatedAtRetType, ok bool) { + return getCreateSecurityGroupPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateSecurityGroupPayload) SetUpdatedAt(v CreateSecurityGroupPayloadGetUpdatedAtRetType) { + setCreateSecurityGroupPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o CreateSecurityGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateSecurityGroupPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + if val, ok := getCreateSecurityGroupPayloadgetStatefulAttributeTypeOk(o.Stateful); ok { + toSerialize["Stateful"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableCreateSecurityGroupPayload struct { + value *CreateSecurityGroupPayload + isSet bool +} + +func (v NullableCreateSecurityGroupPayload) Get() *CreateSecurityGroupPayload { + return v.value +} + +func (v *NullableCreateSecurityGroupPayload) Set(val *CreateSecurityGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSecurityGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSecurityGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSecurityGroupPayload(val *CreateSecurityGroupPayload) *NullableCreateSecurityGroupPayload { + return &NullableCreateSecurityGroupPayload{value: val, isSet: true} +} + +func (v NullableCreateSecurityGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSecurityGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_security_group_payload_test.go b/pkg/iaasbeta/model_create_security_group_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_security_group_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_security_group_rule_payload.go b/pkg/iaasbeta/model_create_security_group_rule_payload.go new file mode 100644 index 00000000..98a05105 --- /dev/null +++ b/pkg/iaasbeta/model_create_security_group_rule_payload.go @@ -0,0 +1,661 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the CreateSecurityGroupRulePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSecurityGroupRulePayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateSecurityGroupRulePayloadGetCreatedAtAttributeType = *time.Time +type CreateSecurityGroupRulePayloadGetCreatedAtArgType = time.Time +type CreateSecurityGroupRulePayloadGetCreatedAtRetType = time.Time + +func getCreateSecurityGroupRulePayloadGetCreatedAtAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetCreatedAtAttributeType) (ret CreateSecurityGroupRulePayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetCreatedAtAttributeType(arg *CreateSecurityGroupRulePayloadGetCreatedAtAttributeType, val CreateSecurityGroupRulePayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetDescriptionAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetDescriptionAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetDescriptionAttributeType) (ret CreateSecurityGroupRulePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetDescriptionAttributeType(arg *CreateSecurityGroupRulePayloadGetDescriptionAttributeType, val CreateSecurityGroupRulePayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetDescriptionArgType = string +type CreateSecurityGroupRulePayloadGetDescriptionRetType = string + +/* + types and functions for direction +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetDirectionAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetDirectionAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetDirectionAttributeType) (ret CreateSecurityGroupRulePayloadGetDirectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetDirectionAttributeType(arg *CreateSecurityGroupRulePayloadGetDirectionAttributeType, val CreateSecurityGroupRulePayloadGetDirectionRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetDirectionArgType = string +type CreateSecurityGroupRulePayloadGetDirectionRetType = string + +/* + types and functions for ethertype +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetEthertypeAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetEthertypeAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetEthertypeAttributeType) (ret CreateSecurityGroupRulePayloadGetEthertypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetEthertypeAttributeType(arg *CreateSecurityGroupRulePayloadGetEthertypeAttributeType, val CreateSecurityGroupRulePayloadGetEthertypeRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetEthertypeArgType = string +type CreateSecurityGroupRulePayloadGetEthertypeRetType = string + +/* + types and functions for icmpParameters +*/ + +// isModel +type CreateSecurityGroupRulePayloadGetIcmpParametersAttributeType = *ICMPParameters +type CreateSecurityGroupRulePayloadGetIcmpParametersArgType = ICMPParameters +type CreateSecurityGroupRulePayloadGetIcmpParametersRetType = ICMPParameters + +func getCreateSecurityGroupRulePayloadGetIcmpParametersAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetIcmpParametersAttributeType) (ret CreateSecurityGroupRulePayloadGetIcmpParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetIcmpParametersAttributeType(arg *CreateSecurityGroupRulePayloadGetIcmpParametersAttributeType, val CreateSecurityGroupRulePayloadGetIcmpParametersRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetIdAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetIdAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetIdAttributeType) (ret CreateSecurityGroupRulePayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetIdAttributeType(arg *CreateSecurityGroupRulePayloadGetIdAttributeType, val CreateSecurityGroupRulePayloadGetIdRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetIdArgType = string +type CreateSecurityGroupRulePayloadGetIdRetType = string + +/* + types and functions for ipRange +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetIpRangeAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetIpRangeAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetIpRangeAttributeType) (ret CreateSecurityGroupRulePayloadGetIpRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetIpRangeAttributeType(arg *CreateSecurityGroupRulePayloadGetIpRangeAttributeType, val CreateSecurityGroupRulePayloadGetIpRangeRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetIpRangeArgType = string +type CreateSecurityGroupRulePayloadGetIpRangeRetType = string + +/* + types and functions for portRange +*/ + +// isModel +type CreateSecurityGroupRulePayloadGetPortRangeAttributeType = *PortRange +type CreateSecurityGroupRulePayloadGetPortRangeArgType = PortRange +type CreateSecurityGroupRulePayloadGetPortRangeRetType = PortRange + +func getCreateSecurityGroupRulePayloadGetPortRangeAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetPortRangeAttributeType) (ret CreateSecurityGroupRulePayloadGetPortRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetPortRangeAttributeType(arg *CreateSecurityGroupRulePayloadGetPortRangeAttributeType, val CreateSecurityGroupRulePayloadGetPortRangeRetType) { + *arg = &val +} + +/* + types and functions for remoteSecurityGroupId +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType) (ret CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType(arg *CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType, val CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdArgType = string +type CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType = string + +/* + types and functions for securityGroupId +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType) (ret CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType(arg *CreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType, val CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetSecurityGroupIdArgType = string +type CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateSecurityGroupRulePayloadGetUpdatedAtAttributeType = *time.Time +type CreateSecurityGroupRulePayloadGetUpdatedAtArgType = time.Time +type CreateSecurityGroupRulePayloadGetUpdatedAtRetType = time.Time + +func getCreateSecurityGroupRulePayloadGetUpdatedAtAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetUpdatedAtAttributeType) (ret CreateSecurityGroupRulePayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetUpdatedAtAttributeType(arg *CreateSecurityGroupRulePayloadGetUpdatedAtAttributeType, val CreateSecurityGroupRulePayloadGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for protocol +*/ + +// isModel +type CreateSecurityGroupRulePayloadGetProtocolAttributeType = *CreateProtocol +type CreateSecurityGroupRulePayloadGetProtocolArgType = CreateProtocol +type CreateSecurityGroupRulePayloadGetProtocolRetType = CreateProtocol + +func getCreateSecurityGroupRulePayloadGetProtocolAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetProtocolAttributeType) (ret CreateSecurityGroupRulePayloadGetProtocolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetProtocolAttributeType(arg *CreateSecurityGroupRulePayloadGetProtocolAttributeType, val CreateSecurityGroupRulePayloadGetProtocolRetType) { + *arg = &val +} + +// CreateSecurityGroupRulePayload Object that represents a request body for security group rule creation. +type CreateSecurityGroupRulePayload struct { + // Date-time when resource was created. + CreatedAt CreateSecurityGroupRulePayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description CreateSecurityGroupRulePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The direction of the traffic which the rule should match. Possible values: `ingress`, `egress`. + // REQUIRED + Direction CreateSecurityGroupRulePayloadGetDirectionAttributeType `json:"direction" required:"true"` + // The ethertype which the rule should match. Possible values: `IPv4`, `IPv6`. + Ethertype CreateSecurityGroupRulePayloadGetEthertypeAttributeType `json:"ethertype,omitempty"` + IcmpParameters CreateSecurityGroupRulePayloadGetIcmpParametersAttributeType `json:"icmpParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateSecurityGroupRulePayloadGetIdAttributeType `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + IpRange CreateSecurityGroupRulePayloadGetIpRangeAttributeType `json:"ipRange,omitempty"` + PortRange CreateSecurityGroupRulePayloadGetPortRangeAttributeType `json:"portRange,omitempty"` + // Universally Unique Identifier (UUID). + RemoteSecurityGroupId CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType `json:"remoteSecurityGroupId,omitempty"` + // Universally Unique Identifier (UUID). + SecurityGroupId CreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType `json:"securityGroupId,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateSecurityGroupRulePayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + Protocol CreateSecurityGroupRulePayloadGetProtocolAttributeType `json:"protocol,omitempty"` +} + +type _CreateSecurityGroupRulePayload CreateSecurityGroupRulePayload + +// NewCreateSecurityGroupRulePayload instantiates a new CreateSecurityGroupRulePayload 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 NewCreateSecurityGroupRulePayload(direction CreateSecurityGroupRulePayloadGetDirectionArgType) *CreateSecurityGroupRulePayload { + this := CreateSecurityGroupRulePayload{} + setCreateSecurityGroupRulePayloadGetDirectionAttributeType(&this.Direction, direction) + return &this +} + +// NewCreateSecurityGroupRulePayloadWithDefaults instantiates a new CreateSecurityGroupRulePayload 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 NewCreateSecurityGroupRulePayloadWithDefaults() *CreateSecurityGroupRulePayload { + this := CreateSecurityGroupRulePayload{} + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetCreatedAt() (res CreateSecurityGroupRulePayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetCreatedAtOk() (ret CreateSecurityGroupRulePayloadGetCreatedAtRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateSecurityGroupRulePayload) SetCreatedAt(v CreateSecurityGroupRulePayloadGetCreatedAtRetType) { + setCreateSecurityGroupRulePayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetDescription() (res CreateSecurityGroupRulePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetDescriptionOk() (ret CreateSecurityGroupRulePayloadGetDescriptionRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateSecurityGroupRulePayload) SetDescription(v CreateSecurityGroupRulePayloadGetDescriptionRetType) { + setCreateSecurityGroupRulePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDirection returns the Direction field value +func (o *CreateSecurityGroupRulePayload) GetDirection() (ret CreateSecurityGroupRulePayloadGetDirectionRetType) { + ret, _ = o.GetDirectionOk() + return ret +} + +// GetDirectionOk returns a tuple with the Direction field value +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetDirectionOk() (ret CreateSecurityGroupRulePayloadGetDirectionRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetDirectionAttributeTypeOk(o.Direction) +} + +// SetDirection sets field value +func (o *CreateSecurityGroupRulePayload) SetDirection(v CreateSecurityGroupRulePayloadGetDirectionRetType) { + setCreateSecurityGroupRulePayloadGetDirectionAttributeType(&o.Direction, v) +} + +// GetEthertype returns the Ethertype field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetEthertype() (res CreateSecurityGroupRulePayloadGetEthertypeRetType) { + res, _ = o.GetEthertypeOk() + return +} + +// GetEthertypeOk returns a tuple with the Ethertype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetEthertypeOk() (ret CreateSecurityGroupRulePayloadGetEthertypeRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetEthertypeAttributeTypeOk(o.Ethertype) +} + +// HasEthertype returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasEthertype() bool { + _, ok := o.GetEthertypeOk() + return ok +} + +// SetEthertype gets a reference to the given string and assigns it to the Ethertype field. +func (o *CreateSecurityGroupRulePayload) SetEthertype(v CreateSecurityGroupRulePayloadGetEthertypeRetType) { + setCreateSecurityGroupRulePayloadGetEthertypeAttributeType(&o.Ethertype, v) +} + +// GetIcmpParameters returns the IcmpParameters field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetIcmpParameters() (res CreateSecurityGroupRulePayloadGetIcmpParametersRetType) { + res, _ = o.GetIcmpParametersOk() + return +} + +// GetIcmpParametersOk returns a tuple with the IcmpParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetIcmpParametersOk() (ret CreateSecurityGroupRulePayloadGetIcmpParametersRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetIcmpParametersAttributeTypeOk(o.IcmpParameters) +} + +// HasIcmpParameters returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasIcmpParameters() bool { + _, ok := o.GetIcmpParametersOk() + return ok +} + +// SetIcmpParameters gets a reference to the given ICMPParameters and assigns it to the IcmpParameters field. +func (o *CreateSecurityGroupRulePayload) SetIcmpParameters(v CreateSecurityGroupRulePayloadGetIcmpParametersRetType) { + setCreateSecurityGroupRulePayloadGetIcmpParametersAttributeType(&o.IcmpParameters, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetId() (res CreateSecurityGroupRulePayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetIdOk() (ret CreateSecurityGroupRulePayloadGetIdRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateSecurityGroupRulePayload) SetId(v CreateSecurityGroupRulePayloadGetIdRetType) { + setCreateSecurityGroupRulePayloadGetIdAttributeType(&o.Id, v) +} + +// GetIpRange returns the IpRange field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetIpRange() (res CreateSecurityGroupRulePayloadGetIpRangeRetType) { + res, _ = o.GetIpRangeOk() + return +} + +// GetIpRangeOk returns a tuple with the IpRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetIpRangeOk() (ret CreateSecurityGroupRulePayloadGetIpRangeRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetIpRangeAttributeTypeOk(o.IpRange) +} + +// HasIpRange returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasIpRange() bool { + _, ok := o.GetIpRangeOk() + return ok +} + +// SetIpRange gets a reference to the given string and assigns it to the IpRange field. +func (o *CreateSecurityGroupRulePayload) SetIpRange(v CreateSecurityGroupRulePayloadGetIpRangeRetType) { + setCreateSecurityGroupRulePayloadGetIpRangeAttributeType(&o.IpRange, v) +} + +// GetPortRange returns the PortRange field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetPortRange() (res CreateSecurityGroupRulePayloadGetPortRangeRetType) { + res, _ = o.GetPortRangeOk() + return +} + +// GetPortRangeOk returns a tuple with the PortRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetPortRangeOk() (ret CreateSecurityGroupRulePayloadGetPortRangeRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetPortRangeAttributeTypeOk(o.PortRange) +} + +// HasPortRange returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasPortRange() bool { + _, ok := o.GetPortRangeOk() + return ok +} + +// SetPortRange gets a reference to the given PortRange and assigns it to the PortRange field. +func (o *CreateSecurityGroupRulePayload) SetPortRange(v CreateSecurityGroupRulePayloadGetPortRangeRetType) { + setCreateSecurityGroupRulePayloadGetPortRangeAttributeType(&o.PortRange, v) +} + +// GetRemoteSecurityGroupId returns the RemoteSecurityGroupId field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetRemoteSecurityGroupId() (res CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType) { + res, _ = o.GetRemoteSecurityGroupIdOk() + return +} + +// GetRemoteSecurityGroupIdOk returns a tuple with the RemoteSecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetRemoteSecurityGroupIdOk() (ret CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId) +} + +// HasRemoteSecurityGroupId returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasRemoteSecurityGroupId() bool { + _, ok := o.GetRemoteSecurityGroupIdOk() + return ok +} + +// SetRemoteSecurityGroupId gets a reference to the given string and assigns it to the RemoteSecurityGroupId field. +func (o *CreateSecurityGroupRulePayload) SetRemoteSecurityGroupId(v CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType) { + setCreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType(&o.RemoteSecurityGroupId, v) +} + +// GetSecurityGroupId returns the SecurityGroupId field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetSecurityGroupId() (res CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType) { + res, _ = o.GetSecurityGroupIdOk() + return +} + +// GetSecurityGroupIdOk returns a tuple with the SecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetSecurityGroupIdOk() (ret CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId) +} + +// HasSecurityGroupId returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasSecurityGroupId() bool { + _, ok := o.GetSecurityGroupIdOk() + return ok +} + +// SetSecurityGroupId gets a reference to the given string and assigns it to the SecurityGroupId field. +func (o *CreateSecurityGroupRulePayload) SetSecurityGroupId(v CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType) { + setCreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType(&o.SecurityGroupId, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetUpdatedAt() (res CreateSecurityGroupRulePayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetUpdatedAtOk() (ret CreateSecurityGroupRulePayloadGetUpdatedAtRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateSecurityGroupRulePayload) SetUpdatedAt(v CreateSecurityGroupRulePayloadGetUpdatedAtRetType) { + setCreateSecurityGroupRulePayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetProtocol() (res CreateSecurityGroupRulePayloadGetProtocolRetType) { + res, _ = o.GetProtocolOk() + return +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetProtocolOk() (ret CreateSecurityGroupRulePayloadGetProtocolRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetProtocolAttributeTypeOk(o.Protocol) +} + +// HasProtocol returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasProtocol() bool { + _, ok := o.GetProtocolOk() + return ok +} + +// SetProtocol gets a reference to the given CreateProtocol and assigns it to the Protocol field. +func (o *CreateSecurityGroupRulePayload) SetProtocol(v CreateSecurityGroupRulePayloadGetProtocolRetType) { + setCreateSecurityGroupRulePayloadGetProtocolAttributeType(&o.Protocol, v) +} + +func (o CreateSecurityGroupRulePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateSecurityGroupRulePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetDirectionAttributeTypeOk(o.Direction); ok { + toSerialize["Direction"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetEthertypeAttributeTypeOk(o.Ethertype); ok { + toSerialize["Ethertype"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetIcmpParametersAttributeTypeOk(o.IcmpParameters); ok { + toSerialize["IcmpParameters"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetIpRangeAttributeTypeOk(o.IpRange); ok { + toSerialize["IpRange"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetPortRangeAttributeTypeOk(o.PortRange); ok { + toSerialize["PortRange"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId); ok { + toSerialize["RemoteSecurityGroupId"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId); ok { + toSerialize["SecurityGroupId"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetProtocolAttributeTypeOk(o.Protocol); ok { + toSerialize["Protocol"] = val + } + return toSerialize, nil +} + +type NullableCreateSecurityGroupRulePayload struct { + value *CreateSecurityGroupRulePayload + isSet bool +} + +func (v NullableCreateSecurityGroupRulePayload) Get() *CreateSecurityGroupRulePayload { + return v.value +} + +func (v *NullableCreateSecurityGroupRulePayload) Set(val *CreateSecurityGroupRulePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSecurityGroupRulePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSecurityGroupRulePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSecurityGroupRulePayload(val *CreateSecurityGroupRulePayload) *NullableCreateSecurityGroupRulePayload { + return &NullableCreateSecurityGroupRulePayload{value: val, isSet: true} +} + +func (v NullableCreateSecurityGroupRulePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSecurityGroupRulePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_security_group_rule_payload_test.go b/pkg/iaasbeta/model_create_security_group_rule_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_security_group_rule_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_security_group_rule_protocol.go b/pkg/iaasbeta/model_create_security_group_rule_protocol.go new file mode 100644 index 00000000..9297d4f8 --- /dev/null +++ b/pkg/iaasbeta/model_create_security_group_rule_protocol.go @@ -0,0 +1,127 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateSecurityGroupRuleProtocol type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSecurityGroupRuleProtocol{} + +/* + types and functions for protocol +*/ + +// isModel +type CreateSecurityGroupRuleProtocolGetProtocolAttributeType = *CreateProtocol +type CreateSecurityGroupRuleProtocolGetProtocolArgType = CreateProtocol +type CreateSecurityGroupRuleProtocolGetProtocolRetType = CreateProtocol + +func getCreateSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(arg CreateSecurityGroupRuleProtocolGetProtocolAttributeType) (ret CreateSecurityGroupRuleProtocolGetProtocolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRuleProtocolGetProtocolAttributeType(arg *CreateSecurityGroupRuleProtocolGetProtocolAttributeType, val CreateSecurityGroupRuleProtocolGetProtocolRetType) { + *arg = &val +} + +// CreateSecurityGroupRuleProtocol The internet protocol which the rule should match. +type CreateSecurityGroupRuleProtocol struct { + Protocol CreateSecurityGroupRuleProtocolGetProtocolAttributeType `json:"protocol,omitempty"` +} + +// NewCreateSecurityGroupRuleProtocol instantiates a new CreateSecurityGroupRuleProtocol 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 NewCreateSecurityGroupRuleProtocol() *CreateSecurityGroupRuleProtocol { + this := CreateSecurityGroupRuleProtocol{} + return &this +} + +// NewCreateSecurityGroupRuleProtocolWithDefaults instantiates a new CreateSecurityGroupRuleProtocol 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 NewCreateSecurityGroupRuleProtocolWithDefaults() *CreateSecurityGroupRuleProtocol { + this := CreateSecurityGroupRuleProtocol{} + return &this +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *CreateSecurityGroupRuleProtocol) GetProtocol() (res CreateSecurityGroupRuleProtocolGetProtocolRetType) { + res, _ = o.GetProtocolOk() + return +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRuleProtocol) GetProtocolOk() (ret CreateSecurityGroupRuleProtocolGetProtocolRetType, ok bool) { + return getCreateSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(o.Protocol) +} + +// HasProtocol returns a boolean if a field has been set. +func (o *CreateSecurityGroupRuleProtocol) HasProtocol() bool { + _, ok := o.GetProtocolOk() + return ok +} + +// SetProtocol gets a reference to the given CreateProtocol and assigns it to the Protocol field. +func (o *CreateSecurityGroupRuleProtocol) SetProtocol(v CreateSecurityGroupRuleProtocolGetProtocolRetType) { + setCreateSecurityGroupRuleProtocolGetProtocolAttributeType(&o.Protocol, v) +} + +func (o CreateSecurityGroupRuleProtocol) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(o.Protocol); ok { + toSerialize["Protocol"] = val + } + return toSerialize, nil +} + +type NullableCreateSecurityGroupRuleProtocol struct { + value *CreateSecurityGroupRuleProtocol + isSet bool +} + +func (v NullableCreateSecurityGroupRuleProtocol) Get() *CreateSecurityGroupRuleProtocol { + return v.value +} + +func (v *NullableCreateSecurityGroupRuleProtocol) Set(val *CreateSecurityGroupRuleProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSecurityGroupRuleProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSecurityGroupRuleProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSecurityGroupRuleProtocol(val *CreateSecurityGroupRuleProtocol) *NullableCreateSecurityGroupRuleProtocol { + return &NullableCreateSecurityGroupRuleProtocol{value: val, isSet: true} +} + +func (v NullableCreateSecurityGroupRuleProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSecurityGroupRuleProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_security_group_rule_protocol_test.go b/pkg/iaasbeta/model_create_security_group_rule_protocol_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_security_group_rule_protocol_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_server_networking.go b/pkg/iaasbeta/model_create_server_networking.go new file mode 100644 index 00000000..8fd60843 --- /dev/null +++ b/pkg/iaasbeta/model_create_server_networking.go @@ -0,0 +1,129 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateServerNetworking type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerNetworking{} + +/* + types and functions for networkId +*/ + +// isNotNullableString +type CreateServerNetworkingGetNetworkIdAttributeType = *string + +func getCreateServerNetworkingGetNetworkIdAttributeTypeOk(arg CreateServerNetworkingGetNetworkIdAttributeType) (ret CreateServerNetworkingGetNetworkIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerNetworkingGetNetworkIdAttributeType(arg *CreateServerNetworkingGetNetworkIdAttributeType, val CreateServerNetworkingGetNetworkIdRetType) { + *arg = &val +} + +type CreateServerNetworkingGetNetworkIdArgType = string +type CreateServerNetworkingGetNetworkIdRetType = string + +// CreateServerNetworking The initial networking setup for the server creation with a network. +type CreateServerNetworking struct { + // Universally Unique Identifier (UUID). + NetworkId CreateServerNetworkingGetNetworkIdAttributeType `json:"networkId,omitempty"` +} + +// NewCreateServerNetworking instantiates a new CreateServerNetworking 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 NewCreateServerNetworking() *CreateServerNetworking { + this := CreateServerNetworking{} + return &this +} + +// NewCreateServerNetworkingWithDefaults instantiates a new CreateServerNetworking 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 NewCreateServerNetworkingWithDefaults() *CreateServerNetworking { + this := CreateServerNetworking{} + return &this +} + +// GetNetworkId returns the NetworkId field value if set, zero value otherwise. +func (o *CreateServerNetworking) GetNetworkId() (res CreateServerNetworkingGetNetworkIdRetType) { + res, _ = o.GetNetworkIdOk() + return +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerNetworking) GetNetworkIdOk() (ret CreateServerNetworkingGetNetworkIdRetType, ok bool) { + return getCreateServerNetworkingGetNetworkIdAttributeTypeOk(o.NetworkId) +} + +// HasNetworkId returns a boolean if a field has been set. +func (o *CreateServerNetworking) HasNetworkId() bool { + _, ok := o.GetNetworkIdOk() + return ok +} + +// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. +func (o *CreateServerNetworking) SetNetworkId(v CreateServerNetworkingGetNetworkIdRetType) { + setCreateServerNetworkingGetNetworkIdAttributeType(&o.NetworkId, v) +} + +func (o CreateServerNetworking) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateServerNetworkingGetNetworkIdAttributeTypeOk(o.NetworkId); ok { + toSerialize["NetworkId"] = val + } + return toSerialize, nil +} + +type NullableCreateServerNetworking struct { + value *CreateServerNetworking + isSet bool +} + +func (v NullableCreateServerNetworking) Get() *CreateServerNetworking { + return v.value +} + +func (v *NullableCreateServerNetworking) Set(val *CreateServerNetworking) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerNetworking) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerNetworking) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerNetworking(val *CreateServerNetworking) *NullableCreateServerNetworking { + return &NullableCreateServerNetworking{value: val, isSet: true} +} + +func (v NullableCreateServerNetworking) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerNetworking) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_server_networking_test.go b/pkg/iaasbeta/model_create_server_networking_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_server_networking_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_server_networking_with_nics.go b/pkg/iaasbeta/model_create_server_networking_with_nics.go new file mode 100644 index 00000000..116fd85a --- /dev/null +++ b/pkg/iaasbeta/model_create_server_networking_with_nics.go @@ -0,0 +1,128 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateServerNetworkingWithNics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerNetworkingWithNics{} + +/* + types and functions for nicIds +*/ + +// isArray +type CreateServerNetworkingWithNicsGetNicIdsAttributeType = *[]string +type CreateServerNetworkingWithNicsGetNicIdsArgType = []string +type CreateServerNetworkingWithNicsGetNicIdsRetType = []string + +func getCreateServerNetworkingWithNicsGetNicIdsAttributeTypeOk(arg CreateServerNetworkingWithNicsGetNicIdsAttributeType) (ret CreateServerNetworkingWithNicsGetNicIdsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerNetworkingWithNicsGetNicIdsAttributeType(arg *CreateServerNetworkingWithNicsGetNicIdsAttributeType, val CreateServerNetworkingWithNicsGetNicIdsRetType) { + *arg = &val +} + +// CreateServerNetworkingWithNics The initial networking setup for the server creation with a network interface. +type CreateServerNetworkingWithNics struct { + // A list of UUIDs. + NicIds CreateServerNetworkingWithNicsGetNicIdsAttributeType `json:"nicIds,omitempty"` +} + +// NewCreateServerNetworkingWithNics instantiates a new CreateServerNetworkingWithNics 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 NewCreateServerNetworkingWithNics() *CreateServerNetworkingWithNics { + this := CreateServerNetworkingWithNics{} + return &this +} + +// NewCreateServerNetworkingWithNicsWithDefaults instantiates a new CreateServerNetworkingWithNics 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 NewCreateServerNetworkingWithNicsWithDefaults() *CreateServerNetworkingWithNics { + this := CreateServerNetworkingWithNics{} + return &this +} + +// GetNicIds returns the NicIds field value if set, zero value otherwise. +func (o *CreateServerNetworkingWithNics) GetNicIds() (res CreateServerNetworkingWithNicsGetNicIdsRetType) { + res, _ = o.GetNicIdsOk() + return +} + +// GetNicIdsOk returns a tuple with the NicIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerNetworkingWithNics) GetNicIdsOk() (ret CreateServerNetworkingWithNicsGetNicIdsRetType, ok bool) { + return getCreateServerNetworkingWithNicsGetNicIdsAttributeTypeOk(o.NicIds) +} + +// HasNicIds returns a boolean if a field has been set. +func (o *CreateServerNetworkingWithNics) HasNicIds() bool { + _, ok := o.GetNicIdsOk() + return ok +} + +// SetNicIds gets a reference to the given []string and assigns it to the NicIds field. +func (o *CreateServerNetworkingWithNics) SetNicIds(v CreateServerNetworkingWithNicsGetNicIdsRetType) { + setCreateServerNetworkingWithNicsGetNicIdsAttributeType(&o.NicIds, v) +} + +func (o CreateServerNetworkingWithNics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateServerNetworkingWithNicsGetNicIdsAttributeTypeOk(o.NicIds); ok { + toSerialize["NicIds"] = val + } + return toSerialize, nil +} + +type NullableCreateServerNetworkingWithNics struct { + value *CreateServerNetworkingWithNics + isSet bool +} + +func (v NullableCreateServerNetworkingWithNics) Get() *CreateServerNetworkingWithNics { + return v.value +} + +func (v *NullableCreateServerNetworkingWithNics) Set(val *CreateServerNetworkingWithNics) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerNetworkingWithNics) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerNetworkingWithNics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerNetworkingWithNics(val *CreateServerNetworkingWithNics) *NullableCreateServerNetworkingWithNics { + return &NullableCreateServerNetworkingWithNics{value: val, isSet: true} +} + +func (v NullableCreateServerNetworkingWithNics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerNetworkingWithNics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_server_networking_with_nics_test.go b/pkg/iaasbeta/model_create_server_networking_with_nics_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_server_networking_with_nics_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_server_payload.go b/pkg/iaasbeta/model_create_server_payload.go new file mode 100644 index 00000000..5b9d6867 --- /dev/null +++ b/pkg/iaasbeta/model_create_server_payload.go @@ -0,0 +1,1229 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the CreateServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerPayload{} + +/* + types and functions for affinityGroup +*/ + +// isNotNullableString +type CreateServerPayloadGetAffinityGroupAttributeType = *string + +func getCreateServerPayloadGetAffinityGroupAttributeTypeOk(arg CreateServerPayloadGetAffinityGroupAttributeType) (ret CreateServerPayloadGetAffinityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetAffinityGroupAttributeType(arg *CreateServerPayloadGetAffinityGroupAttributeType, val CreateServerPayloadGetAffinityGroupRetType) { + *arg = &val +} + +type CreateServerPayloadGetAffinityGroupArgType = string +type CreateServerPayloadGetAffinityGroupRetType = string + +/* + types and functions for agent +*/ + +// isModel +type CreateServerPayloadGetAgentAttributeType = *ServerAgent +type CreateServerPayloadGetAgentArgType = ServerAgent +type CreateServerPayloadGetAgentRetType = ServerAgent + +func getCreateServerPayloadGetAgentAttributeTypeOk(arg CreateServerPayloadGetAgentAttributeType) (ret CreateServerPayloadGetAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetAgentAttributeType(arg *CreateServerPayloadGetAgentAttributeType, val CreateServerPayloadGetAgentRetType) { + *arg = &val +} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type CreateServerPayloadGetAvailabilityZoneAttributeType = *string + +func getCreateServerPayloadGetAvailabilityZoneAttributeTypeOk(arg CreateServerPayloadGetAvailabilityZoneAttributeType) (ret CreateServerPayloadGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetAvailabilityZoneAttributeType(arg *CreateServerPayloadGetAvailabilityZoneAttributeType, val CreateServerPayloadGetAvailabilityZoneRetType) { + *arg = &val +} + +type CreateServerPayloadGetAvailabilityZoneArgType = string +type CreateServerPayloadGetAvailabilityZoneRetType = string + +/* + types and functions for bootVolume +*/ + +// isModel +type CreateServerPayloadGetBootVolumeAttributeType = *ServerBootVolume +type CreateServerPayloadGetBootVolumeArgType = ServerBootVolume +type CreateServerPayloadGetBootVolumeRetType = ServerBootVolume + +func getCreateServerPayloadGetBootVolumeAttributeTypeOk(arg CreateServerPayloadGetBootVolumeAttributeType) (ret CreateServerPayloadGetBootVolumeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetBootVolumeAttributeType(arg *CreateServerPayloadGetBootVolumeAttributeType, val CreateServerPayloadGetBootVolumeRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateServerPayloadGetCreatedAtAttributeType = *time.Time +type CreateServerPayloadGetCreatedAtArgType = time.Time +type CreateServerPayloadGetCreatedAtRetType = time.Time + +func getCreateServerPayloadGetCreatedAtAttributeTypeOk(arg CreateServerPayloadGetCreatedAtAttributeType) (ret CreateServerPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetCreatedAtAttributeType(arg *CreateServerPayloadGetCreatedAtAttributeType, val CreateServerPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for errorMessage +*/ + +// isNotNullableString +type CreateServerPayloadGetErrorMessageAttributeType = *string + +func getCreateServerPayloadGetErrorMessageAttributeTypeOk(arg CreateServerPayloadGetErrorMessageAttributeType) (ret CreateServerPayloadGetErrorMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetErrorMessageAttributeType(arg *CreateServerPayloadGetErrorMessageAttributeType, val CreateServerPayloadGetErrorMessageRetType) { + *arg = &val +} + +type CreateServerPayloadGetErrorMessageArgType = string +type CreateServerPayloadGetErrorMessageRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateServerPayloadGetIdAttributeType = *string + +func getCreateServerPayloadGetIdAttributeTypeOk(arg CreateServerPayloadGetIdAttributeType) (ret CreateServerPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetIdAttributeType(arg *CreateServerPayloadGetIdAttributeType, val CreateServerPayloadGetIdRetType) { + *arg = &val +} + +type CreateServerPayloadGetIdArgType = string +type CreateServerPayloadGetIdRetType = string + +/* + types and functions for imageId +*/ + +// isNotNullableString +type CreateServerPayloadGetImageIdAttributeType = *string + +func getCreateServerPayloadGetImageIdAttributeTypeOk(arg CreateServerPayloadGetImageIdAttributeType) (ret CreateServerPayloadGetImageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetImageIdAttributeType(arg *CreateServerPayloadGetImageIdAttributeType, val CreateServerPayloadGetImageIdRetType) { + *arg = &val +} + +type CreateServerPayloadGetImageIdArgType = string +type CreateServerPayloadGetImageIdRetType = string + +/* + types and functions for keypairName +*/ + +// isNotNullableString +type CreateServerPayloadGetKeypairNameAttributeType = *string + +func getCreateServerPayloadGetKeypairNameAttributeTypeOk(arg CreateServerPayloadGetKeypairNameAttributeType) (ret CreateServerPayloadGetKeypairNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetKeypairNameAttributeType(arg *CreateServerPayloadGetKeypairNameAttributeType, val CreateServerPayloadGetKeypairNameRetType) { + *arg = &val +} + +type CreateServerPayloadGetKeypairNameArgType = string +type CreateServerPayloadGetKeypairNameRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateServerPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateServerPayloadGetLabelsArgType = map[string]interface{} +type CreateServerPayloadGetLabelsRetType = map[string]interface{} + +func getCreateServerPayloadGetLabelsAttributeTypeOk(arg CreateServerPayloadGetLabelsAttributeType) (ret CreateServerPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetLabelsAttributeType(arg *CreateServerPayloadGetLabelsAttributeType, val CreateServerPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for launchedAt +*/ + +// isDateTime +type CreateServerPayloadGetLaunchedAtAttributeType = *time.Time +type CreateServerPayloadGetLaunchedAtArgType = time.Time +type CreateServerPayloadGetLaunchedAtRetType = time.Time + +func getCreateServerPayloadGetLaunchedAtAttributeTypeOk(arg CreateServerPayloadGetLaunchedAtAttributeType) (ret CreateServerPayloadGetLaunchedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetLaunchedAtAttributeType(arg *CreateServerPayloadGetLaunchedAtAttributeType, val CreateServerPayloadGetLaunchedAtRetType) { + *arg = &val +} + +/* + types and functions for machineType +*/ + +// isNotNullableString +type CreateServerPayloadGetMachineTypeAttributeType = *string + +func getCreateServerPayloadGetMachineTypeAttributeTypeOk(arg CreateServerPayloadGetMachineTypeAttributeType) (ret CreateServerPayloadGetMachineTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetMachineTypeAttributeType(arg *CreateServerPayloadGetMachineTypeAttributeType, val CreateServerPayloadGetMachineTypeRetType) { + *arg = &val +} + +type CreateServerPayloadGetMachineTypeArgType = string +type CreateServerPayloadGetMachineTypeRetType = string + +/* + types and functions for maintenanceWindow +*/ + +// isModel +type CreateServerPayloadGetMaintenanceWindowAttributeType = *ServerMaintenance +type CreateServerPayloadGetMaintenanceWindowArgType = ServerMaintenance +type CreateServerPayloadGetMaintenanceWindowRetType = ServerMaintenance + +func getCreateServerPayloadGetMaintenanceWindowAttributeTypeOk(arg CreateServerPayloadGetMaintenanceWindowAttributeType) (ret CreateServerPayloadGetMaintenanceWindowRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetMaintenanceWindowAttributeType(arg *CreateServerPayloadGetMaintenanceWindowAttributeType, val CreateServerPayloadGetMaintenanceWindowRetType) { + *arg = &val +} + +/* + types and functions for metadata +*/ + +// isFreeform +type CreateServerPayloadGetMetadataAttributeType = *map[string]interface{} +type CreateServerPayloadGetMetadataArgType = map[string]interface{} +type CreateServerPayloadGetMetadataRetType = map[string]interface{} + +func getCreateServerPayloadGetMetadataAttributeTypeOk(arg CreateServerPayloadGetMetadataAttributeType) (ret CreateServerPayloadGetMetadataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetMetadataAttributeType(arg *CreateServerPayloadGetMetadataAttributeType, val CreateServerPayloadGetMetadataRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateServerPayloadGetNameAttributeType = *string + +func getCreateServerPayloadGetNameAttributeTypeOk(arg CreateServerPayloadGetNameAttributeType) (ret CreateServerPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetNameAttributeType(arg *CreateServerPayloadGetNameAttributeType, val CreateServerPayloadGetNameRetType) { + *arg = &val +} + +type CreateServerPayloadGetNameArgType = string +type CreateServerPayloadGetNameRetType = string + +/* + types and functions for networking +*/ + +// isModel +type CreateServerPayloadGetNetworkingAttributeType = *CreateServerPayloadAllOfNetworking +type CreateServerPayloadGetNetworkingArgType = CreateServerPayloadAllOfNetworking +type CreateServerPayloadGetNetworkingRetType = CreateServerPayloadAllOfNetworking + +func getCreateServerPayloadGetNetworkingAttributeTypeOk(arg CreateServerPayloadGetNetworkingAttributeType) (ret CreateServerPayloadGetNetworkingRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetNetworkingAttributeType(arg *CreateServerPayloadGetNetworkingAttributeType, val CreateServerPayloadGetNetworkingRetType) { + *arg = &val +} + +/* + types and functions for nics +*/ + +// isArray +type CreateServerPayloadGetNicsAttributeType = *[]ServerNetwork +type CreateServerPayloadGetNicsArgType = []ServerNetwork +type CreateServerPayloadGetNicsRetType = []ServerNetwork + +func getCreateServerPayloadGetNicsAttributeTypeOk(arg CreateServerPayloadGetNicsAttributeType) (ret CreateServerPayloadGetNicsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetNicsAttributeType(arg *CreateServerPayloadGetNicsAttributeType, val CreateServerPayloadGetNicsRetType) { + *arg = &val +} + +/* + types and functions for powerStatus +*/ + +// isNotNullableString +type CreateServerPayloadGetPowerStatusAttributeType = *string + +func getCreateServerPayloadGetPowerStatusAttributeTypeOk(arg CreateServerPayloadGetPowerStatusAttributeType) (ret CreateServerPayloadGetPowerStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetPowerStatusAttributeType(arg *CreateServerPayloadGetPowerStatusAttributeType, val CreateServerPayloadGetPowerStatusRetType) { + *arg = &val +} + +type CreateServerPayloadGetPowerStatusArgType = string +type CreateServerPayloadGetPowerStatusRetType = string + +/* + types and functions for securityGroups +*/ + +// isArray +type CreateServerPayloadGetSecurityGroupsAttributeType = *[]string +type CreateServerPayloadGetSecurityGroupsArgType = []string +type CreateServerPayloadGetSecurityGroupsRetType = []string + +func getCreateServerPayloadGetSecurityGroupsAttributeTypeOk(arg CreateServerPayloadGetSecurityGroupsAttributeType) (ret CreateServerPayloadGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetSecurityGroupsAttributeType(arg *CreateServerPayloadGetSecurityGroupsAttributeType, val CreateServerPayloadGetSecurityGroupsRetType) { + *arg = &val +} + +/* + types and functions for serviceAccountMails +*/ + +// isArray +type CreateServerPayloadGetServiceAccountMailsAttributeType = *[]string +type CreateServerPayloadGetServiceAccountMailsArgType = []string +type CreateServerPayloadGetServiceAccountMailsRetType = []string + +func getCreateServerPayloadGetServiceAccountMailsAttributeTypeOk(arg CreateServerPayloadGetServiceAccountMailsAttributeType) (ret CreateServerPayloadGetServiceAccountMailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetServiceAccountMailsAttributeType(arg *CreateServerPayloadGetServiceAccountMailsAttributeType, val CreateServerPayloadGetServiceAccountMailsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type CreateServerPayloadGetStatusAttributeType = *string + +func getCreateServerPayloadGetStatusAttributeTypeOk(arg CreateServerPayloadGetStatusAttributeType) (ret CreateServerPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetStatusAttributeType(arg *CreateServerPayloadGetStatusAttributeType, val CreateServerPayloadGetStatusRetType) { + *arg = &val +} + +type CreateServerPayloadGetStatusArgType = string +type CreateServerPayloadGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateServerPayloadGetUpdatedAtAttributeType = *time.Time +type CreateServerPayloadGetUpdatedAtArgType = time.Time +type CreateServerPayloadGetUpdatedAtRetType = time.Time + +func getCreateServerPayloadGetUpdatedAtAttributeTypeOk(arg CreateServerPayloadGetUpdatedAtAttributeType) (ret CreateServerPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetUpdatedAtAttributeType(arg *CreateServerPayloadGetUpdatedAtAttributeType, val CreateServerPayloadGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for userData +*/ + +// isByteArray +type CreateServerPayloadGetUserDataAttributeType = *[]byte +type CreateServerPayloadGetUserDataArgType = []byte +type CreateServerPayloadGetUserDataRetType = []byte + +func getCreateServerPayloadGetUserDataAttributeTypeOk(arg CreateServerPayloadGetUserDataAttributeType) (ret CreateServerPayloadGetUserDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetUserDataAttributeType(arg *CreateServerPayloadGetUserDataAttributeType, val CreateServerPayloadGetUserDataRetType) { + *arg = &val +} + +/* + types and functions for volumes +*/ + +// isArray +type CreateServerPayloadGetVolumesAttributeType = *[]string +type CreateServerPayloadGetVolumesArgType = []string +type CreateServerPayloadGetVolumesRetType = []string + +func getCreateServerPayloadGetVolumesAttributeTypeOk(arg CreateServerPayloadGetVolumesAttributeType) (ret CreateServerPayloadGetVolumesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetVolumesAttributeType(arg *CreateServerPayloadGetVolumesAttributeType, val CreateServerPayloadGetVolumesRetType) { + *arg = &val +} + +// CreateServerPayload Object that represents the request body for a server create. +type CreateServerPayload struct { + // Universally Unique Identifier (UUID). + AffinityGroup CreateServerPayloadGetAffinityGroupAttributeType `json:"affinityGroup,omitempty"` + Agent CreateServerPayloadGetAgentAttributeType `json:"agent,omitempty"` + // Object that represents an availability zone. + AvailabilityZone CreateServerPayloadGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + BootVolume CreateServerPayloadGetBootVolumeAttributeType `json:"bootVolume,omitempty"` + // Date-time when resource was created. + CreatedAt CreateServerPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // An error message. + ErrorMessage CreateServerPayloadGetErrorMessageAttributeType `json:"errorMessage,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateServerPayloadGetIdAttributeType `json:"id,omitempty"` + // Universally Unique Identifier (UUID). + ImageId CreateServerPayloadGetImageIdAttributeType `json:"imageId,omitempty"` + // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. + KeypairName CreateServerPayloadGetKeypairNameAttributeType `json:"keypairName,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateServerPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Date-time when resource was launched. + LaunchedAt CreateServerPayloadGetLaunchedAtAttributeType `json:"launchedAt,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + MachineType CreateServerPayloadGetMachineTypeAttributeType `json:"machineType" required:"true"` + MaintenanceWindow CreateServerPayloadGetMaintenanceWindowAttributeType `json:"maintenanceWindow,omitempty"` + // Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value for a key will remove that key. + Metadata CreateServerPayloadGetMetadataAttributeType `json:"metadata,omitempty"` + // The name for a Server. + // REQUIRED + Name CreateServerPayloadGetNameAttributeType `json:"name" required:"true"` + // REQUIRED + Networking CreateServerPayloadGetNetworkingAttributeType `json:"networking" required:"true"` + // A list of networks attached to a server. + Nics CreateServerPayloadGetNicsAttributeType `json:"nics,omitempty"` + // The power status of a server. Possible values: `CRASHED`, `ERROR`, `RUNNING`, `STOPPED`. + PowerStatus CreateServerPayloadGetPowerStatusAttributeType `json:"powerStatus,omitempty"` + // A list of General Objects. + SecurityGroups CreateServerPayloadGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` + // A list of service account mails. + ServiceAccountMails CreateServerPayloadGetServiceAccountMailsAttributeType `json:"serviceAccountMails,omitempty"` + // The status of a server object. Possible values: `ACTIVE`, `BACKING-UP`, `CREATING`, `DEALLOCATED`, `DEALLOCATING`, `DELETED`, `DELETING`, `ERROR`, `INACTIVE`, `MIGRATING`, `PAUSED`, `REBOOT`, `REBOOTING`, `REBUILD`, `REBUILDING`, `RESCUE`, `RESCUING`, `RESIZING`, `RESTORING`, `SNAPSHOTTING`, `STARTING`, `STOPPING`, `UNRESCUING`, `UPDATING`. + Status CreateServerPayloadGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateServerPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // User Data that is provided to the server. Must be base64 encoded and is passed via cloud-init to the server. + UserData CreateServerPayloadGetUserDataAttributeType `json:"userData,omitempty"` + // A list of UUIDs. + Volumes CreateServerPayloadGetVolumesAttributeType `json:"volumes,omitempty"` +} + +type _CreateServerPayload CreateServerPayload + +// NewCreateServerPayload instantiates a new CreateServerPayload 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 NewCreateServerPayload(machineType CreateServerPayloadGetMachineTypeArgType, name CreateServerPayloadGetNameArgType, networking CreateServerPayloadGetNetworkingArgType) *CreateServerPayload { + this := CreateServerPayload{} + setCreateServerPayloadGetMachineTypeAttributeType(&this.MachineType, machineType) + setCreateServerPayloadGetNameAttributeType(&this.Name, name) + setCreateServerPayloadGetNetworkingAttributeType(&this.Networking, networking) + return &this +} + +// NewCreateServerPayloadWithDefaults instantiates a new CreateServerPayload 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 NewCreateServerPayloadWithDefaults() *CreateServerPayload { + this := CreateServerPayload{} + return &this +} + +// GetAffinityGroup returns the AffinityGroup field value if set, zero value otherwise. +func (o *CreateServerPayload) GetAffinityGroup() (res CreateServerPayloadGetAffinityGroupRetType) { + res, _ = o.GetAffinityGroupOk() + return +} + +// GetAffinityGroupOk returns a tuple with the AffinityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetAffinityGroupOk() (ret CreateServerPayloadGetAffinityGroupRetType, ok bool) { + return getCreateServerPayloadGetAffinityGroupAttributeTypeOk(o.AffinityGroup) +} + +// HasAffinityGroup returns a boolean if a field has been set. +func (o *CreateServerPayload) HasAffinityGroup() bool { + _, ok := o.GetAffinityGroupOk() + return ok +} + +// SetAffinityGroup gets a reference to the given string and assigns it to the AffinityGroup field. +func (o *CreateServerPayload) SetAffinityGroup(v CreateServerPayloadGetAffinityGroupRetType) { + setCreateServerPayloadGetAffinityGroupAttributeType(&o.AffinityGroup, v) +} + +// GetAgent returns the Agent field value if set, zero value otherwise. +func (o *CreateServerPayload) GetAgent() (res CreateServerPayloadGetAgentRetType) { + res, _ = o.GetAgentOk() + return +} + +// GetAgentOk returns a tuple with the Agent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetAgentOk() (ret CreateServerPayloadGetAgentRetType, ok bool) { + return getCreateServerPayloadGetAgentAttributeTypeOk(o.Agent) +} + +// HasAgent returns a boolean if a field has been set. +func (o *CreateServerPayload) HasAgent() bool { + _, ok := o.GetAgentOk() + return ok +} + +// SetAgent gets a reference to the given ServerAgent and assigns it to the Agent field. +func (o *CreateServerPayload) SetAgent(v CreateServerPayloadGetAgentRetType) { + setCreateServerPayloadGetAgentAttributeType(&o.Agent, v) +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *CreateServerPayload) GetAvailabilityZone() (res CreateServerPayloadGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetAvailabilityZoneOk() (ret CreateServerPayloadGetAvailabilityZoneRetType, ok bool) { + return getCreateServerPayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *CreateServerPayload) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *CreateServerPayload) SetAvailabilityZone(v CreateServerPayloadGetAvailabilityZoneRetType) { + setCreateServerPayloadGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetBootVolume returns the BootVolume field value if set, zero value otherwise. +func (o *CreateServerPayload) GetBootVolume() (res CreateServerPayloadGetBootVolumeRetType) { + res, _ = o.GetBootVolumeOk() + return +} + +// GetBootVolumeOk returns a tuple with the BootVolume field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetBootVolumeOk() (ret CreateServerPayloadGetBootVolumeRetType, ok bool) { + return getCreateServerPayloadGetBootVolumeAttributeTypeOk(o.BootVolume) +} + +// HasBootVolume returns a boolean if a field has been set. +func (o *CreateServerPayload) HasBootVolume() bool { + _, ok := o.GetBootVolumeOk() + return ok +} + +// SetBootVolume gets a reference to the given ServerBootVolume and assigns it to the BootVolume field. +func (o *CreateServerPayload) SetBootVolume(v CreateServerPayloadGetBootVolumeRetType) { + setCreateServerPayloadGetBootVolumeAttributeType(&o.BootVolume, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateServerPayload) GetCreatedAt() (res CreateServerPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetCreatedAtOk() (ret CreateServerPayloadGetCreatedAtRetType, ok bool) { + return getCreateServerPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateServerPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateServerPayload) SetCreatedAt(v CreateServerPayloadGetCreatedAtRetType) { + setCreateServerPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *CreateServerPayload) GetErrorMessage() (res CreateServerPayloadGetErrorMessageRetType) { + res, _ = o.GetErrorMessageOk() + return +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetErrorMessageOk() (ret CreateServerPayloadGetErrorMessageRetType, ok bool) { + return getCreateServerPayloadGetErrorMessageAttributeTypeOk(o.ErrorMessage) +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *CreateServerPayload) HasErrorMessage() bool { + _, ok := o.GetErrorMessageOk() + return ok +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *CreateServerPayload) SetErrorMessage(v CreateServerPayloadGetErrorMessageRetType) { + setCreateServerPayloadGetErrorMessageAttributeType(&o.ErrorMessage, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateServerPayload) GetId() (res CreateServerPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetIdOk() (ret CreateServerPayloadGetIdRetType, ok bool) { + return getCreateServerPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateServerPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateServerPayload) SetId(v CreateServerPayloadGetIdRetType) { + setCreateServerPayloadGetIdAttributeType(&o.Id, v) +} + +// GetImageId returns the ImageId field value if set, zero value otherwise. +func (o *CreateServerPayload) GetImageId() (res CreateServerPayloadGetImageIdRetType) { + res, _ = o.GetImageIdOk() + return +} + +// GetImageIdOk returns a tuple with the ImageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetImageIdOk() (ret CreateServerPayloadGetImageIdRetType, ok bool) { + return getCreateServerPayloadGetImageIdAttributeTypeOk(o.ImageId) +} + +// HasImageId returns a boolean if a field has been set. +func (o *CreateServerPayload) HasImageId() bool { + _, ok := o.GetImageIdOk() + return ok +} + +// SetImageId gets a reference to the given string and assigns it to the ImageId field. +func (o *CreateServerPayload) SetImageId(v CreateServerPayloadGetImageIdRetType) { + setCreateServerPayloadGetImageIdAttributeType(&o.ImageId, v) +} + +// GetKeypairName returns the KeypairName field value if set, zero value otherwise. +func (o *CreateServerPayload) GetKeypairName() (res CreateServerPayloadGetKeypairNameRetType) { + res, _ = o.GetKeypairNameOk() + return +} + +// GetKeypairNameOk returns a tuple with the KeypairName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetKeypairNameOk() (ret CreateServerPayloadGetKeypairNameRetType, ok bool) { + return getCreateServerPayloadGetKeypairNameAttributeTypeOk(o.KeypairName) +} + +// HasKeypairName returns a boolean if a field has been set. +func (o *CreateServerPayload) HasKeypairName() bool { + _, ok := o.GetKeypairNameOk() + return ok +} + +// SetKeypairName gets a reference to the given string and assigns it to the KeypairName field. +func (o *CreateServerPayload) SetKeypairName(v CreateServerPayloadGetKeypairNameRetType) { + setCreateServerPayloadGetKeypairNameAttributeType(&o.KeypairName, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateServerPayload) GetLabels() (res CreateServerPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetLabelsOk() (ret CreateServerPayloadGetLabelsRetType, ok bool) { + return getCreateServerPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateServerPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateServerPayload) SetLabels(v CreateServerPayloadGetLabelsRetType) { + setCreateServerPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetLaunchedAt returns the LaunchedAt field value if set, zero value otherwise. +func (o *CreateServerPayload) GetLaunchedAt() (res CreateServerPayloadGetLaunchedAtRetType) { + res, _ = o.GetLaunchedAtOk() + return +} + +// GetLaunchedAtOk returns a tuple with the LaunchedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetLaunchedAtOk() (ret CreateServerPayloadGetLaunchedAtRetType, ok bool) { + return getCreateServerPayloadGetLaunchedAtAttributeTypeOk(o.LaunchedAt) +} + +// HasLaunchedAt returns a boolean if a field has been set. +func (o *CreateServerPayload) HasLaunchedAt() bool { + _, ok := o.GetLaunchedAtOk() + return ok +} + +// SetLaunchedAt gets a reference to the given time.Time and assigns it to the LaunchedAt field. +func (o *CreateServerPayload) SetLaunchedAt(v CreateServerPayloadGetLaunchedAtRetType) { + setCreateServerPayloadGetLaunchedAtAttributeType(&o.LaunchedAt, v) +} + +// GetMachineType returns the MachineType field value +func (o *CreateServerPayload) GetMachineType() (ret CreateServerPayloadGetMachineTypeRetType) { + ret, _ = o.GetMachineTypeOk() + return ret +} + +// GetMachineTypeOk returns a tuple with the MachineType field value +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetMachineTypeOk() (ret CreateServerPayloadGetMachineTypeRetType, ok bool) { + return getCreateServerPayloadGetMachineTypeAttributeTypeOk(o.MachineType) +} + +// SetMachineType sets field value +func (o *CreateServerPayload) SetMachineType(v CreateServerPayloadGetMachineTypeRetType) { + setCreateServerPayloadGetMachineTypeAttributeType(&o.MachineType, v) +} + +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *CreateServerPayload) GetMaintenanceWindow() (res CreateServerPayloadGetMaintenanceWindowRetType) { + res, _ = o.GetMaintenanceWindowOk() + return +} + +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetMaintenanceWindowOk() (ret CreateServerPayloadGetMaintenanceWindowRetType, ok bool) { + return getCreateServerPayloadGetMaintenanceWindowAttributeTypeOk(o.MaintenanceWindow) +} + +// HasMaintenanceWindow returns a boolean if a field has been set. +func (o *CreateServerPayload) HasMaintenanceWindow() bool { + _, ok := o.GetMaintenanceWindowOk() + return ok +} + +// SetMaintenanceWindow gets a reference to the given ServerMaintenance and assigns it to the MaintenanceWindow field. +func (o *CreateServerPayload) SetMaintenanceWindow(v CreateServerPayloadGetMaintenanceWindowRetType) { + setCreateServerPayloadGetMaintenanceWindowAttributeType(&o.MaintenanceWindow, v) +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *CreateServerPayload) GetMetadata() (res CreateServerPayloadGetMetadataRetType) { + res, _ = o.GetMetadataOk() + return +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetMetadataOk() (ret CreateServerPayloadGetMetadataRetType, ok bool) { + return getCreateServerPayloadGetMetadataAttributeTypeOk(o.Metadata) +} + +// HasMetadata returns a boolean if a field has been set. +func (o *CreateServerPayload) HasMetadata() bool { + _, ok := o.GetMetadataOk() + return ok +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *CreateServerPayload) SetMetadata(v CreateServerPayloadGetMetadataRetType) { + setCreateServerPayloadGetMetadataAttributeType(&o.Metadata, v) +} + +// GetName returns the Name field value +func (o *CreateServerPayload) GetName() (ret CreateServerPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetNameOk() (ret CreateServerPayloadGetNameRetType, ok bool) { + return getCreateServerPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateServerPayload) SetName(v CreateServerPayloadGetNameRetType) { + setCreateServerPayloadGetNameAttributeType(&o.Name, v) +} + +// GetNetworking returns the Networking field value +func (o *CreateServerPayload) GetNetworking() (ret CreateServerPayloadGetNetworkingRetType) { + ret, _ = o.GetNetworkingOk() + return ret +} + +// GetNetworkingOk returns a tuple with the Networking field value +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetNetworkingOk() (ret CreateServerPayloadGetNetworkingRetType, ok bool) { + return getCreateServerPayloadGetNetworkingAttributeTypeOk(o.Networking) +} + +// SetNetworking sets field value +func (o *CreateServerPayload) SetNetworking(v CreateServerPayloadGetNetworkingRetType) { + setCreateServerPayloadGetNetworkingAttributeType(&o.Networking, v) +} + +// GetNics returns the Nics field value if set, zero value otherwise. +func (o *CreateServerPayload) GetNics() (res CreateServerPayloadGetNicsRetType) { + res, _ = o.GetNicsOk() + return +} + +// GetNicsOk returns a tuple with the Nics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetNicsOk() (ret CreateServerPayloadGetNicsRetType, ok bool) { + return getCreateServerPayloadGetNicsAttributeTypeOk(o.Nics) +} + +// HasNics returns a boolean if a field has been set. +func (o *CreateServerPayload) HasNics() bool { + _, ok := o.GetNicsOk() + return ok +} + +// SetNics gets a reference to the given []ServerNetwork and assigns it to the Nics field. +func (o *CreateServerPayload) SetNics(v CreateServerPayloadGetNicsRetType) { + setCreateServerPayloadGetNicsAttributeType(&o.Nics, v) +} + +// GetPowerStatus returns the PowerStatus field value if set, zero value otherwise. +func (o *CreateServerPayload) GetPowerStatus() (res CreateServerPayloadGetPowerStatusRetType) { + res, _ = o.GetPowerStatusOk() + return +} + +// GetPowerStatusOk returns a tuple with the PowerStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetPowerStatusOk() (ret CreateServerPayloadGetPowerStatusRetType, ok bool) { + return getCreateServerPayloadGetPowerStatusAttributeTypeOk(o.PowerStatus) +} + +// HasPowerStatus returns a boolean if a field has been set. +func (o *CreateServerPayload) HasPowerStatus() bool { + _, ok := o.GetPowerStatusOk() + return ok +} + +// SetPowerStatus gets a reference to the given string and assigns it to the PowerStatus field. +func (o *CreateServerPayload) SetPowerStatus(v CreateServerPayloadGetPowerStatusRetType) { + setCreateServerPayloadGetPowerStatusAttributeType(&o.PowerStatus, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *CreateServerPayload) GetSecurityGroups() (res CreateServerPayloadGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// 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 *CreateServerPayload) GetSecurityGroupsOk() (ret CreateServerPayloadGetSecurityGroupsRetType, ok bool) { + return getCreateServerPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *CreateServerPayload) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *CreateServerPayload) SetSecurityGroups(v CreateServerPayloadGetSecurityGroupsRetType) { + setCreateServerPayloadGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +// GetServiceAccountMails returns the ServiceAccountMails field value if set, zero value otherwise. +func (o *CreateServerPayload) GetServiceAccountMails() (res CreateServerPayloadGetServiceAccountMailsRetType) { + res, _ = o.GetServiceAccountMailsOk() + return +} + +// GetServiceAccountMailsOk returns a tuple with the ServiceAccountMails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetServiceAccountMailsOk() (ret CreateServerPayloadGetServiceAccountMailsRetType, ok bool) { + return getCreateServerPayloadGetServiceAccountMailsAttributeTypeOk(o.ServiceAccountMails) +} + +// HasServiceAccountMails returns a boolean if a field has been set. +func (o *CreateServerPayload) HasServiceAccountMails() bool { + _, ok := o.GetServiceAccountMailsOk() + return ok +} + +// SetServiceAccountMails gets a reference to the given []string and assigns it to the ServiceAccountMails field. +func (o *CreateServerPayload) SetServiceAccountMails(v CreateServerPayloadGetServiceAccountMailsRetType) { + setCreateServerPayloadGetServiceAccountMailsAttributeType(&o.ServiceAccountMails, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateServerPayload) GetStatus() (res CreateServerPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetStatusOk() (ret CreateServerPayloadGetStatusRetType, ok bool) { + return getCreateServerPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateServerPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateServerPayload) SetStatus(v CreateServerPayloadGetStatusRetType) { + setCreateServerPayloadGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateServerPayload) GetUpdatedAt() (res CreateServerPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetUpdatedAtOk() (ret CreateServerPayloadGetUpdatedAtRetType, ok bool) { + return getCreateServerPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateServerPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateServerPayload) SetUpdatedAt(v CreateServerPayloadGetUpdatedAtRetType) { + setCreateServerPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetUserData returns the UserData field value if set, zero value otherwise. +func (o *CreateServerPayload) GetUserData() (res CreateServerPayloadGetUserDataRetType) { + res, _ = o.GetUserDataOk() + return +} + +// GetUserDataOk returns a tuple with the UserData field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetUserDataOk() (ret CreateServerPayloadGetUserDataRetType, ok bool) { + return getCreateServerPayloadGetUserDataAttributeTypeOk(o.UserData) +} + +// HasUserData returns a boolean if a field has been set. +func (o *CreateServerPayload) HasUserData() bool { + _, ok := o.GetUserDataOk() + return ok +} + +// SetUserData gets a reference to the given string and assigns it to the UserData field. +func (o *CreateServerPayload) SetUserData(v CreateServerPayloadGetUserDataRetType) { + setCreateServerPayloadGetUserDataAttributeType(&o.UserData, v) +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *CreateServerPayload) GetVolumes() (res CreateServerPayloadGetVolumesRetType) { + res, _ = o.GetVolumesOk() + return +} + +// 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 *CreateServerPayload) GetVolumesOk() (ret CreateServerPayloadGetVolumesRetType, ok bool) { + return getCreateServerPayloadGetVolumesAttributeTypeOk(o.Volumes) +} + +// HasVolumes returns a boolean if a field has been set. +func (o *CreateServerPayload) HasVolumes() bool { + _, ok := o.GetVolumesOk() + return ok +} + +// SetVolumes gets a reference to the given []string and assigns it to the Volumes field. +func (o *CreateServerPayload) SetVolumes(v CreateServerPayloadGetVolumesRetType) { + setCreateServerPayloadGetVolumesAttributeType(&o.Volumes, v) +} + +func (o CreateServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateServerPayloadGetAffinityGroupAttributeTypeOk(o.AffinityGroup); ok { + toSerialize["AffinityGroup"] = val + } + if val, ok := getCreateServerPayloadGetAgentAttributeTypeOk(o.Agent); ok { + toSerialize["Agent"] = val + } + if val, ok := getCreateServerPayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getCreateServerPayloadGetBootVolumeAttributeTypeOk(o.BootVolume); ok { + toSerialize["BootVolume"] = val + } + if val, ok := getCreateServerPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateServerPayloadGetErrorMessageAttributeTypeOk(o.ErrorMessage); ok { + toSerialize["ErrorMessage"] = val + } + if val, ok := getCreateServerPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateServerPayloadGetImageIdAttributeTypeOk(o.ImageId); ok { + toSerialize["ImageId"] = val + } + if val, ok := getCreateServerPayloadGetKeypairNameAttributeTypeOk(o.KeypairName); ok { + toSerialize["KeypairName"] = val + } + if val, ok := getCreateServerPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateServerPayloadGetLaunchedAtAttributeTypeOk(o.LaunchedAt); ok { + toSerialize["LaunchedAt"] = val + } + if val, ok := getCreateServerPayloadGetMachineTypeAttributeTypeOk(o.MachineType); ok { + toSerialize["MachineType"] = val + } + if val, ok := getCreateServerPayloadGetMaintenanceWindowAttributeTypeOk(o.MaintenanceWindow); ok { + toSerialize["MaintenanceWindow"] = val + } + if val, ok := getCreateServerPayloadGetMetadataAttributeTypeOk(o.Metadata); ok { + toSerialize["Metadata"] = val + } + if val, ok := getCreateServerPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateServerPayloadGetNetworkingAttributeTypeOk(o.Networking); ok { + toSerialize["Networking"] = val + } + if val, ok := getCreateServerPayloadGetNicsAttributeTypeOk(o.Nics); ok { + toSerialize["Nics"] = val + } + if val, ok := getCreateServerPayloadGetPowerStatusAttributeTypeOk(o.PowerStatus); ok { + toSerialize["PowerStatus"] = val + } + if val, ok := getCreateServerPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + if val, ok := getCreateServerPayloadGetServiceAccountMailsAttributeTypeOk(o.ServiceAccountMails); ok { + toSerialize["ServiceAccountMails"] = val + } + if val, ok := getCreateServerPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getCreateServerPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getCreateServerPayloadGetUserDataAttributeTypeOk(o.UserData); ok { + toSerialize["UserData"] = val + } + if val, ok := getCreateServerPayloadGetVolumesAttributeTypeOk(o.Volumes); ok { + toSerialize["Volumes"] = val + } + return toSerialize, nil +} + +type NullableCreateServerPayload struct { + value *CreateServerPayload + isSet bool +} + +func (v NullableCreateServerPayload) Get() *CreateServerPayload { + return v.value +} + +func (v *NullableCreateServerPayload) Set(val *CreateServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayload(val *CreateServerPayload) *NullableCreateServerPayload { + return &NullableCreateServerPayload{value: val, isSet: true} +} + +func (v NullableCreateServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_server_payload_all_of.go b/pkg/iaasbeta/model_create_server_payload_all_of.go new file mode 100644 index 00000000..66dd9bd3 --- /dev/null +++ b/pkg/iaasbeta/model_create_server_payload_all_of.go @@ -0,0 +1,125 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the CreateServerPayloadAllOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerPayloadAllOf{} + +/* + types and functions for networking +*/ + +// isModel +type CreateServerPayloadAllOfGetNetworkingAttributeType = *CreateServerPayloadAllOfNetworking +type CreateServerPayloadAllOfGetNetworkingArgType = CreateServerPayloadAllOfNetworking +type CreateServerPayloadAllOfGetNetworkingRetType = CreateServerPayloadAllOfNetworking + +func getCreateServerPayloadAllOfGetNetworkingAttributeTypeOk(arg CreateServerPayloadAllOfGetNetworkingAttributeType) (ret CreateServerPayloadAllOfGetNetworkingRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadAllOfGetNetworkingAttributeType(arg *CreateServerPayloadAllOfGetNetworkingAttributeType, val CreateServerPayloadAllOfGetNetworkingRetType) { + *arg = &val +} + +// CreateServerPayloadAllOf struct for CreateServerPayloadAllOf +type CreateServerPayloadAllOf struct { + // REQUIRED + Networking CreateServerPayloadAllOfGetNetworkingAttributeType `json:"networking" required:"true"` +} + +type _CreateServerPayloadAllOf CreateServerPayloadAllOf + +// NewCreateServerPayloadAllOf instantiates a new CreateServerPayloadAllOf 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 NewCreateServerPayloadAllOf(networking CreateServerPayloadAllOfGetNetworkingArgType) *CreateServerPayloadAllOf { + this := CreateServerPayloadAllOf{} + setCreateServerPayloadAllOfGetNetworkingAttributeType(&this.Networking, networking) + return &this +} + +// NewCreateServerPayloadAllOfWithDefaults instantiates a new CreateServerPayloadAllOf 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 NewCreateServerPayloadAllOfWithDefaults() *CreateServerPayloadAllOf { + this := CreateServerPayloadAllOf{} + return &this +} + +// GetNetworking returns the Networking field value +func (o *CreateServerPayloadAllOf) GetNetworking() (ret CreateServerPayloadAllOfGetNetworkingRetType) { + ret, _ = o.GetNetworkingOk() + return ret +} + +// GetNetworkingOk returns a tuple with the Networking field value +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadAllOf) GetNetworkingOk() (ret CreateServerPayloadAllOfGetNetworkingRetType, ok bool) { + return getCreateServerPayloadAllOfGetNetworkingAttributeTypeOk(o.Networking) +} + +// SetNetworking sets field value +func (o *CreateServerPayloadAllOf) SetNetworking(v CreateServerPayloadAllOfGetNetworkingRetType) { + setCreateServerPayloadAllOfGetNetworkingAttributeType(&o.Networking, v) +} + +func (o CreateServerPayloadAllOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateServerPayloadAllOfGetNetworkingAttributeTypeOk(o.Networking); ok { + toSerialize["Networking"] = val + } + return toSerialize, nil +} + +type NullableCreateServerPayloadAllOf struct { + value *CreateServerPayloadAllOf + isSet bool +} + +func (v NullableCreateServerPayloadAllOf) Get() *CreateServerPayloadAllOf { + return v.value +} + +func (v *NullableCreateServerPayloadAllOf) Set(val *CreateServerPayloadAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayloadAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayloadAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayloadAllOf(val *CreateServerPayloadAllOf) *NullableCreateServerPayloadAllOf { + return &NullableCreateServerPayloadAllOf{value: val, isSet: true} +} + +func (v NullableCreateServerPayloadAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayloadAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_server_payload_all_of_networking.go b/pkg/iaasbeta/model_create_server_payload_all_of_networking.go new file mode 100644 index 00000000..857215b3 --- /dev/null +++ b/pkg/iaasbeta/model_create_server_payload_all_of_networking.go @@ -0,0 +1,144 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "fmt" +) + +// CreateServerPayloadAllOfNetworking - struct for CreateServerPayloadAllOfNetworking +type CreateServerPayloadAllOfNetworking struct { + CreateServerNetworking *CreateServerNetworking + CreateServerNetworkingWithNics *CreateServerNetworkingWithNics +} + +// CreateServerNetworkingAsCreateServerPayloadAllOfNetworking is a convenience function that returns CreateServerNetworking wrapped in CreateServerPayloadAllOfNetworking +func CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(v *CreateServerNetworking) CreateServerPayloadAllOfNetworking { + return CreateServerPayloadAllOfNetworking{ + CreateServerNetworking: v, + } +} + +// CreateServerNetworkingWithNicsAsCreateServerPayloadAllOfNetworking is a convenience function that returns CreateServerNetworkingWithNics wrapped in CreateServerPayloadAllOfNetworking +func CreateServerNetworkingWithNicsAsCreateServerPayloadAllOfNetworking(v *CreateServerNetworkingWithNics) CreateServerPayloadAllOfNetworking { + return CreateServerPayloadAllOfNetworking{ + CreateServerNetworkingWithNics: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateServerPayloadAllOfNetworking) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateServerNetworking + dstCreateServerPayloadAllOfNetworking1 := &CreateServerPayloadAllOfNetworking{} + err = json.Unmarshal(data, &dstCreateServerPayloadAllOfNetworking1.CreateServerNetworking) + if err == nil { + jsonCreateServerNetworking, _ := json.Marshal(&dstCreateServerPayloadAllOfNetworking1.CreateServerNetworking) + if string(jsonCreateServerNetworking) != "{}" { // empty struct + dst.CreateServerNetworking = dstCreateServerPayloadAllOfNetworking1.CreateServerNetworking + match++ + } + } + + // try to unmarshal data into CreateServerNetworkingWithNics + dstCreateServerPayloadAllOfNetworking2 := &CreateServerPayloadAllOfNetworking{} + err = json.Unmarshal(data, &dstCreateServerPayloadAllOfNetworking2.CreateServerNetworkingWithNics) + if err == nil { + jsonCreateServerNetworkingWithNics, _ := json.Marshal(&dstCreateServerPayloadAllOfNetworking2.CreateServerNetworkingWithNics) + if string(jsonCreateServerNetworkingWithNics) != "{}" { // empty struct + dst.CreateServerNetworkingWithNics = dstCreateServerPayloadAllOfNetworking2.CreateServerNetworkingWithNics + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateServerNetworking = nil + dst.CreateServerNetworkingWithNics = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateServerPayloadAllOfNetworking)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateServerPayloadAllOfNetworking)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateServerPayloadAllOfNetworking) MarshalJSON() ([]byte, error) { + if src.CreateServerNetworking != nil { + return json.Marshal(&src.CreateServerNetworking) + } + + if src.CreateServerNetworkingWithNics != nil { + return json.Marshal(&src.CreateServerNetworkingWithNics) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateServerPayloadAllOfNetworking) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateServerNetworking != nil { + return obj.CreateServerNetworking + } + + if obj.CreateServerNetworkingWithNics != nil { + return obj.CreateServerNetworkingWithNics + } + + // all schemas are nil + return nil +} + +type NullableCreateServerPayloadAllOfNetworking struct { + value *CreateServerPayloadAllOfNetworking + isSet bool +} + +func (v NullableCreateServerPayloadAllOfNetworking) Get() *CreateServerPayloadAllOfNetworking { + return v.value +} + +func (v *NullableCreateServerPayloadAllOfNetworking) Set(val *CreateServerPayloadAllOfNetworking) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayloadAllOfNetworking) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayloadAllOfNetworking) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayloadAllOfNetworking(val *CreateServerPayloadAllOfNetworking) *NullableCreateServerPayloadAllOfNetworking { + return &NullableCreateServerPayloadAllOfNetworking{value: val, isSet: true} +} + +func (v NullableCreateServerPayloadAllOfNetworking) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayloadAllOfNetworking) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_server_payload_all_of_networking_test.go b/pkg/iaasbeta/model_create_server_payload_all_of_networking_test.go new file mode 100644 index 00000000..a5cfbb31 --- /dev/null +++ b/pkg/iaasbeta/model_create_server_payload_all_of_networking_test.go @@ -0,0 +1,43 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "testing" +) + +// isOneOf + +func TestCreateServerPayloadAllOfNetworking_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := &CreateServerPayloadAllOfNetworking{} + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + marshalJson, err := v.MarshalJSON() + if err != nil { + t.Fatalf("failed marshalling CreateServerPayloadAllOfNetworking: %v", err) + } + if string(marshalJson) != string(tt.args.src) { + t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson) + } + }) + } +} diff --git a/pkg/iaasbeta/model_create_server_payload_all_of_test.go b/pkg/iaasbeta/model_create_server_payload_all_of_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_server_payload_all_of_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_server_payload_test.go b/pkg/iaasbeta/model_create_server_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_server_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_create_volume_payload.go b/pkg/iaasbeta/model_create_volume_payload.go new file mode 100644 index 00000000..ce9f3baf --- /dev/null +++ b/pkg/iaasbeta/model_create_volume_payload.go @@ -0,0 +1,851 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the CreateVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVolumePayload{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type CreateVolumePayloadGetAvailabilityZoneAttributeType = *string + +func getCreateVolumePayloadGetAvailabilityZoneAttributeTypeOk(arg CreateVolumePayloadGetAvailabilityZoneAttributeType) (ret CreateVolumePayloadGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetAvailabilityZoneAttributeType(arg *CreateVolumePayloadGetAvailabilityZoneAttributeType, val CreateVolumePayloadGetAvailabilityZoneRetType) { + *arg = &val +} + +type CreateVolumePayloadGetAvailabilityZoneArgType = string +type CreateVolumePayloadGetAvailabilityZoneRetType = string + +/* + types and functions for bootable +*/ + +// isBoolean +type CreateVolumePayloadgetBootableAttributeType = *bool +type CreateVolumePayloadgetBootableArgType = bool +type CreateVolumePayloadgetBootableRetType = bool + +func getCreateVolumePayloadgetBootableAttributeTypeOk(arg CreateVolumePayloadgetBootableAttributeType) (ret CreateVolumePayloadgetBootableRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadgetBootableAttributeType(arg *CreateVolumePayloadgetBootableAttributeType, val CreateVolumePayloadgetBootableRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateVolumePayloadGetCreatedAtAttributeType = *time.Time +type CreateVolumePayloadGetCreatedAtArgType = time.Time +type CreateVolumePayloadGetCreatedAtRetType = time.Time + +func getCreateVolumePayloadGetCreatedAtAttributeTypeOk(arg CreateVolumePayloadGetCreatedAtAttributeType) (ret CreateVolumePayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetCreatedAtAttributeType(arg *CreateVolumePayloadGetCreatedAtAttributeType, val CreateVolumePayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateVolumePayloadGetDescriptionAttributeType = *string + +func getCreateVolumePayloadGetDescriptionAttributeTypeOk(arg CreateVolumePayloadGetDescriptionAttributeType) (ret CreateVolumePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetDescriptionAttributeType(arg *CreateVolumePayloadGetDescriptionAttributeType, val CreateVolumePayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateVolumePayloadGetDescriptionArgType = string +type CreateVolumePayloadGetDescriptionRetType = string + +/* + types and functions for encrypted +*/ + +// isBoolean +type CreateVolumePayloadgetEncryptedAttributeType = *bool +type CreateVolumePayloadgetEncryptedArgType = bool +type CreateVolumePayloadgetEncryptedRetType = bool + +func getCreateVolumePayloadgetEncryptedAttributeTypeOk(arg CreateVolumePayloadgetEncryptedAttributeType) (ret CreateVolumePayloadgetEncryptedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadgetEncryptedAttributeType(arg *CreateVolumePayloadgetEncryptedAttributeType, val CreateVolumePayloadgetEncryptedRetType) { + *arg = &val +} + +/* + types and functions for encryptionParameters +*/ + +// isModel +type CreateVolumePayloadGetEncryptionParametersAttributeType = *VolumeEncryptionParameter +type CreateVolumePayloadGetEncryptionParametersArgType = VolumeEncryptionParameter +type CreateVolumePayloadGetEncryptionParametersRetType = VolumeEncryptionParameter + +func getCreateVolumePayloadGetEncryptionParametersAttributeTypeOk(arg CreateVolumePayloadGetEncryptionParametersAttributeType) (ret CreateVolumePayloadGetEncryptionParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetEncryptionParametersAttributeType(arg *CreateVolumePayloadGetEncryptionParametersAttributeType, val CreateVolumePayloadGetEncryptionParametersRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateVolumePayloadGetIdAttributeType = *string + +func getCreateVolumePayloadGetIdAttributeTypeOk(arg CreateVolumePayloadGetIdAttributeType) (ret CreateVolumePayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetIdAttributeType(arg *CreateVolumePayloadGetIdAttributeType, val CreateVolumePayloadGetIdRetType) { + *arg = &val +} + +type CreateVolumePayloadGetIdArgType = string +type CreateVolumePayloadGetIdRetType = string + +/* + types and functions for imageConfig +*/ + +// isModel +type CreateVolumePayloadGetImageConfigAttributeType = *ImageConfig +type CreateVolumePayloadGetImageConfigArgType = ImageConfig +type CreateVolumePayloadGetImageConfigRetType = ImageConfig + +func getCreateVolumePayloadGetImageConfigAttributeTypeOk(arg CreateVolumePayloadGetImageConfigAttributeType) (ret CreateVolumePayloadGetImageConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetImageConfigAttributeType(arg *CreateVolumePayloadGetImageConfigAttributeType, val CreateVolumePayloadGetImageConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateVolumePayloadGetLabelsAttributeType = *map[string]interface{} +type CreateVolumePayloadGetLabelsArgType = map[string]interface{} +type CreateVolumePayloadGetLabelsRetType = map[string]interface{} + +func getCreateVolumePayloadGetLabelsAttributeTypeOk(arg CreateVolumePayloadGetLabelsAttributeType) (ret CreateVolumePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetLabelsAttributeType(arg *CreateVolumePayloadGetLabelsAttributeType, val CreateVolumePayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateVolumePayloadGetNameAttributeType = *string + +func getCreateVolumePayloadGetNameAttributeTypeOk(arg CreateVolumePayloadGetNameAttributeType) (ret CreateVolumePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetNameAttributeType(arg *CreateVolumePayloadGetNameAttributeType, val CreateVolumePayloadGetNameRetType) { + *arg = &val +} + +type CreateVolumePayloadGetNameArgType = string +type CreateVolumePayloadGetNameRetType = string + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type CreateVolumePayloadGetPerformanceClassAttributeType = *string + +func getCreateVolumePayloadGetPerformanceClassAttributeTypeOk(arg CreateVolumePayloadGetPerformanceClassAttributeType) (ret CreateVolumePayloadGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetPerformanceClassAttributeType(arg *CreateVolumePayloadGetPerformanceClassAttributeType, val CreateVolumePayloadGetPerformanceClassRetType) { + *arg = &val +} + +type CreateVolumePayloadGetPerformanceClassArgType = string +type CreateVolumePayloadGetPerformanceClassRetType = string + +/* + types and functions for serverId +*/ + +// isNotNullableString +type CreateVolumePayloadGetServerIdAttributeType = *string + +func getCreateVolumePayloadGetServerIdAttributeTypeOk(arg CreateVolumePayloadGetServerIdAttributeType) (ret CreateVolumePayloadGetServerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetServerIdAttributeType(arg *CreateVolumePayloadGetServerIdAttributeType, val CreateVolumePayloadGetServerIdRetType) { + *arg = &val +} + +type CreateVolumePayloadGetServerIdArgType = string +type CreateVolumePayloadGetServerIdRetType = string + +/* + types and functions for size +*/ + +// isLong +type CreateVolumePayloadGetSizeAttributeType = *int64 +type CreateVolumePayloadGetSizeArgType = int64 +type CreateVolumePayloadGetSizeRetType = int64 + +func getCreateVolumePayloadGetSizeAttributeTypeOk(arg CreateVolumePayloadGetSizeAttributeType) (ret CreateVolumePayloadGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetSizeAttributeType(arg *CreateVolumePayloadGetSizeAttributeType, val CreateVolumePayloadGetSizeRetType) { + *arg = &val +} + +/* + types and functions for source +*/ + +// isModel +type CreateVolumePayloadGetSourceAttributeType = *VolumeSource +type CreateVolumePayloadGetSourceArgType = VolumeSource +type CreateVolumePayloadGetSourceRetType = VolumeSource + +func getCreateVolumePayloadGetSourceAttributeTypeOk(arg CreateVolumePayloadGetSourceAttributeType) (ret CreateVolumePayloadGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetSourceAttributeType(arg *CreateVolumePayloadGetSourceAttributeType, val CreateVolumePayloadGetSourceRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type CreateVolumePayloadGetStatusAttributeType = *string + +func getCreateVolumePayloadGetStatusAttributeTypeOk(arg CreateVolumePayloadGetStatusAttributeType) (ret CreateVolumePayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetStatusAttributeType(arg *CreateVolumePayloadGetStatusAttributeType, val CreateVolumePayloadGetStatusRetType) { + *arg = &val +} + +type CreateVolumePayloadGetStatusArgType = string +type CreateVolumePayloadGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateVolumePayloadGetUpdatedAtAttributeType = *time.Time +type CreateVolumePayloadGetUpdatedAtArgType = time.Time +type CreateVolumePayloadGetUpdatedAtRetType = time.Time + +func getCreateVolumePayloadGetUpdatedAtAttributeTypeOk(arg CreateVolumePayloadGetUpdatedAtAttributeType) (ret CreateVolumePayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetUpdatedAtAttributeType(arg *CreateVolumePayloadGetUpdatedAtAttributeType, val CreateVolumePayloadGetUpdatedAtRetType) { + *arg = &val +} + +// CreateVolumePayload Object that represents a volume and its parameters. Volumes sized up to 16000GB are supported. +type CreateVolumePayload struct { + // Object that represents an availability zone. + // REQUIRED + AvailabilityZone CreateVolumePayloadGetAvailabilityZoneAttributeType `json:"availabilityZone" required:"true"` + // Indicates if a volume is bootable. + Bootable CreateVolumePayloadgetBootableAttributeType `json:"bootable,omitempty"` + // Date-time when resource was created. + CreatedAt CreateVolumePayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description CreateVolumePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Indicates if a volume is encrypted. + Encrypted CreateVolumePayloadgetEncryptedAttributeType `json:"encrypted,omitempty"` + EncryptionParameters CreateVolumePayloadGetEncryptionParametersAttributeType `json:"encryptionParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateVolumePayloadGetIdAttributeType `json:"id,omitempty"` + ImageConfig CreateVolumePayloadGetImageConfigAttributeType `json:"imageConfig,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateVolumePayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name CreateVolumePayloadGetNameAttributeType `json:"name,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass CreateVolumePayloadGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Universally Unique Identifier (UUID). + ServerId CreateVolumePayloadGetServerIdAttributeType `json:"serverId,omitempty"` + // Size in Gigabyte. + Size CreateVolumePayloadGetSizeAttributeType `json:"size,omitempty"` + Source CreateVolumePayloadGetSourceAttributeType `json:"source,omitempty"` + // The status of a volume object. Possible values: `ATTACHED`, `ATTACHING`, `AVAILABLE`, `AWAITING-TRANSFER`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `DETACHING`, `DOWNLOADING`, `ERROR`, `ERROR_BACKING-UP`, `ERROR_DELETING`, `ERROR_RESIZING`, `ERROR_RESTORING-BACKUP`, `MAINTENANCE`, `RESERVED`, `RESIZING`, `RESTORING-BACKUP`, `RETYPING`, `UPLOADING`. + Status CreateVolumePayloadGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateVolumePayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _CreateVolumePayload CreateVolumePayload + +// NewCreateVolumePayload instantiates a new CreateVolumePayload 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 NewCreateVolumePayload(availabilityZone CreateVolumePayloadGetAvailabilityZoneArgType) *CreateVolumePayload { + this := CreateVolumePayload{} + setCreateVolumePayloadGetAvailabilityZoneAttributeType(&this.AvailabilityZone, availabilityZone) + return &this +} + +// NewCreateVolumePayloadWithDefaults instantiates a new CreateVolumePayload 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 NewCreateVolumePayloadWithDefaults() *CreateVolumePayload { + this := CreateVolumePayload{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value +func (o *CreateVolumePayload) GetAvailabilityZone() (ret CreateVolumePayloadGetAvailabilityZoneRetType) { + ret, _ = o.GetAvailabilityZoneOk() + return ret +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetAvailabilityZoneOk() (ret CreateVolumePayloadGetAvailabilityZoneRetType, ok bool) { + return getCreateVolumePayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// SetAvailabilityZone sets field value +func (o *CreateVolumePayload) SetAvailabilityZone(v CreateVolumePayloadGetAvailabilityZoneRetType) { + setCreateVolumePayloadGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetBootable returns the Bootable field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetBootable() (res CreateVolumePayloadgetBootableRetType) { + res, _ = o.GetBootableOk() + return +} + +// GetBootableOk returns a tuple with the Bootable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetBootableOk() (ret CreateVolumePayloadgetBootableRetType, ok bool) { + return getCreateVolumePayloadgetBootableAttributeTypeOk(o.Bootable) +} + +// HasBootable returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasBootable() bool { + _, ok := o.GetBootableOk() + return ok +} + +// SetBootable gets a reference to the given bool and assigns it to the Bootable field. +func (o *CreateVolumePayload) SetBootable(v CreateVolumePayloadgetBootableRetType) { + setCreateVolumePayloadgetBootableAttributeType(&o.Bootable, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetCreatedAt() (res CreateVolumePayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetCreatedAtOk() (ret CreateVolumePayloadGetCreatedAtRetType, ok bool) { + return getCreateVolumePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateVolumePayload) SetCreatedAt(v CreateVolumePayloadGetCreatedAtRetType) { + setCreateVolumePayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetDescription() (res CreateVolumePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetDescriptionOk() (ret CreateVolumePayloadGetDescriptionRetType, ok bool) { + return getCreateVolumePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateVolumePayload) SetDescription(v CreateVolumePayloadGetDescriptionRetType) { + setCreateVolumePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetEncrypted returns the Encrypted field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetEncrypted() (res CreateVolumePayloadgetEncryptedRetType) { + res, _ = o.GetEncryptedOk() + return +} + +// GetEncryptedOk returns a tuple with the Encrypted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetEncryptedOk() (ret CreateVolumePayloadgetEncryptedRetType, ok bool) { + return getCreateVolumePayloadgetEncryptedAttributeTypeOk(o.Encrypted) +} + +// HasEncrypted returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasEncrypted() bool { + _, ok := o.GetEncryptedOk() + return ok +} + +// SetEncrypted gets a reference to the given bool and assigns it to the Encrypted field. +func (o *CreateVolumePayload) SetEncrypted(v CreateVolumePayloadgetEncryptedRetType) { + setCreateVolumePayloadgetEncryptedAttributeType(&o.Encrypted, v) +} + +// GetEncryptionParameters returns the EncryptionParameters field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetEncryptionParameters() (res CreateVolumePayloadGetEncryptionParametersRetType) { + res, _ = o.GetEncryptionParametersOk() + return +} + +// GetEncryptionParametersOk returns a tuple with the EncryptionParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetEncryptionParametersOk() (ret CreateVolumePayloadGetEncryptionParametersRetType, ok bool) { + return getCreateVolumePayloadGetEncryptionParametersAttributeTypeOk(o.EncryptionParameters) +} + +// HasEncryptionParameters returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasEncryptionParameters() bool { + _, ok := o.GetEncryptionParametersOk() + return ok +} + +// SetEncryptionParameters gets a reference to the given VolumeEncryptionParameter and assigns it to the EncryptionParameters field. +func (o *CreateVolumePayload) SetEncryptionParameters(v CreateVolumePayloadGetEncryptionParametersRetType) { + setCreateVolumePayloadGetEncryptionParametersAttributeType(&o.EncryptionParameters, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetId() (res CreateVolumePayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetIdOk() (ret CreateVolumePayloadGetIdRetType, ok bool) { + return getCreateVolumePayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateVolumePayload) SetId(v CreateVolumePayloadGetIdRetType) { + setCreateVolumePayloadGetIdAttributeType(&o.Id, v) +} + +// GetImageConfig returns the ImageConfig field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetImageConfig() (res CreateVolumePayloadGetImageConfigRetType) { + res, _ = o.GetImageConfigOk() + return +} + +// GetImageConfigOk returns a tuple with the ImageConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetImageConfigOk() (ret CreateVolumePayloadGetImageConfigRetType, ok bool) { + return getCreateVolumePayloadGetImageConfigAttributeTypeOk(o.ImageConfig) +} + +// HasImageConfig returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasImageConfig() bool { + _, ok := o.GetImageConfigOk() + return ok +} + +// SetImageConfig gets a reference to the given ImageConfig and assigns it to the ImageConfig field. +func (o *CreateVolumePayload) SetImageConfig(v CreateVolumePayloadGetImageConfigRetType) { + setCreateVolumePayloadGetImageConfigAttributeType(&o.ImageConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetLabels() (res CreateVolumePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetLabelsOk() (ret CreateVolumePayloadGetLabelsRetType, ok bool) { + return getCreateVolumePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateVolumePayload) SetLabels(v CreateVolumePayloadGetLabelsRetType) { + setCreateVolumePayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetName() (res CreateVolumePayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetNameOk() (ret CreateVolumePayloadGetNameRetType, ok bool) { + return getCreateVolumePayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateVolumePayload) SetName(v CreateVolumePayloadGetNameRetType) { + setCreateVolumePayloadGetNameAttributeType(&o.Name, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetPerformanceClass() (res CreateVolumePayloadGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetPerformanceClassOk() (ret CreateVolumePayloadGetPerformanceClassRetType, ok bool) { + return getCreateVolumePayloadGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *CreateVolumePayload) SetPerformanceClass(v CreateVolumePayloadGetPerformanceClassRetType) { + setCreateVolumePayloadGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetServerId() (res CreateVolumePayloadGetServerIdRetType) { + res, _ = o.GetServerIdOk() + return +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetServerIdOk() (ret CreateVolumePayloadGetServerIdRetType, ok bool) { + return getCreateVolumePayloadGetServerIdAttributeTypeOk(o.ServerId) +} + +// HasServerId returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasServerId() bool { + _, ok := o.GetServerIdOk() + return ok +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *CreateVolumePayload) SetServerId(v CreateVolumePayloadGetServerIdRetType) { + setCreateVolumePayloadGetServerIdAttributeType(&o.ServerId, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetSize() (res CreateVolumePayloadGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetSizeOk() (ret CreateVolumePayloadGetSizeRetType, ok bool) { + return getCreateVolumePayloadGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *CreateVolumePayload) SetSize(v CreateVolumePayloadGetSizeRetType) { + setCreateVolumePayloadGetSizeAttributeType(&o.Size, v) +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetSource() (res CreateVolumePayloadGetSourceRetType) { + res, _ = o.GetSourceOk() + return +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetSourceOk() (ret CreateVolumePayloadGetSourceRetType, ok bool) { + return getCreateVolumePayloadGetSourceAttributeTypeOk(o.Source) +} + +// HasSource returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasSource() bool { + _, ok := o.GetSourceOk() + return ok +} + +// SetSource gets a reference to the given VolumeSource and assigns it to the Source field. +func (o *CreateVolumePayload) SetSource(v CreateVolumePayloadGetSourceRetType) { + setCreateVolumePayloadGetSourceAttributeType(&o.Source, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetStatus() (res CreateVolumePayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetStatusOk() (ret CreateVolumePayloadGetStatusRetType, ok bool) { + return getCreateVolumePayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateVolumePayload) SetStatus(v CreateVolumePayloadGetStatusRetType) { + setCreateVolumePayloadGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetUpdatedAt() (res CreateVolumePayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetUpdatedAtOk() (ret CreateVolumePayloadGetUpdatedAtRetType, ok bool) { + return getCreateVolumePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateVolumePayload) SetUpdatedAt(v CreateVolumePayloadGetUpdatedAtRetType) { + setCreateVolumePayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o CreateVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateVolumePayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getCreateVolumePayloadgetBootableAttributeTypeOk(o.Bootable); ok { + toSerialize["Bootable"] = val + } + if val, ok := getCreateVolumePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateVolumePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateVolumePayloadgetEncryptedAttributeTypeOk(o.Encrypted); ok { + toSerialize["Encrypted"] = val + } + if val, ok := getCreateVolumePayloadGetEncryptionParametersAttributeTypeOk(o.EncryptionParameters); ok { + toSerialize["EncryptionParameters"] = val + } + if val, ok := getCreateVolumePayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateVolumePayloadGetImageConfigAttributeTypeOk(o.ImageConfig); ok { + toSerialize["ImageConfig"] = val + } + if val, ok := getCreateVolumePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateVolumePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateVolumePayloadGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getCreateVolumePayloadGetServerIdAttributeTypeOk(o.ServerId); ok { + toSerialize["ServerId"] = val + } + if val, ok := getCreateVolumePayloadGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getCreateVolumePayloadGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + if val, ok := getCreateVolumePayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getCreateVolumePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableCreateVolumePayload struct { + value *CreateVolumePayload + isSet bool +} + +func (v NullableCreateVolumePayload) Get() *CreateVolumePayload { + return v.value +} + +func (v *NullableCreateVolumePayload) Set(val *CreateVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVolumePayload(val *CreateVolumePayload) *NullableCreateVolumePayload { + return &NullableCreateVolumePayload{value: val, isSet: true} +} + +func (v NullableCreateVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_create_volume_payload_test.go b/pkg/iaasbeta/model_create_volume_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_create_volume_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_destination_cidrv4.go b/pkg/iaasbeta/model_destination_cidrv4.go new file mode 100644 index 00000000..5d40b4dc --- /dev/null +++ b/pkg/iaasbeta/model_destination_cidrv4.go @@ -0,0 +1,171 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the DestinationCIDRv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationCIDRv4{} + +/* + types and functions for type +*/ + +// isNotNullableString +type DestinationCIDRv4GetTypeAttributeType = *string + +func getDestinationCIDRv4GetTypeAttributeTypeOk(arg DestinationCIDRv4GetTypeAttributeType) (ret DestinationCIDRv4GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv4GetTypeAttributeType(arg *DestinationCIDRv4GetTypeAttributeType, val DestinationCIDRv4GetTypeRetType) { + *arg = &val +} + +type DestinationCIDRv4GetTypeArgType = string +type DestinationCIDRv4GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type DestinationCIDRv4GetValueAttributeType = *string + +func getDestinationCIDRv4GetValueAttributeTypeOk(arg DestinationCIDRv4GetValueAttributeType) (ret DestinationCIDRv4GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv4GetValueAttributeType(arg *DestinationCIDRv4GetValueAttributeType, val DestinationCIDRv4GetValueRetType) { + *arg = &val +} + +type DestinationCIDRv4GetValueArgType = string +type DestinationCIDRv4GetValueRetType = string + +// DestinationCIDRv4 IPv4 Classless Inter-Domain Routing (CIDR) Object. +type DestinationCIDRv4 struct { + // REQUIRED + Type DestinationCIDRv4GetTypeAttributeType `json:"type" required:"true"` + // An CIDRv4 string. + // REQUIRED + Value DestinationCIDRv4GetValueAttributeType `json:"value" required:"true"` +} + +type _DestinationCIDRv4 DestinationCIDRv4 + +// NewDestinationCIDRv4 instantiates a new DestinationCIDRv4 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 NewDestinationCIDRv4(types DestinationCIDRv4GetTypeArgType, value DestinationCIDRv4GetValueArgType) *DestinationCIDRv4 { + this := DestinationCIDRv4{} + setDestinationCIDRv4GetTypeAttributeType(&this.Type, types) + setDestinationCIDRv4GetValueAttributeType(&this.Value, value) + return &this +} + +// NewDestinationCIDRv4WithDefaults instantiates a new DestinationCIDRv4 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 NewDestinationCIDRv4WithDefaults() *DestinationCIDRv4 { + this := DestinationCIDRv4{} + return &this +} + +// GetType returns the Type field value +func (o *DestinationCIDRv4) GetType() (ret DestinationCIDRv4GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv4) GetTypeOk() (ret DestinationCIDRv4GetTypeRetType, ok bool) { + return getDestinationCIDRv4GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *DestinationCIDRv4) SetType(v DestinationCIDRv4GetTypeRetType) { + setDestinationCIDRv4GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *DestinationCIDRv4) GetValue() (ret DestinationCIDRv4GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv4) GetValueOk() (ret DestinationCIDRv4GetValueRetType, ok bool) { + return getDestinationCIDRv4GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *DestinationCIDRv4) SetValue(v DestinationCIDRv4GetValueRetType) { + setDestinationCIDRv4GetValueAttributeType(&o.Value, v) +} + +func (o DestinationCIDRv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDestinationCIDRv4GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getDestinationCIDRv4GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableDestinationCIDRv4 struct { + value *DestinationCIDRv4 + isSet bool +} + +func (v NullableDestinationCIDRv4) Get() *DestinationCIDRv4 { + return v.value +} + +func (v *NullableDestinationCIDRv4) Set(val *DestinationCIDRv4) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationCIDRv4) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationCIDRv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationCIDRv4(val *DestinationCIDRv4) *NullableDestinationCIDRv4 { + return &NullableDestinationCIDRv4{value: val, isSet: true} +} + +func (v NullableDestinationCIDRv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationCIDRv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_destination_cidrv4_test.go b/pkg/iaasbeta/model_destination_cidrv4_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_destination_cidrv4_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_destination_cidrv6.go b/pkg/iaasbeta/model_destination_cidrv6.go new file mode 100644 index 00000000..baf2647b --- /dev/null +++ b/pkg/iaasbeta/model_destination_cidrv6.go @@ -0,0 +1,171 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the DestinationCIDRv6 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationCIDRv6{} + +/* + types and functions for type +*/ + +// isNotNullableString +type DestinationCIDRv6GetTypeAttributeType = *string + +func getDestinationCIDRv6GetTypeAttributeTypeOk(arg DestinationCIDRv6GetTypeAttributeType) (ret DestinationCIDRv6GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv6GetTypeAttributeType(arg *DestinationCIDRv6GetTypeAttributeType, val DestinationCIDRv6GetTypeRetType) { + *arg = &val +} + +type DestinationCIDRv6GetTypeArgType = string +type DestinationCIDRv6GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type DestinationCIDRv6GetValueAttributeType = *string + +func getDestinationCIDRv6GetValueAttributeTypeOk(arg DestinationCIDRv6GetValueAttributeType) (ret DestinationCIDRv6GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv6GetValueAttributeType(arg *DestinationCIDRv6GetValueAttributeType, val DestinationCIDRv6GetValueRetType) { + *arg = &val +} + +type DestinationCIDRv6GetValueArgType = string +type DestinationCIDRv6GetValueRetType = string + +// DestinationCIDRv6 IPv6 Classless Inter-Domain Routing (CIDR) Object. +type DestinationCIDRv6 struct { + // REQUIRED + Type DestinationCIDRv6GetTypeAttributeType `json:"type" required:"true"` + // An CIDRv6 string. + // REQUIRED + Value DestinationCIDRv6GetValueAttributeType `json:"value" required:"true"` +} + +type _DestinationCIDRv6 DestinationCIDRv6 + +// NewDestinationCIDRv6 instantiates a new DestinationCIDRv6 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 NewDestinationCIDRv6(types DestinationCIDRv6GetTypeArgType, value DestinationCIDRv6GetValueArgType) *DestinationCIDRv6 { + this := DestinationCIDRv6{} + setDestinationCIDRv6GetTypeAttributeType(&this.Type, types) + setDestinationCIDRv6GetValueAttributeType(&this.Value, value) + return &this +} + +// NewDestinationCIDRv6WithDefaults instantiates a new DestinationCIDRv6 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 NewDestinationCIDRv6WithDefaults() *DestinationCIDRv6 { + this := DestinationCIDRv6{} + return &this +} + +// GetType returns the Type field value +func (o *DestinationCIDRv6) GetType() (ret DestinationCIDRv6GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv6) GetTypeOk() (ret DestinationCIDRv6GetTypeRetType, ok bool) { + return getDestinationCIDRv6GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *DestinationCIDRv6) SetType(v DestinationCIDRv6GetTypeRetType) { + setDestinationCIDRv6GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *DestinationCIDRv6) GetValue() (ret DestinationCIDRv6GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv6) GetValueOk() (ret DestinationCIDRv6GetValueRetType, ok bool) { + return getDestinationCIDRv6GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *DestinationCIDRv6) SetValue(v DestinationCIDRv6GetValueRetType) { + setDestinationCIDRv6GetValueAttributeType(&o.Value, v) +} + +func (o DestinationCIDRv6) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDestinationCIDRv6GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getDestinationCIDRv6GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableDestinationCIDRv6 struct { + value *DestinationCIDRv6 + isSet bool +} + +func (v NullableDestinationCIDRv6) Get() *DestinationCIDRv6 { + return v.value +} + +func (v *NullableDestinationCIDRv6) Set(val *DestinationCIDRv6) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationCIDRv6) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationCIDRv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationCIDRv6(val *DestinationCIDRv6) *NullableDestinationCIDRv6 { + return &NullableDestinationCIDRv6{value: val, isSet: true} +} + +func (v NullableDestinationCIDRv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationCIDRv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_destination_cidrv6_test.go b/pkg/iaasbeta/model_destination_cidrv6_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_destination_cidrv6_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_error.go b/pkg/iaasbeta/model_error.go new file mode 100644 index 00000000..212db0e1 --- /dev/null +++ b/pkg/iaasbeta/model_error.go @@ -0,0 +1,170 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + +/* + types and functions for code +*/ + +// isLong +type ErrorGetCodeAttributeType = *int64 +type ErrorGetCodeArgType = int64 +type ErrorGetCodeRetType = int64 + +func getErrorGetCodeAttributeTypeOk(arg ErrorGetCodeAttributeType) (ret ErrorGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorGetCodeAttributeType(arg *ErrorGetCodeAttributeType, val ErrorGetCodeRetType) { + *arg = &val +} + +/* + types and functions for msg +*/ + +// isNotNullableString +type ErrorGetMsgAttributeType = *string + +func getErrorGetMsgAttributeTypeOk(arg ErrorGetMsgAttributeType) (ret ErrorGetMsgRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorGetMsgAttributeType(arg *ErrorGetMsgAttributeType, val ErrorGetMsgRetType) { + *arg = &val +} + +type ErrorGetMsgArgType = string +type ErrorGetMsgRetType = string + +// Error Error with HTTP error code and an error message. +type Error struct { + // REQUIRED + Code ErrorGetCodeAttributeType `json:"code" required:"true"` + // An error message. + // REQUIRED + Msg ErrorGetMsgAttributeType `json:"msg" required:"true"` +} + +type _Error Error + +// NewError instantiates a new Error object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewError(code ErrorGetCodeArgType, msg ErrorGetMsgArgType) *Error { + this := Error{} + setErrorGetCodeAttributeType(&this.Code, code) + setErrorGetMsgAttributeType(&this.Msg, msg) + return &this +} + +// NewErrorWithDefaults instantiates a new Error object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetCode returns the Code field value +func (o *Error) GetCode() (ret ErrorGetCodeRetType) { + ret, _ = o.GetCodeOk() + return ret +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *Error) GetCodeOk() (ret ErrorGetCodeRetType, ok bool) { + return getErrorGetCodeAttributeTypeOk(o.Code) +} + +// SetCode sets field value +func (o *Error) SetCode(v ErrorGetCodeRetType) { + setErrorGetCodeAttributeType(&o.Code, v) +} + +// GetMsg returns the Msg field value +func (o *Error) GetMsg() (ret ErrorGetMsgRetType) { + ret, _ = o.GetMsgOk() + return ret +} + +// GetMsgOk returns a tuple with the Msg field value +// and a boolean to check if the value has been set. +func (o *Error) GetMsgOk() (ret ErrorGetMsgRetType, ok bool) { + return getErrorGetMsgAttributeTypeOk(o.Msg) +} + +// SetMsg sets field value +func (o *Error) SetMsg(v ErrorGetMsgRetType) { + setErrorGetMsgAttributeType(&o.Msg, v) +} + +func (o Error) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getErrorGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getErrorGetMsgAttributeTypeOk(o.Msg); ok { + toSerialize["Msg"] = val + } + return toSerialize, nil +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_error_test.go b/pkg/iaasbeta/model_error_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_error_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_get_server_log_200_response.go b/pkg/iaasbeta/model_get_server_log_200_response.go new file mode 100644 index 00000000..808aef0b --- /dev/null +++ b/pkg/iaasbeta/model_get_server_log_200_response.go @@ -0,0 +1,128 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the GetServerLog200Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetServerLog200Response{} + +/* + types and functions for output +*/ + +// isNotNullableString +type GetServerLog200ResponseGetOutputAttributeType = *string + +func getGetServerLog200ResponseGetOutputAttributeTypeOk(arg GetServerLog200ResponseGetOutputAttributeType) (ret GetServerLog200ResponseGetOutputRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetServerLog200ResponseGetOutputAttributeType(arg *GetServerLog200ResponseGetOutputAttributeType, val GetServerLog200ResponseGetOutputRetType) { + *arg = &val +} + +type GetServerLog200ResponseGetOutputArgType = string +type GetServerLog200ResponseGetOutputRetType = string + +// GetServerLog200Response struct for GetServerLog200Response +type GetServerLog200Response struct { + Output GetServerLog200ResponseGetOutputAttributeType `json:"output,omitempty"` +} + +// NewGetServerLog200Response instantiates a new GetServerLog200Response 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 NewGetServerLog200Response() *GetServerLog200Response { + this := GetServerLog200Response{} + return &this +} + +// NewGetServerLog200ResponseWithDefaults instantiates a new GetServerLog200Response 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 NewGetServerLog200ResponseWithDefaults() *GetServerLog200Response { + this := GetServerLog200Response{} + return &this +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *GetServerLog200Response) GetOutput() (res GetServerLog200ResponseGetOutputRetType) { + res, _ = o.GetOutputOk() + return +} + +// GetOutputOk returns a tuple with the Output field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetServerLog200Response) GetOutputOk() (ret GetServerLog200ResponseGetOutputRetType, ok bool) { + return getGetServerLog200ResponseGetOutputAttributeTypeOk(o.Output) +} + +// HasOutput returns a boolean if a field has been set. +func (o *GetServerLog200Response) HasOutput() bool { + _, ok := o.GetOutputOk() + return ok +} + +// SetOutput gets a reference to the given string and assigns it to the Output field. +func (o *GetServerLog200Response) SetOutput(v GetServerLog200ResponseGetOutputRetType) { + setGetServerLog200ResponseGetOutputAttributeType(&o.Output, v) +} + +func (o GetServerLog200Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetServerLog200ResponseGetOutputAttributeTypeOk(o.Output); ok { + toSerialize["Output"] = val + } + return toSerialize, nil +} + +type NullableGetServerLog200Response struct { + value *GetServerLog200Response + isSet bool +} + +func (v NullableGetServerLog200Response) Get() *GetServerLog200Response { + return v.value +} + +func (v *NullableGetServerLog200Response) Set(val *GetServerLog200Response) { + v.value = val + v.isSet = true +} + +func (v NullableGetServerLog200Response) IsSet() bool { + return v.isSet +} + +func (v *NullableGetServerLog200Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetServerLog200Response(val *GetServerLog200Response) *NullableGetServerLog200Response { + return &NullableGetServerLog200Response{value: val, isSet: true} +} + +func (v NullableGetServerLog200Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetServerLog200Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_get_server_log_200_response_test.go b/pkg/iaasbeta/model_get_server_log_200_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_get_server_log_200_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_icmp_parameters.go b/pkg/iaasbeta/model_icmp_parameters.go new file mode 100644 index 00000000..063fcd9d --- /dev/null +++ b/pkg/iaasbeta/model_icmp_parameters.go @@ -0,0 +1,170 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ICMPParameters type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ICMPParameters{} + +/* + types and functions for code +*/ + +// isLong +type ICMPParametersGetCodeAttributeType = *int64 +type ICMPParametersGetCodeArgType = int64 +type ICMPParametersGetCodeRetType = int64 + +func getICMPParametersGetCodeAttributeTypeOk(arg ICMPParametersGetCodeAttributeType) (ret ICMPParametersGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setICMPParametersGetCodeAttributeType(arg *ICMPParametersGetCodeAttributeType, val ICMPParametersGetCodeRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isLong +type ICMPParametersGetTypeAttributeType = *int64 +type ICMPParametersGetTypeArgType = int64 +type ICMPParametersGetTypeRetType = int64 + +func getICMPParametersGetTypeAttributeTypeOk(arg ICMPParametersGetTypeAttributeType) (ret ICMPParametersGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setICMPParametersGetTypeAttributeType(arg *ICMPParametersGetTypeAttributeType, val ICMPParametersGetTypeRetType) { + *arg = &val +} + +// ICMPParameters Object that represents ICMP parameters. +type ICMPParameters struct { + // ICMP code. Can be set if the protocol is ICMP. + // REQUIRED + Code ICMPParametersGetCodeAttributeType `json:"code" required:"true"` + // ICMP type. Can be set if the protocol is ICMP. + // REQUIRED + Type ICMPParametersGetTypeAttributeType `json:"type" required:"true"` +} + +type _ICMPParameters ICMPParameters + +// NewICMPParameters instantiates a new ICMPParameters 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 NewICMPParameters(code ICMPParametersGetCodeArgType, types ICMPParametersGetTypeArgType) *ICMPParameters { + this := ICMPParameters{} + setICMPParametersGetCodeAttributeType(&this.Code, code) + setICMPParametersGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewICMPParametersWithDefaults instantiates a new ICMPParameters 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 NewICMPParametersWithDefaults() *ICMPParameters { + this := ICMPParameters{} + return &this +} + +// GetCode returns the Code field value +func (o *ICMPParameters) GetCode() (ret ICMPParametersGetCodeRetType) { + ret, _ = o.GetCodeOk() + return ret +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *ICMPParameters) GetCodeOk() (ret ICMPParametersGetCodeRetType, ok bool) { + return getICMPParametersGetCodeAttributeTypeOk(o.Code) +} + +// SetCode sets field value +func (o *ICMPParameters) SetCode(v ICMPParametersGetCodeRetType) { + setICMPParametersGetCodeAttributeType(&o.Code, v) +} + +// GetType returns the Type field value +func (o *ICMPParameters) GetType() (ret ICMPParametersGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ICMPParameters) GetTypeOk() (ret ICMPParametersGetTypeRetType, ok bool) { + return getICMPParametersGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *ICMPParameters) SetType(v ICMPParametersGetTypeRetType) { + setICMPParametersGetTypeAttributeType(&o.Type, v) +} + +func (o ICMPParameters) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getICMPParametersGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getICMPParametersGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableICMPParameters struct { + value *ICMPParameters + isSet bool +} + +func (v NullableICMPParameters) Get() *ICMPParameters { + return v.value +} + +func (v *NullableICMPParameters) Set(val *ICMPParameters) { + v.value = val + v.isSet = true +} + +func (v NullableICMPParameters) IsSet() bool { + return v.isSet +} + +func (v *NullableICMPParameters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableICMPParameters(val *ICMPParameters) *NullableICMPParameters { + return &NullableICMPParameters{value: val, isSet: true} +} + +func (v NullableICMPParameters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableICMPParameters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_icmp_parameters_test.go b/pkg/iaasbeta/model_icmp_parameters_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_icmp_parameters_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_image.go b/pkg/iaasbeta/model_image.go new file mode 100644 index 00000000..7e54ef57 --- /dev/null +++ b/pkg/iaasbeta/model_image.go @@ -0,0 +1,894 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Image type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Image{} + +/* + types and functions for agent +*/ + +// isModel +type ImageGetAgentAttributeType = *ImageAgent +type ImageGetAgentArgType = ImageAgent +type ImageGetAgentRetType = ImageAgent + +func getImageGetAgentAttributeTypeOk(arg ImageGetAgentAttributeType) (ret ImageGetAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetAgentAttributeType(arg *ImageGetAgentAttributeType, val ImageGetAgentRetType) { + *arg = &val +} + +/* + types and functions for checksum +*/ + +// isModel +type ImageGetChecksumAttributeType = *ImageChecksum +type ImageGetChecksumArgType = ImageChecksum +type ImageGetChecksumRetType = ImageChecksum + +func getImageGetChecksumAttributeTypeOk(arg ImageGetChecksumAttributeType) (ret ImageGetChecksumRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetChecksumAttributeType(arg *ImageGetChecksumAttributeType, val ImageGetChecksumRetType) { + *arg = &val +} + +/* + types and functions for config +*/ + +// isModel +type ImageGetConfigAttributeType = *ImageConfig +type ImageGetConfigArgType = ImageConfig +type ImageGetConfigRetType = ImageConfig + +func getImageGetConfigAttributeTypeOk(arg ImageGetConfigAttributeType) (ret ImageGetConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetConfigAttributeType(arg *ImageGetConfigAttributeType, val ImageGetConfigRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type ImageGetCreatedAtAttributeType = *time.Time +type ImageGetCreatedAtArgType = time.Time +type ImageGetCreatedAtRetType = time.Time + +func getImageGetCreatedAtAttributeTypeOk(arg ImageGetCreatedAtAttributeType) (ret ImageGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetCreatedAtAttributeType(arg *ImageGetCreatedAtAttributeType, val ImageGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for diskFormat +*/ + +// isNotNullableString +type ImageGetDiskFormatAttributeType = *string + +func getImageGetDiskFormatAttributeTypeOk(arg ImageGetDiskFormatAttributeType) (ret ImageGetDiskFormatRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetDiskFormatAttributeType(arg *ImageGetDiskFormatAttributeType, val ImageGetDiskFormatRetType) { + *arg = &val +} + +type ImageGetDiskFormatArgType = string +type ImageGetDiskFormatRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type ImageGetIdAttributeType = *string + +func getImageGetIdAttributeTypeOk(arg ImageGetIdAttributeType) (ret ImageGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetIdAttributeType(arg *ImageGetIdAttributeType, val ImageGetIdRetType) { + *arg = &val +} + +type ImageGetIdArgType = string +type ImageGetIdRetType = string + +/* + types and functions for importProgress +*/ + +// isLong +type ImageGetImportProgressAttributeType = *int64 +type ImageGetImportProgressArgType = int64 +type ImageGetImportProgressRetType = int64 + +func getImageGetImportProgressAttributeTypeOk(arg ImageGetImportProgressAttributeType) (ret ImageGetImportProgressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetImportProgressAttributeType(arg *ImageGetImportProgressAttributeType, val ImageGetImportProgressRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type ImageGetLabelsAttributeType = *map[string]interface{} +type ImageGetLabelsArgType = map[string]interface{} +type ImageGetLabelsRetType = map[string]interface{} + +func getImageGetLabelsAttributeTypeOk(arg ImageGetLabelsAttributeType) (ret ImageGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetLabelsAttributeType(arg *ImageGetLabelsAttributeType, val ImageGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for minDiskSize +*/ + +// isLong +type ImageGetMinDiskSizeAttributeType = *int64 +type ImageGetMinDiskSizeArgType = int64 +type ImageGetMinDiskSizeRetType = int64 + +func getImageGetMinDiskSizeAttributeTypeOk(arg ImageGetMinDiskSizeAttributeType) (ret ImageGetMinDiskSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetMinDiskSizeAttributeType(arg *ImageGetMinDiskSizeAttributeType, val ImageGetMinDiskSizeRetType) { + *arg = &val +} + +/* + types and functions for minRam +*/ + +// isLong +type ImageGetMinRamAttributeType = *int64 +type ImageGetMinRamArgType = int64 +type ImageGetMinRamRetType = int64 + +func getImageGetMinRamAttributeTypeOk(arg ImageGetMinRamAttributeType) (ret ImageGetMinRamRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetMinRamAttributeType(arg *ImageGetMinRamAttributeType, val ImageGetMinRamRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type ImageGetNameAttributeType = *string + +func getImageGetNameAttributeTypeOk(arg ImageGetNameAttributeType) (ret ImageGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetNameAttributeType(arg *ImageGetNameAttributeType, val ImageGetNameRetType) { + *arg = &val +} + +type ImageGetNameArgType = string +type ImageGetNameRetType = string + +/* + types and functions for owner +*/ + +// isNotNullableString +type ImageGetOwnerAttributeType = *string + +func getImageGetOwnerAttributeTypeOk(arg ImageGetOwnerAttributeType) (ret ImageGetOwnerRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetOwnerAttributeType(arg *ImageGetOwnerAttributeType, val ImageGetOwnerRetType) { + *arg = &val +} + +type ImageGetOwnerArgType = string +type ImageGetOwnerRetType = string + +/* + types and functions for protected +*/ + +// isBoolean +type ImagegetProtectedAttributeType = *bool +type ImagegetProtectedArgType = bool +type ImagegetProtectedRetType = bool + +func getImagegetProtectedAttributeTypeOk(arg ImagegetProtectedAttributeType) (ret ImagegetProtectedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImagegetProtectedAttributeType(arg *ImagegetProtectedAttributeType, val ImagegetProtectedRetType) { + *arg = &val +} + +/* + types and functions for scope +*/ + +// isNotNullableString +type ImageGetScopeAttributeType = *string + +func getImageGetScopeAttributeTypeOk(arg ImageGetScopeAttributeType) (ret ImageGetScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetScopeAttributeType(arg *ImageGetScopeAttributeType, val ImageGetScopeRetType) { + *arg = &val +} + +type ImageGetScopeArgType = string +type ImageGetScopeRetType = string + +/* + types and functions for size +*/ + +// isLong +type ImageGetSizeAttributeType = *int64 +type ImageGetSizeArgType = int64 +type ImageGetSizeRetType = int64 + +func getImageGetSizeAttributeTypeOk(arg ImageGetSizeAttributeType) (ret ImageGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetSizeAttributeType(arg *ImageGetSizeAttributeType, val ImageGetSizeRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type ImageGetStatusAttributeType = *string + +func getImageGetStatusAttributeTypeOk(arg ImageGetStatusAttributeType) (ret ImageGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetStatusAttributeType(arg *ImageGetStatusAttributeType, val ImageGetStatusRetType) { + *arg = &val +} + +type ImageGetStatusArgType = string +type ImageGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type ImageGetUpdatedAtAttributeType = *time.Time +type ImageGetUpdatedAtArgType = time.Time +type ImageGetUpdatedAtRetType = time.Time + +func getImageGetUpdatedAtAttributeTypeOk(arg ImageGetUpdatedAtAttributeType) (ret ImageGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetUpdatedAtAttributeType(arg *ImageGetUpdatedAtAttributeType, val ImageGetUpdatedAtRetType) { + *arg = &val +} + +// Image Object that represents an Image and its parameters. Used for Creating and returning (get/list). +type Image struct { + Agent ImageGetAgentAttributeType `json:"agent,omitempty"` + Checksum ImageGetChecksumAttributeType `json:"checksum,omitempty"` + Config ImageGetConfigAttributeType `json:"config,omitempty"` + // Date-time when resource was created. + CreatedAt ImageGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`. + // REQUIRED + DiskFormat ImageGetDiskFormatAttributeType `json:"diskFormat" required:"true"` + // Universally Unique Identifier (UUID). + Id ImageGetIdAttributeType `json:"id,omitempty"` + // Indicates Image Import Progress in percent. + ImportProgress ImageGetImportProgressAttributeType `json:"importProgress,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels ImageGetLabelsAttributeType `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize ImageGetMinDiskSizeAttributeType `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam ImageGetMinRamAttributeType `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name ImageGetNameAttributeType `json:"name" required:"true"` + // Universally Unique Identifier (UUID). + Owner ImageGetOwnerAttributeType `json:"owner,omitempty"` + // When true the image is prevented from being deleted. + Protected ImagegetProtectedAttributeType `json:"protected,omitempty"` + // Scope of an Image. Possible values: `public`, `local`, `projects`, `organization`. + Scope ImageGetScopeAttributeType `json:"scope,omitempty"` + // Size in bytes. + Size ImageGetSizeAttributeType `json:"size,omitempty"` + // The status of an image object. Possible values: `AVAILABLE`, `CREATING`, `DEACTIVATED`, `DELETED`, `DELETING`, `ERROR`. + Status ImageGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt ImageGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Image Image + +// NewImage instantiates a new Image 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 NewImage(diskFormat ImageGetDiskFormatArgType, name ImageGetNameArgType) *Image { + this := Image{} + setImageGetDiskFormatAttributeType(&this.DiskFormat, diskFormat) + setImageGetNameAttributeType(&this.Name, name) + return &this +} + +// NewImageWithDefaults instantiates a new Image 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 NewImageWithDefaults() *Image { + this := Image{} + return &this +} + +// GetAgent returns the Agent field value if set, zero value otherwise. +func (o *Image) GetAgent() (res ImageGetAgentRetType) { + res, _ = o.GetAgentOk() + return +} + +// GetAgentOk returns a tuple with the Agent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetAgentOk() (ret ImageGetAgentRetType, ok bool) { + return getImageGetAgentAttributeTypeOk(o.Agent) +} + +// HasAgent returns a boolean if a field has been set. +func (o *Image) HasAgent() bool { + _, ok := o.GetAgentOk() + return ok +} + +// SetAgent gets a reference to the given ImageAgent and assigns it to the Agent field. +func (o *Image) SetAgent(v ImageGetAgentRetType) { + setImageGetAgentAttributeType(&o.Agent, v) +} + +// GetChecksum returns the Checksum field value if set, zero value otherwise. +func (o *Image) GetChecksum() (res ImageGetChecksumRetType) { + res, _ = o.GetChecksumOk() + return +} + +// GetChecksumOk returns a tuple with the Checksum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetChecksumOk() (ret ImageGetChecksumRetType, ok bool) { + return getImageGetChecksumAttributeTypeOk(o.Checksum) +} + +// HasChecksum returns a boolean if a field has been set. +func (o *Image) HasChecksum() bool { + _, ok := o.GetChecksumOk() + return ok +} + +// SetChecksum gets a reference to the given ImageChecksum and assigns it to the Checksum field. +func (o *Image) SetChecksum(v ImageGetChecksumRetType) { + setImageGetChecksumAttributeType(&o.Checksum, v) +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *Image) GetConfig() (res ImageGetConfigRetType) { + res, _ = o.GetConfigOk() + return +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetConfigOk() (ret ImageGetConfigRetType, ok bool) { + return getImageGetConfigAttributeTypeOk(o.Config) +} + +// HasConfig returns a boolean if a field has been set. +func (o *Image) HasConfig() bool { + _, ok := o.GetConfigOk() + return ok +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *Image) SetConfig(v ImageGetConfigRetType) { + setImageGetConfigAttributeType(&o.Config, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Image) GetCreatedAt() (res ImageGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetCreatedAtOk() (ret ImageGetCreatedAtRetType, ok bool) { + return getImageGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Image) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Image) SetCreatedAt(v ImageGetCreatedAtRetType) { + setImageGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDiskFormat returns the DiskFormat field value +func (o *Image) GetDiskFormat() (ret ImageGetDiskFormatRetType) { + ret, _ = o.GetDiskFormatOk() + return ret +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value +// and a boolean to check if the value has been set. +func (o *Image) GetDiskFormatOk() (ret ImageGetDiskFormatRetType, ok bool) { + return getImageGetDiskFormatAttributeTypeOk(o.DiskFormat) +} + +// SetDiskFormat sets field value +func (o *Image) SetDiskFormat(v ImageGetDiskFormatRetType) { + setImageGetDiskFormatAttributeType(&o.DiskFormat, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Image) GetId() (res ImageGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetIdOk() (ret ImageGetIdRetType, ok bool) { + return getImageGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Image) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Image) SetId(v ImageGetIdRetType) { + setImageGetIdAttributeType(&o.Id, v) +} + +// GetImportProgress returns the ImportProgress field value if set, zero value otherwise. +func (o *Image) GetImportProgress() (res ImageGetImportProgressRetType) { + res, _ = o.GetImportProgressOk() + return +} + +// GetImportProgressOk returns a tuple with the ImportProgress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetImportProgressOk() (ret ImageGetImportProgressRetType, ok bool) { + return getImageGetImportProgressAttributeTypeOk(o.ImportProgress) +} + +// HasImportProgress returns a boolean if a field has been set. +func (o *Image) HasImportProgress() bool { + _, ok := o.GetImportProgressOk() + return ok +} + +// SetImportProgress gets a reference to the given int64 and assigns it to the ImportProgress field. +func (o *Image) SetImportProgress(v ImageGetImportProgressRetType) { + setImageGetImportProgressAttributeType(&o.ImportProgress, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Image) GetLabels() (res ImageGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetLabelsOk() (ret ImageGetLabelsRetType, ok bool) { + return getImageGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Image) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Image) SetLabels(v ImageGetLabelsRetType) { + setImageGetLabelsAttributeType(&o.Labels, v) +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *Image) GetMinDiskSize() (res ImageGetMinDiskSizeRetType) { + res, _ = o.GetMinDiskSizeOk() + return +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetMinDiskSizeOk() (ret ImageGetMinDiskSizeRetType, ok bool) { + return getImageGetMinDiskSizeAttributeTypeOk(o.MinDiskSize) +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *Image) HasMinDiskSize() bool { + _, ok := o.GetMinDiskSizeOk() + return ok +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *Image) SetMinDiskSize(v ImageGetMinDiskSizeRetType) { + setImageGetMinDiskSizeAttributeType(&o.MinDiskSize, v) +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *Image) GetMinRam() (res ImageGetMinRamRetType) { + res, _ = o.GetMinRamOk() + return +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetMinRamOk() (ret ImageGetMinRamRetType, ok bool) { + return getImageGetMinRamAttributeTypeOk(o.MinRam) +} + +// HasMinRam returns a boolean if a field has been set. +func (o *Image) HasMinRam() bool { + _, ok := o.GetMinRamOk() + return ok +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *Image) SetMinRam(v ImageGetMinRamRetType) { + setImageGetMinRamAttributeType(&o.MinRam, v) +} + +// GetName returns the Name field value +func (o *Image) GetName() (ret ImageGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Image) GetNameOk() (ret ImageGetNameRetType, ok bool) { + return getImageGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Image) SetName(v ImageGetNameRetType) { + setImageGetNameAttributeType(&o.Name, v) +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *Image) GetOwner() (res ImageGetOwnerRetType) { + res, _ = o.GetOwnerOk() + return +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetOwnerOk() (ret ImageGetOwnerRetType, ok bool) { + return getImageGetOwnerAttributeTypeOk(o.Owner) +} + +// HasOwner returns a boolean if a field has been set. +func (o *Image) HasOwner() bool { + _, ok := o.GetOwnerOk() + return ok +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *Image) SetOwner(v ImageGetOwnerRetType) { + setImageGetOwnerAttributeType(&o.Owner, v) +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *Image) GetProtected() (res ImagegetProtectedRetType) { + res, _ = o.GetProtectedOk() + return +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetProtectedOk() (ret ImagegetProtectedRetType, ok bool) { + return getImagegetProtectedAttributeTypeOk(o.Protected) +} + +// HasProtected returns a boolean if a field has been set. +func (o *Image) HasProtected() bool { + _, ok := o.GetProtectedOk() + return ok +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *Image) SetProtected(v ImagegetProtectedRetType) { + setImagegetProtectedAttributeType(&o.Protected, v) +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *Image) GetScope() (res ImageGetScopeRetType) { + res, _ = o.GetScopeOk() + return +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetScopeOk() (ret ImageGetScopeRetType, ok bool) { + return getImageGetScopeAttributeTypeOk(o.Scope) +} + +// HasScope returns a boolean if a field has been set. +func (o *Image) HasScope() bool { + _, ok := o.GetScopeOk() + return ok +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *Image) SetScope(v ImageGetScopeRetType) { + setImageGetScopeAttributeType(&o.Scope, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Image) GetSize() (res ImageGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetSizeOk() (ret ImageGetSizeRetType, ok bool) { + return getImageGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *Image) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Image) SetSize(v ImageGetSizeRetType) { + setImageGetSizeAttributeType(&o.Size, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Image) GetStatus() (res ImageGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetStatusOk() (ret ImageGetStatusRetType, ok bool) { + return getImageGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Image) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Image) SetStatus(v ImageGetStatusRetType) { + setImageGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Image) GetUpdatedAt() (res ImageGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetUpdatedAtOk() (ret ImageGetUpdatedAtRetType, ok bool) { + return getImageGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Image) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Image) SetUpdatedAt(v ImageGetUpdatedAtRetType) { + setImageGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Image) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageGetAgentAttributeTypeOk(o.Agent); ok { + toSerialize["Agent"] = val + } + if val, ok := getImageGetChecksumAttributeTypeOk(o.Checksum); ok { + toSerialize["Checksum"] = val + } + if val, ok := getImageGetConfigAttributeTypeOk(o.Config); ok { + toSerialize["Config"] = val + } + if val, ok := getImageGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getImageGetDiskFormatAttributeTypeOk(o.DiskFormat); ok { + toSerialize["DiskFormat"] = val + } + if val, ok := getImageGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getImageGetImportProgressAttributeTypeOk(o.ImportProgress); ok { + toSerialize["ImportProgress"] = val + } + if val, ok := getImageGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getImageGetMinDiskSizeAttributeTypeOk(o.MinDiskSize); ok { + toSerialize["MinDiskSize"] = val + } + if val, ok := getImageGetMinRamAttributeTypeOk(o.MinRam); ok { + toSerialize["MinRam"] = val + } + if val, ok := getImageGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getImageGetOwnerAttributeTypeOk(o.Owner); ok { + toSerialize["Owner"] = val + } + if val, ok := getImagegetProtectedAttributeTypeOk(o.Protected); ok { + toSerialize["Protected"] = val + } + if val, ok := getImageGetScopeAttributeTypeOk(o.Scope); ok { + toSerialize["Scope"] = val + } + if val, ok := getImageGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getImageGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getImageGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableImage struct { + value *Image + isSet bool +} + +func (v NullableImage) Get() *Image { + return v.value +} + +func (v *NullableImage) Set(val *Image) { + v.value = val + v.isSet = true +} + +func (v NullableImage) IsSet() bool { + return v.isSet +} + +func (v *NullableImage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImage(val *Image) *NullableImage { + return &NullableImage{value: val, isSet: true} +} + +func (v NullableImage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_image_agent.go b/pkg/iaasbeta/model_image_agent.go new file mode 100644 index 00000000..a082cda3 --- /dev/null +++ b/pkg/iaasbeta/model_image_agent.go @@ -0,0 +1,176 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ImageAgent type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageAgent{} + +/* + types and functions for provisionByDefault +*/ + +// isBoolean +type ImageAgentgetProvisionByDefaultAttributeType = *bool +type ImageAgentgetProvisionByDefaultArgType = bool +type ImageAgentgetProvisionByDefaultRetType = bool + +func getImageAgentgetProvisionByDefaultAttributeTypeOk(arg ImageAgentgetProvisionByDefaultAttributeType) (ret ImageAgentgetProvisionByDefaultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageAgentgetProvisionByDefaultAttributeType(arg *ImageAgentgetProvisionByDefaultAttributeType, val ImageAgentgetProvisionByDefaultRetType) { + *arg = &val +} + +/* + types and functions for supported +*/ + +// isBoolean +type ImageAgentgetSupportedAttributeType = *bool +type ImageAgentgetSupportedArgType = bool +type ImageAgentgetSupportedRetType = bool + +func getImageAgentgetSupportedAttributeTypeOk(arg ImageAgentgetSupportedAttributeType) (ret ImageAgentgetSupportedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageAgentgetSupportedAttributeType(arg *ImageAgentgetSupportedAttributeType, val ImageAgentgetSupportedRetType) { + *arg = &val +} + +// ImageAgent Support status and default provioning setting for the STACKIT server agent. +type ImageAgent struct { + // Default provioning of the STACKIT server agent for new servers. The default for new images is false. Can only be enabled when supported is also true. + ProvisionByDefault ImageAgentgetProvisionByDefaultAttributeType `json:"provisionByDefault,omitempty"` + // Indicates the STACKIT server agent for the image. The default for new images is false. + Supported ImageAgentgetSupportedAttributeType `json:"supported,omitempty"` +} + +// NewImageAgent instantiates a new ImageAgent 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 NewImageAgent() *ImageAgent { + this := ImageAgent{} + return &this +} + +// NewImageAgentWithDefaults instantiates a new ImageAgent 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 NewImageAgentWithDefaults() *ImageAgent { + this := ImageAgent{} + return &this +} + +// GetProvisionByDefault returns the ProvisionByDefault field value if set, zero value otherwise. +func (o *ImageAgent) GetProvisionByDefault() (res ImageAgentgetProvisionByDefaultRetType) { + res, _ = o.GetProvisionByDefaultOk() + return +} + +// GetProvisionByDefaultOk returns a tuple with the ProvisionByDefault field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageAgent) GetProvisionByDefaultOk() (ret ImageAgentgetProvisionByDefaultRetType, ok bool) { + return getImageAgentgetProvisionByDefaultAttributeTypeOk(o.ProvisionByDefault) +} + +// HasProvisionByDefault returns a boolean if a field has been set. +func (o *ImageAgent) HasProvisionByDefault() bool { + _, ok := o.GetProvisionByDefaultOk() + return ok +} + +// SetProvisionByDefault gets a reference to the given bool and assigns it to the ProvisionByDefault field. +func (o *ImageAgent) SetProvisionByDefault(v ImageAgentgetProvisionByDefaultRetType) { + setImageAgentgetProvisionByDefaultAttributeType(&o.ProvisionByDefault, v) +} + +// GetSupported returns the Supported field value if set, zero value otherwise. +func (o *ImageAgent) GetSupported() (res ImageAgentgetSupportedRetType) { + res, _ = o.GetSupportedOk() + return +} + +// GetSupportedOk returns a tuple with the Supported field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageAgent) GetSupportedOk() (ret ImageAgentgetSupportedRetType, ok bool) { + return getImageAgentgetSupportedAttributeTypeOk(o.Supported) +} + +// HasSupported returns a boolean if a field has been set. +func (o *ImageAgent) HasSupported() bool { + _, ok := o.GetSupportedOk() + return ok +} + +// SetSupported gets a reference to the given bool and assigns it to the Supported field. +func (o *ImageAgent) SetSupported(v ImageAgentgetSupportedRetType) { + setImageAgentgetSupportedAttributeType(&o.Supported, v) +} + +func (o ImageAgent) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageAgentgetProvisionByDefaultAttributeTypeOk(o.ProvisionByDefault); ok { + toSerialize["ProvisionByDefault"] = val + } + if val, ok := getImageAgentgetSupportedAttributeTypeOk(o.Supported); ok { + toSerialize["Supported"] = val + } + return toSerialize, nil +} + +type NullableImageAgent struct { + value *ImageAgent + isSet bool +} + +func (v NullableImageAgent) Get() *ImageAgent { + return v.value +} + +func (v *NullableImageAgent) Set(val *ImageAgent) { + v.value = val + v.isSet = true +} + +func (v NullableImageAgent) IsSet() bool { + return v.isSet +} + +func (v *NullableImageAgent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageAgent(val *ImageAgent) *NullableImageAgent { + return &NullableImageAgent{value: val, isSet: true} +} + +func (v NullableImageAgent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageAgent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_image_agent_test.go b/pkg/iaasbeta/model_image_agent_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_image_agent_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_image_checksum.go b/pkg/iaasbeta/model_image_checksum.go new file mode 100644 index 00000000..79798071 --- /dev/null +++ b/pkg/iaasbeta/model_image_checksum.go @@ -0,0 +1,172 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ImageChecksum type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageChecksum{} + +/* + types and functions for algorithm +*/ + +// isNotNullableString +type ImageChecksumGetAlgorithmAttributeType = *string + +func getImageChecksumGetAlgorithmAttributeTypeOk(arg ImageChecksumGetAlgorithmAttributeType) (ret ImageChecksumGetAlgorithmRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageChecksumGetAlgorithmAttributeType(arg *ImageChecksumGetAlgorithmAttributeType, val ImageChecksumGetAlgorithmRetType) { + *arg = &val +} + +type ImageChecksumGetAlgorithmArgType = string +type ImageChecksumGetAlgorithmRetType = string + +/* + types and functions for digest +*/ + +// isNotNullableString +type ImageChecksumGetDigestAttributeType = *string + +func getImageChecksumGetDigestAttributeTypeOk(arg ImageChecksumGetDigestAttributeType) (ret ImageChecksumGetDigestRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageChecksumGetDigestAttributeType(arg *ImageChecksumGetDigestAttributeType, val ImageChecksumGetDigestRetType) { + *arg = &val +} + +type ImageChecksumGetDigestArgType = string +type ImageChecksumGetDigestRetType = string + +// ImageChecksum Representation of an image checksum. +type ImageChecksum struct { + // Algorithm for the checksum of the image data. Possible values: `md5`, `sha512`. + // REQUIRED + Algorithm ImageChecksumGetAlgorithmAttributeType `json:"algorithm" required:"true"` + // Hexdigest of the checksum of the image data. + // REQUIRED + Digest ImageChecksumGetDigestAttributeType `json:"digest" required:"true"` +} + +type _ImageChecksum ImageChecksum + +// NewImageChecksum instantiates a new ImageChecksum 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 NewImageChecksum(algorithm ImageChecksumGetAlgorithmArgType, digest ImageChecksumGetDigestArgType) *ImageChecksum { + this := ImageChecksum{} + setImageChecksumGetAlgorithmAttributeType(&this.Algorithm, algorithm) + setImageChecksumGetDigestAttributeType(&this.Digest, digest) + return &this +} + +// NewImageChecksumWithDefaults instantiates a new ImageChecksum 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 NewImageChecksumWithDefaults() *ImageChecksum { + this := ImageChecksum{} + return &this +} + +// GetAlgorithm returns the Algorithm field value +func (o *ImageChecksum) GetAlgorithm() (ret ImageChecksumGetAlgorithmRetType) { + ret, _ = o.GetAlgorithmOk() + return ret +} + +// GetAlgorithmOk returns a tuple with the Algorithm field value +// and a boolean to check if the value has been set. +func (o *ImageChecksum) GetAlgorithmOk() (ret ImageChecksumGetAlgorithmRetType, ok bool) { + return getImageChecksumGetAlgorithmAttributeTypeOk(o.Algorithm) +} + +// SetAlgorithm sets field value +func (o *ImageChecksum) SetAlgorithm(v ImageChecksumGetAlgorithmRetType) { + setImageChecksumGetAlgorithmAttributeType(&o.Algorithm, v) +} + +// GetDigest returns the Digest field value +func (o *ImageChecksum) GetDigest() (ret ImageChecksumGetDigestRetType) { + ret, _ = o.GetDigestOk() + return ret +} + +// GetDigestOk returns a tuple with the Digest field value +// and a boolean to check if the value has been set. +func (o *ImageChecksum) GetDigestOk() (ret ImageChecksumGetDigestRetType, ok bool) { + return getImageChecksumGetDigestAttributeTypeOk(o.Digest) +} + +// SetDigest sets field value +func (o *ImageChecksum) SetDigest(v ImageChecksumGetDigestRetType) { + setImageChecksumGetDigestAttributeType(&o.Digest, v) +} + +func (o ImageChecksum) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageChecksumGetAlgorithmAttributeTypeOk(o.Algorithm); ok { + toSerialize["Algorithm"] = val + } + if val, ok := getImageChecksumGetDigestAttributeTypeOk(o.Digest); ok { + toSerialize["Digest"] = val + } + return toSerialize, nil +} + +type NullableImageChecksum struct { + value *ImageChecksum + isSet bool +} + +func (v NullableImageChecksum) Get() *ImageChecksum { + return v.value +} + +func (v *NullableImageChecksum) Set(val *ImageChecksum) { + v.value = val + v.isSet = true +} + +func (v NullableImageChecksum) IsSet() bool { + return v.isSet +} + +func (v *NullableImageChecksum) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageChecksum(val *ImageChecksum) *NullableImageChecksum { + return &NullableImageChecksum{value: val, isSet: true} +} + +func (v NullableImageChecksum) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageChecksum) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_image_checksum_test.go b/pkg/iaasbeta/model_image_checksum_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_image_checksum_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_image_config.go b/pkg/iaasbeta/model_image_config.go new file mode 100644 index 00000000..ba4e9a1c --- /dev/null +++ b/pkg/iaasbeta/model_image_config.go @@ -0,0 +1,882 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ImageConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageConfig{} + +/* + types and functions for architecture +*/ + +// isNotNullableString +type ImageConfigGetArchitectureAttributeType = *string + +func getImageConfigGetArchitectureAttributeTypeOk(arg ImageConfigGetArchitectureAttributeType) (ret ImageConfigGetArchitectureRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfigGetArchitectureAttributeType(arg *ImageConfigGetArchitectureAttributeType, val ImageConfigGetArchitectureRetType) { + *arg = &val +} + +type ImageConfigGetArchitectureArgType = string +type ImageConfigGetArchitectureRetType = string + +/* + types and functions for bootMenu +*/ + +// isBoolean +type ImageConfiggetBootMenuAttributeType = *bool +type ImageConfiggetBootMenuArgType = bool +type ImageConfiggetBootMenuRetType = bool + +func getImageConfiggetBootMenuAttributeTypeOk(arg ImageConfiggetBootMenuAttributeType) (ret ImageConfiggetBootMenuRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfiggetBootMenuAttributeType(arg *ImageConfiggetBootMenuAttributeType, val ImageConfiggetBootMenuRetType) { + *arg = &val +} + +/* + types and functions for cdromBus +*/ + +// isNullableString +type ImageConfigGetCdromBusAttributeType = *NullableString + +func getImageConfigGetCdromBusAttributeTypeOk(arg ImageConfigGetCdromBusAttributeType) (ret ImageConfigGetCdromBusRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetCdromBusAttributeType(arg *ImageConfigGetCdromBusAttributeType, val ImageConfigGetCdromBusRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetCdromBusArgType = *string +type ImageConfigGetCdromBusRetType = *string + +/* + types and functions for diskBus +*/ + +// isNullableString +type ImageConfigGetDiskBusAttributeType = *NullableString + +func getImageConfigGetDiskBusAttributeTypeOk(arg ImageConfigGetDiskBusAttributeType) (ret ImageConfigGetDiskBusRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetDiskBusAttributeType(arg *ImageConfigGetDiskBusAttributeType, val ImageConfigGetDiskBusRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetDiskBusArgType = *string +type ImageConfigGetDiskBusRetType = *string + +/* + types and functions for nicModel +*/ + +// isNullableString +type ImageConfigGetNicModelAttributeType = *NullableString + +func getImageConfigGetNicModelAttributeTypeOk(arg ImageConfigGetNicModelAttributeType) (ret ImageConfigGetNicModelRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetNicModelAttributeType(arg *ImageConfigGetNicModelAttributeType, val ImageConfigGetNicModelRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetNicModelArgType = *string +type ImageConfigGetNicModelRetType = *string + +/* + types and functions for operatingSystem +*/ + +// isNotNullableString +type ImageConfigGetOperatingSystemAttributeType = *string + +func getImageConfigGetOperatingSystemAttributeTypeOk(arg ImageConfigGetOperatingSystemAttributeType) (ret ImageConfigGetOperatingSystemRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfigGetOperatingSystemAttributeType(arg *ImageConfigGetOperatingSystemAttributeType, val ImageConfigGetOperatingSystemRetType) { + *arg = &val +} + +type ImageConfigGetOperatingSystemArgType = string +type ImageConfigGetOperatingSystemRetType = string + +/* + types and functions for operatingSystemDistro +*/ + +// isNullableString +type ImageConfigGetOperatingSystemDistroAttributeType = *NullableString + +func getImageConfigGetOperatingSystemDistroAttributeTypeOk(arg ImageConfigGetOperatingSystemDistroAttributeType) (ret ImageConfigGetOperatingSystemDistroRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetOperatingSystemDistroAttributeType(arg *ImageConfigGetOperatingSystemDistroAttributeType, val ImageConfigGetOperatingSystemDistroRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetOperatingSystemDistroArgType = *string +type ImageConfigGetOperatingSystemDistroRetType = *string + +/* + types and functions for operatingSystemVersion +*/ + +// isNullableString +type ImageConfigGetOperatingSystemVersionAttributeType = *NullableString + +func getImageConfigGetOperatingSystemVersionAttributeTypeOk(arg ImageConfigGetOperatingSystemVersionAttributeType) (ret ImageConfigGetOperatingSystemVersionRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetOperatingSystemVersionAttributeType(arg *ImageConfigGetOperatingSystemVersionAttributeType, val ImageConfigGetOperatingSystemVersionRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetOperatingSystemVersionArgType = *string +type ImageConfigGetOperatingSystemVersionRetType = *string + +/* + types and functions for rescueBus +*/ + +// isNullableString +type ImageConfigGetRescueBusAttributeType = *NullableString + +func getImageConfigGetRescueBusAttributeTypeOk(arg ImageConfigGetRescueBusAttributeType) (ret ImageConfigGetRescueBusRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetRescueBusAttributeType(arg *ImageConfigGetRescueBusAttributeType, val ImageConfigGetRescueBusRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetRescueBusArgType = *string +type ImageConfigGetRescueBusRetType = *string + +/* + types and functions for rescueDevice +*/ + +// isNullableString +type ImageConfigGetRescueDeviceAttributeType = *NullableString + +func getImageConfigGetRescueDeviceAttributeTypeOk(arg ImageConfigGetRescueDeviceAttributeType) (ret ImageConfigGetRescueDeviceRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetRescueDeviceAttributeType(arg *ImageConfigGetRescueDeviceAttributeType, val ImageConfigGetRescueDeviceRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetRescueDeviceArgType = *string +type ImageConfigGetRescueDeviceRetType = *string + +/* + types and functions for secureBoot +*/ + +// isBoolean +type ImageConfiggetSecureBootAttributeType = *bool +type ImageConfiggetSecureBootArgType = bool +type ImageConfiggetSecureBootRetType = bool + +func getImageConfiggetSecureBootAttributeTypeOk(arg ImageConfiggetSecureBootAttributeType) (ret ImageConfiggetSecureBootRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfiggetSecureBootAttributeType(arg *ImageConfiggetSecureBootAttributeType, val ImageConfiggetSecureBootRetType) { + *arg = &val +} + +/* + types and functions for uefi +*/ + +// isBoolean +type ImageConfiggetUefiAttributeType = *bool +type ImageConfiggetUefiArgType = bool +type ImageConfiggetUefiRetType = bool + +func getImageConfiggetUefiAttributeTypeOk(arg ImageConfiggetUefiAttributeType) (ret ImageConfiggetUefiRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfiggetUefiAttributeType(arg *ImageConfiggetUefiAttributeType, val ImageConfiggetUefiRetType) { + *arg = &val +} + +/* + types and functions for videoModel +*/ + +// isNullableString +type ImageConfigGetVideoModelAttributeType = *NullableString + +func getImageConfigGetVideoModelAttributeTypeOk(arg ImageConfigGetVideoModelAttributeType) (ret ImageConfigGetVideoModelRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetVideoModelAttributeType(arg *ImageConfigGetVideoModelAttributeType, val ImageConfigGetVideoModelRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetVideoModelArgType = *string +type ImageConfigGetVideoModelRetType = *string + +/* + types and functions for virtioScsi +*/ + +// isBoolean +type ImageConfiggetVirtioScsiAttributeType = *bool +type ImageConfiggetVirtioScsiArgType = bool +type ImageConfiggetVirtioScsiRetType = bool + +func getImageConfiggetVirtioScsiAttributeTypeOk(arg ImageConfiggetVirtioScsiAttributeType) (ret ImageConfiggetVirtioScsiRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfiggetVirtioScsiAttributeType(arg *ImageConfiggetVirtioScsiAttributeType, val ImageConfiggetVirtioScsiRetType) { + *arg = &val +} + +// ImageConfig Properties to set hardware and scheduling settings for an Image. +type ImageConfig struct { + // Represents CPU architecture. The default for new images is x86. Possible values: `arm64`, `x86`. + Architecture ImageConfigGetArchitectureAttributeType `json:"architecture,omitempty"` + // Enables the BIOS bootmenu. The default for new images is disabled. + BootMenu ImageConfiggetBootMenuAttributeType `json:"bootMenu,omitempty"` + // Sets CDROM bus controller type. Possible values: `scsi`, `virtio`, `ide`, `usb`. + CdromBus ImageConfigGetCdromBusAttributeType `json:"cdromBus,omitempty"` + // Sets Disk bus controller type. Possible values: `scsi`, `virtio`, `ide`, `usb`. + DiskBus ImageConfigGetDiskBusAttributeType `json:"diskBus,omitempty"` + // Sets virtual nic model. Possible values: `e1000`, `e1000e`, `ne2k_pci`, `pcnet`, `rtl8139`, `virtio`, `vmxnet3`. + NicModel ImageConfigGetNicModelAttributeType `json:"nicModel,omitempty"` + // Enables OS specific optimizations. Possible values: `windows`, `linux`. + OperatingSystem ImageConfigGetOperatingSystemAttributeType `json:"operatingSystem,omitempty"` + // Operating System Distribution. + OperatingSystemDistro ImageConfigGetOperatingSystemDistroAttributeType `json:"operatingSystemDistro,omitempty"` + // Version of the OS. + OperatingSystemVersion ImageConfigGetOperatingSystemVersionAttributeType `json:"operatingSystemVersion,omitempty"` + // Sets the device bus when the image is used as a rescue image. Possible values: `sata`, `scsi`, `virtio`, `usb`. + RescueBus ImageConfigGetRescueBusAttributeType `json:"rescueBus,omitempty"` + // Sets the device when the image is used as a rescue image. Possible values: `cdrom`, `disk`. + RescueDevice ImageConfigGetRescueDeviceAttributeType `json:"rescueDevice,omitempty"` + // Enables Secure Boot. The default for new images is disabled. + SecureBoot ImageConfiggetSecureBootAttributeType `json:"secureBoot,omitempty"` + // Configure UEFI boot. The default for new images is enabled. + Uefi ImageConfiggetUefiAttributeType `json:"uefi,omitempty"` + // Sets Graphic device model. Possible values: `vga`, `cirrus`, `vmvga`, `qxl`, `virtio`, `none`. + VideoModel ImageConfigGetVideoModelAttributeType `json:"videoModel,omitempty"` + // Enables the use of VirtIO SCSI to provide block device access. By default servers use VirtIO Block. + VirtioScsi ImageConfiggetVirtioScsiAttributeType `json:"virtioScsi,omitempty"` +} + +// NewImageConfig instantiates a new ImageConfig 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 NewImageConfig() *ImageConfig { + this := ImageConfig{} + return &this +} + +// NewImageConfigWithDefaults instantiates a new ImageConfig 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 NewImageConfigWithDefaults() *ImageConfig { + this := ImageConfig{} + return &this +} + +// GetArchitecture returns the Architecture field value if set, zero value otherwise. +func (o *ImageConfig) GetArchitecture() (res ImageConfigGetArchitectureRetType) { + res, _ = o.GetArchitectureOk() + return +} + +// GetArchitectureOk returns a tuple with the Architecture field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetArchitectureOk() (ret ImageConfigGetArchitectureRetType, ok bool) { + return getImageConfigGetArchitectureAttributeTypeOk(o.Architecture) +} + +// HasArchitecture returns a boolean if a field has been set. +func (o *ImageConfig) HasArchitecture() bool { + _, ok := o.GetArchitectureOk() + return ok +} + +// SetArchitecture gets a reference to the given string and assigns it to the Architecture field. +func (o *ImageConfig) SetArchitecture(v ImageConfigGetArchitectureRetType) { + setImageConfigGetArchitectureAttributeType(&o.Architecture, v) +} + +// GetBootMenu returns the BootMenu field value if set, zero value otherwise. +func (o *ImageConfig) GetBootMenu() (res ImageConfiggetBootMenuRetType) { + res, _ = o.GetBootMenuOk() + return +} + +// GetBootMenuOk returns a tuple with the BootMenu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetBootMenuOk() (ret ImageConfiggetBootMenuRetType, ok bool) { + return getImageConfiggetBootMenuAttributeTypeOk(o.BootMenu) +} + +// HasBootMenu returns a boolean if a field has been set. +func (o *ImageConfig) HasBootMenu() bool { + _, ok := o.GetBootMenuOk() + return ok +} + +// SetBootMenu gets a reference to the given bool and assigns it to the BootMenu field. +func (o *ImageConfig) SetBootMenu(v ImageConfiggetBootMenuRetType) { + setImageConfiggetBootMenuAttributeType(&o.BootMenu, v) +} + +// GetCdromBus returns the CdromBus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetCdromBus() (res ImageConfigGetCdromBusRetType) { + res, _ = o.GetCdromBusOk() + return +} + +// GetCdromBusOk returns a tuple with the CdromBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetCdromBusOk() (ret ImageConfigGetCdromBusRetType, ok bool) { + return getImageConfigGetCdromBusAttributeTypeOk(o.CdromBus) +} + +// HasCdromBus returns a boolean if a field has been set. +func (o *ImageConfig) HasCdromBus() bool { + _, ok := o.GetCdromBusOk() + return ok +} + +// SetCdromBus gets a reference to the given string and assigns it to the CdromBus field. +func (o *ImageConfig) SetCdromBus(v ImageConfigGetCdromBusRetType) { + setImageConfigGetCdromBusAttributeType(&o.CdromBus, v) +} + +// SetCdromBusNil sets the value for CdromBus to be an explicit nil +func (o *ImageConfig) SetCdromBusNil() { + o.CdromBus = nil +} + +// UnsetCdromBus ensures that no value is present for CdromBus, not even an explicit nil +func (o *ImageConfig) UnsetCdromBus() { + o.CdromBus = nil +} + +// GetDiskBus returns the DiskBus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetDiskBus() (res ImageConfigGetDiskBusRetType) { + res, _ = o.GetDiskBusOk() + return +} + +// GetDiskBusOk returns a tuple with the DiskBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetDiskBusOk() (ret ImageConfigGetDiskBusRetType, ok bool) { + return getImageConfigGetDiskBusAttributeTypeOk(o.DiskBus) +} + +// HasDiskBus returns a boolean if a field has been set. +func (o *ImageConfig) HasDiskBus() bool { + _, ok := o.GetDiskBusOk() + return ok +} + +// SetDiskBus gets a reference to the given string and assigns it to the DiskBus field. +func (o *ImageConfig) SetDiskBus(v ImageConfigGetDiskBusRetType) { + setImageConfigGetDiskBusAttributeType(&o.DiskBus, v) +} + +// SetDiskBusNil sets the value for DiskBus to be an explicit nil +func (o *ImageConfig) SetDiskBusNil() { + o.DiskBus = nil +} + +// UnsetDiskBus ensures that no value is present for DiskBus, not even an explicit nil +func (o *ImageConfig) UnsetDiskBus() { + o.DiskBus = nil +} + +// GetNicModel returns the NicModel field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetNicModel() (res ImageConfigGetNicModelRetType) { + res, _ = o.GetNicModelOk() + return +} + +// GetNicModelOk returns a tuple with the NicModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetNicModelOk() (ret ImageConfigGetNicModelRetType, ok bool) { + return getImageConfigGetNicModelAttributeTypeOk(o.NicModel) +} + +// HasNicModel returns a boolean if a field has been set. +func (o *ImageConfig) HasNicModel() bool { + _, ok := o.GetNicModelOk() + return ok +} + +// SetNicModel gets a reference to the given string and assigns it to the NicModel field. +func (o *ImageConfig) SetNicModel(v ImageConfigGetNicModelRetType) { + setImageConfigGetNicModelAttributeType(&o.NicModel, v) +} + +// SetNicModelNil sets the value for NicModel to be an explicit nil +func (o *ImageConfig) SetNicModelNil() { + o.NicModel = nil +} + +// UnsetNicModel ensures that no value is present for NicModel, not even an explicit nil +func (o *ImageConfig) UnsetNicModel() { + o.NicModel = nil +} + +// GetOperatingSystem returns the OperatingSystem field value if set, zero value otherwise. +func (o *ImageConfig) GetOperatingSystem() (res ImageConfigGetOperatingSystemRetType) { + res, _ = o.GetOperatingSystemOk() + return +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetOperatingSystemOk() (ret ImageConfigGetOperatingSystemRetType, ok bool) { + return getImageConfigGetOperatingSystemAttributeTypeOk(o.OperatingSystem) +} + +// HasOperatingSystem returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystem() bool { + _, ok := o.GetOperatingSystemOk() + return ok +} + +// SetOperatingSystem gets a reference to the given string and assigns it to the OperatingSystem field. +func (o *ImageConfig) SetOperatingSystem(v ImageConfigGetOperatingSystemRetType) { + setImageConfigGetOperatingSystemAttributeType(&o.OperatingSystem, v) +} + +// GetOperatingSystemDistro returns the OperatingSystemDistro field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetOperatingSystemDistro() (res ImageConfigGetOperatingSystemDistroRetType) { + res, _ = o.GetOperatingSystemDistroOk() + return +} + +// GetOperatingSystemDistroOk returns a tuple with the OperatingSystemDistro field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetOperatingSystemDistroOk() (ret ImageConfigGetOperatingSystemDistroRetType, ok bool) { + return getImageConfigGetOperatingSystemDistroAttributeTypeOk(o.OperatingSystemDistro) +} + +// HasOperatingSystemDistro returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystemDistro() bool { + _, ok := o.GetOperatingSystemDistroOk() + return ok +} + +// SetOperatingSystemDistro gets a reference to the given string and assigns it to the OperatingSystemDistro field. +func (o *ImageConfig) SetOperatingSystemDistro(v ImageConfigGetOperatingSystemDistroRetType) { + setImageConfigGetOperatingSystemDistroAttributeType(&o.OperatingSystemDistro, v) +} + +// SetOperatingSystemDistroNil sets the value for OperatingSystemDistro to be an explicit nil +func (o *ImageConfig) SetOperatingSystemDistroNil() { + o.OperatingSystemDistro = nil +} + +// UnsetOperatingSystemDistro ensures that no value is present for OperatingSystemDistro, not even an explicit nil +func (o *ImageConfig) UnsetOperatingSystemDistro() { + o.OperatingSystemDistro = nil +} + +// GetOperatingSystemVersion returns the OperatingSystemVersion field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetOperatingSystemVersion() (res ImageConfigGetOperatingSystemVersionRetType) { + res, _ = o.GetOperatingSystemVersionOk() + return +} + +// GetOperatingSystemVersionOk returns a tuple with the OperatingSystemVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetOperatingSystemVersionOk() (ret ImageConfigGetOperatingSystemVersionRetType, ok bool) { + return getImageConfigGetOperatingSystemVersionAttributeTypeOk(o.OperatingSystemVersion) +} + +// HasOperatingSystemVersion returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystemVersion() bool { + _, ok := o.GetOperatingSystemVersionOk() + return ok +} + +// SetOperatingSystemVersion gets a reference to the given string and assigns it to the OperatingSystemVersion field. +func (o *ImageConfig) SetOperatingSystemVersion(v ImageConfigGetOperatingSystemVersionRetType) { + setImageConfigGetOperatingSystemVersionAttributeType(&o.OperatingSystemVersion, v) +} + +// SetOperatingSystemVersionNil sets the value for OperatingSystemVersion to be an explicit nil +func (o *ImageConfig) SetOperatingSystemVersionNil() { + o.OperatingSystemVersion = nil +} + +// UnsetOperatingSystemVersion ensures that no value is present for OperatingSystemVersion, not even an explicit nil +func (o *ImageConfig) UnsetOperatingSystemVersion() { + o.OperatingSystemVersion = nil +} + +// GetRescueBus returns the RescueBus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetRescueBus() (res ImageConfigGetRescueBusRetType) { + res, _ = o.GetRescueBusOk() + return +} + +// GetRescueBusOk returns a tuple with the RescueBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetRescueBusOk() (ret ImageConfigGetRescueBusRetType, ok bool) { + return getImageConfigGetRescueBusAttributeTypeOk(o.RescueBus) +} + +// HasRescueBus returns a boolean if a field has been set. +func (o *ImageConfig) HasRescueBus() bool { + _, ok := o.GetRescueBusOk() + return ok +} + +// SetRescueBus gets a reference to the given string and assigns it to the RescueBus field. +func (o *ImageConfig) SetRescueBus(v ImageConfigGetRescueBusRetType) { + setImageConfigGetRescueBusAttributeType(&o.RescueBus, v) +} + +// SetRescueBusNil sets the value for RescueBus to be an explicit nil +func (o *ImageConfig) SetRescueBusNil() { + o.RescueBus = nil +} + +// UnsetRescueBus ensures that no value is present for RescueBus, not even an explicit nil +func (o *ImageConfig) UnsetRescueBus() { + o.RescueBus = nil +} + +// GetRescueDevice returns the RescueDevice field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetRescueDevice() (res ImageConfigGetRescueDeviceRetType) { + res, _ = o.GetRescueDeviceOk() + return +} + +// GetRescueDeviceOk returns a tuple with the RescueDevice field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetRescueDeviceOk() (ret ImageConfigGetRescueDeviceRetType, ok bool) { + return getImageConfigGetRescueDeviceAttributeTypeOk(o.RescueDevice) +} + +// HasRescueDevice returns a boolean if a field has been set. +func (o *ImageConfig) HasRescueDevice() bool { + _, ok := o.GetRescueDeviceOk() + return ok +} + +// SetRescueDevice gets a reference to the given string and assigns it to the RescueDevice field. +func (o *ImageConfig) SetRescueDevice(v ImageConfigGetRescueDeviceRetType) { + setImageConfigGetRescueDeviceAttributeType(&o.RescueDevice, v) +} + +// SetRescueDeviceNil sets the value for RescueDevice to be an explicit nil +func (o *ImageConfig) SetRescueDeviceNil() { + o.RescueDevice = nil +} + +// UnsetRescueDevice ensures that no value is present for RescueDevice, not even an explicit nil +func (o *ImageConfig) UnsetRescueDevice() { + o.RescueDevice = nil +} + +// GetSecureBoot returns the SecureBoot field value if set, zero value otherwise. +func (o *ImageConfig) GetSecureBoot() (res ImageConfiggetSecureBootRetType) { + res, _ = o.GetSecureBootOk() + return +} + +// GetSecureBootOk returns a tuple with the SecureBoot field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetSecureBootOk() (ret ImageConfiggetSecureBootRetType, ok bool) { + return getImageConfiggetSecureBootAttributeTypeOk(o.SecureBoot) +} + +// HasSecureBoot returns a boolean if a field has been set. +func (o *ImageConfig) HasSecureBoot() bool { + _, ok := o.GetSecureBootOk() + return ok +} + +// SetSecureBoot gets a reference to the given bool and assigns it to the SecureBoot field. +func (o *ImageConfig) SetSecureBoot(v ImageConfiggetSecureBootRetType) { + setImageConfiggetSecureBootAttributeType(&o.SecureBoot, v) +} + +// GetUefi returns the Uefi field value if set, zero value otherwise. +func (o *ImageConfig) GetUefi() (res ImageConfiggetUefiRetType) { + res, _ = o.GetUefiOk() + return +} + +// GetUefiOk returns a tuple with the Uefi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetUefiOk() (ret ImageConfiggetUefiRetType, ok bool) { + return getImageConfiggetUefiAttributeTypeOk(o.Uefi) +} + +// HasUefi returns a boolean if a field has been set. +func (o *ImageConfig) HasUefi() bool { + _, ok := o.GetUefiOk() + return ok +} + +// SetUefi gets a reference to the given bool and assigns it to the Uefi field. +func (o *ImageConfig) SetUefi(v ImageConfiggetUefiRetType) { + setImageConfiggetUefiAttributeType(&o.Uefi, v) +} + +// GetVideoModel returns the VideoModel field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetVideoModel() (res ImageConfigGetVideoModelRetType) { + res, _ = o.GetVideoModelOk() + return +} + +// GetVideoModelOk returns a tuple with the VideoModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetVideoModelOk() (ret ImageConfigGetVideoModelRetType, ok bool) { + return getImageConfigGetVideoModelAttributeTypeOk(o.VideoModel) +} + +// HasVideoModel returns a boolean if a field has been set. +func (o *ImageConfig) HasVideoModel() bool { + _, ok := o.GetVideoModelOk() + return ok +} + +// SetVideoModel gets a reference to the given string and assigns it to the VideoModel field. +func (o *ImageConfig) SetVideoModel(v ImageConfigGetVideoModelRetType) { + setImageConfigGetVideoModelAttributeType(&o.VideoModel, v) +} + +// SetVideoModelNil sets the value for VideoModel to be an explicit nil +func (o *ImageConfig) SetVideoModelNil() { + o.VideoModel = nil +} + +// UnsetVideoModel ensures that no value is present for VideoModel, not even an explicit nil +func (o *ImageConfig) UnsetVideoModel() { + o.VideoModel = nil +} + +// GetVirtioScsi returns the VirtioScsi field value if set, zero value otherwise. +func (o *ImageConfig) GetVirtioScsi() (res ImageConfiggetVirtioScsiRetType) { + res, _ = o.GetVirtioScsiOk() + return +} + +// GetVirtioScsiOk returns a tuple with the VirtioScsi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetVirtioScsiOk() (ret ImageConfiggetVirtioScsiRetType, ok bool) { + return getImageConfiggetVirtioScsiAttributeTypeOk(o.VirtioScsi) +} + +// HasVirtioScsi returns a boolean if a field has been set. +func (o *ImageConfig) HasVirtioScsi() bool { + _, ok := o.GetVirtioScsiOk() + return ok +} + +// SetVirtioScsi gets a reference to the given bool and assigns it to the VirtioScsi field. +func (o *ImageConfig) SetVirtioScsi(v ImageConfiggetVirtioScsiRetType) { + setImageConfiggetVirtioScsiAttributeType(&o.VirtioScsi, v) +} + +func (o ImageConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageConfigGetArchitectureAttributeTypeOk(o.Architecture); ok { + toSerialize["Architecture"] = val + } + if val, ok := getImageConfiggetBootMenuAttributeTypeOk(o.BootMenu); ok { + toSerialize["BootMenu"] = val + } + if val, ok := getImageConfigGetCdromBusAttributeTypeOk(o.CdromBus); ok { + toSerialize["CdromBus"] = val + } + if val, ok := getImageConfigGetDiskBusAttributeTypeOk(o.DiskBus); ok { + toSerialize["DiskBus"] = val + } + if val, ok := getImageConfigGetNicModelAttributeTypeOk(o.NicModel); ok { + toSerialize["NicModel"] = val + } + if val, ok := getImageConfigGetOperatingSystemAttributeTypeOk(o.OperatingSystem); ok { + toSerialize["OperatingSystem"] = val + } + if val, ok := getImageConfigGetOperatingSystemDistroAttributeTypeOk(o.OperatingSystemDistro); ok { + toSerialize["OperatingSystemDistro"] = val + } + if val, ok := getImageConfigGetOperatingSystemVersionAttributeTypeOk(o.OperatingSystemVersion); ok { + toSerialize["OperatingSystemVersion"] = val + } + if val, ok := getImageConfigGetRescueBusAttributeTypeOk(o.RescueBus); ok { + toSerialize["RescueBus"] = val + } + if val, ok := getImageConfigGetRescueDeviceAttributeTypeOk(o.RescueDevice); ok { + toSerialize["RescueDevice"] = val + } + if val, ok := getImageConfiggetSecureBootAttributeTypeOk(o.SecureBoot); ok { + toSerialize["SecureBoot"] = val + } + if val, ok := getImageConfiggetUefiAttributeTypeOk(o.Uefi); ok { + toSerialize["Uefi"] = val + } + if val, ok := getImageConfigGetVideoModelAttributeTypeOk(o.VideoModel); ok { + toSerialize["VideoModel"] = val + } + if val, ok := getImageConfiggetVirtioScsiAttributeTypeOk(o.VirtioScsi); ok { + toSerialize["VirtioScsi"] = val + } + return toSerialize, nil +} + +type NullableImageConfig struct { + value *ImageConfig + isSet bool +} + +func (v NullableImageConfig) Get() *ImageConfig { + return v.value +} + +func (v *NullableImageConfig) Set(val *ImageConfig) { + v.value = val + v.isSet = true +} + +func (v NullableImageConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableImageConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageConfig(val *ImageConfig) *NullableImageConfig { + return &NullableImageConfig{value: val, isSet: true} +} + +func (v NullableImageConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_image_config_test.go b/pkg/iaasbeta/model_image_config_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_image_config_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_image_create_response.go b/pkg/iaasbeta/model_image_create_response.go new file mode 100644 index 00000000..7d77801c --- /dev/null +++ b/pkg/iaasbeta/model_image_create_response.go @@ -0,0 +1,171 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ImageCreateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageCreateResponse{} + +/* + types and functions for id +*/ + +// isNotNullableString +type ImageCreateResponseGetIdAttributeType = *string + +func getImageCreateResponseGetIdAttributeTypeOk(arg ImageCreateResponseGetIdAttributeType) (ret ImageCreateResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageCreateResponseGetIdAttributeType(arg *ImageCreateResponseGetIdAttributeType, val ImageCreateResponseGetIdRetType) { + *arg = &val +} + +type ImageCreateResponseGetIdArgType = string +type ImageCreateResponseGetIdRetType = string + +/* + types and functions for uploadUrl +*/ + +// isNotNullableString +type ImageCreateResponseGetUploadUrlAttributeType = *string + +func getImageCreateResponseGetUploadUrlAttributeTypeOk(arg ImageCreateResponseGetUploadUrlAttributeType) (ret ImageCreateResponseGetUploadUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageCreateResponseGetUploadUrlAttributeType(arg *ImageCreateResponseGetUploadUrlAttributeType, val ImageCreateResponseGetUploadUrlRetType) { + *arg = &val +} + +type ImageCreateResponseGetUploadUrlArgType = string +type ImageCreateResponseGetUploadUrlRetType = string + +// ImageCreateResponse Image creation response. +type ImageCreateResponse struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id ImageCreateResponseGetIdAttributeType `json:"id" required:"true"` + // REQUIRED + UploadUrl ImageCreateResponseGetUploadUrlAttributeType `json:"uploadUrl" required:"true"` +} + +type _ImageCreateResponse ImageCreateResponse + +// NewImageCreateResponse instantiates a new ImageCreateResponse 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 NewImageCreateResponse(id ImageCreateResponseGetIdArgType, uploadUrl ImageCreateResponseGetUploadUrlArgType) *ImageCreateResponse { + this := ImageCreateResponse{} + setImageCreateResponseGetIdAttributeType(&this.Id, id) + setImageCreateResponseGetUploadUrlAttributeType(&this.UploadUrl, uploadUrl) + return &this +} + +// NewImageCreateResponseWithDefaults instantiates a new ImageCreateResponse 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 NewImageCreateResponseWithDefaults() *ImageCreateResponse { + this := ImageCreateResponse{} + return &this +} + +// GetId returns the Id field value +func (o *ImageCreateResponse) GetId() (ret ImageCreateResponseGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ImageCreateResponse) GetIdOk() (ret ImageCreateResponseGetIdRetType, ok bool) { + return getImageCreateResponseGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *ImageCreateResponse) SetId(v ImageCreateResponseGetIdRetType) { + setImageCreateResponseGetIdAttributeType(&o.Id, v) +} + +// GetUploadUrl returns the UploadUrl field value +func (o *ImageCreateResponse) GetUploadUrl() (ret ImageCreateResponseGetUploadUrlRetType) { + ret, _ = o.GetUploadUrlOk() + return ret +} + +// GetUploadUrlOk returns a tuple with the UploadUrl field value +// and a boolean to check if the value has been set. +func (o *ImageCreateResponse) GetUploadUrlOk() (ret ImageCreateResponseGetUploadUrlRetType, ok bool) { + return getImageCreateResponseGetUploadUrlAttributeTypeOk(o.UploadUrl) +} + +// SetUploadUrl sets field value +func (o *ImageCreateResponse) SetUploadUrl(v ImageCreateResponseGetUploadUrlRetType) { + setImageCreateResponseGetUploadUrlAttributeType(&o.UploadUrl, v) +} + +func (o ImageCreateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageCreateResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getImageCreateResponseGetUploadUrlAttributeTypeOk(o.UploadUrl); ok { + toSerialize["UploadUrl"] = val + } + return toSerialize, nil +} + +type NullableImageCreateResponse struct { + value *ImageCreateResponse + isSet bool +} + +func (v NullableImageCreateResponse) Get() *ImageCreateResponse { + return v.value +} + +func (v *NullableImageCreateResponse) Set(val *ImageCreateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableImageCreateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableImageCreateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageCreateResponse(val *ImageCreateResponse) *NullableImageCreateResponse { + return &NullableImageCreateResponse{value: val, isSet: true} +} + +func (v NullableImageCreateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageCreateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_image_create_response_test.go b/pkg/iaasbeta/model_image_create_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_image_create_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_image_list_response.go b/pkg/iaasbeta/model_image_list_response.go new file mode 100644 index 00000000..cfd04ef9 --- /dev/null +++ b/pkg/iaasbeta/model_image_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ImageListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageListResponse{} + +/* + types and functions for items +*/ + +// isArray +type ImageListResponseGetItemsAttributeType = *[]Image +type ImageListResponseGetItemsArgType = []Image +type ImageListResponseGetItemsRetType = []Image + +func getImageListResponseGetItemsAttributeTypeOk(arg ImageListResponseGetItemsAttributeType) (ret ImageListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageListResponseGetItemsAttributeType(arg *ImageListResponseGetItemsAttributeType, val ImageListResponseGetItemsRetType) { + *arg = &val +} + +// ImageListResponse Image list response. +type ImageListResponse struct { + // A list containing image objects. + // REQUIRED + Items ImageListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _ImageListResponse ImageListResponse + +// NewImageListResponse instantiates a new ImageListResponse 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 NewImageListResponse(items ImageListResponseGetItemsArgType) *ImageListResponse { + this := ImageListResponse{} + setImageListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewImageListResponseWithDefaults instantiates a new ImageListResponse 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 NewImageListResponseWithDefaults() *ImageListResponse { + this := ImageListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ImageListResponse) GetItems() (ret ImageListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ImageListResponse) GetItemsOk() (ret ImageListResponseGetItemsRetType, ok bool) { + return getImageListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *ImageListResponse) SetItems(v ImageListResponseGetItemsRetType) { + setImageListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o ImageListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableImageListResponse struct { + value *ImageListResponse + isSet bool +} + +func (v NullableImageListResponse) Get() *ImageListResponse { + return v.value +} + +func (v *NullableImageListResponse) Set(val *ImageListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableImageListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableImageListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageListResponse(val *ImageListResponse) *NullableImageListResponse { + return &NullableImageListResponse{value: val, isSet: true} +} + +func (v NullableImageListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_image_list_response_test.go b/pkg/iaasbeta/model_image_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_image_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_image_share.go b/pkg/iaasbeta/model_image_share.go new file mode 100644 index 00000000..364ee7c9 --- /dev/null +++ b/pkg/iaasbeta/model_image_share.go @@ -0,0 +1,176 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ImageShare type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageShare{} + +/* + types and functions for parentOrganization +*/ + +// isBoolean +type ImageSharegetParentOrganizationAttributeType = *bool +type ImageSharegetParentOrganizationArgType = bool +type ImageSharegetParentOrganizationRetType = bool + +func getImageSharegetParentOrganizationAttributeTypeOk(arg ImageSharegetParentOrganizationAttributeType) (ret ImageSharegetParentOrganizationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageSharegetParentOrganizationAttributeType(arg *ImageSharegetParentOrganizationAttributeType, val ImageSharegetParentOrganizationRetType) { + *arg = &val +} + +/* + types and functions for projects +*/ + +// isArray +type ImageShareGetProjectsAttributeType = *[]string +type ImageShareGetProjectsArgType = []string +type ImageShareGetProjectsRetType = []string + +func getImageShareGetProjectsAttributeTypeOk(arg ImageShareGetProjectsAttributeType) (ret ImageShareGetProjectsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageShareGetProjectsAttributeType(arg *ImageShareGetProjectsAttributeType, val ImageShareGetProjectsRetType) { + *arg = &val +} + +// ImageShare Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. +type ImageShare struct { + // Image is shared with all projects inside the image owners organization. + ParentOrganization ImageSharegetParentOrganizationAttributeType `json:"parentOrganization,omitempty"` + // List of all projects the Image is shared with. + Projects ImageShareGetProjectsAttributeType `json:"projects,omitempty"` +} + +// NewImageShare instantiates a new ImageShare 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 NewImageShare() *ImageShare { + this := ImageShare{} + return &this +} + +// NewImageShareWithDefaults instantiates a new ImageShare 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 NewImageShareWithDefaults() *ImageShare { + this := ImageShare{} + return &this +} + +// GetParentOrganization returns the ParentOrganization field value if set, zero value otherwise. +func (o *ImageShare) GetParentOrganization() (res ImageSharegetParentOrganizationRetType) { + res, _ = o.GetParentOrganizationOk() + return +} + +// GetParentOrganizationOk returns a tuple with the ParentOrganization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShare) GetParentOrganizationOk() (ret ImageSharegetParentOrganizationRetType, ok bool) { + return getImageSharegetParentOrganizationAttributeTypeOk(o.ParentOrganization) +} + +// HasParentOrganization returns a boolean if a field has been set. +func (o *ImageShare) HasParentOrganization() bool { + _, ok := o.GetParentOrganizationOk() + return ok +} + +// SetParentOrganization gets a reference to the given bool and assigns it to the ParentOrganization field. +func (o *ImageShare) SetParentOrganization(v ImageSharegetParentOrganizationRetType) { + setImageSharegetParentOrganizationAttributeType(&o.ParentOrganization, v) +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *ImageShare) GetProjects() (res ImageShareGetProjectsRetType) { + res, _ = o.GetProjectsOk() + return +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShare) GetProjectsOk() (ret ImageShareGetProjectsRetType, ok bool) { + return getImageShareGetProjectsAttributeTypeOk(o.Projects) +} + +// HasProjects returns a boolean if a field has been set. +func (o *ImageShare) HasProjects() bool { + _, ok := o.GetProjectsOk() + return ok +} + +// SetProjects gets a reference to the given []string and assigns it to the Projects field. +func (o *ImageShare) SetProjects(v ImageShareGetProjectsRetType) { + setImageShareGetProjectsAttributeType(&o.Projects, v) +} + +func (o ImageShare) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageSharegetParentOrganizationAttributeTypeOk(o.ParentOrganization); ok { + toSerialize["ParentOrganization"] = val + } + if val, ok := getImageShareGetProjectsAttributeTypeOk(o.Projects); ok { + toSerialize["Projects"] = val + } + return toSerialize, nil +} + +type NullableImageShare struct { + value *ImageShare + isSet bool +} + +func (v NullableImageShare) Get() *ImageShare { + return v.value +} + +func (v *NullableImageShare) Set(val *ImageShare) { + v.value = val + v.isSet = true +} + +func (v NullableImageShare) IsSet() bool { + return v.isSet +} + +func (v *NullableImageShare) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageShare(val *ImageShare) *NullableImageShare { + return &NullableImageShare{value: val, isSet: true} +} + +func (v NullableImageShare) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageShare) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_image_share_consumer.go b/pkg/iaasbeta/model_image_share_consumer.go new file mode 100644 index 00000000..7eae0dba --- /dev/null +++ b/pkg/iaasbeta/model_image_share_consumer.go @@ -0,0 +1,275 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the ImageShareConsumer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageShareConsumer{} + +/* + types and functions for consumerProjectId +*/ + +// isNotNullableString +type ImageShareConsumerGetConsumerProjectIdAttributeType = *string + +func getImageShareConsumerGetConsumerProjectIdAttributeTypeOk(arg ImageShareConsumerGetConsumerProjectIdAttributeType) (ret ImageShareConsumerGetConsumerProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageShareConsumerGetConsumerProjectIdAttributeType(arg *ImageShareConsumerGetConsumerProjectIdAttributeType, val ImageShareConsumerGetConsumerProjectIdRetType) { + *arg = &val +} + +type ImageShareConsumerGetConsumerProjectIdArgType = string +type ImageShareConsumerGetConsumerProjectIdRetType = string + +/* + types and functions for createdAt +*/ + +// isDateTime +type ImageShareConsumerGetCreatedAtAttributeType = *time.Time +type ImageShareConsumerGetCreatedAtArgType = time.Time +type ImageShareConsumerGetCreatedAtRetType = time.Time + +func getImageShareConsumerGetCreatedAtAttributeTypeOk(arg ImageShareConsumerGetCreatedAtAttributeType) (ret ImageShareConsumerGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageShareConsumerGetCreatedAtAttributeType(arg *ImageShareConsumerGetCreatedAtAttributeType, val ImageShareConsumerGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for imageId +*/ + +// isNotNullableString +type ImageShareConsumerGetImageIdAttributeType = *string + +func getImageShareConsumerGetImageIdAttributeTypeOk(arg ImageShareConsumerGetImageIdAttributeType) (ret ImageShareConsumerGetImageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageShareConsumerGetImageIdAttributeType(arg *ImageShareConsumerGetImageIdAttributeType, val ImageShareConsumerGetImageIdRetType) { + *arg = &val +} + +type ImageShareConsumerGetImageIdArgType = string +type ImageShareConsumerGetImageIdRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type ImageShareConsumerGetUpdatedAtAttributeType = *time.Time +type ImageShareConsumerGetUpdatedAtArgType = time.Time +type ImageShareConsumerGetUpdatedAtRetType = time.Time + +func getImageShareConsumerGetUpdatedAtAttributeTypeOk(arg ImageShareConsumerGetUpdatedAtAttributeType) (ret ImageShareConsumerGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageShareConsumerGetUpdatedAtAttributeType(arg *ImageShareConsumerGetUpdatedAtAttributeType, val ImageShareConsumerGetUpdatedAtRetType) { + *arg = &val +} + +// ImageShareConsumer The details of an Image share consumer. +type ImageShareConsumer struct { + // Universally Unique Identifier (UUID). + ConsumerProjectId ImageShareConsumerGetConsumerProjectIdAttributeType `json:"consumerProjectId,omitempty"` + // Date-time when resource was created. + CreatedAt ImageShareConsumerGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + ImageId ImageShareConsumerGetImageIdAttributeType `json:"imageId,omitempty"` + // Date-time when resource was last updated. + UpdatedAt ImageShareConsumerGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +// NewImageShareConsumer instantiates a new ImageShareConsumer 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 NewImageShareConsumer() *ImageShareConsumer { + this := ImageShareConsumer{} + return &this +} + +// NewImageShareConsumerWithDefaults instantiates a new ImageShareConsumer 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 NewImageShareConsumerWithDefaults() *ImageShareConsumer { + this := ImageShareConsumer{} + return &this +} + +// GetConsumerProjectId returns the ConsumerProjectId field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetConsumerProjectId() (res ImageShareConsumerGetConsumerProjectIdRetType) { + res, _ = o.GetConsumerProjectIdOk() + return +} + +// GetConsumerProjectIdOk returns a tuple with the ConsumerProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetConsumerProjectIdOk() (ret ImageShareConsumerGetConsumerProjectIdRetType, ok bool) { + return getImageShareConsumerGetConsumerProjectIdAttributeTypeOk(o.ConsumerProjectId) +} + +// HasConsumerProjectId returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasConsumerProjectId() bool { + _, ok := o.GetConsumerProjectIdOk() + return ok +} + +// SetConsumerProjectId gets a reference to the given string and assigns it to the ConsumerProjectId field. +func (o *ImageShareConsumer) SetConsumerProjectId(v ImageShareConsumerGetConsumerProjectIdRetType) { + setImageShareConsumerGetConsumerProjectIdAttributeType(&o.ConsumerProjectId, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetCreatedAt() (res ImageShareConsumerGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetCreatedAtOk() (ret ImageShareConsumerGetCreatedAtRetType, ok bool) { + return getImageShareConsumerGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *ImageShareConsumer) SetCreatedAt(v ImageShareConsumerGetCreatedAtRetType) { + setImageShareConsumerGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetImageId returns the ImageId field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetImageId() (res ImageShareConsumerGetImageIdRetType) { + res, _ = o.GetImageIdOk() + return +} + +// GetImageIdOk returns a tuple with the ImageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetImageIdOk() (ret ImageShareConsumerGetImageIdRetType, ok bool) { + return getImageShareConsumerGetImageIdAttributeTypeOk(o.ImageId) +} + +// HasImageId returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasImageId() bool { + _, ok := o.GetImageIdOk() + return ok +} + +// SetImageId gets a reference to the given string and assigns it to the ImageId field. +func (o *ImageShareConsumer) SetImageId(v ImageShareConsumerGetImageIdRetType) { + setImageShareConsumerGetImageIdAttributeType(&o.ImageId, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetUpdatedAt() (res ImageShareConsumerGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetUpdatedAtOk() (ret ImageShareConsumerGetUpdatedAtRetType, ok bool) { + return getImageShareConsumerGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *ImageShareConsumer) SetUpdatedAt(v ImageShareConsumerGetUpdatedAtRetType) { + setImageShareConsumerGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o ImageShareConsumer) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageShareConsumerGetConsumerProjectIdAttributeTypeOk(o.ConsumerProjectId); ok { + toSerialize["ConsumerProjectId"] = val + } + if val, ok := getImageShareConsumerGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getImageShareConsumerGetImageIdAttributeTypeOk(o.ImageId); ok { + toSerialize["ImageId"] = val + } + if val, ok := getImageShareConsumerGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableImageShareConsumer struct { + value *ImageShareConsumer + isSet bool +} + +func (v NullableImageShareConsumer) Get() *ImageShareConsumer { + return v.value +} + +func (v *NullableImageShareConsumer) Set(val *ImageShareConsumer) { + v.value = val + v.isSet = true +} + +func (v NullableImageShareConsumer) IsSet() bool { + return v.isSet +} + +func (v *NullableImageShareConsumer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageShareConsumer(val *ImageShareConsumer) *NullableImageShareConsumer { + return &NullableImageShareConsumer{value: val, isSet: true} +} + +func (v NullableImageShareConsumer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageShareConsumer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_image_share_consumer_test.go b/pkg/iaasbeta/model_image_share_consumer_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_image_share_consumer_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_image_share_test.go b/pkg/iaasbeta/model_image_share_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_image_share_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_image_test.go b/pkg/iaasbeta/model_image_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_image_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_key_pair_list_response.go b/pkg/iaasbeta/model_key_pair_list_response.go new file mode 100644 index 00000000..e32346e2 --- /dev/null +++ b/pkg/iaasbeta/model_key_pair_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the KeyPairListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KeyPairListResponse{} + +/* + types and functions for items +*/ + +// isArray +type KeyPairListResponseGetItemsAttributeType = *[]Keypair +type KeyPairListResponseGetItemsArgType = []Keypair +type KeyPairListResponseGetItemsRetType = []Keypair + +func getKeyPairListResponseGetItemsAttributeTypeOk(arg KeyPairListResponseGetItemsAttributeType) (ret KeyPairListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyPairListResponseGetItemsAttributeType(arg *KeyPairListResponseGetItemsAttributeType, val KeyPairListResponseGetItemsRetType) { + *arg = &val +} + +// KeyPairListResponse SSH keypair list response. +type KeyPairListResponse struct { + // A list of SSH keypairs. + // REQUIRED + Items KeyPairListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _KeyPairListResponse KeyPairListResponse + +// NewKeyPairListResponse instantiates a new KeyPairListResponse 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 NewKeyPairListResponse(items KeyPairListResponseGetItemsArgType) *KeyPairListResponse { + this := KeyPairListResponse{} + setKeyPairListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewKeyPairListResponseWithDefaults instantiates a new KeyPairListResponse 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 NewKeyPairListResponseWithDefaults() *KeyPairListResponse { + this := KeyPairListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *KeyPairListResponse) GetItems() (ret KeyPairListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *KeyPairListResponse) GetItemsOk() (ret KeyPairListResponseGetItemsRetType, ok bool) { + return getKeyPairListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *KeyPairListResponse) SetItems(v KeyPairListResponseGetItemsRetType) { + setKeyPairListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o KeyPairListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKeyPairListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableKeyPairListResponse struct { + value *KeyPairListResponse + isSet bool +} + +func (v NullableKeyPairListResponse) Get() *KeyPairListResponse { + return v.value +} + +func (v *NullableKeyPairListResponse) Set(val *KeyPairListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableKeyPairListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableKeyPairListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeyPairListResponse(val *KeyPairListResponse) *NullableKeyPairListResponse { + return &NullableKeyPairListResponse{value: val, isSet: true} +} + +func (v NullableKeyPairListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeyPairListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_key_pair_list_response_test.go b/pkg/iaasbeta/model_key_pair_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_key_pair_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_keypair.go b/pkg/iaasbeta/model_keypair.go new file mode 100644 index 00000000..951af7e9 --- /dev/null +++ b/pkg/iaasbeta/model_keypair.go @@ -0,0 +1,370 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Keypair type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Keypair{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type KeypairGetCreatedAtAttributeType = *time.Time +type KeypairGetCreatedAtArgType = time.Time +type KeypairGetCreatedAtRetType = time.Time + +func getKeypairGetCreatedAtAttributeTypeOk(arg KeypairGetCreatedAtAttributeType) (ret KeypairGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetCreatedAtAttributeType(arg *KeypairGetCreatedAtAttributeType, val KeypairGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for fingerprint +*/ + +// isNotNullableString +type KeypairGetFingerprintAttributeType = *string + +func getKeypairGetFingerprintAttributeTypeOk(arg KeypairGetFingerprintAttributeType) (ret KeypairGetFingerprintRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetFingerprintAttributeType(arg *KeypairGetFingerprintAttributeType, val KeypairGetFingerprintRetType) { + *arg = &val +} + +type KeypairGetFingerprintArgType = string +type KeypairGetFingerprintRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type KeypairGetLabelsAttributeType = *map[string]interface{} +type KeypairGetLabelsArgType = map[string]interface{} +type KeypairGetLabelsRetType = map[string]interface{} + +func getKeypairGetLabelsAttributeTypeOk(arg KeypairGetLabelsAttributeType) (ret KeypairGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetLabelsAttributeType(arg *KeypairGetLabelsAttributeType, val KeypairGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type KeypairGetNameAttributeType = *string + +func getKeypairGetNameAttributeTypeOk(arg KeypairGetNameAttributeType) (ret KeypairGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetNameAttributeType(arg *KeypairGetNameAttributeType, val KeypairGetNameRetType) { + *arg = &val +} + +type KeypairGetNameArgType = string +type KeypairGetNameRetType = string + +/* + types and functions for publicKey +*/ + +// isNotNullableString +type KeypairGetPublicKeyAttributeType = *string + +func getKeypairGetPublicKeyAttributeTypeOk(arg KeypairGetPublicKeyAttributeType) (ret KeypairGetPublicKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetPublicKeyAttributeType(arg *KeypairGetPublicKeyAttributeType, val KeypairGetPublicKeyRetType) { + *arg = &val +} + +type KeypairGetPublicKeyArgType = string +type KeypairGetPublicKeyRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type KeypairGetUpdatedAtAttributeType = *time.Time +type KeypairGetUpdatedAtArgType = time.Time +type KeypairGetUpdatedAtRetType = time.Time + +func getKeypairGetUpdatedAtAttributeTypeOk(arg KeypairGetUpdatedAtAttributeType) (ret KeypairGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetUpdatedAtAttributeType(arg *KeypairGetUpdatedAtAttributeType, val KeypairGetUpdatedAtRetType) { + *arg = &val +} + +// Keypair Object that represents the public key of an SSH keypair and its name. +type Keypair struct { + // Date-time when resource was created. + CreatedAt KeypairGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Object that represents an SSH keypair MD5 fingerprint. + Fingerprint KeypairGetFingerprintAttributeType `json:"fingerprint,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels KeypairGetLabelsAttributeType `json:"labels,omitempty"` + // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. + Name KeypairGetNameAttributeType `json:"name,omitempty"` + // Object that represents a public SSH key. + // REQUIRED + PublicKey KeypairGetPublicKeyAttributeType `json:"publicKey" required:"true"` + // Date-time when resource was last updated. + UpdatedAt KeypairGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Keypair Keypair + +// NewKeypair instantiates a new Keypair 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 NewKeypair(publicKey KeypairGetPublicKeyArgType) *Keypair { + this := Keypair{} + setKeypairGetPublicKeyAttributeType(&this.PublicKey, publicKey) + return &this +} + +// NewKeypairWithDefaults instantiates a new Keypair 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 NewKeypairWithDefaults() *Keypair { + this := Keypair{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Keypair) GetCreatedAt() (res KeypairGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Keypair) GetCreatedAtOk() (ret KeypairGetCreatedAtRetType, ok bool) { + return getKeypairGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Keypair) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Keypair) SetCreatedAt(v KeypairGetCreatedAtRetType) { + setKeypairGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetFingerprint returns the Fingerprint field value if set, zero value otherwise. +func (o *Keypair) GetFingerprint() (res KeypairGetFingerprintRetType) { + res, _ = o.GetFingerprintOk() + return +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Keypair) GetFingerprintOk() (ret KeypairGetFingerprintRetType, ok bool) { + return getKeypairGetFingerprintAttributeTypeOk(o.Fingerprint) +} + +// HasFingerprint returns a boolean if a field has been set. +func (o *Keypair) HasFingerprint() bool { + _, ok := o.GetFingerprintOk() + return ok +} + +// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field. +func (o *Keypair) SetFingerprint(v KeypairGetFingerprintRetType) { + setKeypairGetFingerprintAttributeType(&o.Fingerprint, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Keypair) GetLabels() (res KeypairGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Keypair) GetLabelsOk() (ret KeypairGetLabelsRetType, ok bool) { + return getKeypairGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Keypair) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Keypair) SetLabels(v KeypairGetLabelsRetType) { + setKeypairGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Keypair) GetName() (res KeypairGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Keypair) GetNameOk() (ret KeypairGetNameRetType, ok bool) { + return getKeypairGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Keypair) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Keypair) SetName(v KeypairGetNameRetType) { + setKeypairGetNameAttributeType(&o.Name, v) +} + +// GetPublicKey returns the PublicKey field value +func (o *Keypair) GetPublicKey() (ret KeypairGetPublicKeyRetType) { + ret, _ = o.GetPublicKeyOk() + return ret +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *Keypair) GetPublicKeyOk() (ret KeypairGetPublicKeyRetType, ok bool) { + return getKeypairGetPublicKeyAttributeTypeOk(o.PublicKey) +} + +// SetPublicKey sets field value +func (o *Keypair) SetPublicKey(v KeypairGetPublicKeyRetType) { + setKeypairGetPublicKeyAttributeType(&o.PublicKey, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Keypair) GetUpdatedAt() (res KeypairGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Keypair) GetUpdatedAtOk() (ret KeypairGetUpdatedAtRetType, ok bool) { + return getKeypairGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Keypair) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Keypair) SetUpdatedAt(v KeypairGetUpdatedAtRetType) { + setKeypairGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Keypair) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKeypairGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getKeypairGetFingerprintAttributeTypeOk(o.Fingerprint); ok { + toSerialize["Fingerprint"] = val + } + if val, ok := getKeypairGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getKeypairGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getKeypairGetPublicKeyAttributeTypeOk(o.PublicKey); ok { + toSerialize["PublicKey"] = val + } + if val, ok := getKeypairGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableKeypair struct { + value *Keypair + isSet bool +} + +func (v NullableKeypair) Get() *Keypair { + return v.value +} + +func (v *NullableKeypair) Set(val *Keypair) { + v.value = val + v.isSet = true +} + +func (v NullableKeypair) IsSet() bool { + return v.isSet +} + +func (v *NullableKeypair) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeypair(val *Keypair) *NullableKeypair { + return &NullableKeypair{value: val, isSet: true} +} + +func (v NullableKeypair) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeypair) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_keypair_test.go b/pkg/iaasbeta/model_keypair_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_keypair_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_machine_type.go b/pkg/iaasbeta/model_machine_type.go new file mode 100644 index 00000000..d178542b --- /dev/null +++ b/pkg/iaasbeta/model_machine_type.go @@ -0,0 +1,356 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the MachineType type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MachineType{} + +/* + types and functions for description +*/ + +// isNotNullableString +type MachineTypeGetDescriptionAttributeType = *string + +func getMachineTypeGetDescriptionAttributeTypeOk(arg MachineTypeGetDescriptionAttributeType) (ret MachineTypeGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetDescriptionAttributeType(arg *MachineTypeGetDescriptionAttributeType, val MachineTypeGetDescriptionRetType) { + *arg = &val +} + +type MachineTypeGetDescriptionArgType = string +type MachineTypeGetDescriptionRetType = string + +/* + types and functions for disk +*/ + +// isLong +type MachineTypeGetDiskAttributeType = *int64 +type MachineTypeGetDiskArgType = int64 +type MachineTypeGetDiskRetType = int64 + +func getMachineTypeGetDiskAttributeTypeOk(arg MachineTypeGetDiskAttributeType) (ret MachineTypeGetDiskRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetDiskAttributeType(arg *MachineTypeGetDiskAttributeType, val MachineTypeGetDiskRetType) { + *arg = &val +} + +/* + types and functions for extraSpecs +*/ + +// isFreeform +type MachineTypeGetExtraSpecsAttributeType = *map[string]interface{} +type MachineTypeGetExtraSpecsArgType = map[string]interface{} +type MachineTypeGetExtraSpecsRetType = map[string]interface{} + +func getMachineTypeGetExtraSpecsAttributeTypeOk(arg MachineTypeGetExtraSpecsAttributeType) (ret MachineTypeGetExtraSpecsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetExtraSpecsAttributeType(arg *MachineTypeGetExtraSpecsAttributeType, val MachineTypeGetExtraSpecsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type MachineTypeGetNameAttributeType = *string + +func getMachineTypeGetNameAttributeTypeOk(arg MachineTypeGetNameAttributeType) (ret MachineTypeGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetNameAttributeType(arg *MachineTypeGetNameAttributeType, val MachineTypeGetNameRetType) { + *arg = &val +} + +type MachineTypeGetNameArgType = string +type MachineTypeGetNameRetType = string + +/* + types and functions for ram +*/ + +// isLong +type MachineTypeGetRamAttributeType = *int64 +type MachineTypeGetRamArgType = int64 +type MachineTypeGetRamRetType = int64 + +func getMachineTypeGetRamAttributeTypeOk(arg MachineTypeGetRamAttributeType) (ret MachineTypeGetRamRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetRamAttributeType(arg *MachineTypeGetRamAttributeType, val MachineTypeGetRamRetType) { + *arg = &val +} + +/* + types and functions for vcpus +*/ + +// isLong +type MachineTypeGetVcpusAttributeType = *int64 +type MachineTypeGetVcpusArgType = int64 +type MachineTypeGetVcpusRetType = int64 + +func getMachineTypeGetVcpusAttributeTypeOk(arg MachineTypeGetVcpusAttributeType) (ret MachineTypeGetVcpusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetVcpusAttributeType(arg *MachineTypeGetVcpusAttributeType, val MachineTypeGetVcpusRetType) { + *arg = &val +} + +// MachineType Machine Type. Filterable Fields: `disk`, `extraSpecs`, `name`, `ram`, `vcpus`. +type MachineType struct { + // Description Object. Allows string up to 255 Characters. + Description MachineTypeGetDescriptionAttributeType `json:"description,omitempty"` + // Size in Gigabyte. + // REQUIRED + Disk MachineTypeGetDiskAttributeType `json:"disk" required:"true"` + // Properties to control certain aspects or scheduling behavior for an object. + ExtraSpecs MachineTypeGetExtraSpecsAttributeType `json:"extraSpecs,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name MachineTypeGetNameAttributeType `json:"name" required:"true"` + // Size in Megabyte. + // REQUIRED + Ram MachineTypeGetRamAttributeType `json:"ram" required:"true"` + // The number of virtual CPUs of a server. + // REQUIRED + Vcpus MachineTypeGetVcpusAttributeType `json:"vcpus" required:"true"` +} + +type _MachineType MachineType + +// NewMachineType instantiates a new MachineType 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 NewMachineType(disk MachineTypeGetDiskArgType, name MachineTypeGetNameArgType, ram MachineTypeGetRamArgType, vcpus MachineTypeGetVcpusArgType) *MachineType { + this := MachineType{} + setMachineTypeGetDiskAttributeType(&this.Disk, disk) + setMachineTypeGetNameAttributeType(&this.Name, name) + setMachineTypeGetRamAttributeType(&this.Ram, ram) + setMachineTypeGetVcpusAttributeType(&this.Vcpus, vcpus) + return &this +} + +// NewMachineTypeWithDefaults instantiates a new MachineType 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 NewMachineTypeWithDefaults() *MachineType { + this := MachineType{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *MachineType) GetDescription() (res MachineTypeGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MachineType) GetDescriptionOk() (ret MachineTypeGetDescriptionRetType, ok bool) { + return getMachineTypeGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *MachineType) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *MachineType) SetDescription(v MachineTypeGetDescriptionRetType) { + setMachineTypeGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisk returns the Disk field value +func (o *MachineType) GetDisk() (ret MachineTypeGetDiskRetType) { + ret, _ = o.GetDiskOk() + return ret +} + +// GetDiskOk returns a tuple with the Disk field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetDiskOk() (ret MachineTypeGetDiskRetType, ok bool) { + return getMachineTypeGetDiskAttributeTypeOk(o.Disk) +} + +// SetDisk sets field value +func (o *MachineType) SetDisk(v MachineTypeGetDiskRetType) { + setMachineTypeGetDiskAttributeType(&o.Disk, v) +} + +// GetExtraSpecs returns the ExtraSpecs field value if set, zero value otherwise. +func (o *MachineType) GetExtraSpecs() (res MachineTypeGetExtraSpecsRetType) { + res, _ = o.GetExtraSpecsOk() + return +} + +// GetExtraSpecsOk returns a tuple with the ExtraSpecs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MachineType) GetExtraSpecsOk() (ret MachineTypeGetExtraSpecsRetType, ok bool) { + return getMachineTypeGetExtraSpecsAttributeTypeOk(o.ExtraSpecs) +} + +// HasExtraSpecs returns a boolean if a field has been set. +func (o *MachineType) HasExtraSpecs() bool { + _, ok := o.GetExtraSpecsOk() + return ok +} + +// SetExtraSpecs gets a reference to the given map[string]interface{} and assigns it to the ExtraSpecs field. +func (o *MachineType) SetExtraSpecs(v MachineTypeGetExtraSpecsRetType) { + setMachineTypeGetExtraSpecsAttributeType(&o.ExtraSpecs, v) +} + +// GetName returns the Name field value +func (o *MachineType) GetName() (ret MachineTypeGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetNameOk() (ret MachineTypeGetNameRetType, ok bool) { + return getMachineTypeGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *MachineType) SetName(v MachineTypeGetNameRetType) { + setMachineTypeGetNameAttributeType(&o.Name, v) +} + +// GetRam returns the Ram field value +func (o *MachineType) GetRam() (ret MachineTypeGetRamRetType) { + ret, _ = o.GetRamOk() + return ret +} + +// GetRamOk returns a tuple with the Ram field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetRamOk() (ret MachineTypeGetRamRetType, ok bool) { + return getMachineTypeGetRamAttributeTypeOk(o.Ram) +} + +// SetRam sets field value +func (o *MachineType) SetRam(v MachineTypeGetRamRetType) { + setMachineTypeGetRamAttributeType(&o.Ram, v) +} + +// GetVcpus returns the Vcpus field value +func (o *MachineType) GetVcpus() (ret MachineTypeGetVcpusRetType) { + ret, _ = o.GetVcpusOk() + return ret +} + +// GetVcpusOk returns a tuple with the Vcpus field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetVcpusOk() (ret MachineTypeGetVcpusRetType, ok bool) { + return getMachineTypeGetVcpusAttributeTypeOk(o.Vcpus) +} + +// SetVcpus sets field value +func (o *MachineType) SetVcpus(v MachineTypeGetVcpusRetType) { + setMachineTypeGetVcpusAttributeType(&o.Vcpus, v) +} + +func (o MachineType) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getMachineTypeGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getMachineTypeGetDiskAttributeTypeOk(o.Disk); ok { + toSerialize["Disk"] = val + } + if val, ok := getMachineTypeGetExtraSpecsAttributeTypeOk(o.ExtraSpecs); ok { + toSerialize["ExtraSpecs"] = val + } + if val, ok := getMachineTypeGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getMachineTypeGetRamAttributeTypeOk(o.Ram); ok { + toSerialize["Ram"] = val + } + if val, ok := getMachineTypeGetVcpusAttributeTypeOk(o.Vcpus); ok { + toSerialize["Vcpus"] = val + } + return toSerialize, nil +} + +type NullableMachineType struct { + value *MachineType + isSet bool +} + +func (v NullableMachineType) Get() *MachineType { + return v.value +} + +func (v *NullableMachineType) Set(val *MachineType) { + v.value = val + v.isSet = true +} + +func (v NullableMachineType) IsSet() bool { + return v.isSet +} + +func (v *NullableMachineType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMachineType(val *MachineType) *NullableMachineType { + return &NullableMachineType{value: val, isSet: true} +} + +func (v NullableMachineType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMachineType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_machine_type_list_response.go b/pkg/iaasbeta/model_machine_type_list_response.go new file mode 100644 index 00000000..0ef94e3f --- /dev/null +++ b/pkg/iaasbeta/model_machine_type_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the MachineTypeListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MachineTypeListResponse{} + +/* + types and functions for items +*/ + +// isArray +type MachineTypeListResponseGetItemsAttributeType = *[]MachineType +type MachineTypeListResponseGetItemsArgType = []MachineType +type MachineTypeListResponseGetItemsRetType = []MachineType + +func getMachineTypeListResponseGetItemsAttributeTypeOk(arg MachineTypeListResponseGetItemsAttributeType) (ret MachineTypeListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeListResponseGetItemsAttributeType(arg *MachineTypeListResponseGetItemsAttributeType, val MachineTypeListResponseGetItemsRetType) { + *arg = &val +} + +// MachineTypeListResponse Machine type list response. +type MachineTypeListResponse struct { + // Machine type list. + // REQUIRED + Items MachineTypeListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _MachineTypeListResponse MachineTypeListResponse + +// NewMachineTypeListResponse instantiates a new MachineTypeListResponse 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 NewMachineTypeListResponse(items MachineTypeListResponseGetItemsArgType) *MachineTypeListResponse { + this := MachineTypeListResponse{} + setMachineTypeListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewMachineTypeListResponseWithDefaults instantiates a new MachineTypeListResponse 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 NewMachineTypeListResponseWithDefaults() *MachineTypeListResponse { + this := MachineTypeListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *MachineTypeListResponse) GetItems() (ret MachineTypeListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *MachineTypeListResponse) GetItemsOk() (ret MachineTypeListResponseGetItemsRetType, ok bool) { + return getMachineTypeListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *MachineTypeListResponse) SetItems(v MachineTypeListResponseGetItemsRetType) { + setMachineTypeListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o MachineTypeListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getMachineTypeListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableMachineTypeListResponse struct { + value *MachineTypeListResponse + isSet bool +} + +func (v NullableMachineTypeListResponse) Get() *MachineTypeListResponse { + return v.value +} + +func (v *NullableMachineTypeListResponse) Set(val *MachineTypeListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableMachineTypeListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableMachineTypeListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMachineTypeListResponse(val *MachineTypeListResponse) *NullableMachineTypeListResponse { + return &NullableMachineTypeListResponse{value: val, isSet: true} +} + +func (v NullableMachineTypeListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMachineTypeListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_machine_type_list_response_test.go b/pkg/iaasbeta/model_machine_type_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_machine_type_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_machine_type_test.go b/pkg/iaasbeta/model_machine_type_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_machine_type_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_network.go b/pkg/iaasbeta/model_network.go new file mode 100644 index 00000000..d203f053 --- /dev/null +++ b/pkg/iaasbeta/model_network.go @@ -0,0 +1,600 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Network type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Network{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type NetworkGetCreatedAtAttributeType = *time.Time +type NetworkGetCreatedAtArgType = time.Time +type NetworkGetCreatedAtRetType = time.Time + +func getNetworkGetCreatedAtAttributeTypeOk(arg NetworkGetCreatedAtAttributeType) (ret NetworkGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetCreatedAtAttributeType(arg *NetworkGetCreatedAtAttributeType, val NetworkGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for dhcp +*/ + +// isBoolean +type NetworkgetDhcpAttributeType = *bool +type NetworkgetDhcpArgType = bool +type NetworkgetDhcpRetType = bool + +func getNetworkgetDhcpAttributeTypeOk(arg NetworkgetDhcpAttributeType) (ret NetworkgetDhcpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkgetDhcpAttributeType(arg *NetworkgetDhcpAttributeType, val NetworkgetDhcpRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type NetworkGetIdAttributeType = *string + +func getNetworkGetIdAttributeTypeOk(arg NetworkGetIdAttributeType) (ret NetworkGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetIdAttributeType(arg *NetworkGetIdAttributeType, val NetworkGetIdRetType) { + *arg = &val +} + +type NetworkGetIdArgType = string +type NetworkGetIdRetType = string + +/* + types and functions for ipv4 +*/ + +// isModel +type NetworkGetIpv4AttributeType = *NetworkIPv4 +type NetworkGetIpv4ArgType = NetworkIPv4 +type NetworkGetIpv4RetType = NetworkIPv4 + +func getNetworkGetIpv4AttributeTypeOk(arg NetworkGetIpv4AttributeType) (ret NetworkGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetIpv4AttributeType(arg *NetworkGetIpv4AttributeType, val NetworkGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type NetworkGetIpv6AttributeType = *NetworkIPv6 +type NetworkGetIpv6ArgType = NetworkIPv6 +type NetworkGetIpv6RetType = NetworkIPv6 + +func getNetworkGetIpv6AttributeTypeOk(arg NetworkGetIpv6AttributeType) (ret NetworkGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetIpv6AttributeType(arg *NetworkGetIpv6AttributeType, val NetworkGetIpv6RetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type NetworkGetLabelsAttributeType = *map[string]interface{} +type NetworkGetLabelsArgType = map[string]interface{} +type NetworkGetLabelsRetType = map[string]interface{} + +func getNetworkGetLabelsAttributeTypeOk(arg NetworkGetLabelsAttributeType) (ret NetworkGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetLabelsAttributeType(arg *NetworkGetLabelsAttributeType, val NetworkGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type NetworkGetNameAttributeType = *string + +func getNetworkGetNameAttributeTypeOk(arg NetworkGetNameAttributeType) (ret NetworkGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetNameAttributeType(arg *NetworkGetNameAttributeType, val NetworkGetNameRetType) { + *arg = &val +} + +type NetworkGetNameArgType = string +type NetworkGetNameRetType = string + +/* + types and functions for routed +*/ + +// isBoolean +type NetworkgetRoutedAttributeType = *bool +type NetworkgetRoutedArgType = bool +type NetworkgetRoutedRetType = bool + +func getNetworkgetRoutedAttributeTypeOk(arg NetworkgetRoutedAttributeType) (ret NetworkgetRoutedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkgetRoutedAttributeType(arg *NetworkgetRoutedAttributeType, val NetworkgetRoutedRetType) { + *arg = &val +} + +/* + types and functions for routingTableId +*/ + +// isNotNullableString +type NetworkGetRoutingTableIdAttributeType = *string + +func getNetworkGetRoutingTableIdAttributeTypeOk(arg NetworkGetRoutingTableIdAttributeType) (ret NetworkGetRoutingTableIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetRoutingTableIdAttributeType(arg *NetworkGetRoutingTableIdAttributeType, val NetworkGetRoutingTableIdRetType) { + *arg = &val +} + +type NetworkGetRoutingTableIdArgType = string +type NetworkGetRoutingTableIdRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type NetworkGetStatusAttributeType = *string + +func getNetworkGetStatusAttributeTypeOk(arg NetworkGetStatusAttributeType) (ret NetworkGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetStatusAttributeType(arg *NetworkGetStatusAttributeType, val NetworkGetStatusRetType) { + *arg = &val +} + +type NetworkGetStatusArgType = string +type NetworkGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type NetworkGetUpdatedAtAttributeType = *time.Time +type NetworkGetUpdatedAtArgType = time.Time +type NetworkGetUpdatedAtRetType = time.Time + +func getNetworkGetUpdatedAtAttributeTypeOk(arg NetworkGetUpdatedAtAttributeType) (ret NetworkGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetUpdatedAtAttributeType(arg *NetworkGetUpdatedAtAttributeType, val NetworkGetUpdatedAtRetType) { + *arg = &val +} + +// Network Object that represents a network. If no routing table is specified, the default routing table is used. +type Network struct { + // Date-time when resource was created. + CreatedAt NetworkGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Enable or disable DHCP for a network. + Dhcp NetworkgetDhcpAttributeType `json:"dhcp,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + Id NetworkGetIdAttributeType `json:"id" required:"true"` + Ipv4 NetworkGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 NetworkGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels NetworkGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Name NetworkGetNameAttributeType `json:"name" required:"true"` + // Shows if the network is routed and therefore accessible from other networks. + Routed NetworkgetRoutedAttributeType `json:"routed,omitempty"` + // Universally Unique Identifier (UUID). + RoutingTableId NetworkGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + // REQUIRED + Status NetworkGetStatusAttributeType `json:"status" required:"true"` + // Date-time when resource was last updated. + UpdatedAt NetworkGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Network Network + +// NewNetwork instantiates a new Network 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 NewNetwork(id NetworkGetIdArgType, name NetworkGetNameArgType, status NetworkGetStatusArgType) *Network { + this := Network{} + setNetworkGetIdAttributeType(&this.Id, id) + setNetworkGetNameAttributeType(&this.Name, name) + setNetworkGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewNetworkWithDefaults instantiates a new Network 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 NewNetworkWithDefaults() *Network { + this := Network{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Network) GetCreatedAt() (res NetworkGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetCreatedAtOk() (ret NetworkGetCreatedAtRetType, ok bool) { + return getNetworkGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Network) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Network) SetCreatedAt(v NetworkGetCreatedAtRetType) { + setNetworkGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *Network) GetDhcp() (res NetworkgetDhcpRetType) { + res, _ = o.GetDhcpOk() + return +} + +// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetDhcpOk() (ret NetworkgetDhcpRetType, ok bool) { + return getNetworkgetDhcpAttributeTypeOk(o.Dhcp) +} + +// HasDhcp returns a boolean if a field has been set. +func (o *Network) HasDhcp() bool { + _, ok := o.GetDhcpOk() + return ok +} + +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *Network) SetDhcp(v NetworkgetDhcpRetType) { + setNetworkgetDhcpAttributeType(&o.Dhcp, v) +} + +// GetId returns the Id field value +func (o *Network) GetId() (ret NetworkGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Network) GetIdOk() (ret NetworkGetIdRetType, ok bool) { + return getNetworkGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Network) SetId(v NetworkGetIdRetType) { + setNetworkGetIdAttributeType(&o.Id, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *Network) GetIpv4() (res NetworkGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetIpv4Ok() (ret NetworkGetIpv4RetType, ok bool) { + return getNetworkGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *Network) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given NetworkIPv4 and assigns it to the Ipv4 field. +func (o *Network) SetIpv4(v NetworkGetIpv4RetType) { + setNetworkGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *Network) GetIpv6() (res NetworkGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetIpv6Ok() (ret NetworkGetIpv6RetType, ok bool) { + return getNetworkGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *Network) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given NetworkIPv6 and assigns it to the Ipv6 field. +func (o *Network) SetIpv6(v NetworkGetIpv6RetType) { + setNetworkGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Network) GetLabels() (res NetworkGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetLabelsOk() (ret NetworkGetLabelsRetType, ok bool) { + return getNetworkGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Network) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Network) SetLabels(v NetworkGetLabelsRetType) { + setNetworkGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *Network) GetName() (ret NetworkGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Network) GetNameOk() (ret NetworkGetNameRetType, ok bool) { + return getNetworkGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Network) SetName(v NetworkGetNameRetType) { + setNetworkGetNameAttributeType(&o.Name, v) +} + +// GetRouted returns the Routed field value if set, zero value otherwise. +func (o *Network) GetRouted() (res NetworkgetRoutedRetType) { + res, _ = o.GetRoutedOk() + return +} + +// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetRoutedOk() (ret NetworkgetRoutedRetType, ok bool) { + return getNetworkgetRoutedAttributeTypeOk(o.Routed) +} + +// HasRouted returns a boolean if a field has been set. +func (o *Network) HasRouted() bool { + _, ok := o.GetRoutedOk() + return ok +} + +// SetRouted gets a reference to the given bool and assigns it to the Routed field. +func (o *Network) SetRouted(v NetworkgetRoutedRetType) { + setNetworkgetRoutedAttributeType(&o.Routed, v) +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *Network) GetRoutingTableId() (res NetworkGetRoutingTableIdRetType) { + res, _ = o.GetRoutingTableIdOk() + return +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetRoutingTableIdOk() (ret NetworkGetRoutingTableIdRetType, ok bool) { + return getNetworkGetRoutingTableIdAttributeTypeOk(o.RoutingTableId) +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *Network) HasRoutingTableId() bool { + _, ok := o.GetRoutingTableIdOk() + return ok +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *Network) SetRoutingTableId(v NetworkGetRoutingTableIdRetType) { + setNetworkGetRoutingTableIdAttributeType(&o.RoutingTableId, v) +} + +// GetStatus returns the Status field value +func (o *Network) GetStatus() (ret NetworkGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Network) GetStatusOk() (ret NetworkGetStatusRetType, ok bool) { + return getNetworkGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Network) SetStatus(v NetworkGetStatusRetType) { + setNetworkGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Network) GetUpdatedAt() (res NetworkGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetUpdatedAtOk() (ret NetworkGetUpdatedAtRetType, ok bool) { + return getNetworkGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Network) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Network) SetUpdatedAt(v NetworkGetUpdatedAtRetType) { + setNetworkGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Network) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getNetworkgetDhcpAttributeTypeOk(o.Dhcp); ok { + toSerialize["Dhcp"] = val + } + if val, ok := getNetworkGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getNetworkGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getNetworkGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getNetworkGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getNetworkGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getNetworkgetRoutedAttributeTypeOk(o.Routed); ok { + toSerialize["Routed"] = val + } + if val, ok := getNetworkGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok { + toSerialize["RoutingTableId"] = val + } + if val, ok := getNetworkGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getNetworkGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableNetwork struct { + value *Network + isSet bool +} + +func (v NullableNetwork) Get() *Network { + return v.value +} + +func (v *NullableNetwork) Set(val *Network) { + v.value = val + v.isSet = true +} + +func (v NullableNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetwork(val *Network) *NullableNetwork { + return &NullableNetwork{value: val, isSet: true} +} + +func (v NullableNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_network_area.go b/pkg/iaasbeta/model_network_area.go new file mode 100644 index 00000000..4f58ce4f --- /dev/null +++ b/pkg/iaasbeta/model_network_area.go @@ -0,0 +1,368 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the NetworkArea type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkArea{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type NetworkAreaGetCreatedAtAttributeType = *time.Time +type NetworkAreaGetCreatedAtArgType = time.Time +type NetworkAreaGetCreatedAtRetType = time.Time + +func getNetworkAreaGetCreatedAtAttributeTypeOk(arg NetworkAreaGetCreatedAtAttributeType) (ret NetworkAreaGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetCreatedAtAttributeType(arg *NetworkAreaGetCreatedAtAttributeType, val NetworkAreaGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type NetworkAreaGetIdAttributeType = *string + +func getNetworkAreaGetIdAttributeTypeOk(arg NetworkAreaGetIdAttributeType) (ret NetworkAreaGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetIdAttributeType(arg *NetworkAreaGetIdAttributeType, val NetworkAreaGetIdRetType) { + *arg = &val +} + +type NetworkAreaGetIdArgType = string +type NetworkAreaGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type NetworkAreaGetLabelsAttributeType = *map[string]interface{} +type NetworkAreaGetLabelsArgType = map[string]interface{} +type NetworkAreaGetLabelsRetType = map[string]interface{} + +func getNetworkAreaGetLabelsAttributeTypeOk(arg NetworkAreaGetLabelsAttributeType) (ret NetworkAreaGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetLabelsAttributeType(arg *NetworkAreaGetLabelsAttributeType, val NetworkAreaGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type NetworkAreaGetNameAttributeType = *string + +func getNetworkAreaGetNameAttributeTypeOk(arg NetworkAreaGetNameAttributeType) (ret NetworkAreaGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetNameAttributeType(arg *NetworkAreaGetNameAttributeType, val NetworkAreaGetNameRetType) { + *arg = &val +} + +type NetworkAreaGetNameArgType = string +type NetworkAreaGetNameRetType = string + +/* + types and functions for projectCount +*/ + +// isLong +type NetworkAreaGetProjectCountAttributeType = *int64 +type NetworkAreaGetProjectCountArgType = int64 +type NetworkAreaGetProjectCountRetType = int64 + +func getNetworkAreaGetProjectCountAttributeTypeOk(arg NetworkAreaGetProjectCountAttributeType) (ret NetworkAreaGetProjectCountRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetProjectCountAttributeType(arg *NetworkAreaGetProjectCountAttributeType, val NetworkAreaGetProjectCountRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type NetworkAreaGetUpdatedAtAttributeType = *time.Time +type NetworkAreaGetUpdatedAtArgType = time.Time +type NetworkAreaGetUpdatedAtRetType = time.Time + +func getNetworkAreaGetUpdatedAtAttributeTypeOk(arg NetworkAreaGetUpdatedAtAttributeType) (ret NetworkAreaGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetUpdatedAtAttributeType(arg *NetworkAreaGetUpdatedAtAttributeType, val NetworkAreaGetUpdatedAtRetType) { + *arg = &val +} + +// NetworkArea Object that represents a network area. +type NetworkArea struct { + // Date-time when resource was created. + CreatedAt NetworkAreaGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id NetworkAreaGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels NetworkAreaGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Name NetworkAreaGetNameAttributeType `json:"name" required:"true"` + // The amount of projects currently referencing a specific area. + ProjectCount NetworkAreaGetProjectCountAttributeType `json:"projectCount,omitempty"` + // Date-time when resource was last updated. + UpdatedAt NetworkAreaGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _NetworkArea NetworkArea + +// NewNetworkArea instantiates a new NetworkArea 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 NewNetworkArea(name NetworkAreaGetNameArgType) *NetworkArea { + this := NetworkArea{} + setNetworkAreaGetNameAttributeType(&this.Name, name) + return &this +} + +// NewNetworkAreaWithDefaults instantiates a new NetworkArea 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 NewNetworkAreaWithDefaults() *NetworkArea { + this := NetworkArea{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *NetworkArea) GetCreatedAt() (res NetworkAreaGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetCreatedAtOk() (ret NetworkAreaGetCreatedAtRetType, ok bool) { + return getNetworkAreaGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *NetworkArea) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *NetworkArea) SetCreatedAt(v NetworkAreaGetCreatedAtRetType) { + setNetworkAreaGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *NetworkArea) GetId() (res NetworkAreaGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetIdOk() (ret NetworkAreaGetIdRetType, ok bool) { + return getNetworkAreaGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *NetworkArea) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NetworkArea) SetId(v NetworkAreaGetIdRetType) { + setNetworkAreaGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *NetworkArea) GetLabels() (res NetworkAreaGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetLabelsOk() (ret NetworkAreaGetLabelsRetType, ok bool) { + return getNetworkAreaGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *NetworkArea) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *NetworkArea) SetLabels(v NetworkAreaGetLabelsRetType) { + setNetworkAreaGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *NetworkArea) GetName() (ret NetworkAreaGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetNameOk() (ret NetworkAreaGetNameRetType, ok bool) { + return getNetworkAreaGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *NetworkArea) SetName(v NetworkAreaGetNameRetType) { + setNetworkAreaGetNameAttributeType(&o.Name, v) +} + +// GetProjectCount returns the ProjectCount field value if set, zero value otherwise. +func (o *NetworkArea) GetProjectCount() (res NetworkAreaGetProjectCountRetType) { + res, _ = o.GetProjectCountOk() + return +} + +// GetProjectCountOk returns a tuple with the ProjectCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetProjectCountOk() (ret NetworkAreaGetProjectCountRetType, ok bool) { + return getNetworkAreaGetProjectCountAttributeTypeOk(o.ProjectCount) +} + +// HasProjectCount returns a boolean if a field has been set. +func (o *NetworkArea) HasProjectCount() bool { + _, ok := o.GetProjectCountOk() + return ok +} + +// SetProjectCount gets a reference to the given int64 and assigns it to the ProjectCount field. +func (o *NetworkArea) SetProjectCount(v NetworkAreaGetProjectCountRetType) { + setNetworkAreaGetProjectCountAttributeType(&o.ProjectCount, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *NetworkArea) GetUpdatedAt() (res NetworkAreaGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetUpdatedAtOk() (ret NetworkAreaGetUpdatedAtRetType, ok bool) { + return getNetworkAreaGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *NetworkArea) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *NetworkArea) SetUpdatedAt(v NetworkAreaGetUpdatedAtRetType) { + setNetworkAreaGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o NetworkArea) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkAreaGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getNetworkAreaGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getNetworkAreaGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getNetworkAreaGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getNetworkAreaGetProjectCountAttributeTypeOk(o.ProjectCount); ok { + toSerialize["ProjectCount"] = val + } + if val, ok := getNetworkAreaGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableNetworkArea struct { + value *NetworkArea + isSet bool +} + +func (v NullableNetworkArea) Get() *NetworkArea { + return v.value +} + +func (v *NullableNetworkArea) Set(val *NetworkArea) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkArea) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkArea) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkArea(val *NetworkArea) *NullableNetworkArea { + return &NullableNetworkArea{value: val, isSet: true} +} + +func (v NullableNetworkArea) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkArea) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_network_area_list_response.go b/pkg/iaasbeta/model_network_area_list_response.go new file mode 100644 index 00000000..ca58f19b --- /dev/null +++ b/pkg/iaasbeta/model_network_area_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NetworkAreaListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkAreaListResponse{} + +/* + types and functions for items +*/ + +// isArray +type NetworkAreaListResponseGetItemsAttributeType = *[]NetworkArea +type NetworkAreaListResponseGetItemsArgType = []NetworkArea +type NetworkAreaListResponseGetItemsRetType = []NetworkArea + +func getNetworkAreaListResponseGetItemsAttributeTypeOk(arg NetworkAreaListResponseGetItemsAttributeType) (ret NetworkAreaListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaListResponseGetItemsAttributeType(arg *NetworkAreaListResponseGetItemsAttributeType, val NetworkAreaListResponseGetItemsRetType) { + *arg = &val +} + +// NetworkAreaListResponse Network area list response. +type NetworkAreaListResponse struct { + // A list of network areas. + // REQUIRED + Items NetworkAreaListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _NetworkAreaListResponse NetworkAreaListResponse + +// NewNetworkAreaListResponse instantiates a new NetworkAreaListResponse 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 NewNetworkAreaListResponse(items NetworkAreaListResponseGetItemsArgType) *NetworkAreaListResponse { + this := NetworkAreaListResponse{} + setNetworkAreaListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewNetworkAreaListResponseWithDefaults instantiates a new NetworkAreaListResponse 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 NewNetworkAreaListResponseWithDefaults() *NetworkAreaListResponse { + this := NetworkAreaListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *NetworkAreaListResponse) GetItems() (ret NetworkAreaListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *NetworkAreaListResponse) GetItemsOk() (ret NetworkAreaListResponseGetItemsRetType, ok bool) { + return getNetworkAreaListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *NetworkAreaListResponse) SetItems(v NetworkAreaListResponseGetItemsRetType) { + setNetworkAreaListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o NetworkAreaListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkAreaListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableNetworkAreaListResponse struct { + value *NetworkAreaListResponse + isSet bool +} + +func (v NullableNetworkAreaListResponse) Get() *NetworkAreaListResponse { + return v.value +} + +func (v *NullableNetworkAreaListResponse) Set(val *NetworkAreaListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkAreaListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkAreaListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkAreaListResponse(val *NetworkAreaListResponse) *NullableNetworkAreaListResponse { + return &NullableNetworkAreaListResponse{value: val, isSet: true} +} + +func (v NullableNetworkAreaListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkAreaListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_network_area_list_response_test.go b/pkg/iaasbeta/model_network_area_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_network_area_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_network_area_test.go b/pkg/iaasbeta/model_network_area_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_network_area_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_network_ipv4.go b/pkg/iaasbeta/model_network_ipv4.go new file mode 100644 index 00000000..f83b6799 --- /dev/null +++ b/pkg/iaasbeta/model_network_ipv4.go @@ -0,0 +1,286 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NetworkIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkIPv4{} + +/* + types and functions for gateway +*/ + +// isNullableString +type NetworkIPv4GetGatewayAttributeType = *NullableString + +func getNetworkIPv4GetGatewayAttributeTypeOk(arg NetworkIPv4GetGatewayAttributeType) (ret NetworkIPv4GetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setNetworkIPv4GetGatewayAttributeType(arg *NetworkIPv4GetGatewayAttributeType, val NetworkIPv4GetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type NetworkIPv4GetGatewayArgType = *string +type NetworkIPv4GetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type NetworkIPv4GetNameserversAttributeType = *[]string +type NetworkIPv4GetNameserversArgType = []string +type NetworkIPv4GetNameserversRetType = []string + +func getNetworkIPv4GetNameserversAttributeTypeOk(arg NetworkIPv4GetNameserversAttributeType) (ret NetworkIPv4GetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv4GetNameserversAttributeType(arg *NetworkIPv4GetNameserversAttributeType, val NetworkIPv4GetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixes +*/ + +// isArray +type NetworkIPv4GetPrefixesAttributeType = *[]string +type NetworkIPv4GetPrefixesArgType = []string +type NetworkIPv4GetPrefixesRetType = []string + +func getNetworkIPv4GetPrefixesAttributeTypeOk(arg NetworkIPv4GetPrefixesAttributeType) (ret NetworkIPv4GetPrefixesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv4GetPrefixesAttributeType(arg *NetworkIPv4GetPrefixesAttributeType, val NetworkIPv4GetPrefixesRetType) { + *arg = &val +} + +/* + types and functions for publicIp +*/ + +// isNotNullableString +type NetworkIPv4GetPublicIpAttributeType = *string + +func getNetworkIPv4GetPublicIpAttributeTypeOk(arg NetworkIPv4GetPublicIpAttributeType) (ret NetworkIPv4GetPublicIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv4GetPublicIpAttributeType(arg *NetworkIPv4GetPublicIpAttributeType, val NetworkIPv4GetPublicIpRetType) { + *arg = &val +} + +type NetworkIPv4GetPublicIpArgType = string +type NetworkIPv4GetPublicIpRetType = string + +// NetworkIPv4 Object that represents the IPv4 part of a network. +type NetworkIPv4 struct { + // The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway NetworkIPv4GetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers NetworkIPv4GetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + Prefixes NetworkIPv4GetPrefixesAttributeType `json:"prefixes" required:"true"` + // String that represents an IPv4 address. + PublicIp NetworkIPv4GetPublicIpAttributeType `json:"publicIp,omitempty"` +} + +type _NetworkIPv4 NetworkIPv4 + +// NewNetworkIPv4 instantiates a new NetworkIPv4 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 NewNetworkIPv4(prefixes NetworkIPv4GetPrefixesArgType) *NetworkIPv4 { + this := NetworkIPv4{} + setNetworkIPv4GetPrefixesAttributeType(&this.Prefixes, prefixes) + return &this +} + +// NewNetworkIPv4WithDefaults instantiates a new NetworkIPv4 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 NewNetworkIPv4WithDefaults() *NetworkIPv4 { + this := NetworkIPv4{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NetworkIPv4) GetGateway() (res NetworkIPv4GetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NetworkIPv4) GetGatewayOk() (ret NetworkIPv4GetGatewayRetType, ok bool) { + return getNetworkIPv4GetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *NetworkIPv4) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *NetworkIPv4) SetGateway(v NetworkIPv4GetGatewayRetType) { + setNetworkIPv4GetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *NetworkIPv4) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *NetworkIPv4) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *NetworkIPv4) GetNameservers() (res NetworkIPv4GetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkIPv4) GetNameserversOk() (ret NetworkIPv4GetNameserversRetType, ok bool) { + return getNetworkIPv4GetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *NetworkIPv4) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *NetworkIPv4) SetNameservers(v NetworkIPv4GetNameserversRetType) { + setNetworkIPv4GetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixes returns the Prefixes field value +func (o *NetworkIPv4) GetPrefixes() (ret NetworkIPv4GetPrefixesRetType) { + ret, _ = o.GetPrefixesOk() + return ret +} + +// GetPrefixesOk returns a tuple with the Prefixes field value +// and a boolean to check if the value has been set. +func (o *NetworkIPv4) GetPrefixesOk() (ret NetworkIPv4GetPrefixesRetType, ok bool) { + return getNetworkIPv4GetPrefixesAttributeTypeOk(o.Prefixes) +} + +// SetPrefixes sets field value +func (o *NetworkIPv4) SetPrefixes(v NetworkIPv4GetPrefixesRetType) { + setNetworkIPv4GetPrefixesAttributeType(&o.Prefixes, v) +} + +// GetPublicIp returns the PublicIp field value if set, zero value otherwise. +func (o *NetworkIPv4) GetPublicIp() (res NetworkIPv4GetPublicIpRetType) { + res, _ = o.GetPublicIpOk() + return +} + +// GetPublicIpOk returns a tuple with the PublicIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkIPv4) GetPublicIpOk() (ret NetworkIPv4GetPublicIpRetType, ok bool) { + return getNetworkIPv4GetPublicIpAttributeTypeOk(o.PublicIp) +} + +// HasPublicIp returns a boolean if a field has been set. +func (o *NetworkIPv4) HasPublicIp() bool { + _, ok := o.GetPublicIpOk() + return ok +} + +// SetPublicIp gets a reference to the given string and assigns it to the PublicIp field. +func (o *NetworkIPv4) SetPublicIp(v NetworkIPv4GetPublicIpRetType) { + setNetworkIPv4GetPublicIpAttributeType(&o.PublicIp, v) +} + +func (o NetworkIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkIPv4GetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getNetworkIPv4GetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getNetworkIPv4GetPrefixesAttributeTypeOk(o.Prefixes); ok { + toSerialize["Prefixes"] = val + } + if val, ok := getNetworkIPv4GetPublicIpAttributeTypeOk(o.PublicIp); ok { + toSerialize["PublicIp"] = val + } + return toSerialize, nil +} + +type NullableNetworkIPv4 struct { + value *NetworkIPv4 + isSet bool +} + +func (v NullableNetworkIPv4) Get() *NetworkIPv4 { + return v.value +} + +func (v *NullableNetworkIPv4) Set(val *NetworkIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkIPv4(val *NetworkIPv4) *NullableNetworkIPv4 { + return &NullableNetworkIPv4{value: val, isSet: true} +} + +func (v NullableNetworkIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_network_ipv4_test.go b/pkg/iaasbeta/model_network_ipv4_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_network_ipv4_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_network_ipv6.go b/pkg/iaasbeta/model_network_ipv6.go new file mode 100644 index 00000000..f19b7e6d --- /dev/null +++ b/pkg/iaasbeta/model_network_ipv6.go @@ -0,0 +1,237 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NetworkIPv6 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkIPv6{} + +/* + types and functions for gateway +*/ + +// isNullableString +type NetworkIPv6GetGatewayAttributeType = *NullableString + +func getNetworkIPv6GetGatewayAttributeTypeOk(arg NetworkIPv6GetGatewayAttributeType) (ret NetworkIPv6GetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setNetworkIPv6GetGatewayAttributeType(arg *NetworkIPv6GetGatewayAttributeType, val NetworkIPv6GetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type NetworkIPv6GetGatewayArgType = *string +type NetworkIPv6GetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type NetworkIPv6GetNameserversAttributeType = *[]string +type NetworkIPv6GetNameserversArgType = []string +type NetworkIPv6GetNameserversRetType = []string + +func getNetworkIPv6GetNameserversAttributeTypeOk(arg NetworkIPv6GetNameserversAttributeType) (ret NetworkIPv6GetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv6GetNameserversAttributeType(arg *NetworkIPv6GetNameserversAttributeType, val NetworkIPv6GetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixes +*/ + +// isArray +type NetworkIPv6GetPrefixesAttributeType = *[]string +type NetworkIPv6GetPrefixesArgType = []string +type NetworkIPv6GetPrefixesRetType = []string + +func getNetworkIPv6GetPrefixesAttributeTypeOk(arg NetworkIPv6GetPrefixesAttributeType) (ret NetworkIPv6GetPrefixesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv6GetPrefixesAttributeType(arg *NetworkIPv6GetPrefixesAttributeType, val NetworkIPv6GetPrefixesRetType) { + *arg = &val +} + +// NetworkIPv6 Object that represents the IPv6 part of a network. +type NetworkIPv6 struct { + // The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway NetworkIPv6GetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers NetworkIPv6GetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + Prefixes NetworkIPv6GetPrefixesAttributeType `json:"prefixes" required:"true"` +} + +type _NetworkIPv6 NetworkIPv6 + +// NewNetworkIPv6 instantiates a new NetworkIPv6 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 NewNetworkIPv6(prefixes NetworkIPv6GetPrefixesArgType) *NetworkIPv6 { + this := NetworkIPv6{} + setNetworkIPv6GetPrefixesAttributeType(&this.Prefixes, prefixes) + return &this +} + +// NewNetworkIPv6WithDefaults instantiates a new NetworkIPv6 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 NewNetworkIPv6WithDefaults() *NetworkIPv6 { + this := NetworkIPv6{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NetworkIPv6) GetGateway() (res NetworkIPv6GetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NetworkIPv6) GetGatewayOk() (ret NetworkIPv6GetGatewayRetType, ok bool) { + return getNetworkIPv6GetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *NetworkIPv6) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *NetworkIPv6) SetGateway(v NetworkIPv6GetGatewayRetType) { + setNetworkIPv6GetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *NetworkIPv6) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *NetworkIPv6) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *NetworkIPv6) GetNameservers() (res NetworkIPv6GetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkIPv6) GetNameserversOk() (ret NetworkIPv6GetNameserversRetType, ok bool) { + return getNetworkIPv6GetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *NetworkIPv6) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *NetworkIPv6) SetNameservers(v NetworkIPv6GetNameserversRetType) { + setNetworkIPv6GetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixes returns the Prefixes field value +func (o *NetworkIPv6) GetPrefixes() (ret NetworkIPv6GetPrefixesRetType) { + ret, _ = o.GetPrefixesOk() + return ret +} + +// GetPrefixesOk returns a tuple with the Prefixes field value +// and a boolean to check if the value has been set. +func (o *NetworkIPv6) GetPrefixesOk() (ret NetworkIPv6GetPrefixesRetType, ok bool) { + return getNetworkIPv6GetPrefixesAttributeTypeOk(o.Prefixes) +} + +// SetPrefixes sets field value +func (o *NetworkIPv6) SetPrefixes(v NetworkIPv6GetPrefixesRetType) { + setNetworkIPv6GetPrefixesAttributeType(&o.Prefixes, v) +} + +func (o NetworkIPv6) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkIPv6GetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getNetworkIPv6GetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getNetworkIPv6GetPrefixesAttributeTypeOk(o.Prefixes); ok { + toSerialize["Prefixes"] = val + } + return toSerialize, nil +} + +type NullableNetworkIPv6 struct { + value *NetworkIPv6 + isSet bool +} + +func (v NullableNetworkIPv6) Get() *NetworkIPv6 { + return v.value +} + +func (v *NullableNetworkIPv6) Set(val *NetworkIPv6) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkIPv6) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkIPv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkIPv6(val *NetworkIPv6) *NullableNetworkIPv6 { + return &NullableNetworkIPv6{value: val, isSet: true} +} + +func (v NullableNetworkIPv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkIPv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_network_ipv6_test.go b/pkg/iaasbeta/model_network_ipv6_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_network_ipv6_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_network_list_response.go b/pkg/iaasbeta/model_network_list_response.go new file mode 100644 index 00000000..0ecf3b59 --- /dev/null +++ b/pkg/iaasbeta/model_network_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NetworkListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkListResponse{} + +/* + types and functions for items +*/ + +// isArray +type NetworkListResponseGetItemsAttributeType = *[]Network +type NetworkListResponseGetItemsArgType = []Network +type NetworkListResponseGetItemsRetType = []Network + +func getNetworkListResponseGetItemsAttributeTypeOk(arg NetworkListResponseGetItemsAttributeType) (ret NetworkListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkListResponseGetItemsAttributeType(arg *NetworkListResponseGetItemsAttributeType, val NetworkListResponseGetItemsRetType) { + *arg = &val +} + +// NetworkListResponse Network list response. +type NetworkListResponse struct { + // A list of networks. + // REQUIRED + Items NetworkListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _NetworkListResponse NetworkListResponse + +// NewNetworkListResponse instantiates a new NetworkListResponse 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 NewNetworkListResponse(items NetworkListResponseGetItemsArgType) *NetworkListResponse { + this := NetworkListResponse{} + setNetworkListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewNetworkListResponseWithDefaults instantiates a new NetworkListResponse 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 NewNetworkListResponseWithDefaults() *NetworkListResponse { + this := NetworkListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *NetworkListResponse) GetItems() (ret NetworkListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *NetworkListResponse) GetItemsOk() (ret NetworkListResponseGetItemsRetType, ok bool) { + return getNetworkListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *NetworkListResponse) SetItems(v NetworkListResponseGetItemsRetType) { + setNetworkListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o NetworkListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableNetworkListResponse struct { + value *NetworkListResponse + isSet bool +} + +func (v NullableNetworkListResponse) Get() *NetworkListResponse { + return v.value +} + +func (v *NullableNetworkListResponse) Set(val *NetworkListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkListResponse(val *NetworkListResponse) *NullableNetworkListResponse { + return &NullableNetworkListResponse{value: val, isSet: true} +} + +func (v NullableNetworkListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_network_list_response_test.go b/pkg/iaasbeta/model_network_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_network_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_network_range.go b/pkg/iaasbeta/model_network_range.go new file mode 100644 index 00000000..56e3787a --- /dev/null +++ b/pkg/iaasbeta/model_network_range.go @@ -0,0 +1,273 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the NetworkRange type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkRange{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type NetworkRangeGetCreatedAtAttributeType = *time.Time +type NetworkRangeGetCreatedAtArgType = time.Time +type NetworkRangeGetCreatedAtRetType = time.Time + +func getNetworkRangeGetCreatedAtAttributeTypeOk(arg NetworkRangeGetCreatedAtAttributeType) (ret NetworkRangeGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkRangeGetCreatedAtAttributeType(arg *NetworkRangeGetCreatedAtAttributeType, val NetworkRangeGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type NetworkRangeGetIdAttributeType = *string + +func getNetworkRangeGetIdAttributeTypeOk(arg NetworkRangeGetIdAttributeType) (ret NetworkRangeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkRangeGetIdAttributeType(arg *NetworkRangeGetIdAttributeType, val NetworkRangeGetIdRetType) { + *arg = &val +} + +type NetworkRangeGetIdArgType = string +type NetworkRangeGetIdRetType = string + +/* + types and functions for prefix +*/ + +// isNotNullableString +type NetworkRangeGetPrefixAttributeType = *string + +func getNetworkRangeGetPrefixAttributeTypeOk(arg NetworkRangeGetPrefixAttributeType) (ret NetworkRangeGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkRangeGetPrefixAttributeType(arg *NetworkRangeGetPrefixAttributeType, val NetworkRangeGetPrefixRetType) { + *arg = &val +} + +type NetworkRangeGetPrefixArgType = string +type NetworkRangeGetPrefixRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type NetworkRangeGetUpdatedAtAttributeType = *time.Time +type NetworkRangeGetUpdatedAtArgType = time.Time +type NetworkRangeGetUpdatedAtRetType = time.Time + +func getNetworkRangeGetUpdatedAtAttributeTypeOk(arg NetworkRangeGetUpdatedAtAttributeType) (ret NetworkRangeGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkRangeGetUpdatedAtAttributeType(arg *NetworkRangeGetUpdatedAtAttributeType, val NetworkRangeGetUpdatedAtRetType) { + *arg = &val +} + +// NetworkRange Object that represents a network range. +type NetworkRange struct { + // Date-time when resource was created. + CreatedAt NetworkRangeGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id NetworkRangeGetIdAttributeType `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + // REQUIRED + Prefix NetworkRangeGetPrefixAttributeType `json:"prefix" required:"true"` + // Date-time when resource was last updated. + UpdatedAt NetworkRangeGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _NetworkRange NetworkRange + +// NewNetworkRange instantiates a new NetworkRange 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 NewNetworkRange(prefix NetworkRangeGetPrefixArgType) *NetworkRange { + this := NetworkRange{} + setNetworkRangeGetPrefixAttributeType(&this.Prefix, prefix) + return &this +} + +// NewNetworkRangeWithDefaults instantiates a new NetworkRange 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 NewNetworkRangeWithDefaults() *NetworkRange { + this := NetworkRange{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *NetworkRange) GetCreatedAt() (res NetworkRangeGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkRange) GetCreatedAtOk() (ret NetworkRangeGetCreatedAtRetType, ok bool) { + return getNetworkRangeGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *NetworkRange) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *NetworkRange) SetCreatedAt(v NetworkRangeGetCreatedAtRetType) { + setNetworkRangeGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *NetworkRange) GetId() (res NetworkRangeGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkRange) GetIdOk() (ret NetworkRangeGetIdRetType, ok bool) { + return getNetworkRangeGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *NetworkRange) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NetworkRange) SetId(v NetworkRangeGetIdRetType) { + setNetworkRangeGetIdAttributeType(&o.Id, v) +} + +// GetPrefix returns the Prefix field value +func (o *NetworkRange) GetPrefix() (ret NetworkRangeGetPrefixRetType) { + ret, _ = o.GetPrefixOk() + return ret +} + +// GetPrefixOk returns a tuple with the Prefix field value +// and a boolean to check if the value has been set. +func (o *NetworkRange) GetPrefixOk() (ret NetworkRangeGetPrefixRetType, ok bool) { + return getNetworkRangeGetPrefixAttributeTypeOk(o.Prefix) +} + +// SetPrefix sets field value +func (o *NetworkRange) SetPrefix(v NetworkRangeGetPrefixRetType) { + setNetworkRangeGetPrefixAttributeType(&o.Prefix, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *NetworkRange) GetUpdatedAt() (res NetworkRangeGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkRange) GetUpdatedAtOk() (ret NetworkRangeGetUpdatedAtRetType, ok bool) { + return getNetworkRangeGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *NetworkRange) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *NetworkRange) SetUpdatedAt(v NetworkRangeGetUpdatedAtRetType) { + setNetworkRangeGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o NetworkRange) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkRangeGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getNetworkRangeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getNetworkRangeGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + if val, ok := getNetworkRangeGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableNetworkRange struct { + value *NetworkRange + isSet bool +} + +func (v NullableNetworkRange) Get() *NetworkRange { + return v.value +} + +func (v *NullableNetworkRange) Set(val *NetworkRange) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkRange) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkRange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkRange(val *NetworkRange) *NullableNetworkRange { + return &NullableNetworkRange{value: val, isSet: true} +} + +func (v NullableNetworkRange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkRange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_network_range_list_response.go b/pkg/iaasbeta/model_network_range_list_response.go new file mode 100644 index 00000000..4a95f2f5 --- /dev/null +++ b/pkg/iaasbeta/model_network_range_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NetworkRangeListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkRangeListResponse{} + +/* + types and functions for items +*/ + +// isArray +type NetworkRangeListResponseGetItemsAttributeType = *[]NetworkRange +type NetworkRangeListResponseGetItemsArgType = []NetworkRange +type NetworkRangeListResponseGetItemsRetType = []NetworkRange + +func getNetworkRangeListResponseGetItemsAttributeTypeOk(arg NetworkRangeListResponseGetItemsAttributeType) (ret NetworkRangeListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkRangeListResponseGetItemsAttributeType(arg *NetworkRangeListResponseGetItemsAttributeType, val NetworkRangeListResponseGetItemsRetType) { + *arg = &val +} + +// NetworkRangeListResponse Network Range list response. +type NetworkRangeListResponse struct { + // A list of network ranges. + // REQUIRED + Items NetworkRangeListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _NetworkRangeListResponse NetworkRangeListResponse + +// NewNetworkRangeListResponse instantiates a new NetworkRangeListResponse 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 NewNetworkRangeListResponse(items NetworkRangeListResponseGetItemsArgType) *NetworkRangeListResponse { + this := NetworkRangeListResponse{} + setNetworkRangeListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewNetworkRangeListResponseWithDefaults instantiates a new NetworkRangeListResponse 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 NewNetworkRangeListResponseWithDefaults() *NetworkRangeListResponse { + this := NetworkRangeListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *NetworkRangeListResponse) GetItems() (ret NetworkRangeListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *NetworkRangeListResponse) GetItemsOk() (ret NetworkRangeListResponseGetItemsRetType, ok bool) { + return getNetworkRangeListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *NetworkRangeListResponse) SetItems(v NetworkRangeListResponseGetItemsRetType) { + setNetworkRangeListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o NetworkRangeListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkRangeListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableNetworkRangeListResponse struct { + value *NetworkRangeListResponse + isSet bool +} + +func (v NullableNetworkRangeListResponse) Get() *NetworkRangeListResponse { + return v.value +} + +func (v *NullableNetworkRangeListResponse) Set(val *NetworkRangeListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkRangeListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkRangeListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkRangeListResponse(val *NetworkRangeListResponse) *NullableNetworkRangeListResponse { + return &NullableNetworkRangeListResponse{value: val, isSet: true} +} + +func (v NullableNetworkRangeListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkRangeListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_network_range_list_response_test.go b/pkg/iaasbeta/model_network_range_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_network_range_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_network_range_test.go b/pkg/iaasbeta/model_network_range_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_network_range_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_network_test.go b/pkg/iaasbeta/model_network_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_network_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_nexthop_blackhole.go b/pkg/iaasbeta/model_nexthop_blackhole.go new file mode 100644 index 00000000..1f3da267 --- /dev/null +++ b/pkg/iaasbeta/model_nexthop_blackhole.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NexthopBlackhole type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopBlackhole{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopBlackholeGetTypeAttributeType = *string + +func getNexthopBlackholeGetTypeAttributeTypeOk(arg NexthopBlackholeGetTypeAttributeType) (ret NexthopBlackholeGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopBlackholeGetTypeAttributeType(arg *NexthopBlackholeGetTypeAttributeType, val NexthopBlackholeGetTypeRetType) { + *arg = &val +} + +type NexthopBlackholeGetTypeArgType = string +type NexthopBlackholeGetTypeRetType = string + +// NexthopBlackhole Object that represents a blackhole route. +type NexthopBlackhole struct { + // REQUIRED + Type NexthopBlackholeGetTypeAttributeType `json:"type" required:"true"` +} + +type _NexthopBlackhole NexthopBlackhole + +// NewNexthopBlackhole instantiates a new NexthopBlackhole 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 NewNexthopBlackhole(types NexthopBlackholeGetTypeArgType) *NexthopBlackhole { + this := NexthopBlackhole{} + setNexthopBlackholeGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewNexthopBlackholeWithDefaults instantiates a new NexthopBlackhole 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 NewNexthopBlackholeWithDefaults() *NexthopBlackhole { + this := NexthopBlackhole{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopBlackhole) GetType() (ret NexthopBlackholeGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopBlackhole) GetTypeOk() (ret NexthopBlackholeGetTypeRetType, ok bool) { + return getNexthopBlackholeGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopBlackhole) SetType(v NexthopBlackholeGetTypeRetType) { + setNexthopBlackholeGetTypeAttributeType(&o.Type, v) +} + +func (o NexthopBlackhole) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopBlackholeGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableNexthopBlackhole struct { + value *NexthopBlackhole + isSet bool +} + +func (v NullableNexthopBlackhole) Get() *NexthopBlackhole { + return v.value +} + +func (v *NullableNexthopBlackhole) Set(val *NexthopBlackhole) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopBlackhole) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopBlackhole) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopBlackhole(val *NexthopBlackhole) *NullableNexthopBlackhole { + return &NullableNexthopBlackhole{value: val, isSet: true} +} + +func (v NullableNexthopBlackhole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopBlackhole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_nexthop_blackhole_test.go b/pkg/iaasbeta/model_nexthop_blackhole_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_nexthop_blackhole_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_nexthop_internet.go b/pkg/iaasbeta/model_nexthop_internet.go new file mode 100644 index 00000000..8f2f89a5 --- /dev/null +++ b/pkg/iaasbeta/model_nexthop_internet.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NexthopInternet type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopInternet{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopInternetGetTypeAttributeType = *string + +func getNexthopInternetGetTypeAttributeTypeOk(arg NexthopInternetGetTypeAttributeType) (ret NexthopInternetGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopInternetGetTypeAttributeType(arg *NexthopInternetGetTypeAttributeType, val NexthopInternetGetTypeRetType) { + *arg = &val +} + +type NexthopInternetGetTypeArgType = string +type NexthopInternetGetTypeRetType = string + +// NexthopInternet Object that represents a route to the internet. +type NexthopInternet struct { + // REQUIRED + Type NexthopInternetGetTypeAttributeType `json:"type" required:"true"` +} + +type _NexthopInternet NexthopInternet + +// NewNexthopInternet instantiates a new NexthopInternet 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 NewNexthopInternet(types NexthopInternetGetTypeArgType) *NexthopInternet { + this := NexthopInternet{} + setNexthopInternetGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewNexthopInternetWithDefaults instantiates a new NexthopInternet 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 NewNexthopInternetWithDefaults() *NexthopInternet { + this := NexthopInternet{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopInternet) GetType() (ret NexthopInternetGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopInternet) GetTypeOk() (ret NexthopInternetGetTypeRetType, ok bool) { + return getNexthopInternetGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopInternet) SetType(v NexthopInternetGetTypeRetType) { + setNexthopInternetGetTypeAttributeType(&o.Type, v) +} + +func (o NexthopInternet) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopInternetGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableNexthopInternet struct { + value *NexthopInternet + isSet bool +} + +func (v NullableNexthopInternet) Get() *NexthopInternet { + return v.value +} + +func (v *NullableNexthopInternet) Set(val *NexthopInternet) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopInternet) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopInternet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopInternet(val *NexthopInternet) *NullableNexthopInternet { + return &NullableNexthopInternet{value: val, isSet: true} +} + +func (v NullableNexthopInternet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopInternet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_nexthop_internet_test.go b/pkg/iaasbeta/model_nexthop_internet_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_nexthop_internet_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_nexthop_ipv4.go b/pkg/iaasbeta/model_nexthop_ipv4.go new file mode 100644 index 00000000..51594e19 --- /dev/null +++ b/pkg/iaasbeta/model_nexthop_ipv4.go @@ -0,0 +1,171 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NexthopIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopIPv4{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopIPv4GetTypeAttributeType = *string + +func getNexthopIPv4GetTypeAttributeTypeOk(arg NexthopIPv4GetTypeAttributeType) (ret NexthopIPv4GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv4GetTypeAttributeType(arg *NexthopIPv4GetTypeAttributeType, val NexthopIPv4GetTypeRetType) { + *arg = &val +} + +type NexthopIPv4GetTypeArgType = string +type NexthopIPv4GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type NexthopIPv4GetValueAttributeType = *string + +func getNexthopIPv4GetValueAttributeTypeOk(arg NexthopIPv4GetValueAttributeType) (ret NexthopIPv4GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv4GetValueAttributeType(arg *NexthopIPv4GetValueAttributeType, val NexthopIPv4GetValueRetType) { + *arg = &val +} + +type NexthopIPv4GetValueArgType = string +type NexthopIPv4GetValueRetType = string + +// NexthopIPv4 Object that represents an IPv4 address. +type NexthopIPv4 struct { + // REQUIRED + Type NexthopIPv4GetTypeAttributeType `json:"type" required:"true"` + // An IPv4 address. + // REQUIRED + Value NexthopIPv4GetValueAttributeType `json:"value" required:"true"` +} + +type _NexthopIPv4 NexthopIPv4 + +// NewNexthopIPv4 instantiates a new NexthopIPv4 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 NewNexthopIPv4(types NexthopIPv4GetTypeArgType, value NexthopIPv4GetValueArgType) *NexthopIPv4 { + this := NexthopIPv4{} + setNexthopIPv4GetTypeAttributeType(&this.Type, types) + setNexthopIPv4GetValueAttributeType(&this.Value, value) + return &this +} + +// NewNexthopIPv4WithDefaults instantiates a new NexthopIPv4 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 NewNexthopIPv4WithDefaults() *NexthopIPv4 { + this := NexthopIPv4{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopIPv4) GetType() (ret NexthopIPv4GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv4) GetTypeOk() (ret NexthopIPv4GetTypeRetType, ok bool) { + return getNexthopIPv4GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopIPv4) SetType(v NexthopIPv4GetTypeRetType) { + setNexthopIPv4GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *NexthopIPv4) GetValue() (ret NexthopIPv4GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv4) GetValueOk() (ret NexthopIPv4GetValueRetType, ok bool) { + return getNexthopIPv4GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *NexthopIPv4) SetValue(v NexthopIPv4GetValueRetType) { + setNexthopIPv4GetValueAttributeType(&o.Value, v) +} + +func (o NexthopIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopIPv4GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getNexthopIPv4GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableNexthopIPv4 struct { + value *NexthopIPv4 + isSet bool +} + +func (v NullableNexthopIPv4) Get() *NexthopIPv4 { + return v.value +} + +func (v *NullableNexthopIPv4) Set(val *NexthopIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopIPv4(val *NexthopIPv4) *NullableNexthopIPv4 { + return &NullableNexthopIPv4{value: val, isSet: true} +} + +func (v NullableNexthopIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_nexthop_ipv4_test.go b/pkg/iaasbeta/model_nexthop_ipv4_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_nexthop_ipv4_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_nexthop_ipv6.go b/pkg/iaasbeta/model_nexthop_ipv6.go new file mode 100644 index 00000000..b202dc51 --- /dev/null +++ b/pkg/iaasbeta/model_nexthop_ipv6.go @@ -0,0 +1,171 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NexthopIPv6 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopIPv6{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopIPv6GetTypeAttributeType = *string + +func getNexthopIPv6GetTypeAttributeTypeOk(arg NexthopIPv6GetTypeAttributeType) (ret NexthopIPv6GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv6GetTypeAttributeType(arg *NexthopIPv6GetTypeAttributeType, val NexthopIPv6GetTypeRetType) { + *arg = &val +} + +type NexthopIPv6GetTypeArgType = string +type NexthopIPv6GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type NexthopIPv6GetValueAttributeType = *string + +func getNexthopIPv6GetValueAttributeTypeOk(arg NexthopIPv6GetValueAttributeType) (ret NexthopIPv6GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv6GetValueAttributeType(arg *NexthopIPv6GetValueAttributeType, val NexthopIPv6GetValueRetType) { + *arg = &val +} + +type NexthopIPv6GetValueArgType = string +type NexthopIPv6GetValueRetType = string + +// NexthopIPv6 Object that represents an IPv6 address. +type NexthopIPv6 struct { + // REQUIRED + Type NexthopIPv6GetTypeAttributeType `json:"type" required:"true"` + // An IPv6 address. + // REQUIRED + Value NexthopIPv6GetValueAttributeType `json:"value" required:"true"` +} + +type _NexthopIPv6 NexthopIPv6 + +// NewNexthopIPv6 instantiates a new NexthopIPv6 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 NewNexthopIPv6(types NexthopIPv6GetTypeArgType, value NexthopIPv6GetValueArgType) *NexthopIPv6 { + this := NexthopIPv6{} + setNexthopIPv6GetTypeAttributeType(&this.Type, types) + setNexthopIPv6GetValueAttributeType(&this.Value, value) + return &this +} + +// NewNexthopIPv6WithDefaults instantiates a new NexthopIPv6 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 NewNexthopIPv6WithDefaults() *NexthopIPv6 { + this := NexthopIPv6{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopIPv6) GetType() (ret NexthopIPv6GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv6) GetTypeOk() (ret NexthopIPv6GetTypeRetType, ok bool) { + return getNexthopIPv6GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopIPv6) SetType(v NexthopIPv6GetTypeRetType) { + setNexthopIPv6GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *NexthopIPv6) GetValue() (ret NexthopIPv6GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv6) GetValueOk() (ret NexthopIPv6GetValueRetType, ok bool) { + return getNexthopIPv6GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *NexthopIPv6) SetValue(v NexthopIPv6GetValueRetType) { + setNexthopIPv6GetValueAttributeType(&o.Value, v) +} + +func (o NexthopIPv6) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopIPv6GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getNexthopIPv6GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableNexthopIPv6 struct { + value *NexthopIPv6 + isSet bool +} + +func (v NullableNexthopIPv6) Get() *NexthopIPv6 { + return v.value +} + +func (v *NullableNexthopIPv6) Set(val *NexthopIPv6) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopIPv6) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopIPv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopIPv6(val *NexthopIPv6) *NullableNexthopIPv6 { + return &NullableNexthopIPv6{value: val, isSet: true} +} + +func (v NullableNexthopIPv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopIPv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_nexthop_ipv6_test.go b/pkg/iaasbeta/model_nexthop_ipv6_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_nexthop_ipv6_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_nic.go b/pkg/iaasbeta/model_nic.go new file mode 100644 index 00000000..2c256f1e --- /dev/null +++ b/pkg/iaasbeta/model_nic.go @@ -0,0 +1,764 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NIC type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NIC{} + +/* + types and functions for allowedAddresses +*/ + +// isArray +type NICGetAllowedAddressesAttributeType = *[]AllowedAddressesInner +type NICGetAllowedAddressesArgType = []AllowedAddressesInner +type NICGetAllowedAddressesRetType = []AllowedAddressesInner + +func getNICGetAllowedAddressesAttributeTypeOk(arg NICGetAllowedAddressesAttributeType) (ret NICGetAllowedAddressesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetAllowedAddressesAttributeType(arg *NICGetAllowedAddressesAttributeType, val NICGetAllowedAddressesRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type NICGetDescriptionAttributeType = *string + +func getNICGetDescriptionAttributeTypeOk(arg NICGetDescriptionAttributeType) (ret NICGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetDescriptionAttributeType(arg *NICGetDescriptionAttributeType, val NICGetDescriptionRetType) { + *arg = &val +} + +type NICGetDescriptionArgType = string +type NICGetDescriptionRetType = string + +/* + types and functions for device +*/ + +// isNotNullableString +type NICGetDeviceAttributeType = *string + +func getNICGetDeviceAttributeTypeOk(arg NICGetDeviceAttributeType) (ret NICGetDeviceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetDeviceAttributeType(arg *NICGetDeviceAttributeType, val NICGetDeviceRetType) { + *arg = &val +} + +type NICGetDeviceArgType = string +type NICGetDeviceRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type NICGetIdAttributeType = *string + +func getNICGetIdAttributeTypeOk(arg NICGetIdAttributeType) (ret NICGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetIdAttributeType(arg *NICGetIdAttributeType, val NICGetIdRetType) { + *arg = &val +} + +type NICGetIdArgType = string +type NICGetIdRetType = string + +/* + types and functions for ipv4 +*/ + +// isNotNullableString +type NICGetIpv4AttributeType = *string + +func getNICGetIpv4AttributeTypeOk(arg NICGetIpv4AttributeType) (ret NICGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetIpv4AttributeType(arg *NICGetIpv4AttributeType, val NICGetIpv4RetType) { + *arg = &val +} + +type NICGetIpv4ArgType = string +type NICGetIpv4RetType = string + +/* + types and functions for ipv6 +*/ + +// isNotNullableString +type NICGetIpv6AttributeType = *string + +func getNICGetIpv6AttributeTypeOk(arg NICGetIpv6AttributeType) (ret NICGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetIpv6AttributeType(arg *NICGetIpv6AttributeType, val NICGetIpv6RetType) { + *arg = &val +} + +type NICGetIpv6ArgType = string +type NICGetIpv6RetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type NICGetLabelsAttributeType = *map[string]interface{} +type NICGetLabelsArgType = map[string]interface{} +type NICGetLabelsRetType = map[string]interface{} + +func getNICGetLabelsAttributeTypeOk(arg NICGetLabelsAttributeType) (ret NICGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetLabelsAttributeType(arg *NICGetLabelsAttributeType, val NICGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mac +*/ + +// isNotNullableString +type NICGetMacAttributeType = *string + +func getNICGetMacAttributeTypeOk(arg NICGetMacAttributeType) (ret NICGetMacRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetMacAttributeType(arg *NICGetMacAttributeType, val NICGetMacRetType) { + *arg = &val +} + +type NICGetMacArgType = string +type NICGetMacRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type NICGetNameAttributeType = *string + +func getNICGetNameAttributeTypeOk(arg NICGetNameAttributeType) (ret NICGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetNameAttributeType(arg *NICGetNameAttributeType, val NICGetNameRetType) { + *arg = &val +} + +type NICGetNameArgType = string +type NICGetNameRetType = string + +/* + types and functions for networkId +*/ + +// isNotNullableString +type NICGetNetworkIdAttributeType = *string + +func getNICGetNetworkIdAttributeTypeOk(arg NICGetNetworkIdAttributeType) (ret NICGetNetworkIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetNetworkIdAttributeType(arg *NICGetNetworkIdAttributeType, val NICGetNetworkIdRetType) { + *arg = &val +} + +type NICGetNetworkIdArgType = string +type NICGetNetworkIdRetType = string + +/* + types and functions for nicSecurity +*/ + +// isBoolean +type NICgetNicSecurityAttributeType = *bool +type NICgetNicSecurityArgType = bool +type NICgetNicSecurityRetType = bool + +func getNICgetNicSecurityAttributeTypeOk(arg NICgetNicSecurityAttributeType) (ret NICgetNicSecurityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICgetNicSecurityAttributeType(arg *NICgetNicSecurityAttributeType, val NICgetNicSecurityRetType) { + *arg = &val +} + +/* + types and functions for securityGroups +*/ + +// isArray +type NICGetSecurityGroupsAttributeType = *[]string +type NICGetSecurityGroupsArgType = []string +type NICGetSecurityGroupsRetType = []string + +func getNICGetSecurityGroupsAttributeTypeOk(arg NICGetSecurityGroupsAttributeType) (ret NICGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetSecurityGroupsAttributeType(arg *NICGetSecurityGroupsAttributeType, val NICGetSecurityGroupsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type NICGetStatusAttributeType = *string + +func getNICGetStatusAttributeTypeOk(arg NICGetStatusAttributeType) (ret NICGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetStatusAttributeType(arg *NICGetStatusAttributeType, val NICGetStatusRetType) { + *arg = &val +} + +type NICGetStatusArgType = string +type NICGetStatusRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type NICGetTypeAttributeType = *string + +func getNICGetTypeAttributeTypeOk(arg NICGetTypeAttributeType) (ret NICGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetTypeAttributeType(arg *NICGetTypeAttributeType, val NICGetTypeRetType) { + *arg = &val +} + +type NICGetTypeArgType = string +type NICGetTypeRetType = string + +// NIC Object that represents a network interface. +type NIC struct { + // A list of IPs or CIDR notations. + AllowedAddresses NICGetAllowedAddressesAttributeType `json:"allowedAddresses,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description NICGetDescriptionAttributeType `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Device NICGetDeviceAttributeType `json:"device,omitempty"` + // Universally Unique Identifier (UUID). + Id NICGetIdAttributeType `json:"id,omitempty"` + // Object that represents an IP address. + Ipv4 NICGetIpv4AttributeType `json:"ipv4,omitempty"` + // String that represents an IPv6 address. + Ipv6 NICGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels NICGetLabelsAttributeType `json:"labels,omitempty"` + // Object that represents an MAC address. + Mac NICGetMacAttributeType `json:"mac,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name NICGetNameAttributeType `json:"name,omitempty"` + // Universally Unique Identifier (UUID). + NetworkId NICGetNetworkIdAttributeType `json:"networkId,omitempty"` + // If this is set to false, then no security groups will apply to this network interface. + NicSecurity NICgetNicSecurityAttributeType `json:"nicSecurity,omitempty"` + // A list of UUIDs. + SecurityGroups NICGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` + // Possible values: `ACTIVE`, `DOWN`. + Status NICGetStatusAttributeType `json:"status,omitempty"` + // Possible values: `server`, `metadata`, `gateway`, `none`. + Type NICGetTypeAttributeType `json:"type,omitempty"` +} + +// NewNIC instantiates a new NIC 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 NewNIC() *NIC { + this := NIC{} + return &this +} + +// NewNICWithDefaults instantiates a new NIC 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 NewNICWithDefaults() *NIC { + this := NIC{} + var nicSecurity bool = true + this.NicSecurity = &nicSecurity + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *NIC) GetAllowedAddresses() (res NICGetAllowedAddressesRetType) { + res, _ = o.GetAllowedAddressesOk() + return +} + +// GetAllowedAddressesOk returns a tuple with the AllowedAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetAllowedAddressesOk() (ret NICGetAllowedAddressesRetType, ok bool) { + return getNICGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses) +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *NIC) HasAllowedAddresses() bool { + _, ok := o.GetAllowedAddressesOk() + return ok +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +func (o *NIC) SetAllowedAddresses(v NICGetAllowedAddressesRetType) { + setNICGetAllowedAddressesAttributeType(&o.AllowedAddresses, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *NIC) GetDescription() (res NICGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetDescriptionOk() (ret NICGetDescriptionRetType, ok bool) { + return getNICGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *NIC) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *NIC) SetDescription(v NICGetDescriptionRetType) { + setNICGetDescriptionAttributeType(&o.Description, v) +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *NIC) GetDevice() (res NICGetDeviceRetType) { + res, _ = o.GetDeviceOk() + return +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetDeviceOk() (ret NICGetDeviceRetType, ok bool) { + return getNICGetDeviceAttributeTypeOk(o.Device) +} + +// HasDevice returns a boolean if a field has been set. +func (o *NIC) HasDevice() bool { + _, ok := o.GetDeviceOk() + return ok +} + +// SetDevice gets a reference to the given string and assigns it to the Device field. +func (o *NIC) SetDevice(v NICGetDeviceRetType) { + setNICGetDeviceAttributeType(&o.Device, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *NIC) GetId() (res NICGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetIdOk() (ret NICGetIdRetType, ok bool) { + return getNICGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *NIC) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NIC) SetId(v NICGetIdRetType) { + setNICGetIdAttributeType(&o.Id, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *NIC) GetIpv4() (res NICGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetIpv4Ok() (ret NICGetIpv4RetType, ok bool) { + return getNICGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *NIC) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given string and assigns it to the Ipv4 field. +func (o *NIC) SetIpv4(v NICGetIpv4RetType) { + setNICGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *NIC) GetIpv6() (res NICGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetIpv6Ok() (ret NICGetIpv6RetType, ok bool) { + return getNICGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *NIC) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given string and assigns it to the Ipv6 field. +func (o *NIC) SetIpv6(v NICGetIpv6RetType) { + setNICGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *NIC) GetLabels() (res NICGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetLabelsOk() (ret NICGetLabelsRetType, ok bool) { + return getNICGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *NIC) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *NIC) SetLabels(v NICGetLabelsRetType) { + setNICGetLabelsAttributeType(&o.Labels, v) +} + +// GetMac returns the Mac field value if set, zero value otherwise. +func (o *NIC) GetMac() (res NICGetMacRetType) { + res, _ = o.GetMacOk() + return +} + +// GetMacOk returns a tuple with the Mac field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetMacOk() (ret NICGetMacRetType, ok bool) { + return getNICGetMacAttributeTypeOk(o.Mac) +} + +// HasMac returns a boolean if a field has been set. +func (o *NIC) HasMac() bool { + _, ok := o.GetMacOk() + return ok +} + +// SetMac gets a reference to the given string and assigns it to the Mac field. +func (o *NIC) SetMac(v NICGetMacRetType) { + setNICGetMacAttributeType(&o.Mac, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *NIC) GetName() (res NICGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetNameOk() (ret NICGetNameRetType, ok bool) { + return getNICGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *NIC) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *NIC) SetName(v NICGetNameRetType) { + setNICGetNameAttributeType(&o.Name, v) +} + +// GetNetworkId returns the NetworkId field value if set, zero value otherwise. +func (o *NIC) GetNetworkId() (res NICGetNetworkIdRetType) { + res, _ = o.GetNetworkIdOk() + return +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetNetworkIdOk() (ret NICGetNetworkIdRetType, ok bool) { + return getNICGetNetworkIdAttributeTypeOk(o.NetworkId) +} + +// HasNetworkId returns a boolean if a field has been set. +func (o *NIC) HasNetworkId() bool { + _, ok := o.GetNetworkIdOk() + return ok +} + +// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. +func (o *NIC) SetNetworkId(v NICGetNetworkIdRetType) { + setNICGetNetworkIdAttributeType(&o.NetworkId, v) +} + +// GetNicSecurity returns the NicSecurity field value if set, zero value otherwise. +func (o *NIC) GetNicSecurity() (res NICgetNicSecurityRetType) { + res, _ = o.GetNicSecurityOk() + return +} + +// GetNicSecurityOk returns a tuple with the NicSecurity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetNicSecurityOk() (ret NICgetNicSecurityRetType, ok bool) { + return getNICgetNicSecurityAttributeTypeOk(o.NicSecurity) +} + +// HasNicSecurity returns a boolean if a field has been set. +func (o *NIC) HasNicSecurity() bool { + _, ok := o.GetNicSecurityOk() + return ok +} + +// SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. +func (o *NIC) SetNicSecurity(v NICgetNicSecurityRetType) { + setNICgetNicSecurityAttributeType(&o.NicSecurity, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *NIC) GetSecurityGroups() (res NICGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// 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 *NIC) GetSecurityGroupsOk() (ret NICGetSecurityGroupsRetType, ok bool) { + return getNICGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *NIC) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *NIC) SetSecurityGroups(v NICGetSecurityGroupsRetType) { + setNICGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *NIC) GetStatus() (res NICGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetStatusOk() (ret NICGetStatusRetType, ok bool) { + return getNICGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *NIC) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *NIC) SetStatus(v NICGetStatusRetType) { + setNICGetStatusAttributeType(&o.Status, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *NIC) GetType() (res NICGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetTypeOk() (ret NICGetTypeRetType, ok bool) { + return getNICGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *NIC) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *NIC) SetType(v NICGetTypeRetType) { + setNICGetTypeAttributeType(&o.Type, v) +} + +func (o NIC) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNICGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses); ok { + toSerialize["AllowedAddresses"] = val + } + if val, ok := getNICGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getNICGetDeviceAttributeTypeOk(o.Device); ok { + toSerialize["Device"] = val + } + if val, ok := getNICGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getNICGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getNICGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getNICGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getNICGetMacAttributeTypeOk(o.Mac); ok { + toSerialize["Mac"] = val + } + if val, ok := getNICGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getNICGetNetworkIdAttributeTypeOk(o.NetworkId); ok { + toSerialize["NetworkId"] = val + } + if val, ok := getNICgetNicSecurityAttributeTypeOk(o.NicSecurity); ok { + toSerialize["NicSecurity"] = val + } + if val, ok := getNICGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + if val, ok := getNICGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getNICGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableNIC struct { + value *NIC + isSet bool +} + +func (v NullableNIC) Get() *NIC { + return v.value +} + +func (v *NullableNIC) Set(val *NIC) { + v.value = val + v.isSet = true +} + +func (v NullableNIC) IsSet() bool { + return v.isSet +} + +func (v *NullableNIC) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNIC(val *NIC) *NullableNIC { + return &NullableNIC{value: val, isSet: true} +} + +func (v NullableNIC) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNIC) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_nic_list_response.go b/pkg/iaasbeta/model_nic_list_response.go new file mode 100644 index 00000000..b4a24cdb --- /dev/null +++ b/pkg/iaasbeta/model_nic_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the NICListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NICListResponse{} + +/* + types and functions for items +*/ + +// isArray +type NICListResponseGetItemsAttributeType = *[]NIC +type NICListResponseGetItemsArgType = []NIC +type NICListResponseGetItemsRetType = []NIC + +func getNICListResponseGetItemsAttributeTypeOk(arg NICListResponseGetItemsAttributeType) (ret NICListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICListResponseGetItemsAttributeType(arg *NICListResponseGetItemsAttributeType, val NICListResponseGetItemsRetType) { + *arg = &val +} + +// NICListResponse NIC list response. +type NICListResponse struct { + // A list of network interfaces. + // REQUIRED + Items NICListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _NICListResponse NICListResponse + +// NewNICListResponse instantiates a new NICListResponse 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 NewNICListResponse(items NICListResponseGetItemsArgType) *NICListResponse { + this := NICListResponse{} + setNICListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewNICListResponseWithDefaults instantiates a new NICListResponse 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 NewNICListResponseWithDefaults() *NICListResponse { + this := NICListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *NICListResponse) GetItems() (ret NICListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *NICListResponse) GetItemsOk() (ret NICListResponseGetItemsRetType, ok bool) { + return getNICListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *NICListResponse) SetItems(v NICListResponseGetItemsRetType) { + setNICListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o NICListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNICListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableNICListResponse struct { + value *NICListResponse + isSet bool +} + +func (v NullableNICListResponse) Get() *NICListResponse { + return v.value +} + +func (v *NullableNICListResponse) Set(val *NICListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNICListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNICListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNICListResponse(val *NICListResponse) *NullableNICListResponse { + return &NullableNICListResponse{value: val, isSet: true} +} + +func (v NullableNICListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNICListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_nic_list_response_test.go b/pkg/iaasbeta/model_nic_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_nic_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_nic_test.go b/pkg/iaasbeta/model_nic_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_nic_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_partial_update_network_area_payload.go b/pkg/iaasbeta/model_partial_update_network_area_payload.go new file mode 100644 index 00000000..67b44003 --- /dev/null +++ b/pkg/iaasbeta/model_partial_update_network_area_payload.go @@ -0,0 +1,176 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the PartialUpdateNetworkAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PartialUpdateNetworkAreaPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type PartialUpdateNetworkAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type PartialUpdateNetworkAreaPayloadGetLabelsArgType = map[string]interface{} +type PartialUpdateNetworkAreaPayloadGetLabelsRetType = map[string]interface{} + +func getPartialUpdateNetworkAreaPayloadGetLabelsAttributeTypeOk(arg PartialUpdateNetworkAreaPayloadGetLabelsAttributeType) (ret PartialUpdateNetworkAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkAreaPayloadGetLabelsAttributeType(arg *PartialUpdateNetworkAreaPayloadGetLabelsAttributeType, val PartialUpdateNetworkAreaPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type PartialUpdateNetworkAreaPayloadGetNameAttributeType = *string + +func getPartialUpdateNetworkAreaPayloadGetNameAttributeTypeOk(arg PartialUpdateNetworkAreaPayloadGetNameAttributeType) (ret PartialUpdateNetworkAreaPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkAreaPayloadGetNameAttributeType(arg *PartialUpdateNetworkAreaPayloadGetNameAttributeType, val PartialUpdateNetworkAreaPayloadGetNameRetType) { + *arg = &val +} + +type PartialUpdateNetworkAreaPayloadGetNameArgType = string +type PartialUpdateNetworkAreaPayloadGetNameRetType = string + +// PartialUpdateNetworkAreaPayload Object that represents the network area update request. +type PartialUpdateNetworkAreaPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels PartialUpdateNetworkAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` + Name PartialUpdateNetworkAreaPayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewPartialUpdateNetworkAreaPayload instantiates a new PartialUpdateNetworkAreaPayload 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 NewPartialUpdateNetworkAreaPayload() *PartialUpdateNetworkAreaPayload { + this := PartialUpdateNetworkAreaPayload{} + return &this +} + +// NewPartialUpdateNetworkAreaPayloadWithDefaults instantiates a new PartialUpdateNetworkAreaPayload 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 NewPartialUpdateNetworkAreaPayloadWithDefaults() *PartialUpdateNetworkAreaPayload { + this := PartialUpdateNetworkAreaPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PartialUpdateNetworkAreaPayload) GetLabels() (res PartialUpdateNetworkAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkAreaPayload) GetLabelsOk() (ret PartialUpdateNetworkAreaPayloadGetLabelsRetType, ok bool) { + return getPartialUpdateNetworkAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *PartialUpdateNetworkAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *PartialUpdateNetworkAreaPayload) SetLabels(v PartialUpdateNetworkAreaPayloadGetLabelsRetType) { + setPartialUpdateNetworkAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PartialUpdateNetworkAreaPayload) GetName() (res PartialUpdateNetworkAreaPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkAreaPayload) GetNameOk() (ret PartialUpdateNetworkAreaPayloadGetNameRetType, ok bool) { + return getPartialUpdateNetworkAreaPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *PartialUpdateNetworkAreaPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PartialUpdateNetworkAreaPayload) SetName(v PartialUpdateNetworkAreaPayloadGetNameRetType) { + setPartialUpdateNetworkAreaPayloadGetNameAttributeType(&o.Name, v) +} + +func (o PartialUpdateNetworkAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPartialUpdateNetworkAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getPartialUpdateNetworkAreaPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullablePartialUpdateNetworkAreaPayload struct { + value *PartialUpdateNetworkAreaPayload + isSet bool +} + +func (v NullablePartialUpdateNetworkAreaPayload) Get() *PartialUpdateNetworkAreaPayload { + return v.value +} + +func (v *NullablePartialUpdateNetworkAreaPayload) Set(val *PartialUpdateNetworkAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateNetworkAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateNetworkAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateNetworkAreaPayload(val *PartialUpdateNetworkAreaPayload) *NullablePartialUpdateNetworkAreaPayload { + return &NullablePartialUpdateNetworkAreaPayload{value: val, isSet: true} +} + +func (v NullablePartialUpdateNetworkAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateNetworkAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_partial_update_network_area_payload_test.go b/pkg/iaasbeta/model_partial_update_network_area_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_partial_update_network_area_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_partial_update_network_payload.go b/pkg/iaasbeta/model_partial_update_network_payload.go new file mode 100644 index 00000000..3c990962 --- /dev/null +++ b/pkg/iaasbeta/model_partial_update_network_payload.go @@ -0,0 +1,416 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the PartialUpdateNetworkPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PartialUpdateNetworkPayload{} + +/* + types and functions for dhcp +*/ + +// isBoolean +type PartialUpdateNetworkPayloadgetDhcpAttributeType = *bool +type PartialUpdateNetworkPayloadgetDhcpArgType = bool +type PartialUpdateNetworkPayloadgetDhcpRetType = bool + +func getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(arg PartialUpdateNetworkPayloadgetDhcpAttributeType) (ret PartialUpdateNetworkPayloadgetDhcpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadgetDhcpAttributeType(arg *PartialUpdateNetworkPayloadgetDhcpAttributeType, val PartialUpdateNetworkPayloadgetDhcpRetType) { + *arg = &val +} + +/* + types and functions for ipv4 +*/ + +// isModel +type PartialUpdateNetworkPayloadGetIpv4AttributeType = *UpdateNetworkIPv4Body +type PartialUpdateNetworkPayloadGetIpv4ArgType = UpdateNetworkIPv4Body +type PartialUpdateNetworkPayloadGetIpv4RetType = UpdateNetworkIPv4Body + +func getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(arg PartialUpdateNetworkPayloadGetIpv4AttributeType) (ret PartialUpdateNetworkPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetIpv4AttributeType(arg *PartialUpdateNetworkPayloadGetIpv4AttributeType, val PartialUpdateNetworkPayloadGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type PartialUpdateNetworkPayloadGetIpv6AttributeType = *UpdateNetworkIPv6Body +type PartialUpdateNetworkPayloadGetIpv6ArgType = UpdateNetworkIPv6Body +type PartialUpdateNetworkPayloadGetIpv6RetType = UpdateNetworkIPv6Body + +func getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(arg PartialUpdateNetworkPayloadGetIpv6AttributeType) (ret PartialUpdateNetworkPayloadGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetIpv6AttributeType(arg *PartialUpdateNetworkPayloadGetIpv6AttributeType, val PartialUpdateNetworkPayloadGetIpv6RetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type PartialUpdateNetworkPayloadGetLabelsAttributeType = *map[string]interface{} +type PartialUpdateNetworkPayloadGetLabelsArgType = map[string]interface{} +type PartialUpdateNetworkPayloadGetLabelsRetType = map[string]interface{} + +func getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(arg PartialUpdateNetworkPayloadGetLabelsAttributeType) (ret PartialUpdateNetworkPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetLabelsAttributeType(arg *PartialUpdateNetworkPayloadGetLabelsAttributeType, val PartialUpdateNetworkPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type PartialUpdateNetworkPayloadGetNameAttributeType = *string + +func getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(arg PartialUpdateNetworkPayloadGetNameAttributeType) (ret PartialUpdateNetworkPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetNameAttributeType(arg *PartialUpdateNetworkPayloadGetNameAttributeType, val PartialUpdateNetworkPayloadGetNameRetType) { + *arg = &val +} + +type PartialUpdateNetworkPayloadGetNameArgType = string +type PartialUpdateNetworkPayloadGetNameRetType = string + +/* + types and functions for routed +*/ + +// isBoolean +type PartialUpdateNetworkPayloadgetRoutedAttributeType = *bool +type PartialUpdateNetworkPayloadgetRoutedArgType = bool +type PartialUpdateNetworkPayloadgetRoutedRetType = bool + +func getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(arg PartialUpdateNetworkPayloadgetRoutedAttributeType) (ret PartialUpdateNetworkPayloadgetRoutedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadgetRoutedAttributeType(arg *PartialUpdateNetworkPayloadgetRoutedAttributeType, val PartialUpdateNetworkPayloadgetRoutedRetType) { + *arg = &val +} + +/* + types and functions for routingTableId +*/ + +// isNotNullableString +type PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType = *string + +func getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(arg PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType) (ret PartialUpdateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetRoutingTableIdAttributeType(arg *PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType, val PartialUpdateNetworkPayloadGetRoutingTableIdRetType) { + *arg = &val +} + +type PartialUpdateNetworkPayloadGetRoutingTableIdArgType = string +type PartialUpdateNetworkPayloadGetRoutingTableIdRetType = string + +// PartialUpdateNetworkPayload Object that represents the request body for a network update. +type PartialUpdateNetworkPayload struct { + // Enable or disable DHCP for a network. + Dhcp PartialUpdateNetworkPayloadgetDhcpAttributeType `json:"dhcp,omitempty"` + Ipv4 PartialUpdateNetworkPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 PartialUpdateNetworkPayloadGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels PartialUpdateNetworkPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name PartialUpdateNetworkPayloadGetNameAttributeType `json:"name,omitempty"` + // Shows if the network is routed and therefore accessible from other networks. + Routed PartialUpdateNetworkPayloadgetRoutedAttributeType `json:"routed,omitempty"` + // Universally Unique Identifier (UUID). + RoutingTableId PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"` +} + +// NewPartialUpdateNetworkPayload instantiates a new PartialUpdateNetworkPayload 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 NewPartialUpdateNetworkPayload() *PartialUpdateNetworkPayload { + this := PartialUpdateNetworkPayload{} + return &this +} + +// NewPartialUpdateNetworkPayloadWithDefaults instantiates a new PartialUpdateNetworkPayload 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 NewPartialUpdateNetworkPayloadWithDefaults() *PartialUpdateNetworkPayload { + this := PartialUpdateNetworkPayload{} + return &this +} + +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetDhcp() (res PartialUpdateNetworkPayloadgetDhcpRetType) { + res, _ = o.GetDhcpOk() + return +} + +// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetDhcpOk() (ret PartialUpdateNetworkPayloadgetDhcpRetType, ok bool) { + return getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp) +} + +// HasDhcp returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasDhcp() bool { + _, ok := o.GetDhcpOk() + return ok +} + +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *PartialUpdateNetworkPayload) SetDhcp(v PartialUpdateNetworkPayloadgetDhcpRetType) { + setPartialUpdateNetworkPayloadgetDhcpAttributeType(&o.Dhcp, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetIpv4() (res PartialUpdateNetworkPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetIpv4Ok() (ret PartialUpdateNetworkPayloadGetIpv4RetType, ok bool) { + return getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given UpdateNetworkIPv4Body and assigns it to the Ipv4 field. +func (o *PartialUpdateNetworkPayload) SetIpv4(v PartialUpdateNetworkPayloadGetIpv4RetType) { + setPartialUpdateNetworkPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetIpv6() (res PartialUpdateNetworkPayloadGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetIpv6Ok() (ret PartialUpdateNetworkPayloadGetIpv6RetType, ok bool) { + return getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given UpdateNetworkIPv6Body and assigns it to the Ipv6 field. +func (o *PartialUpdateNetworkPayload) SetIpv6(v PartialUpdateNetworkPayloadGetIpv6RetType) { + setPartialUpdateNetworkPayloadGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetLabels() (res PartialUpdateNetworkPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetLabelsOk() (ret PartialUpdateNetworkPayloadGetLabelsRetType, ok bool) { + return getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *PartialUpdateNetworkPayload) SetLabels(v PartialUpdateNetworkPayloadGetLabelsRetType) { + setPartialUpdateNetworkPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetName() (res PartialUpdateNetworkPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetNameOk() (ret PartialUpdateNetworkPayloadGetNameRetType, ok bool) { + return getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PartialUpdateNetworkPayload) SetName(v PartialUpdateNetworkPayloadGetNameRetType) { + setPartialUpdateNetworkPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRouted returns the Routed field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetRouted() (res PartialUpdateNetworkPayloadgetRoutedRetType) { + res, _ = o.GetRoutedOk() + return +} + +// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetRoutedOk() (ret PartialUpdateNetworkPayloadgetRoutedRetType, ok bool) { + return getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed) +} + +// HasRouted returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasRouted() bool { + _, ok := o.GetRoutedOk() + return ok +} + +// SetRouted gets a reference to the given bool and assigns it to the Routed field. +func (o *PartialUpdateNetworkPayload) SetRouted(v PartialUpdateNetworkPayloadgetRoutedRetType) { + setPartialUpdateNetworkPayloadgetRoutedAttributeType(&o.Routed, v) +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetRoutingTableId() (res PartialUpdateNetworkPayloadGetRoutingTableIdRetType) { + res, _ = o.GetRoutingTableIdOk() + return +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetRoutingTableIdOk() (ret PartialUpdateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + return getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId) +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasRoutingTableId() bool { + _, ok := o.GetRoutingTableIdOk() + return ok +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *PartialUpdateNetworkPayload) SetRoutingTableId(v PartialUpdateNetworkPayloadGetRoutingTableIdRetType) { + setPartialUpdateNetworkPayloadGetRoutingTableIdAttributeType(&o.RoutingTableId, v) +} + +func (o PartialUpdateNetworkPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp); ok { + toSerialize["Dhcp"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed); ok { + toSerialize["Routed"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok { + toSerialize["RoutingTableId"] = val + } + return toSerialize, nil +} + +type NullablePartialUpdateNetworkPayload struct { + value *PartialUpdateNetworkPayload + isSet bool +} + +func (v NullablePartialUpdateNetworkPayload) Get() *PartialUpdateNetworkPayload { + return v.value +} + +func (v *NullablePartialUpdateNetworkPayload) Set(val *PartialUpdateNetworkPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateNetworkPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateNetworkPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateNetworkPayload(val *PartialUpdateNetworkPayload) *NullablePartialUpdateNetworkPayload { + return &NullablePartialUpdateNetworkPayload{value: val, isSet: true} +} + +func (v NullablePartialUpdateNetworkPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateNetworkPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_partial_update_network_payload_test.go b/pkg/iaasbeta/model_partial_update_network_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_partial_update_network_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_port_range.go b/pkg/iaasbeta/model_port_range.go new file mode 100644 index 00000000..879ff5ba --- /dev/null +++ b/pkg/iaasbeta/model_port_range.go @@ -0,0 +1,170 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the PortRange type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortRange{} + +/* + types and functions for max +*/ + +// isLong +type PortRangeGetMaxAttributeType = *int64 +type PortRangeGetMaxArgType = int64 +type PortRangeGetMaxRetType = int64 + +func getPortRangeGetMaxAttributeTypeOk(arg PortRangeGetMaxAttributeType) (ret PortRangeGetMaxRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPortRangeGetMaxAttributeType(arg *PortRangeGetMaxAttributeType, val PortRangeGetMaxRetType) { + *arg = &val +} + +/* + types and functions for min +*/ + +// isLong +type PortRangeGetMinAttributeType = *int64 +type PortRangeGetMinArgType = int64 +type PortRangeGetMinRetType = int64 + +func getPortRangeGetMinAttributeTypeOk(arg PortRangeGetMinAttributeType) (ret PortRangeGetMinRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPortRangeGetMinAttributeType(arg *PortRangeGetMinAttributeType, val PortRangeGetMinRetType) { + *arg = &val +} + +// PortRange Object that represents a range of ports. +type PortRange struct { + // The maximum port number. Should be greater or equal to the minimum. + // REQUIRED + Max PortRangeGetMaxAttributeType `json:"max" required:"true"` + // The minimum port number. Should be less or equal to the maximum. + // REQUIRED + Min PortRangeGetMinAttributeType `json:"min" required:"true"` +} + +type _PortRange PortRange + +// NewPortRange instantiates a new PortRange 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 NewPortRange(max PortRangeGetMaxArgType, min PortRangeGetMinArgType) *PortRange { + this := PortRange{} + setPortRangeGetMaxAttributeType(&this.Max, max) + setPortRangeGetMinAttributeType(&this.Min, min) + return &this +} + +// NewPortRangeWithDefaults instantiates a new PortRange 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 NewPortRangeWithDefaults() *PortRange { + this := PortRange{} + return &this +} + +// GetMax returns the Max field value +func (o *PortRange) GetMax() (ret PortRangeGetMaxRetType) { + ret, _ = o.GetMaxOk() + return ret +} + +// GetMaxOk returns a tuple with the Max field value +// and a boolean to check if the value has been set. +func (o *PortRange) GetMaxOk() (ret PortRangeGetMaxRetType, ok bool) { + return getPortRangeGetMaxAttributeTypeOk(o.Max) +} + +// SetMax sets field value +func (o *PortRange) SetMax(v PortRangeGetMaxRetType) { + setPortRangeGetMaxAttributeType(&o.Max, v) +} + +// GetMin returns the Min field value +func (o *PortRange) GetMin() (ret PortRangeGetMinRetType) { + ret, _ = o.GetMinOk() + return ret +} + +// GetMinOk returns a tuple with the Min field value +// and a boolean to check if the value has been set. +func (o *PortRange) GetMinOk() (ret PortRangeGetMinRetType, ok bool) { + return getPortRangeGetMinAttributeTypeOk(o.Min) +} + +// SetMin sets field value +func (o *PortRange) SetMin(v PortRangeGetMinRetType) { + setPortRangeGetMinAttributeType(&o.Min, v) +} + +func (o PortRange) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPortRangeGetMaxAttributeTypeOk(o.Max); ok { + toSerialize["Max"] = val + } + if val, ok := getPortRangeGetMinAttributeTypeOk(o.Min); ok { + toSerialize["Min"] = val + } + return toSerialize, nil +} + +type NullablePortRange struct { + value *PortRange + isSet bool +} + +func (v NullablePortRange) Get() *PortRange { + return v.value +} + +func (v *NullablePortRange) Set(val *PortRange) { + v.value = val + v.isSet = true +} + +func (v NullablePortRange) IsSet() bool { + return v.isSet +} + +func (v *NullablePortRange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortRange(val *PortRange) *NullablePortRange { + return &NullablePortRange{value: val, isSet: true} +} + +func (v NullablePortRange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortRange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_port_range_test.go b/pkg/iaasbeta/model_port_range_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_port_range_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_project.go b/pkg/iaasbeta/model_project.go new file mode 100644 index 00000000..5e09703c --- /dev/null +++ b/pkg/iaasbeta/model_project.go @@ -0,0 +1,359 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Project type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Project{} + +/* + types and functions for areaId +*/ + +// isModel +type ProjectGetAreaIdAttributeType = *AreaId +type ProjectGetAreaIdArgType = AreaId +type ProjectGetAreaIdRetType = AreaId + +func getProjectGetAreaIdAttributeTypeOk(arg ProjectGetAreaIdAttributeType) (ret ProjectGetAreaIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectGetAreaIdAttributeType(arg *ProjectGetAreaIdAttributeType, val ProjectGetAreaIdRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type ProjectGetCreatedAtAttributeType = *time.Time +type ProjectGetCreatedAtArgType = time.Time +type ProjectGetCreatedAtRetType = time.Time + +func getProjectGetCreatedAtAttributeTypeOk(arg ProjectGetCreatedAtAttributeType) (ret ProjectGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectGetCreatedAtAttributeType(arg *ProjectGetCreatedAtAttributeType, val ProjectGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type ProjectGetIdAttributeType = *string + +func getProjectGetIdAttributeTypeOk(arg ProjectGetIdAttributeType) (ret ProjectGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectGetIdAttributeType(arg *ProjectGetIdAttributeType, val ProjectGetIdRetType) { + *arg = &val +} + +type ProjectGetIdArgType = string +type ProjectGetIdRetType = string + +/* + types and functions for internetAccess +*/ + +// isBoolean +type ProjectgetInternetAccessAttributeType = *bool +type ProjectgetInternetAccessArgType = bool +type ProjectgetInternetAccessRetType = bool + +func getProjectgetInternetAccessAttributeTypeOk(arg ProjectgetInternetAccessAttributeType) (ret ProjectgetInternetAccessRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectgetInternetAccessAttributeType(arg *ProjectgetInternetAccessAttributeType, val ProjectgetInternetAccessRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type ProjectGetStatusAttributeType = *string + +func getProjectGetStatusAttributeTypeOk(arg ProjectGetStatusAttributeType) (ret ProjectGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectGetStatusAttributeType(arg *ProjectGetStatusAttributeType, val ProjectGetStatusRetType) { + *arg = &val +} + +type ProjectGetStatusArgType = string +type ProjectGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type ProjectGetUpdatedAtAttributeType = *time.Time +type ProjectGetUpdatedAtArgType = time.Time +type ProjectGetUpdatedAtRetType = time.Time + +func getProjectGetUpdatedAtAttributeTypeOk(arg ProjectGetUpdatedAtAttributeType) (ret ProjectGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectGetUpdatedAtAttributeType(arg *ProjectGetUpdatedAtAttributeType, val ProjectGetUpdatedAtRetType) { + *arg = &val +} + +// Project Object that represents a STACKIT project. +type Project struct { + // REQUIRED + AreaId ProjectGetAreaIdAttributeType `json:"areaId" required:"true"` + // Date-time when resource was created. + CreatedAt ProjectGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + Id ProjectGetIdAttributeType `json:"id" required:"true"` + InternetAccess ProjectgetInternetAccessAttributeType `json:"internetAccess,omitempty"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + // REQUIRED + Status ProjectGetStatusAttributeType `json:"status" required:"true"` + // Date-time when resource was last updated. + UpdatedAt ProjectGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Project Project + +// NewProject instantiates a new Project object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProject(areaId ProjectGetAreaIdArgType, id ProjectGetIdArgType, status ProjectGetStatusArgType) *Project { + this := Project{} + setProjectGetAreaIdAttributeType(&this.AreaId, areaId) + setProjectGetIdAttributeType(&this.Id, id) + setProjectGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewProjectWithDefaults instantiates a new Project object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectWithDefaults() *Project { + this := Project{} + return &this +} + +// GetAreaId returns the AreaId field value +func (o *Project) GetAreaId() (ret ProjectGetAreaIdRetType) { + ret, _ = o.GetAreaIdOk() + return ret +} + +// GetAreaIdOk returns a tuple with the AreaId field value +// and a boolean to check if the value has been set. +func (o *Project) GetAreaIdOk() (ret ProjectGetAreaIdRetType, ok bool) { + return getProjectGetAreaIdAttributeTypeOk(o.AreaId) +} + +// SetAreaId sets field value +func (o *Project) SetAreaId(v ProjectGetAreaIdRetType) { + setProjectGetAreaIdAttributeType(&o.AreaId, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Project) GetCreatedAt() (res ProjectGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetCreatedAtOk() (ret ProjectGetCreatedAtRetType, ok bool) { + return getProjectGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Project) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Project) SetCreatedAt(v ProjectGetCreatedAtRetType) { + setProjectGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value +func (o *Project) GetId() (ret ProjectGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Project) GetIdOk() (ret ProjectGetIdRetType, ok bool) { + return getProjectGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Project) SetId(v ProjectGetIdRetType) { + setProjectGetIdAttributeType(&o.Id, v) +} + +// GetInternetAccess returns the InternetAccess field value if set, zero value otherwise. +func (o *Project) GetInternetAccess() (res ProjectgetInternetAccessRetType) { + res, _ = o.GetInternetAccessOk() + return +} + +// GetInternetAccessOk returns a tuple with the InternetAccess field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetInternetAccessOk() (ret ProjectgetInternetAccessRetType, ok bool) { + return getProjectgetInternetAccessAttributeTypeOk(o.InternetAccess) +} + +// HasInternetAccess returns a boolean if a field has been set. +func (o *Project) HasInternetAccess() bool { + _, ok := o.GetInternetAccessOk() + return ok +} + +// SetInternetAccess gets a reference to the given bool and assigns it to the InternetAccess field. +func (o *Project) SetInternetAccess(v ProjectgetInternetAccessRetType) { + setProjectgetInternetAccessAttributeType(&o.InternetAccess, v) +} + +// GetStatus returns the Status field value +func (o *Project) GetStatus() (ret ProjectGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Project) GetStatusOk() (ret ProjectGetStatusRetType, ok bool) { + return getProjectGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Project) SetStatus(v ProjectGetStatusRetType) { + setProjectGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Project) GetUpdatedAt() (res ProjectGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetUpdatedAtOk() (ret ProjectGetUpdatedAtRetType, ok bool) { + return getProjectGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Project) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Project) SetUpdatedAt(v ProjectGetUpdatedAtRetType) { + setProjectGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Project) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getProjectGetAreaIdAttributeTypeOk(o.AreaId); ok { + toSerialize["AreaId"] = val + } + if val, ok := getProjectGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getProjectGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getProjectgetInternetAccessAttributeTypeOk(o.InternetAccess); ok { + toSerialize["InternetAccess"] = val + } + if val, ok := getProjectGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getProjectGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableProject struct { + value *Project + isSet bool +} + +func (v NullableProject) Get() *Project { + return v.value +} + +func (v *NullableProject) Set(val *Project) { + v.value = val + v.isSet = true +} + +func (v NullableProject) IsSet() bool { + return v.isSet +} + +func (v *NullableProject) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProject(val *Project) *NullableProject { + return &NullableProject{value: val, isSet: true} +} + +func (v NullableProject) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProject) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_project_list_response.go b/pkg/iaasbeta/model_project_list_response.go new file mode 100644 index 00000000..0207dd9b --- /dev/null +++ b/pkg/iaasbeta/model_project_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ProjectListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProjectListResponse{} + +/* + types and functions for items +*/ + +// isArray +type ProjectListResponseGetItemsAttributeType = *[]string +type ProjectListResponseGetItemsArgType = []string +type ProjectListResponseGetItemsRetType = []string + +func getProjectListResponseGetItemsAttributeTypeOk(arg ProjectListResponseGetItemsAttributeType) (ret ProjectListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectListResponseGetItemsAttributeType(arg *ProjectListResponseGetItemsAttributeType, val ProjectListResponseGetItemsRetType) { + *arg = &val +} + +// ProjectListResponse Project list response. +type ProjectListResponse struct { + // A list of STACKIT projects. + // REQUIRED + Items ProjectListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _ProjectListResponse ProjectListResponse + +// NewProjectListResponse instantiates a new ProjectListResponse 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 NewProjectListResponse(items ProjectListResponseGetItemsArgType) *ProjectListResponse { + this := ProjectListResponse{} + setProjectListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewProjectListResponseWithDefaults instantiates a new ProjectListResponse 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 NewProjectListResponseWithDefaults() *ProjectListResponse { + this := ProjectListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ProjectListResponse) GetItems() (ret ProjectListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ProjectListResponse) GetItemsOk() (ret ProjectListResponseGetItemsRetType, ok bool) { + return getProjectListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *ProjectListResponse) SetItems(v ProjectListResponseGetItemsRetType) { + setProjectListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o ProjectListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getProjectListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableProjectListResponse struct { + value *ProjectListResponse + isSet bool +} + +func (v NullableProjectListResponse) Get() *ProjectListResponse { + return v.value +} + +func (v *NullableProjectListResponse) Set(val *ProjectListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableProjectListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectListResponse(val *ProjectListResponse) *NullableProjectListResponse { + return &NullableProjectListResponse{value: val, isSet: true} +} + +func (v NullableProjectListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_project_list_response_test.go b/pkg/iaasbeta/model_project_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_project_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_project_test.go b/pkg/iaasbeta/model_project_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_project_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_protocol.go b/pkg/iaasbeta/model_protocol.go new file mode 100644 index 00000000..24f3f42a --- /dev/null +++ b/pkg/iaasbeta/model_protocol.go @@ -0,0 +1,177 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the Protocol type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Protocol{} + +/* + types and functions for name +*/ + +// isNotNullableString +type ProtocolGetNameAttributeType = *string + +func getProtocolGetNameAttributeTypeOk(arg ProtocolGetNameAttributeType) (ret ProtocolGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProtocolGetNameAttributeType(arg *ProtocolGetNameAttributeType, val ProtocolGetNameRetType) { + *arg = &val +} + +type ProtocolGetNameArgType = string +type ProtocolGetNameRetType = string + +/* + types and functions for number +*/ + +// isLong +type ProtocolGetNumberAttributeType = *int64 +type ProtocolGetNumberArgType = int64 +type ProtocolGetNumberRetType = int64 + +func getProtocolGetNumberAttributeTypeOk(arg ProtocolGetNumberAttributeType) (ret ProtocolGetNumberRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProtocolGetNumberAttributeType(arg *ProtocolGetNumberAttributeType, val ProtocolGetNumberRetType) { + *arg = &val +} + +// Protocol The schema for a protocol of a security group rule. +type Protocol struct { + // The protocol name which the rule should match. Possible values: `ah`, `dccp`, `egp`, `esp`, `gre`, `icmp`, `igmp`, `ipip`, `ipv6-encap`, `ipv6-frag`, `ipv6-icmp`, `ipv6-nonxt`, `ipv6-opts`, `ipv6-route`, `ospf`, `pgm`, `rsvp`, `sctp`, `tcp`, `udp`, `udplite`, `vrrp`. + Name ProtocolGetNameAttributeType `json:"name,omitempty"` + // The protocol number which the rule should match. + Number ProtocolGetNumberAttributeType `json:"number,omitempty"` +} + +// NewProtocol instantiates a new Protocol 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 NewProtocol() *Protocol { + this := Protocol{} + return &this +} + +// NewProtocolWithDefaults instantiates a new Protocol 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 NewProtocolWithDefaults() *Protocol { + this := Protocol{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Protocol) GetName() (res ProtocolGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Protocol) GetNameOk() (ret ProtocolGetNameRetType, ok bool) { + return getProtocolGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Protocol) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Protocol) SetName(v ProtocolGetNameRetType) { + setProtocolGetNameAttributeType(&o.Name, v) +} + +// GetNumber returns the Number field value if set, zero value otherwise. +func (o *Protocol) GetNumber() (res ProtocolGetNumberRetType) { + res, _ = o.GetNumberOk() + return +} + +// GetNumberOk returns a tuple with the Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Protocol) GetNumberOk() (ret ProtocolGetNumberRetType, ok bool) { + return getProtocolGetNumberAttributeTypeOk(o.Number) +} + +// HasNumber returns a boolean if a field has been set. +func (o *Protocol) HasNumber() bool { + _, ok := o.GetNumberOk() + return ok +} + +// SetNumber gets a reference to the given int64 and assigns it to the Number field. +func (o *Protocol) SetNumber(v ProtocolGetNumberRetType) { + setProtocolGetNumberAttributeType(&o.Number, v) +} + +func (o Protocol) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getProtocolGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getProtocolGetNumberAttributeTypeOk(o.Number); ok { + toSerialize["Number"] = val + } + return toSerialize, nil +} + +type NullableProtocol struct { + value *Protocol + isSet bool +} + +func (v NullableProtocol) Get() *Protocol { + return v.value +} + +func (v *NullableProtocol) Set(val *Protocol) { + v.value = val + v.isSet = true +} + +func (v NullableProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtocol(val *Protocol) *NullableProtocol { + return &NullableProtocol{value: val, isSet: true} +} + +func (v NullableProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_protocol_test.go b/pkg/iaasbeta/model_protocol_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_protocol_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_public_ip.go b/pkg/iaasbeta/model_public_ip.go new file mode 100644 index 00000000..f394865a --- /dev/null +++ b/pkg/iaasbeta/model_public_ip.go @@ -0,0 +1,290 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the PublicIp type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicIp{} + +/* + types and functions for id +*/ + +// isNotNullableString +type PublicIpGetIdAttributeType = *string + +func getPublicIpGetIdAttributeTypeOk(arg PublicIpGetIdAttributeType) (ret PublicIpGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicIpGetIdAttributeType(arg *PublicIpGetIdAttributeType, val PublicIpGetIdRetType) { + *arg = &val +} + +type PublicIpGetIdArgType = string +type PublicIpGetIdRetType = string + +/* + types and functions for ip +*/ + +// isNotNullableString +type PublicIpGetIpAttributeType = *string + +func getPublicIpGetIpAttributeTypeOk(arg PublicIpGetIpAttributeType) (ret PublicIpGetIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicIpGetIpAttributeType(arg *PublicIpGetIpAttributeType, val PublicIpGetIpRetType) { + *arg = &val +} + +type PublicIpGetIpArgType = string +type PublicIpGetIpRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type PublicIpGetLabelsAttributeType = *map[string]interface{} +type PublicIpGetLabelsArgType = map[string]interface{} +type PublicIpGetLabelsRetType = map[string]interface{} + +func getPublicIpGetLabelsAttributeTypeOk(arg PublicIpGetLabelsAttributeType) (ret PublicIpGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicIpGetLabelsAttributeType(arg *PublicIpGetLabelsAttributeType, val PublicIpGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for networkInterface +*/ + +// isNullableString +type PublicIpGetNetworkInterfaceAttributeType = *NullableString + +func getPublicIpGetNetworkInterfaceAttributeTypeOk(arg PublicIpGetNetworkInterfaceAttributeType) (ret PublicIpGetNetworkInterfaceRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setPublicIpGetNetworkInterfaceAttributeType(arg *PublicIpGetNetworkInterfaceAttributeType, val PublicIpGetNetworkInterfaceRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type PublicIpGetNetworkInterfaceArgType = *string +type PublicIpGetNetworkInterfaceRetType = *string + +// PublicIp Object that represents a public IP. +type PublicIp struct { + // Universally Unique Identifier (UUID). + Id PublicIpGetIdAttributeType `json:"id,omitempty"` + // String that represents an IPv4 address. + Ip PublicIpGetIpAttributeType `json:"ip,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels PublicIpGetLabelsAttributeType `json:"labels,omitempty"` + // Universally Unique Identifier (UUID). + NetworkInterface PublicIpGetNetworkInterfaceAttributeType `json:"networkInterface,omitempty"` +} + +// NewPublicIp instantiates a new PublicIp 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 NewPublicIp() *PublicIp { + this := PublicIp{} + return &this +} + +// NewPublicIpWithDefaults instantiates a new PublicIp 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 NewPublicIpWithDefaults() *PublicIp { + this := PublicIp{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PublicIp) GetId() (res PublicIpGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PublicIp) GetIdOk() (ret PublicIpGetIdRetType, ok bool) { + return getPublicIpGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *PublicIp) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PublicIp) SetId(v PublicIpGetIdRetType) { + setPublicIpGetIdAttributeType(&o.Id, v) +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *PublicIp) GetIp() (res PublicIpGetIpRetType) { + res, _ = o.GetIpOk() + return +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PublicIp) GetIpOk() (ret PublicIpGetIpRetType, ok bool) { + return getPublicIpGetIpAttributeTypeOk(o.Ip) +} + +// HasIp returns a boolean if a field has been set. +func (o *PublicIp) HasIp() bool { + _, ok := o.GetIpOk() + return ok +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *PublicIp) SetIp(v PublicIpGetIpRetType) { + setPublicIpGetIpAttributeType(&o.Ip, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PublicIp) GetLabels() (res PublicIpGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PublicIp) GetLabelsOk() (ret PublicIpGetLabelsRetType, ok bool) { + return getPublicIpGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *PublicIp) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *PublicIp) SetLabels(v PublicIpGetLabelsRetType) { + setPublicIpGetLabelsAttributeType(&o.Labels, v) +} + +// GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *PublicIp) GetNetworkInterface() (res PublicIpGetNetworkInterfaceRetType) { + res, _ = o.GetNetworkInterfaceOk() + return +} + +// GetNetworkInterfaceOk returns a tuple with the NetworkInterface field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PublicIp) GetNetworkInterfaceOk() (ret PublicIpGetNetworkInterfaceRetType, ok bool) { + return getPublicIpGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface) +} + +// HasNetworkInterface returns a boolean if a field has been set. +func (o *PublicIp) HasNetworkInterface() bool { + _, ok := o.GetNetworkInterfaceOk() + return ok +} + +// SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. +func (o *PublicIp) SetNetworkInterface(v PublicIpGetNetworkInterfaceRetType) { + setPublicIpGetNetworkInterfaceAttributeType(&o.NetworkInterface, v) +} + +// SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil +func (o *PublicIp) SetNetworkInterfaceNil() { + o.NetworkInterface = nil +} + +// UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil +func (o *PublicIp) UnsetNetworkInterface() { + o.NetworkInterface = nil +} + +func (o PublicIp) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPublicIpGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getPublicIpGetIpAttributeTypeOk(o.Ip); ok { + toSerialize["Ip"] = val + } + if val, ok := getPublicIpGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getPublicIpGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface); ok { + toSerialize["NetworkInterface"] = val + } + return toSerialize, nil +} + +type NullablePublicIp struct { + value *PublicIp + isSet bool +} + +func (v NullablePublicIp) Get() *PublicIp { + return v.value +} + +func (v *NullablePublicIp) Set(val *PublicIp) { + v.value = val + v.isSet = true +} + +func (v NullablePublicIp) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicIp) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicIp(val *PublicIp) *NullablePublicIp { + return &NullablePublicIp{value: val, isSet: true} +} + +func (v NullablePublicIp) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicIp) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_public_ip_list_response.go b/pkg/iaasbeta/model_public_ip_list_response.go new file mode 100644 index 00000000..e35a0176 --- /dev/null +++ b/pkg/iaasbeta/model_public_ip_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the PublicIpListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicIpListResponse{} + +/* + types and functions for items +*/ + +// isArray +type PublicIpListResponseGetItemsAttributeType = *[]PublicIp +type PublicIpListResponseGetItemsArgType = []PublicIp +type PublicIpListResponseGetItemsRetType = []PublicIp + +func getPublicIpListResponseGetItemsAttributeTypeOk(arg PublicIpListResponseGetItemsAttributeType) (ret PublicIpListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicIpListResponseGetItemsAttributeType(arg *PublicIpListResponseGetItemsAttributeType, val PublicIpListResponseGetItemsRetType) { + *arg = &val +} + +// PublicIpListResponse Public IP list response. +type PublicIpListResponse struct { + // A list of public IPs. + // REQUIRED + Items PublicIpListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _PublicIpListResponse PublicIpListResponse + +// NewPublicIpListResponse instantiates a new PublicIpListResponse 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 NewPublicIpListResponse(items PublicIpListResponseGetItemsArgType) *PublicIpListResponse { + this := PublicIpListResponse{} + setPublicIpListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewPublicIpListResponseWithDefaults instantiates a new PublicIpListResponse 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 NewPublicIpListResponseWithDefaults() *PublicIpListResponse { + this := PublicIpListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *PublicIpListResponse) GetItems() (ret PublicIpListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *PublicIpListResponse) GetItemsOk() (ret PublicIpListResponseGetItemsRetType, ok bool) { + return getPublicIpListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *PublicIpListResponse) SetItems(v PublicIpListResponseGetItemsRetType) { + setPublicIpListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o PublicIpListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPublicIpListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullablePublicIpListResponse struct { + value *PublicIpListResponse + isSet bool +} + +func (v NullablePublicIpListResponse) Get() *PublicIpListResponse { + return v.value +} + +func (v *NullablePublicIpListResponse) Set(val *PublicIpListResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePublicIpListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicIpListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicIpListResponse(val *PublicIpListResponse) *NullablePublicIpListResponse { + return &NullablePublicIpListResponse{value: val, isSet: true} +} + +func (v NullablePublicIpListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicIpListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_public_ip_list_response_test.go b/pkg/iaasbeta/model_public_ip_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_public_ip_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_public_ip_test.go b/pkg/iaasbeta/model_public_ip_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_public_ip_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_public_network.go b/pkg/iaasbeta/model_public_network.go new file mode 100644 index 00000000..2ddd0262 --- /dev/null +++ b/pkg/iaasbeta/model_public_network.go @@ -0,0 +1,172 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the PublicNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicNetwork{} + +/* + types and functions for cidr +*/ + +// isNotNullableString +type PublicNetworkGetCidrAttributeType = *string + +func getPublicNetworkGetCidrAttributeTypeOk(arg PublicNetworkGetCidrAttributeType) (ret PublicNetworkGetCidrRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicNetworkGetCidrAttributeType(arg *PublicNetworkGetCidrAttributeType, val PublicNetworkGetCidrRetType) { + *arg = &val +} + +type PublicNetworkGetCidrArgType = string +type PublicNetworkGetCidrRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type PublicNetworkGetRegionAttributeType = *string + +func getPublicNetworkGetRegionAttributeTypeOk(arg PublicNetworkGetRegionAttributeType) (ret PublicNetworkGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicNetworkGetRegionAttributeType(arg *PublicNetworkGetRegionAttributeType, val PublicNetworkGetRegionRetType) { + *arg = &val +} + +type PublicNetworkGetRegionArgType = string +type PublicNetworkGetRegionRetType = string + +// PublicNetwork Public network. +type PublicNetwork struct { + // Classless Inter-Domain Routing (CIDR). + // REQUIRED + Cidr PublicNetworkGetCidrAttributeType `json:"cidr" required:"true"` + // Name of the region. + // REQUIRED + Region PublicNetworkGetRegionAttributeType `json:"region" required:"true"` +} + +type _PublicNetwork PublicNetwork + +// NewPublicNetwork instantiates a new PublicNetwork 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 NewPublicNetwork(cidr PublicNetworkGetCidrArgType, region PublicNetworkGetRegionArgType) *PublicNetwork { + this := PublicNetwork{} + setPublicNetworkGetCidrAttributeType(&this.Cidr, cidr) + setPublicNetworkGetRegionAttributeType(&this.Region, region) + return &this +} + +// NewPublicNetworkWithDefaults instantiates a new PublicNetwork 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 NewPublicNetworkWithDefaults() *PublicNetwork { + this := PublicNetwork{} + return &this +} + +// GetCidr returns the Cidr field value +func (o *PublicNetwork) GetCidr() (ret PublicNetworkGetCidrRetType) { + ret, _ = o.GetCidrOk() + return ret +} + +// GetCidrOk returns a tuple with the Cidr field value +// and a boolean to check if the value has been set. +func (o *PublicNetwork) GetCidrOk() (ret PublicNetworkGetCidrRetType, ok bool) { + return getPublicNetworkGetCidrAttributeTypeOk(o.Cidr) +} + +// SetCidr sets field value +func (o *PublicNetwork) SetCidr(v PublicNetworkGetCidrRetType) { + setPublicNetworkGetCidrAttributeType(&o.Cidr, v) +} + +// GetRegion returns the Region field value +func (o *PublicNetwork) GetRegion() (ret PublicNetworkGetRegionRetType) { + ret, _ = o.GetRegionOk() + return ret +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *PublicNetwork) GetRegionOk() (ret PublicNetworkGetRegionRetType, ok bool) { + return getPublicNetworkGetRegionAttributeTypeOk(o.Region) +} + +// SetRegion sets field value +func (o *PublicNetwork) SetRegion(v PublicNetworkGetRegionRetType) { + setPublicNetworkGetRegionAttributeType(&o.Region, v) +} + +func (o PublicNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPublicNetworkGetCidrAttributeTypeOk(o.Cidr); ok { + toSerialize["Cidr"] = val + } + if val, ok := getPublicNetworkGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullablePublicNetwork struct { + value *PublicNetwork + isSet bool +} + +func (v NullablePublicNetwork) Get() *PublicNetwork { + return v.value +} + +func (v *NullablePublicNetwork) Set(val *PublicNetwork) { + v.value = val + v.isSet = true +} + +func (v NullablePublicNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicNetwork(val *PublicNetwork) *NullablePublicNetwork { + return &NullablePublicNetwork{value: val, isSet: true} +} + +func (v NullablePublicNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_public_network_list_response.go b/pkg/iaasbeta/model_public_network_list_response.go new file mode 100644 index 00000000..40ddb2f5 --- /dev/null +++ b/pkg/iaasbeta/model_public_network_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the PublicNetworkListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicNetworkListResponse{} + +/* + types and functions for items +*/ + +// isArray +type PublicNetworkListResponseGetItemsAttributeType = *[]PublicNetwork +type PublicNetworkListResponseGetItemsArgType = []PublicNetwork +type PublicNetworkListResponseGetItemsRetType = []PublicNetwork + +func getPublicNetworkListResponseGetItemsAttributeTypeOk(arg PublicNetworkListResponseGetItemsAttributeType) (ret PublicNetworkListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicNetworkListResponseGetItemsAttributeType(arg *PublicNetworkListResponseGetItemsAttributeType, val PublicNetworkListResponseGetItemsRetType) { + *arg = &val +} + +// PublicNetworkListResponse Public network list response. +type PublicNetworkListResponse struct { + // A list of public networks. + // REQUIRED + Items PublicNetworkListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _PublicNetworkListResponse PublicNetworkListResponse + +// NewPublicNetworkListResponse instantiates a new PublicNetworkListResponse 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 NewPublicNetworkListResponse(items PublicNetworkListResponseGetItemsArgType) *PublicNetworkListResponse { + this := PublicNetworkListResponse{} + setPublicNetworkListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewPublicNetworkListResponseWithDefaults instantiates a new PublicNetworkListResponse 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 NewPublicNetworkListResponseWithDefaults() *PublicNetworkListResponse { + this := PublicNetworkListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *PublicNetworkListResponse) GetItems() (ret PublicNetworkListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *PublicNetworkListResponse) GetItemsOk() (ret PublicNetworkListResponseGetItemsRetType, ok bool) { + return getPublicNetworkListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *PublicNetworkListResponse) SetItems(v PublicNetworkListResponseGetItemsRetType) { + setPublicNetworkListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o PublicNetworkListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPublicNetworkListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullablePublicNetworkListResponse struct { + value *PublicNetworkListResponse + isSet bool +} + +func (v NullablePublicNetworkListResponse) Get() *PublicNetworkListResponse { + return v.value +} + +func (v *NullablePublicNetworkListResponse) Set(val *PublicNetworkListResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePublicNetworkListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicNetworkListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicNetworkListResponse(val *PublicNetworkListResponse) *NullablePublicNetworkListResponse { + return &NullablePublicNetworkListResponse{value: val, isSet: true} +} + +func (v NullablePublicNetworkListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicNetworkListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_public_network_list_response_test.go b/pkg/iaasbeta/model_public_network_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_public_network_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_public_network_test.go b/pkg/iaasbeta/model_public_network_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_public_network_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota.go b/pkg/iaasbeta/model_quota.go new file mode 100644 index 00000000..c4dab6a4 --- /dev/null +++ b/pkg/iaasbeta/model_quota.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the Quota type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Quota{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaGetLimitAttributeType = *int64 +type QuotaGetLimitArgType = int64 +type QuotaGetLimitRetType = int64 + +func getQuotaGetLimitAttributeTypeOk(arg QuotaGetLimitAttributeType) (ret QuotaGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaGetLimitAttributeType(arg *QuotaGetLimitAttributeType, val QuotaGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaGetUsageAttributeType = *int64 +type QuotaGetUsageArgType = int64 +type QuotaGetUsageRetType = int64 + +func getQuotaGetUsageAttributeTypeOk(arg QuotaGetUsageAttributeType) (ret QuotaGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaGetUsageAttributeType(arg *QuotaGetUsageAttributeType, val QuotaGetUsageRetType) { + *arg = &val +} + +// Quota Object that represents a single resource quota. +type Quota struct { + // REQUIRED + Limit QuotaGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaGetUsageAttributeType `json:"usage" required:"true"` +} + +type _Quota Quota + +// NewQuota instantiates a new Quota 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 NewQuota(limit QuotaGetLimitArgType, usage QuotaGetUsageArgType) *Quota { + this := Quota{} + setQuotaGetLimitAttributeType(&this.Limit, limit) + setQuotaGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaWithDefaults instantiates a new Quota 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 NewQuotaWithDefaults() *Quota { + this := Quota{} + return &this +} + +// GetLimit returns the Limit field value +func (o *Quota) GetLimit() (ret QuotaGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *Quota) GetLimitOk() (ret QuotaGetLimitRetType, ok bool) { + return getQuotaGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *Quota) SetLimit(v QuotaGetLimitRetType) { + setQuotaGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *Quota) GetUsage() (ret QuotaGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *Quota) GetUsageOk() (ret QuotaGetUsageRetType, ok bool) { + return getQuotaGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *Quota) SetUsage(v QuotaGetUsageRetType) { + setQuotaGetUsageAttributeType(&o.Usage, v) +} + +func (o Quota) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuota struct { + value *Quota + isSet bool +} + +func (v NullableQuota) Get() *Quota { + return v.value +} + +func (v *NullableQuota) Set(val *Quota) { + v.value = val + v.isSet = true +} + +func (v NullableQuota) IsSet() bool { + return v.isSet +} + +func (v *NullableQuota) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuota(val *Quota) *NullableQuota { + return &NullableQuota{value: val, isSet: true} +} + +func (v NullableQuota) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuota) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list.go b/pkg/iaasbeta/model_quota_list.go new file mode 100644 index 00000000..a5367d6c --- /dev/null +++ b/pkg/iaasbeta/model_quota_list.go @@ -0,0 +1,598 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaList{} + +/* + types and functions for backupGigabytes +*/ + +// isModel +type QuotaListGetBackupGigabytesAttributeType = *QuotaListBackupGigabytes +type QuotaListGetBackupGigabytesArgType = QuotaListBackupGigabytes +type QuotaListGetBackupGigabytesRetType = QuotaListBackupGigabytes + +func getQuotaListGetBackupGigabytesAttributeTypeOk(arg QuotaListGetBackupGigabytesAttributeType) (ret QuotaListGetBackupGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetBackupGigabytesAttributeType(arg *QuotaListGetBackupGigabytesAttributeType, val QuotaListGetBackupGigabytesRetType) { + *arg = &val +} + +/* + types and functions for backups +*/ + +// isModel +type QuotaListGetBackupsAttributeType = *QuotaListBackups +type QuotaListGetBackupsArgType = QuotaListBackups +type QuotaListGetBackupsRetType = QuotaListBackups + +func getQuotaListGetBackupsAttributeTypeOk(arg QuotaListGetBackupsAttributeType) (ret QuotaListGetBackupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetBackupsAttributeType(arg *QuotaListGetBackupsAttributeType, val QuotaListGetBackupsRetType) { + *arg = &val +} + +/* + types and functions for gigabytes +*/ + +// isModel +type QuotaListGetGigabytesAttributeType = *QuotaListGigabytes +type QuotaListGetGigabytesArgType = QuotaListGigabytes +type QuotaListGetGigabytesRetType = QuotaListGigabytes + +func getQuotaListGetGigabytesAttributeTypeOk(arg QuotaListGetGigabytesAttributeType) (ret QuotaListGetGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetGigabytesAttributeType(arg *QuotaListGetGigabytesAttributeType, val QuotaListGetGigabytesRetType) { + *arg = &val +} + +/* + types and functions for networks +*/ + +// isModel +type QuotaListGetNetworksAttributeType = *QuotaListNetworks +type QuotaListGetNetworksArgType = QuotaListNetworks +type QuotaListGetNetworksRetType = QuotaListNetworks + +func getQuotaListGetNetworksAttributeTypeOk(arg QuotaListGetNetworksAttributeType) (ret QuotaListGetNetworksRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetNetworksAttributeType(arg *QuotaListGetNetworksAttributeType, val QuotaListGetNetworksRetType) { + *arg = &val +} + +/* + types and functions for nics +*/ + +// isModel +type QuotaListGetNicsAttributeType = *QuotaListNics +type QuotaListGetNicsArgType = QuotaListNics +type QuotaListGetNicsRetType = QuotaListNics + +func getQuotaListGetNicsAttributeTypeOk(arg QuotaListGetNicsAttributeType) (ret QuotaListGetNicsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetNicsAttributeType(arg *QuotaListGetNicsAttributeType, val QuotaListGetNicsRetType) { + *arg = &val +} + +/* + types and functions for publicIps +*/ + +// isModel +type QuotaListGetPublicIpsAttributeType = *QuotaListPublicIps +type QuotaListGetPublicIpsArgType = QuotaListPublicIps +type QuotaListGetPublicIpsRetType = QuotaListPublicIps + +func getQuotaListGetPublicIpsAttributeTypeOk(arg QuotaListGetPublicIpsAttributeType) (ret QuotaListGetPublicIpsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetPublicIpsAttributeType(arg *QuotaListGetPublicIpsAttributeType, val QuotaListGetPublicIpsRetType) { + *arg = &val +} + +/* + types and functions for ram +*/ + +// isModel +type QuotaListGetRamAttributeType = *QuotaListRam +type QuotaListGetRamArgType = QuotaListRam +type QuotaListGetRamRetType = QuotaListRam + +func getQuotaListGetRamAttributeTypeOk(arg QuotaListGetRamAttributeType) (ret QuotaListGetRamRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetRamAttributeType(arg *QuotaListGetRamAttributeType, val QuotaListGetRamRetType) { + *arg = &val +} + +/* + types and functions for securityGroupRules +*/ + +// isModel +type QuotaListGetSecurityGroupRulesAttributeType = *QuotaListSecurityGroupRules +type QuotaListGetSecurityGroupRulesArgType = QuotaListSecurityGroupRules +type QuotaListGetSecurityGroupRulesRetType = QuotaListSecurityGroupRules + +func getQuotaListGetSecurityGroupRulesAttributeTypeOk(arg QuotaListGetSecurityGroupRulesAttributeType) (ret QuotaListGetSecurityGroupRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetSecurityGroupRulesAttributeType(arg *QuotaListGetSecurityGroupRulesAttributeType, val QuotaListGetSecurityGroupRulesRetType) { + *arg = &val +} + +/* + types and functions for securityGroups +*/ + +// isModel +type QuotaListGetSecurityGroupsAttributeType = *QuotaListSecurityGroups +type QuotaListGetSecurityGroupsArgType = QuotaListSecurityGroups +type QuotaListGetSecurityGroupsRetType = QuotaListSecurityGroups + +func getQuotaListGetSecurityGroupsAttributeTypeOk(arg QuotaListGetSecurityGroupsAttributeType) (ret QuotaListGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetSecurityGroupsAttributeType(arg *QuotaListGetSecurityGroupsAttributeType, val QuotaListGetSecurityGroupsRetType) { + *arg = &val +} + +/* + types and functions for snapshots +*/ + +// isModel +type QuotaListGetSnapshotsAttributeType = *QuotaListSnapshots +type QuotaListGetSnapshotsArgType = QuotaListSnapshots +type QuotaListGetSnapshotsRetType = QuotaListSnapshots + +func getQuotaListGetSnapshotsAttributeTypeOk(arg QuotaListGetSnapshotsAttributeType) (ret QuotaListGetSnapshotsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetSnapshotsAttributeType(arg *QuotaListGetSnapshotsAttributeType, val QuotaListGetSnapshotsRetType) { + *arg = &val +} + +/* + types and functions for vcpu +*/ + +// isModel +type QuotaListGetVcpuAttributeType = *QuotaListVcpu +type QuotaListGetVcpuArgType = QuotaListVcpu +type QuotaListGetVcpuRetType = QuotaListVcpu + +func getQuotaListGetVcpuAttributeTypeOk(arg QuotaListGetVcpuAttributeType) (ret QuotaListGetVcpuRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetVcpuAttributeType(arg *QuotaListGetVcpuAttributeType, val QuotaListGetVcpuRetType) { + *arg = &val +} + +/* + types and functions for volumes +*/ + +// isModel +type QuotaListGetVolumesAttributeType = *QuotaListVolumes +type QuotaListGetVolumesArgType = QuotaListVolumes +type QuotaListGetVolumesRetType = QuotaListVolumes + +func getQuotaListGetVolumesAttributeTypeOk(arg QuotaListGetVolumesAttributeType) (ret QuotaListGetVolumesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetVolumesAttributeType(arg *QuotaListGetVolumesAttributeType, val QuotaListGetVolumesRetType) { + *arg = &val +} + +// QuotaList Object that represents the quotas for a project. +type QuotaList struct { + // REQUIRED + BackupGigabytes QuotaListGetBackupGigabytesAttributeType `json:"backupGigabytes" required:"true"` + // REQUIRED + Backups QuotaListGetBackupsAttributeType `json:"backups" required:"true"` + // REQUIRED + Gigabytes QuotaListGetGigabytesAttributeType `json:"gigabytes" required:"true"` + // REQUIRED + Networks QuotaListGetNetworksAttributeType `json:"networks" required:"true"` + // REQUIRED + Nics QuotaListGetNicsAttributeType `json:"nics" required:"true"` + // REQUIRED + PublicIps QuotaListGetPublicIpsAttributeType `json:"publicIps" required:"true"` + // REQUIRED + Ram QuotaListGetRamAttributeType `json:"ram" required:"true"` + // REQUIRED + SecurityGroupRules QuotaListGetSecurityGroupRulesAttributeType `json:"securityGroupRules" required:"true"` + // REQUIRED + SecurityGroups QuotaListGetSecurityGroupsAttributeType `json:"securityGroups" required:"true"` + // REQUIRED + Snapshots QuotaListGetSnapshotsAttributeType `json:"snapshots" required:"true"` + // REQUIRED + Vcpu QuotaListGetVcpuAttributeType `json:"vcpu" required:"true"` + // REQUIRED + Volumes QuotaListGetVolumesAttributeType `json:"volumes" required:"true"` +} + +type _QuotaList QuotaList + +// NewQuotaList instantiates a new QuotaList 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 NewQuotaList(backupGigabytes QuotaListGetBackupGigabytesArgType, backups QuotaListGetBackupsArgType, gigabytes QuotaListGetGigabytesArgType, networks QuotaListGetNetworksArgType, nics QuotaListGetNicsArgType, publicIps QuotaListGetPublicIpsArgType, ram QuotaListGetRamArgType, securityGroupRules QuotaListGetSecurityGroupRulesArgType, securityGroups QuotaListGetSecurityGroupsArgType, snapshots QuotaListGetSnapshotsArgType, vcpu QuotaListGetVcpuArgType, volumes QuotaListGetVolumesArgType) *QuotaList { + this := QuotaList{} + setQuotaListGetBackupGigabytesAttributeType(&this.BackupGigabytes, backupGigabytes) + setQuotaListGetBackupsAttributeType(&this.Backups, backups) + setQuotaListGetGigabytesAttributeType(&this.Gigabytes, gigabytes) + setQuotaListGetNetworksAttributeType(&this.Networks, networks) + setQuotaListGetNicsAttributeType(&this.Nics, nics) + setQuotaListGetPublicIpsAttributeType(&this.PublicIps, publicIps) + setQuotaListGetRamAttributeType(&this.Ram, ram) + setQuotaListGetSecurityGroupRulesAttributeType(&this.SecurityGroupRules, securityGroupRules) + setQuotaListGetSecurityGroupsAttributeType(&this.SecurityGroups, securityGroups) + setQuotaListGetSnapshotsAttributeType(&this.Snapshots, snapshots) + setQuotaListGetVcpuAttributeType(&this.Vcpu, vcpu) + setQuotaListGetVolumesAttributeType(&this.Volumes, volumes) + return &this +} + +// NewQuotaListWithDefaults instantiates a new QuotaList 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 NewQuotaListWithDefaults() *QuotaList { + this := QuotaList{} + return &this +} + +// GetBackupGigabytes returns the BackupGigabytes field value +func (o *QuotaList) GetBackupGigabytes() (ret QuotaListGetBackupGigabytesRetType) { + ret, _ = o.GetBackupGigabytesOk() + return ret +} + +// GetBackupGigabytesOk returns a tuple with the BackupGigabytes field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetBackupGigabytesOk() (ret QuotaListGetBackupGigabytesRetType, ok bool) { + return getQuotaListGetBackupGigabytesAttributeTypeOk(o.BackupGigabytes) +} + +// SetBackupGigabytes sets field value +func (o *QuotaList) SetBackupGigabytes(v QuotaListGetBackupGigabytesRetType) { + setQuotaListGetBackupGigabytesAttributeType(&o.BackupGigabytes, v) +} + +// GetBackups returns the Backups field value +func (o *QuotaList) GetBackups() (ret QuotaListGetBackupsRetType) { + ret, _ = o.GetBackupsOk() + return ret +} + +// GetBackupsOk returns a tuple with the Backups field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetBackupsOk() (ret QuotaListGetBackupsRetType, ok bool) { + return getQuotaListGetBackupsAttributeTypeOk(o.Backups) +} + +// SetBackups sets field value +func (o *QuotaList) SetBackups(v QuotaListGetBackupsRetType) { + setQuotaListGetBackupsAttributeType(&o.Backups, v) +} + +// GetGigabytes returns the Gigabytes field value +func (o *QuotaList) GetGigabytes() (ret QuotaListGetGigabytesRetType) { + ret, _ = o.GetGigabytesOk() + return ret +} + +// GetGigabytesOk returns a tuple with the Gigabytes field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetGigabytesOk() (ret QuotaListGetGigabytesRetType, ok bool) { + return getQuotaListGetGigabytesAttributeTypeOk(o.Gigabytes) +} + +// SetGigabytes sets field value +func (o *QuotaList) SetGigabytes(v QuotaListGetGigabytesRetType) { + setQuotaListGetGigabytesAttributeType(&o.Gigabytes, v) +} + +// GetNetworks returns the Networks field value +func (o *QuotaList) GetNetworks() (ret QuotaListGetNetworksRetType) { + ret, _ = o.GetNetworksOk() + return ret +} + +// GetNetworksOk returns a tuple with the Networks field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetNetworksOk() (ret QuotaListGetNetworksRetType, ok bool) { + return getQuotaListGetNetworksAttributeTypeOk(o.Networks) +} + +// SetNetworks sets field value +func (o *QuotaList) SetNetworks(v QuotaListGetNetworksRetType) { + setQuotaListGetNetworksAttributeType(&o.Networks, v) +} + +// GetNics returns the Nics field value +func (o *QuotaList) GetNics() (ret QuotaListGetNicsRetType) { + ret, _ = o.GetNicsOk() + return ret +} + +// GetNicsOk returns a tuple with the Nics field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetNicsOk() (ret QuotaListGetNicsRetType, ok bool) { + return getQuotaListGetNicsAttributeTypeOk(o.Nics) +} + +// SetNics sets field value +func (o *QuotaList) SetNics(v QuotaListGetNicsRetType) { + setQuotaListGetNicsAttributeType(&o.Nics, v) +} + +// GetPublicIps returns the PublicIps field value +func (o *QuotaList) GetPublicIps() (ret QuotaListGetPublicIpsRetType) { + ret, _ = o.GetPublicIpsOk() + return ret +} + +// GetPublicIpsOk returns a tuple with the PublicIps field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetPublicIpsOk() (ret QuotaListGetPublicIpsRetType, ok bool) { + return getQuotaListGetPublicIpsAttributeTypeOk(o.PublicIps) +} + +// SetPublicIps sets field value +func (o *QuotaList) SetPublicIps(v QuotaListGetPublicIpsRetType) { + setQuotaListGetPublicIpsAttributeType(&o.PublicIps, v) +} + +// GetRam returns the Ram field value +func (o *QuotaList) GetRam() (ret QuotaListGetRamRetType) { + ret, _ = o.GetRamOk() + return ret +} + +// GetRamOk returns a tuple with the Ram field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetRamOk() (ret QuotaListGetRamRetType, ok bool) { + return getQuotaListGetRamAttributeTypeOk(o.Ram) +} + +// SetRam sets field value +func (o *QuotaList) SetRam(v QuotaListGetRamRetType) { + setQuotaListGetRamAttributeType(&o.Ram, v) +} + +// GetSecurityGroupRules returns the SecurityGroupRules field value +func (o *QuotaList) GetSecurityGroupRules() (ret QuotaListGetSecurityGroupRulesRetType) { + ret, _ = o.GetSecurityGroupRulesOk() + return ret +} + +// GetSecurityGroupRulesOk returns a tuple with the SecurityGroupRules field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetSecurityGroupRulesOk() (ret QuotaListGetSecurityGroupRulesRetType, ok bool) { + return getQuotaListGetSecurityGroupRulesAttributeTypeOk(o.SecurityGroupRules) +} + +// SetSecurityGroupRules sets field value +func (o *QuotaList) SetSecurityGroupRules(v QuotaListGetSecurityGroupRulesRetType) { + setQuotaListGetSecurityGroupRulesAttributeType(&o.SecurityGroupRules, v) +} + +// GetSecurityGroups returns the SecurityGroups field value +func (o *QuotaList) GetSecurityGroups() (ret QuotaListGetSecurityGroupsRetType) { + ret, _ = o.GetSecurityGroupsOk() + return ret +} + +// GetSecurityGroupsOk returns a tuple with the SecurityGroups field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetSecurityGroupsOk() (ret QuotaListGetSecurityGroupsRetType, ok bool) { + return getQuotaListGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// SetSecurityGroups sets field value +func (o *QuotaList) SetSecurityGroups(v QuotaListGetSecurityGroupsRetType) { + setQuotaListGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +// GetSnapshots returns the Snapshots field value +func (o *QuotaList) GetSnapshots() (ret QuotaListGetSnapshotsRetType) { + ret, _ = o.GetSnapshotsOk() + return ret +} + +// GetSnapshotsOk returns a tuple with the Snapshots field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetSnapshotsOk() (ret QuotaListGetSnapshotsRetType, ok bool) { + return getQuotaListGetSnapshotsAttributeTypeOk(o.Snapshots) +} + +// SetSnapshots sets field value +func (o *QuotaList) SetSnapshots(v QuotaListGetSnapshotsRetType) { + setQuotaListGetSnapshotsAttributeType(&o.Snapshots, v) +} + +// GetVcpu returns the Vcpu field value +func (o *QuotaList) GetVcpu() (ret QuotaListGetVcpuRetType) { + ret, _ = o.GetVcpuOk() + return ret +} + +// GetVcpuOk returns a tuple with the Vcpu field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetVcpuOk() (ret QuotaListGetVcpuRetType, ok bool) { + return getQuotaListGetVcpuAttributeTypeOk(o.Vcpu) +} + +// SetVcpu sets field value +func (o *QuotaList) SetVcpu(v QuotaListGetVcpuRetType) { + setQuotaListGetVcpuAttributeType(&o.Vcpu, v) +} + +// GetVolumes returns the Volumes field value +func (o *QuotaList) GetVolumes() (ret QuotaListGetVolumesRetType) { + ret, _ = o.GetVolumesOk() + return ret +} + +// GetVolumesOk returns a tuple with the Volumes field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetVolumesOk() (ret QuotaListGetVolumesRetType, ok bool) { + return getQuotaListGetVolumesAttributeTypeOk(o.Volumes) +} + +// SetVolumes sets field value +func (o *QuotaList) SetVolumes(v QuotaListGetVolumesRetType) { + setQuotaListGetVolumesAttributeType(&o.Volumes, v) +} + +func (o QuotaList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListGetBackupGigabytesAttributeTypeOk(o.BackupGigabytes); ok { + toSerialize["BackupGigabytes"] = val + } + if val, ok := getQuotaListGetBackupsAttributeTypeOk(o.Backups); ok { + toSerialize["Backups"] = val + } + if val, ok := getQuotaListGetGigabytesAttributeTypeOk(o.Gigabytes); ok { + toSerialize["Gigabytes"] = val + } + if val, ok := getQuotaListGetNetworksAttributeTypeOk(o.Networks); ok { + toSerialize["Networks"] = val + } + if val, ok := getQuotaListGetNicsAttributeTypeOk(o.Nics); ok { + toSerialize["Nics"] = val + } + if val, ok := getQuotaListGetPublicIpsAttributeTypeOk(o.PublicIps); ok { + toSerialize["PublicIps"] = val + } + if val, ok := getQuotaListGetRamAttributeTypeOk(o.Ram); ok { + toSerialize["Ram"] = val + } + if val, ok := getQuotaListGetSecurityGroupRulesAttributeTypeOk(o.SecurityGroupRules); ok { + toSerialize["SecurityGroupRules"] = val + } + if val, ok := getQuotaListGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + if val, ok := getQuotaListGetSnapshotsAttributeTypeOk(o.Snapshots); ok { + toSerialize["Snapshots"] = val + } + if val, ok := getQuotaListGetVcpuAttributeTypeOk(o.Vcpu); ok { + toSerialize["Vcpu"] = val + } + if val, ok := getQuotaListGetVolumesAttributeTypeOk(o.Volumes); ok { + toSerialize["Volumes"] = val + } + return toSerialize, nil +} + +type NullableQuotaList struct { + value *QuotaList + isSet bool +} + +func (v NullableQuotaList) Get() *QuotaList { + return v.value +} + +func (v *NullableQuotaList) Set(val *QuotaList) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaList) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaList(val *QuotaList) *NullableQuotaList { + return &NullableQuotaList{value: val, isSet: true} +} + +func (v NullableQuotaList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_backup_gigabytes.go b/pkg/iaasbeta/model_quota_list_backup_gigabytes.go new file mode 100644 index 00000000..654ac4be --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_backup_gigabytes.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListBackupGigabytes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListBackupGigabytes{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListBackupGigabytesGetLimitAttributeType = *int64 +type QuotaListBackupGigabytesGetLimitArgType = int64 +type QuotaListBackupGigabytesGetLimitRetType = int64 + +func getQuotaListBackupGigabytesGetLimitAttributeTypeOk(arg QuotaListBackupGigabytesGetLimitAttributeType) (ret QuotaListBackupGigabytesGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListBackupGigabytesGetLimitAttributeType(arg *QuotaListBackupGigabytesGetLimitAttributeType, val QuotaListBackupGigabytesGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListBackupGigabytesGetUsageAttributeType = *int64 +type QuotaListBackupGigabytesGetUsageArgType = int64 +type QuotaListBackupGigabytesGetUsageRetType = int64 + +func getQuotaListBackupGigabytesGetUsageAttributeTypeOk(arg QuotaListBackupGigabytesGetUsageAttributeType) (ret QuotaListBackupGigabytesGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListBackupGigabytesGetUsageAttributeType(arg *QuotaListBackupGigabytesGetUsageAttributeType, val QuotaListBackupGigabytesGetUsageRetType) { + *arg = &val +} + +// QuotaListBackupGigabytes Total size in GiB of backups. +type QuotaListBackupGigabytes struct { + // REQUIRED + Limit QuotaListBackupGigabytesGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListBackupGigabytesGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListBackupGigabytes QuotaListBackupGigabytes + +// NewQuotaListBackupGigabytes instantiates a new QuotaListBackupGigabytes 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 NewQuotaListBackupGigabytes(limit QuotaListBackupGigabytesGetLimitArgType, usage QuotaListBackupGigabytesGetUsageArgType) *QuotaListBackupGigabytes { + this := QuotaListBackupGigabytes{} + setQuotaListBackupGigabytesGetLimitAttributeType(&this.Limit, limit) + setQuotaListBackupGigabytesGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListBackupGigabytesWithDefaults instantiates a new QuotaListBackupGigabytes 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 NewQuotaListBackupGigabytesWithDefaults() *QuotaListBackupGigabytes { + this := QuotaListBackupGigabytes{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListBackupGigabytes) GetLimit() (ret QuotaListBackupGigabytesGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListBackupGigabytes) GetLimitOk() (ret QuotaListBackupGigabytesGetLimitRetType, ok bool) { + return getQuotaListBackupGigabytesGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListBackupGigabytes) SetLimit(v QuotaListBackupGigabytesGetLimitRetType) { + setQuotaListBackupGigabytesGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListBackupGigabytes) GetUsage() (ret QuotaListBackupGigabytesGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListBackupGigabytes) GetUsageOk() (ret QuotaListBackupGigabytesGetUsageRetType, ok bool) { + return getQuotaListBackupGigabytesGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListBackupGigabytes) SetUsage(v QuotaListBackupGigabytesGetUsageRetType) { + setQuotaListBackupGigabytesGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListBackupGigabytes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListBackupGigabytesGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListBackupGigabytesGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListBackupGigabytes struct { + value *QuotaListBackupGigabytes + isSet bool +} + +func (v NullableQuotaListBackupGigabytes) Get() *QuotaListBackupGigabytes { + return v.value +} + +func (v *NullableQuotaListBackupGigabytes) Set(val *QuotaListBackupGigabytes) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListBackupGigabytes) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListBackupGigabytes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListBackupGigabytes(val *QuotaListBackupGigabytes) *NullableQuotaListBackupGigabytes { + return &NullableQuotaListBackupGigabytes{value: val, isSet: true} +} + +func (v NullableQuotaListBackupGigabytes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListBackupGigabytes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_backup_gigabytes_test.go b/pkg/iaasbeta/model_quota_list_backup_gigabytes_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_backup_gigabytes_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_backups.go b/pkg/iaasbeta/model_quota_list_backups.go new file mode 100644 index 00000000..034a0a37 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_backups.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListBackups type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListBackups{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListBackupsGetLimitAttributeType = *int64 +type QuotaListBackupsGetLimitArgType = int64 +type QuotaListBackupsGetLimitRetType = int64 + +func getQuotaListBackupsGetLimitAttributeTypeOk(arg QuotaListBackupsGetLimitAttributeType) (ret QuotaListBackupsGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListBackupsGetLimitAttributeType(arg *QuotaListBackupsGetLimitAttributeType, val QuotaListBackupsGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListBackupsGetUsageAttributeType = *int64 +type QuotaListBackupsGetUsageArgType = int64 +type QuotaListBackupsGetUsageRetType = int64 + +func getQuotaListBackupsGetUsageAttributeTypeOk(arg QuotaListBackupsGetUsageAttributeType) (ret QuotaListBackupsGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListBackupsGetUsageAttributeType(arg *QuotaListBackupsGetUsageAttributeType, val QuotaListBackupsGetUsageRetType) { + *arg = &val +} + +// QuotaListBackups Number of backups. +type QuotaListBackups struct { + // REQUIRED + Limit QuotaListBackupsGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListBackupsGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListBackups QuotaListBackups + +// NewQuotaListBackups instantiates a new QuotaListBackups 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 NewQuotaListBackups(limit QuotaListBackupsGetLimitArgType, usage QuotaListBackupsGetUsageArgType) *QuotaListBackups { + this := QuotaListBackups{} + setQuotaListBackupsGetLimitAttributeType(&this.Limit, limit) + setQuotaListBackupsGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListBackupsWithDefaults instantiates a new QuotaListBackups 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 NewQuotaListBackupsWithDefaults() *QuotaListBackups { + this := QuotaListBackups{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListBackups) GetLimit() (ret QuotaListBackupsGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListBackups) GetLimitOk() (ret QuotaListBackupsGetLimitRetType, ok bool) { + return getQuotaListBackupsGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListBackups) SetLimit(v QuotaListBackupsGetLimitRetType) { + setQuotaListBackupsGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListBackups) GetUsage() (ret QuotaListBackupsGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListBackups) GetUsageOk() (ret QuotaListBackupsGetUsageRetType, ok bool) { + return getQuotaListBackupsGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListBackups) SetUsage(v QuotaListBackupsGetUsageRetType) { + setQuotaListBackupsGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListBackups) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListBackupsGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListBackupsGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListBackups struct { + value *QuotaListBackups + isSet bool +} + +func (v NullableQuotaListBackups) Get() *QuotaListBackups { + return v.value +} + +func (v *NullableQuotaListBackups) Set(val *QuotaListBackups) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListBackups) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListBackups) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListBackups(val *QuotaListBackups) *NullableQuotaListBackups { + return &NullableQuotaListBackups{value: val, isSet: true} +} + +func (v NullableQuotaListBackups) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListBackups) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_backups_test.go b/pkg/iaasbeta/model_quota_list_backups_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_backups_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_gigabytes.go b/pkg/iaasbeta/model_quota_list_gigabytes.go new file mode 100644 index 00000000..2bd6c301 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_gigabytes.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListGigabytes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListGigabytes{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListGigabytesGetLimitAttributeType = *int64 +type QuotaListGigabytesGetLimitArgType = int64 +type QuotaListGigabytesGetLimitRetType = int64 + +func getQuotaListGigabytesGetLimitAttributeTypeOk(arg QuotaListGigabytesGetLimitAttributeType) (ret QuotaListGigabytesGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGigabytesGetLimitAttributeType(arg *QuotaListGigabytesGetLimitAttributeType, val QuotaListGigabytesGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListGigabytesGetUsageAttributeType = *int64 +type QuotaListGigabytesGetUsageArgType = int64 +type QuotaListGigabytesGetUsageRetType = int64 + +func getQuotaListGigabytesGetUsageAttributeTypeOk(arg QuotaListGigabytesGetUsageAttributeType) (ret QuotaListGigabytesGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGigabytesGetUsageAttributeType(arg *QuotaListGigabytesGetUsageAttributeType, val QuotaListGigabytesGetUsageRetType) { + *arg = &val +} + +// QuotaListGigabytes Total size in GiB of volumes and snapshots. +type QuotaListGigabytes struct { + // REQUIRED + Limit QuotaListGigabytesGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListGigabytesGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListGigabytes QuotaListGigabytes + +// NewQuotaListGigabytes instantiates a new QuotaListGigabytes 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 NewQuotaListGigabytes(limit QuotaListGigabytesGetLimitArgType, usage QuotaListGigabytesGetUsageArgType) *QuotaListGigabytes { + this := QuotaListGigabytes{} + setQuotaListGigabytesGetLimitAttributeType(&this.Limit, limit) + setQuotaListGigabytesGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListGigabytesWithDefaults instantiates a new QuotaListGigabytes 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 NewQuotaListGigabytesWithDefaults() *QuotaListGigabytes { + this := QuotaListGigabytes{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListGigabytes) GetLimit() (ret QuotaListGigabytesGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListGigabytes) GetLimitOk() (ret QuotaListGigabytesGetLimitRetType, ok bool) { + return getQuotaListGigabytesGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListGigabytes) SetLimit(v QuotaListGigabytesGetLimitRetType) { + setQuotaListGigabytesGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListGigabytes) GetUsage() (ret QuotaListGigabytesGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListGigabytes) GetUsageOk() (ret QuotaListGigabytesGetUsageRetType, ok bool) { + return getQuotaListGigabytesGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListGigabytes) SetUsage(v QuotaListGigabytesGetUsageRetType) { + setQuotaListGigabytesGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListGigabytes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListGigabytesGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListGigabytesGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListGigabytes struct { + value *QuotaListGigabytes + isSet bool +} + +func (v NullableQuotaListGigabytes) Get() *QuotaListGigabytes { + return v.value +} + +func (v *NullableQuotaListGigabytes) Set(val *QuotaListGigabytes) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListGigabytes) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListGigabytes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListGigabytes(val *QuotaListGigabytes) *NullableQuotaListGigabytes { + return &NullableQuotaListGigabytes{value: val, isSet: true} +} + +func (v NullableQuotaListGigabytes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListGigabytes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_gigabytes_test.go b/pkg/iaasbeta/model_quota_list_gigabytes_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_gigabytes_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_networks.go b/pkg/iaasbeta/model_quota_list_networks.go new file mode 100644 index 00000000..e053441b --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_networks.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListNetworks type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListNetworks{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListNetworksGetLimitAttributeType = *int64 +type QuotaListNetworksGetLimitArgType = int64 +type QuotaListNetworksGetLimitRetType = int64 + +func getQuotaListNetworksGetLimitAttributeTypeOk(arg QuotaListNetworksGetLimitAttributeType) (ret QuotaListNetworksGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListNetworksGetLimitAttributeType(arg *QuotaListNetworksGetLimitAttributeType, val QuotaListNetworksGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListNetworksGetUsageAttributeType = *int64 +type QuotaListNetworksGetUsageArgType = int64 +type QuotaListNetworksGetUsageRetType = int64 + +func getQuotaListNetworksGetUsageAttributeTypeOk(arg QuotaListNetworksGetUsageAttributeType) (ret QuotaListNetworksGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListNetworksGetUsageAttributeType(arg *QuotaListNetworksGetUsageAttributeType, val QuotaListNetworksGetUsageRetType) { + *arg = &val +} + +// QuotaListNetworks Number of networks. +type QuotaListNetworks struct { + // REQUIRED + Limit QuotaListNetworksGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListNetworksGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListNetworks QuotaListNetworks + +// NewQuotaListNetworks instantiates a new QuotaListNetworks 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 NewQuotaListNetworks(limit QuotaListNetworksGetLimitArgType, usage QuotaListNetworksGetUsageArgType) *QuotaListNetworks { + this := QuotaListNetworks{} + setQuotaListNetworksGetLimitAttributeType(&this.Limit, limit) + setQuotaListNetworksGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListNetworksWithDefaults instantiates a new QuotaListNetworks 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 NewQuotaListNetworksWithDefaults() *QuotaListNetworks { + this := QuotaListNetworks{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListNetworks) GetLimit() (ret QuotaListNetworksGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListNetworks) GetLimitOk() (ret QuotaListNetworksGetLimitRetType, ok bool) { + return getQuotaListNetworksGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListNetworks) SetLimit(v QuotaListNetworksGetLimitRetType) { + setQuotaListNetworksGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListNetworks) GetUsage() (ret QuotaListNetworksGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListNetworks) GetUsageOk() (ret QuotaListNetworksGetUsageRetType, ok bool) { + return getQuotaListNetworksGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListNetworks) SetUsage(v QuotaListNetworksGetUsageRetType) { + setQuotaListNetworksGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListNetworks) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListNetworksGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListNetworksGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListNetworks struct { + value *QuotaListNetworks + isSet bool +} + +func (v NullableQuotaListNetworks) Get() *QuotaListNetworks { + return v.value +} + +func (v *NullableQuotaListNetworks) Set(val *QuotaListNetworks) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListNetworks) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListNetworks) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListNetworks(val *QuotaListNetworks) *NullableQuotaListNetworks { + return &NullableQuotaListNetworks{value: val, isSet: true} +} + +func (v NullableQuotaListNetworks) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListNetworks) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_networks_test.go b/pkg/iaasbeta/model_quota_list_networks_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_networks_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_nics.go b/pkg/iaasbeta/model_quota_list_nics.go new file mode 100644 index 00000000..c1fe8d2b --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_nics.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListNics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListNics{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListNicsGetLimitAttributeType = *int64 +type QuotaListNicsGetLimitArgType = int64 +type QuotaListNicsGetLimitRetType = int64 + +func getQuotaListNicsGetLimitAttributeTypeOk(arg QuotaListNicsGetLimitAttributeType) (ret QuotaListNicsGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListNicsGetLimitAttributeType(arg *QuotaListNicsGetLimitAttributeType, val QuotaListNicsGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListNicsGetUsageAttributeType = *int64 +type QuotaListNicsGetUsageArgType = int64 +type QuotaListNicsGetUsageRetType = int64 + +func getQuotaListNicsGetUsageAttributeTypeOk(arg QuotaListNicsGetUsageAttributeType) (ret QuotaListNicsGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListNicsGetUsageAttributeType(arg *QuotaListNicsGetUsageAttributeType, val QuotaListNicsGetUsageRetType) { + *arg = &val +} + +// QuotaListNics Number of network interfaces. +type QuotaListNics struct { + // REQUIRED + Limit QuotaListNicsGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListNicsGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListNics QuotaListNics + +// NewQuotaListNics instantiates a new QuotaListNics 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 NewQuotaListNics(limit QuotaListNicsGetLimitArgType, usage QuotaListNicsGetUsageArgType) *QuotaListNics { + this := QuotaListNics{} + setQuotaListNicsGetLimitAttributeType(&this.Limit, limit) + setQuotaListNicsGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListNicsWithDefaults instantiates a new QuotaListNics 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 NewQuotaListNicsWithDefaults() *QuotaListNics { + this := QuotaListNics{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListNics) GetLimit() (ret QuotaListNicsGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListNics) GetLimitOk() (ret QuotaListNicsGetLimitRetType, ok bool) { + return getQuotaListNicsGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListNics) SetLimit(v QuotaListNicsGetLimitRetType) { + setQuotaListNicsGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListNics) GetUsage() (ret QuotaListNicsGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListNics) GetUsageOk() (ret QuotaListNicsGetUsageRetType, ok bool) { + return getQuotaListNicsGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListNics) SetUsage(v QuotaListNicsGetUsageRetType) { + setQuotaListNicsGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListNics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListNicsGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListNicsGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListNics struct { + value *QuotaListNics + isSet bool +} + +func (v NullableQuotaListNics) Get() *QuotaListNics { + return v.value +} + +func (v *NullableQuotaListNics) Set(val *QuotaListNics) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListNics) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListNics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListNics(val *QuotaListNics) *NullableQuotaListNics { + return &NullableQuotaListNics{value: val, isSet: true} +} + +func (v NullableQuotaListNics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListNics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_nics_test.go b/pkg/iaasbeta/model_quota_list_nics_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_nics_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_public_ips.go b/pkg/iaasbeta/model_quota_list_public_ips.go new file mode 100644 index 00000000..eefc6d98 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_public_ips.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListPublicIps type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListPublicIps{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListPublicIpsGetLimitAttributeType = *int64 +type QuotaListPublicIpsGetLimitArgType = int64 +type QuotaListPublicIpsGetLimitRetType = int64 + +func getQuotaListPublicIpsGetLimitAttributeTypeOk(arg QuotaListPublicIpsGetLimitAttributeType) (ret QuotaListPublicIpsGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListPublicIpsGetLimitAttributeType(arg *QuotaListPublicIpsGetLimitAttributeType, val QuotaListPublicIpsGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListPublicIpsGetUsageAttributeType = *int64 +type QuotaListPublicIpsGetUsageArgType = int64 +type QuotaListPublicIpsGetUsageRetType = int64 + +func getQuotaListPublicIpsGetUsageAttributeTypeOk(arg QuotaListPublicIpsGetUsageAttributeType) (ret QuotaListPublicIpsGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListPublicIpsGetUsageAttributeType(arg *QuotaListPublicIpsGetUsageAttributeType, val QuotaListPublicIpsGetUsageRetType) { + *arg = &val +} + +// QuotaListPublicIps Number of public IP addresses. +type QuotaListPublicIps struct { + // REQUIRED + Limit QuotaListPublicIpsGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListPublicIpsGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListPublicIps QuotaListPublicIps + +// NewQuotaListPublicIps instantiates a new QuotaListPublicIps 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 NewQuotaListPublicIps(limit QuotaListPublicIpsGetLimitArgType, usage QuotaListPublicIpsGetUsageArgType) *QuotaListPublicIps { + this := QuotaListPublicIps{} + setQuotaListPublicIpsGetLimitAttributeType(&this.Limit, limit) + setQuotaListPublicIpsGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListPublicIpsWithDefaults instantiates a new QuotaListPublicIps 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 NewQuotaListPublicIpsWithDefaults() *QuotaListPublicIps { + this := QuotaListPublicIps{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListPublicIps) GetLimit() (ret QuotaListPublicIpsGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListPublicIps) GetLimitOk() (ret QuotaListPublicIpsGetLimitRetType, ok bool) { + return getQuotaListPublicIpsGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListPublicIps) SetLimit(v QuotaListPublicIpsGetLimitRetType) { + setQuotaListPublicIpsGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListPublicIps) GetUsage() (ret QuotaListPublicIpsGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListPublicIps) GetUsageOk() (ret QuotaListPublicIpsGetUsageRetType, ok bool) { + return getQuotaListPublicIpsGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListPublicIps) SetUsage(v QuotaListPublicIpsGetUsageRetType) { + setQuotaListPublicIpsGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListPublicIps) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListPublicIpsGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListPublicIpsGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListPublicIps struct { + value *QuotaListPublicIps + isSet bool +} + +func (v NullableQuotaListPublicIps) Get() *QuotaListPublicIps { + return v.value +} + +func (v *NullableQuotaListPublicIps) Set(val *QuotaListPublicIps) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListPublicIps) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListPublicIps) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListPublicIps(val *QuotaListPublicIps) *NullableQuotaListPublicIps { + return &NullableQuotaListPublicIps{value: val, isSet: true} +} + +func (v NullableQuotaListPublicIps) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListPublicIps) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_public_ips_test.go b/pkg/iaasbeta/model_quota_list_public_ips_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_public_ips_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_ram.go b/pkg/iaasbeta/model_quota_list_ram.go new file mode 100644 index 00000000..4c1d6162 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_ram.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListRam type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListRam{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListRamGetLimitAttributeType = *int64 +type QuotaListRamGetLimitArgType = int64 +type QuotaListRamGetLimitRetType = int64 + +func getQuotaListRamGetLimitAttributeTypeOk(arg QuotaListRamGetLimitAttributeType) (ret QuotaListRamGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListRamGetLimitAttributeType(arg *QuotaListRamGetLimitAttributeType, val QuotaListRamGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListRamGetUsageAttributeType = *int64 +type QuotaListRamGetUsageArgType = int64 +type QuotaListRamGetUsageRetType = int64 + +func getQuotaListRamGetUsageAttributeTypeOk(arg QuotaListRamGetUsageAttributeType) (ret QuotaListRamGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListRamGetUsageAttributeType(arg *QuotaListRamGetUsageAttributeType, val QuotaListRamGetUsageRetType) { + *arg = &val +} + +// QuotaListRam Amount of server RAM in MiB. +type QuotaListRam struct { + // REQUIRED + Limit QuotaListRamGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListRamGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListRam QuotaListRam + +// NewQuotaListRam instantiates a new QuotaListRam 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 NewQuotaListRam(limit QuotaListRamGetLimitArgType, usage QuotaListRamGetUsageArgType) *QuotaListRam { + this := QuotaListRam{} + setQuotaListRamGetLimitAttributeType(&this.Limit, limit) + setQuotaListRamGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListRamWithDefaults instantiates a new QuotaListRam 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 NewQuotaListRamWithDefaults() *QuotaListRam { + this := QuotaListRam{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListRam) GetLimit() (ret QuotaListRamGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListRam) GetLimitOk() (ret QuotaListRamGetLimitRetType, ok bool) { + return getQuotaListRamGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListRam) SetLimit(v QuotaListRamGetLimitRetType) { + setQuotaListRamGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListRam) GetUsage() (ret QuotaListRamGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListRam) GetUsageOk() (ret QuotaListRamGetUsageRetType, ok bool) { + return getQuotaListRamGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListRam) SetUsage(v QuotaListRamGetUsageRetType) { + setQuotaListRamGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListRam) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListRamGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListRamGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListRam struct { + value *QuotaListRam + isSet bool +} + +func (v NullableQuotaListRam) Get() *QuotaListRam { + return v.value +} + +func (v *NullableQuotaListRam) Set(val *QuotaListRam) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListRam) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListRam) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListRam(val *QuotaListRam) *NullableQuotaListRam { + return &NullableQuotaListRam{value: val, isSet: true} +} + +func (v NullableQuotaListRam) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListRam) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_ram_test.go b/pkg/iaasbeta/model_quota_list_ram_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_ram_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_response.go b/pkg/iaasbeta/model_quota_list_response.go new file mode 100644 index 00000000..d953278e --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_response.go @@ -0,0 +1,125 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListResponse{} + +/* + types and functions for quotas +*/ + +// isModel +type QuotaListResponseGetQuotasAttributeType = *QuotaList +type QuotaListResponseGetQuotasArgType = QuotaList +type QuotaListResponseGetQuotasRetType = QuotaList + +func getQuotaListResponseGetQuotasAttributeTypeOk(arg QuotaListResponseGetQuotasAttributeType) (ret QuotaListResponseGetQuotasRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListResponseGetQuotasAttributeType(arg *QuotaListResponseGetQuotasAttributeType, val QuotaListResponseGetQuotasRetType) { + *arg = &val +} + +// QuotaListResponse Quotas list response. +type QuotaListResponse struct { + // REQUIRED + Quotas QuotaListResponseGetQuotasAttributeType `json:"quotas" required:"true"` +} + +type _QuotaListResponse QuotaListResponse + +// NewQuotaListResponse instantiates a new QuotaListResponse 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 NewQuotaListResponse(quotas QuotaListResponseGetQuotasArgType) *QuotaListResponse { + this := QuotaListResponse{} + setQuotaListResponseGetQuotasAttributeType(&this.Quotas, quotas) + return &this +} + +// NewQuotaListResponseWithDefaults instantiates a new QuotaListResponse 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 NewQuotaListResponseWithDefaults() *QuotaListResponse { + this := QuotaListResponse{} + return &this +} + +// GetQuotas returns the Quotas field value +func (o *QuotaListResponse) GetQuotas() (ret QuotaListResponseGetQuotasRetType) { + ret, _ = o.GetQuotasOk() + return ret +} + +// GetQuotasOk returns a tuple with the Quotas field value +// and a boolean to check if the value has been set. +func (o *QuotaListResponse) GetQuotasOk() (ret QuotaListResponseGetQuotasRetType, ok bool) { + return getQuotaListResponseGetQuotasAttributeTypeOk(o.Quotas) +} + +// SetQuotas sets field value +func (o *QuotaListResponse) SetQuotas(v QuotaListResponseGetQuotasRetType) { + setQuotaListResponseGetQuotasAttributeType(&o.Quotas, v) +} + +func (o QuotaListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListResponseGetQuotasAttributeTypeOk(o.Quotas); ok { + toSerialize["Quotas"] = val + } + return toSerialize, nil +} + +type NullableQuotaListResponse struct { + value *QuotaListResponse + isSet bool +} + +func (v NullableQuotaListResponse) Get() *QuotaListResponse { + return v.value +} + +func (v *NullableQuotaListResponse) Set(val *QuotaListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListResponse(val *QuotaListResponse) *NullableQuotaListResponse { + return &NullableQuotaListResponse{value: val, isSet: true} +} + +func (v NullableQuotaListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_response_test.go b/pkg/iaasbeta/model_quota_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_security_group_rules.go b/pkg/iaasbeta/model_quota_list_security_group_rules.go new file mode 100644 index 00000000..91670ce7 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_security_group_rules.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListSecurityGroupRules type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListSecurityGroupRules{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListSecurityGroupRulesGetLimitAttributeType = *int64 +type QuotaListSecurityGroupRulesGetLimitArgType = int64 +type QuotaListSecurityGroupRulesGetLimitRetType = int64 + +func getQuotaListSecurityGroupRulesGetLimitAttributeTypeOk(arg QuotaListSecurityGroupRulesGetLimitAttributeType) (ret QuotaListSecurityGroupRulesGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSecurityGroupRulesGetLimitAttributeType(arg *QuotaListSecurityGroupRulesGetLimitAttributeType, val QuotaListSecurityGroupRulesGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListSecurityGroupRulesGetUsageAttributeType = *int64 +type QuotaListSecurityGroupRulesGetUsageArgType = int64 +type QuotaListSecurityGroupRulesGetUsageRetType = int64 + +func getQuotaListSecurityGroupRulesGetUsageAttributeTypeOk(arg QuotaListSecurityGroupRulesGetUsageAttributeType) (ret QuotaListSecurityGroupRulesGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSecurityGroupRulesGetUsageAttributeType(arg *QuotaListSecurityGroupRulesGetUsageAttributeType, val QuotaListSecurityGroupRulesGetUsageRetType) { + *arg = &val +} + +// QuotaListSecurityGroupRules Number of security group rules. +type QuotaListSecurityGroupRules struct { + // REQUIRED + Limit QuotaListSecurityGroupRulesGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListSecurityGroupRulesGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListSecurityGroupRules QuotaListSecurityGroupRules + +// NewQuotaListSecurityGroupRules instantiates a new QuotaListSecurityGroupRules 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 NewQuotaListSecurityGroupRules(limit QuotaListSecurityGroupRulesGetLimitArgType, usage QuotaListSecurityGroupRulesGetUsageArgType) *QuotaListSecurityGroupRules { + this := QuotaListSecurityGroupRules{} + setQuotaListSecurityGroupRulesGetLimitAttributeType(&this.Limit, limit) + setQuotaListSecurityGroupRulesGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListSecurityGroupRulesWithDefaults instantiates a new QuotaListSecurityGroupRules 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 NewQuotaListSecurityGroupRulesWithDefaults() *QuotaListSecurityGroupRules { + this := QuotaListSecurityGroupRules{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListSecurityGroupRules) GetLimit() (ret QuotaListSecurityGroupRulesGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListSecurityGroupRules) GetLimitOk() (ret QuotaListSecurityGroupRulesGetLimitRetType, ok bool) { + return getQuotaListSecurityGroupRulesGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListSecurityGroupRules) SetLimit(v QuotaListSecurityGroupRulesGetLimitRetType) { + setQuotaListSecurityGroupRulesGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListSecurityGroupRules) GetUsage() (ret QuotaListSecurityGroupRulesGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListSecurityGroupRules) GetUsageOk() (ret QuotaListSecurityGroupRulesGetUsageRetType, ok bool) { + return getQuotaListSecurityGroupRulesGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListSecurityGroupRules) SetUsage(v QuotaListSecurityGroupRulesGetUsageRetType) { + setQuotaListSecurityGroupRulesGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListSecurityGroupRules) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListSecurityGroupRulesGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListSecurityGroupRulesGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListSecurityGroupRules struct { + value *QuotaListSecurityGroupRules + isSet bool +} + +func (v NullableQuotaListSecurityGroupRules) Get() *QuotaListSecurityGroupRules { + return v.value +} + +func (v *NullableQuotaListSecurityGroupRules) Set(val *QuotaListSecurityGroupRules) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListSecurityGroupRules) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListSecurityGroupRules) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListSecurityGroupRules(val *QuotaListSecurityGroupRules) *NullableQuotaListSecurityGroupRules { + return &NullableQuotaListSecurityGroupRules{value: val, isSet: true} +} + +func (v NullableQuotaListSecurityGroupRules) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListSecurityGroupRules) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_security_group_rules_test.go b/pkg/iaasbeta/model_quota_list_security_group_rules_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_security_group_rules_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_security_groups.go b/pkg/iaasbeta/model_quota_list_security_groups.go new file mode 100644 index 00000000..b2b0cc72 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_security_groups.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListSecurityGroups type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListSecurityGroups{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListSecurityGroupsGetLimitAttributeType = *int64 +type QuotaListSecurityGroupsGetLimitArgType = int64 +type QuotaListSecurityGroupsGetLimitRetType = int64 + +func getQuotaListSecurityGroupsGetLimitAttributeTypeOk(arg QuotaListSecurityGroupsGetLimitAttributeType) (ret QuotaListSecurityGroupsGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSecurityGroupsGetLimitAttributeType(arg *QuotaListSecurityGroupsGetLimitAttributeType, val QuotaListSecurityGroupsGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListSecurityGroupsGetUsageAttributeType = *int64 +type QuotaListSecurityGroupsGetUsageArgType = int64 +type QuotaListSecurityGroupsGetUsageRetType = int64 + +func getQuotaListSecurityGroupsGetUsageAttributeTypeOk(arg QuotaListSecurityGroupsGetUsageAttributeType) (ret QuotaListSecurityGroupsGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSecurityGroupsGetUsageAttributeType(arg *QuotaListSecurityGroupsGetUsageAttributeType, val QuotaListSecurityGroupsGetUsageRetType) { + *arg = &val +} + +// QuotaListSecurityGroups Number of security groups. +type QuotaListSecurityGroups struct { + // REQUIRED + Limit QuotaListSecurityGroupsGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListSecurityGroupsGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListSecurityGroups QuotaListSecurityGroups + +// NewQuotaListSecurityGroups instantiates a new QuotaListSecurityGroups 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 NewQuotaListSecurityGroups(limit QuotaListSecurityGroupsGetLimitArgType, usage QuotaListSecurityGroupsGetUsageArgType) *QuotaListSecurityGroups { + this := QuotaListSecurityGroups{} + setQuotaListSecurityGroupsGetLimitAttributeType(&this.Limit, limit) + setQuotaListSecurityGroupsGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListSecurityGroupsWithDefaults instantiates a new QuotaListSecurityGroups 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 NewQuotaListSecurityGroupsWithDefaults() *QuotaListSecurityGroups { + this := QuotaListSecurityGroups{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListSecurityGroups) GetLimit() (ret QuotaListSecurityGroupsGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListSecurityGroups) GetLimitOk() (ret QuotaListSecurityGroupsGetLimitRetType, ok bool) { + return getQuotaListSecurityGroupsGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListSecurityGroups) SetLimit(v QuotaListSecurityGroupsGetLimitRetType) { + setQuotaListSecurityGroupsGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListSecurityGroups) GetUsage() (ret QuotaListSecurityGroupsGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListSecurityGroups) GetUsageOk() (ret QuotaListSecurityGroupsGetUsageRetType, ok bool) { + return getQuotaListSecurityGroupsGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListSecurityGroups) SetUsage(v QuotaListSecurityGroupsGetUsageRetType) { + setQuotaListSecurityGroupsGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListSecurityGroups) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListSecurityGroupsGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListSecurityGroupsGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListSecurityGroups struct { + value *QuotaListSecurityGroups + isSet bool +} + +func (v NullableQuotaListSecurityGroups) Get() *QuotaListSecurityGroups { + return v.value +} + +func (v *NullableQuotaListSecurityGroups) Set(val *QuotaListSecurityGroups) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListSecurityGroups) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListSecurityGroups) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListSecurityGroups(val *QuotaListSecurityGroups) *NullableQuotaListSecurityGroups { + return &NullableQuotaListSecurityGroups{value: val, isSet: true} +} + +func (v NullableQuotaListSecurityGroups) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListSecurityGroups) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_security_groups_test.go b/pkg/iaasbeta/model_quota_list_security_groups_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_security_groups_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_snapshots.go b/pkg/iaasbeta/model_quota_list_snapshots.go new file mode 100644 index 00000000..a939f319 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_snapshots.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListSnapshots type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListSnapshots{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListSnapshotsGetLimitAttributeType = *int64 +type QuotaListSnapshotsGetLimitArgType = int64 +type QuotaListSnapshotsGetLimitRetType = int64 + +func getQuotaListSnapshotsGetLimitAttributeTypeOk(arg QuotaListSnapshotsGetLimitAttributeType) (ret QuotaListSnapshotsGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSnapshotsGetLimitAttributeType(arg *QuotaListSnapshotsGetLimitAttributeType, val QuotaListSnapshotsGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListSnapshotsGetUsageAttributeType = *int64 +type QuotaListSnapshotsGetUsageArgType = int64 +type QuotaListSnapshotsGetUsageRetType = int64 + +func getQuotaListSnapshotsGetUsageAttributeTypeOk(arg QuotaListSnapshotsGetUsageAttributeType) (ret QuotaListSnapshotsGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSnapshotsGetUsageAttributeType(arg *QuotaListSnapshotsGetUsageAttributeType, val QuotaListSnapshotsGetUsageRetType) { + *arg = &val +} + +// QuotaListSnapshots Number of snapshots. +type QuotaListSnapshots struct { + // REQUIRED + Limit QuotaListSnapshotsGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListSnapshotsGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListSnapshots QuotaListSnapshots + +// NewQuotaListSnapshots instantiates a new QuotaListSnapshots 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 NewQuotaListSnapshots(limit QuotaListSnapshotsGetLimitArgType, usage QuotaListSnapshotsGetUsageArgType) *QuotaListSnapshots { + this := QuotaListSnapshots{} + setQuotaListSnapshotsGetLimitAttributeType(&this.Limit, limit) + setQuotaListSnapshotsGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListSnapshotsWithDefaults instantiates a new QuotaListSnapshots 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 NewQuotaListSnapshotsWithDefaults() *QuotaListSnapshots { + this := QuotaListSnapshots{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListSnapshots) GetLimit() (ret QuotaListSnapshotsGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListSnapshots) GetLimitOk() (ret QuotaListSnapshotsGetLimitRetType, ok bool) { + return getQuotaListSnapshotsGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListSnapshots) SetLimit(v QuotaListSnapshotsGetLimitRetType) { + setQuotaListSnapshotsGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListSnapshots) GetUsage() (ret QuotaListSnapshotsGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListSnapshots) GetUsageOk() (ret QuotaListSnapshotsGetUsageRetType, ok bool) { + return getQuotaListSnapshotsGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListSnapshots) SetUsage(v QuotaListSnapshotsGetUsageRetType) { + setQuotaListSnapshotsGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListSnapshots) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListSnapshotsGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListSnapshotsGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListSnapshots struct { + value *QuotaListSnapshots + isSet bool +} + +func (v NullableQuotaListSnapshots) Get() *QuotaListSnapshots { + return v.value +} + +func (v *NullableQuotaListSnapshots) Set(val *QuotaListSnapshots) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListSnapshots) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListSnapshots) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListSnapshots(val *QuotaListSnapshots) *NullableQuotaListSnapshots { + return &NullableQuotaListSnapshots{value: val, isSet: true} +} + +func (v NullableQuotaListSnapshots) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListSnapshots) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_snapshots_test.go b/pkg/iaasbeta/model_quota_list_snapshots_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_snapshots_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_test.go b/pkg/iaasbeta/model_quota_list_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_vcpu.go b/pkg/iaasbeta/model_quota_list_vcpu.go new file mode 100644 index 00000000..7391396c --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_vcpu.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListVcpu type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListVcpu{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListVcpuGetLimitAttributeType = *int64 +type QuotaListVcpuGetLimitArgType = int64 +type QuotaListVcpuGetLimitRetType = int64 + +func getQuotaListVcpuGetLimitAttributeTypeOk(arg QuotaListVcpuGetLimitAttributeType) (ret QuotaListVcpuGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListVcpuGetLimitAttributeType(arg *QuotaListVcpuGetLimitAttributeType, val QuotaListVcpuGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListVcpuGetUsageAttributeType = *int64 +type QuotaListVcpuGetUsageArgType = int64 +type QuotaListVcpuGetUsageRetType = int64 + +func getQuotaListVcpuGetUsageAttributeTypeOk(arg QuotaListVcpuGetUsageAttributeType) (ret QuotaListVcpuGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListVcpuGetUsageAttributeType(arg *QuotaListVcpuGetUsageAttributeType, val QuotaListVcpuGetUsageRetType) { + *arg = &val +} + +// QuotaListVcpu Number of server cores. +type QuotaListVcpu struct { + // REQUIRED + Limit QuotaListVcpuGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListVcpuGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListVcpu QuotaListVcpu + +// NewQuotaListVcpu instantiates a new QuotaListVcpu 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 NewQuotaListVcpu(limit QuotaListVcpuGetLimitArgType, usage QuotaListVcpuGetUsageArgType) *QuotaListVcpu { + this := QuotaListVcpu{} + setQuotaListVcpuGetLimitAttributeType(&this.Limit, limit) + setQuotaListVcpuGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListVcpuWithDefaults instantiates a new QuotaListVcpu 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 NewQuotaListVcpuWithDefaults() *QuotaListVcpu { + this := QuotaListVcpu{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListVcpu) GetLimit() (ret QuotaListVcpuGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListVcpu) GetLimitOk() (ret QuotaListVcpuGetLimitRetType, ok bool) { + return getQuotaListVcpuGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListVcpu) SetLimit(v QuotaListVcpuGetLimitRetType) { + setQuotaListVcpuGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListVcpu) GetUsage() (ret QuotaListVcpuGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListVcpu) GetUsageOk() (ret QuotaListVcpuGetUsageRetType, ok bool) { + return getQuotaListVcpuGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListVcpu) SetUsage(v QuotaListVcpuGetUsageRetType) { + setQuotaListVcpuGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListVcpu) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListVcpuGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListVcpuGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListVcpu struct { + value *QuotaListVcpu + isSet bool +} + +func (v NullableQuotaListVcpu) Get() *QuotaListVcpu { + return v.value +} + +func (v *NullableQuotaListVcpu) Set(val *QuotaListVcpu) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListVcpu) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListVcpu) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListVcpu(val *QuotaListVcpu) *NullableQuotaListVcpu { + return &NullableQuotaListVcpu{value: val, isSet: true} +} + +func (v NullableQuotaListVcpu) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListVcpu) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_vcpu_test.go b/pkg/iaasbeta/model_quota_list_vcpu_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_vcpu_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_list_volumes.go b/pkg/iaasbeta/model_quota_list_volumes.go new file mode 100644 index 00000000..3a12d445 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_volumes.go @@ -0,0 +1,168 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the QuotaListVolumes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListVolumes{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListVolumesGetLimitAttributeType = *int64 +type QuotaListVolumesGetLimitArgType = int64 +type QuotaListVolumesGetLimitRetType = int64 + +func getQuotaListVolumesGetLimitAttributeTypeOk(arg QuotaListVolumesGetLimitAttributeType) (ret QuotaListVolumesGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListVolumesGetLimitAttributeType(arg *QuotaListVolumesGetLimitAttributeType, val QuotaListVolumesGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListVolumesGetUsageAttributeType = *int64 +type QuotaListVolumesGetUsageArgType = int64 +type QuotaListVolumesGetUsageRetType = int64 + +func getQuotaListVolumesGetUsageAttributeTypeOk(arg QuotaListVolumesGetUsageAttributeType) (ret QuotaListVolumesGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListVolumesGetUsageAttributeType(arg *QuotaListVolumesGetUsageAttributeType, val QuotaListVolumesGetUsageRetType) { + *arg = &val +} + +// QuotaListVolumes Number of volumes. +type QuotaListVolumes struct { + // REQUIRED + Limit QuotaListVolumesGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListVolumesGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListVolumes QuotaListVolumes + +// NewQuotaListVolumes instantiates a new QuotaListVolumes 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 NewQuotaListVolumes(limit QuotaListVolumesGetLimitArgType, usage QuotaListVolumesGetUsageArgType) *QuotaListVolumes { + this := QuotaListVolumes{} + setQuotaListVolumesGetLimitAttributeType(&this.Limit, limit) + setQuotaListVolumesGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListVolumesWithDefaults instantiates a new QuotaListVolumes 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 NewQuotaListVolumesWithDefaults() *QuotaListVolumes { + this := QuotaListVolumes{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListVolumes) GetLimit() (ret QuotaListVolumesGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListVolumes) GetLimitOk() (ret QuotaListVolumesGetLimitRetType, ok bool) { + return getQuotaListVolumesGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListVolumes) SetLimit(v QuotaListVolumesGetLimitRetType) { + setQuotaListVolumesGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListVolumes) GetUsage() (ret QuotaListVolumesGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListVolumes) GetUsageOk() (ret QuotaListVolumesGetUsageRetType, ok bool) { + return getQuotaListVolumesGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListVolumes) SetUsage(v QuotaListVolumesGetUsageRetType) { + setQuotaListVolumesGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListVolumes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListVolumesGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListVolumesGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListVolumes struct { + value *QuotaListVolumes + isSet bool +} + +func (v NullableQuotaListVolumes) Get() *QuotaListVolumes { + return v.value +} + +func (v *NullableQuotaListVolumes) Set(val *QuotaListVolumes) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListVolumes) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListVolumes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListVolumes(val *QuotaListVolumes) *NullableQuotaListVolumes { + return &NullableQuotaListVolumes{value: val, isSet: true} +} + +func (v NullableQuotaListVolumes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListVolumes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_quota_list_volumes_test.go b/pkg/iaasbeta/model_quota_list_volumes_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_list_volumes_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_quota_test.go b/pkg/iaasbeta/model_quota_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_quota_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_regional_area.go b/pkg/iaasbeta/model_regional_area.go new file mode 100644 index 00000000..23ea5a9e --- /dev/null +++ b/pkg/iaasbeta/model_regional_area.go @@ -0,0 +1,176 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the RegionalArea type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegionalArea{} + +/* + types and functions for ipv4 +*/ + +// isModel +type RegionalAreaGetIpv4AttributeType = *RegionalAreaIPv4 +type RegionalAreaGetIpv4ArgType = RegionalAreaIPv4 +type RegionalAreaGetIpv4RetType = RegionalAreaIPv4 + +func getRegionalAreaGetIpv4AttributeTypeOk(arg RegionalAreaGetIpv4AttributeType) (ret RegionalAreaGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaGetIpv4AttributeType(arg *RegionalAreaGetIpv4AttributeType, val RegionalAreaGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type RegionalAreaGetStatusAttributeType = *string + +func getRegionalAreaGetStatusAttributeTypeOk(arg RegionalAreaGetStatusAttributeType) (ret RegionalAreaGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaGetStatusAttributeType(arg *RegionalAreaGetStatusAttributeType, val RegionalAreaGetStatusRetType) { + *arg = &val +} + +type RegionalAreaGetStatusArgType = string +type RegionalAreaGetStatusRetType = string + +// RegionalArea The basic properties of a regional network area. +type RegionalArea struct { + Ipv4 RegionalAreaGetIpv4AttributeType `json:"ipv4,omitempty"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + Status RegionalAreaGetStatusAttributeType `json:"status,omitempty"` +} + +// NewRegionalArea instantiates a new RegionalArea 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 NewRegionalArea() *RegionalArea { + this := RegionalArea{} + return &this +} + +// NewRegionalAreaWithDefaults instantiates a new RegionalArea 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 NewRegionalAreaWithDefaults() *RegionalArea { + this := RegionalArea{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *RegionalArea) GetIpv4() (res RegionalAreaGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegionalArea) GetIpv4Ok() (ret RegionalAreaGetIpv4RetType, ok bool) { + return getRegionalAreaGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *RegionalArea) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given RegionalAreaIPv4 and assigns it to the Ipv4 field. +func (o *RegionalArea) SetIpv4(v RegionalAreaGetIpv4RetType) { + setRegionalAreaGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *RegionalArea) GetStatus() (res RegionalAreaGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegionalArea) GetStatusOk() (ret RegionalAreaGetStatusRetType, ok bool) { + return getRegionalAreaGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *RegionalArea) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *RegionalArea) SetStatus(v RegionalAreaGetStatusRetType) { + setRegionalAreaGetStatusAttributeType(&o.Status, v) +} + +func (o RegionalArea) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRegionalAreaGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getRegionalAreaGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableRegionalArea struct { + value *RegionalArea + isSet bool +} + +func (v NullableRegionalArea) Get() *RegionalArea { + return v.value +} + +func (v *NullableRegionalArea) Set(val *RegionalArea) { + v.value = val + v.isSet = true +} + +func (v NullableRegionalArea) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionalArea) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionalArea(val *RegionalArea) *NullableRegionalArea { + return &NullableRegionalArea{value: val, isSet: true} +} + +func (v NullableRegionalArea) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionalArea) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_regional_area_ipv4.go b/pkg/iaasbeta/model_regional_area_ipv4.go new file mode 100644 index 00000000..e01f267f --- /dev/null +++ b/pkg/iaasbeta/model_regional_area_ipv4.go @@ -0,0 +1,356 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the RegionalAreaIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegionalAreaIPv4{} + +/* + types and functions for defaultNameservers +*/ + +// isArray +type RegionalAreaIPv4GetDefaultNameserversAttributeType = *[]string +type RegionalAreaIPv4GetDefaultNameserversArgType = []string +type RegionalAreaIPv4GetDefaultNameserversRetType = []string + +func getRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(arg RegionalAreaIPv4GetDefaultNameserversAttributeType) (ret RegionalAreaIPv4GetDefaultNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetDefaultNameserversAttributeType(arg *RegionalAreaIPv4GetDefaultNameserversAttributeType, val RegionalAreaIPv4GetDefaultNameserversRetType) { + *arg = &val +} + +/* + types and functions for defaultPrefixLen +*/ + +// isLong +type RegionalAreaIPv4GetDefaultPrefixLenAttributeType = *int64 +type RegionalAreaIPv4GetDefaultPrefixLenArgType = int64 +type RegionalAreaIPv4GetDefaultPrefixLenRetType = int64 + +func getRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(arg RegionalAreaIPv4GetDefaultPrefixLenAttributeType) (ret RegionalAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetDefaultPrefixLenAttributeType(arg *RegionalAreaIPv4GetDefaultPrefixLenAttributeType, val RegionalAreaIPv4GetDefaultPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for maxPrefixLen +*/ + +// isLong +type RegionalAreaIPv4GetMaxPrefixLenAttributeType = *int64 +type RegionalAreaIPv4GetMaxPrefixLenArgType = int64 +type RegionalAreaIPv4GetMaxPrefixLenRetType = int64 + +func getRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(arg RegionalAreaIPv4GetMaxPrefixLenAttributeType) (ret RegionalAreaIPv4GetMaxPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetMaxPrefixLenAttributeType(arg *RegionalAreaIPv4GetMaxPrefixLenAttributeType, val RegionalAreaIPv4GetMaxPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for minPrefixLen +*/ + +// isLong +type RegionalAreaIPv4GetMinPrefixLenAttributeType = *int64 +type RegionalAreaIPv4GetMinPrefixLenArgType = int64 +type RegionalAreaIPv4GetMinPrefixLenRetType = int64 + +func getRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(arg RegionalAreaIPv4GetMinPrefixLenAttributeType) (ret RegionalAreaIPv4GetMinPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetMinPrefixLenAttributeType(arg *RegionalAreaIPv4GetMinPrefixLenAttributeType, val RegionalAreaIPv4GetMinPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for networkRanges +*/ + +// isArray +type RegionalAreaIPv4GetNetworkRangesAttributeType = *[]NetworkRange +type RegionalAreaIPv4GetNetworkRangesArgType = []NetworkRange +type RegionalAreaIPv4GetNetworkRangesRetType = []NetworkRange + +func getRegionalAreaIPv4GetNetworkRangesAttributeTypeOk(arg RegionalAreaIPv4GetNetworkRangesAttributeType) (ret RegionalAreaIPv4GetNetworkRangesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetNetworkRangesAttributeType(arg *RegionalAreaIPv4GetNetworkRangesAttributeType, val RegionalAreaIPv4GetNetworkRangesRetType) { + *arg = &val +} + +/* + types and functions for transferNetwork +*/ + +// isNotNullableString +type RegionalAreaIPv4GetTransferNetworkAttributeType = *string + +func getRegionalAreaIPv4GetTransferNetworkAttributeTypeOk(arg RegionalAreaIPv4GetTransferNetworkAttributeType) (ret RegionalAreaIPv4GetTransferNetworkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetTransferNetworkAttributeType(arg *RegionalAreaIPv4GetTransferNetworkAttributeType, val RegionalAreaIPv4GetTransferNetworkRetType) { + *arg = &val +} + +type RegionalAreaIPv4GetTransferNetworkArgType = string +type RegionalAreaIPv4GetTransferNetworkRetType = string + +// RegionalAreaIPv4 The regional IPv4 config of a network area. +type RegionalAreaIPv4 struct { + DefaultNameservers RegionalAreaIPv4GetDefaultNameserversAttributeType `json:"defaultNameservers,omitempty"` + // The default prefix length for networks in the network area. + // REQUIRED + DefaultPrefixLen RegionalAreaIPv4GetDefaultPrefixLenAttributeType `json:"defaultPrefixLen" required:"true"` + // The maximal prefix length for networks in the network area. + // REQUIRED + MaxPrefixLen RegionalAreaIPv4GetMaxPrefixLenAttributeType `json:"maxPrefixLen" required:"true"` + // The minimal prefix length for networks in the network area. + // REQUIRED + MinPrefixLen RegionalAreaIPv4GetMinPrefixLenAttributeType `json:"minPrefixLen" required:"true"` + // A list of network ranges. + // REQUIRED + NetworkRanges RegionalAreaIPv4GetNetworkRangesAttributeType `json:"networkRanges" required:"true"` + // IPv4 Classless Inter-Domain Routing (CIDR). + // REQUIRED + TransferNetwork RegionalAreaIPv4GetTransferNetworkAttributeType `json:"transferNetwork" required:"true"` +} + +type _RegionalAreaIPv4 RegionalAreaIPv4 + +// NewRegionalAreaIPv4 instantiates a new RegionalAreaIPv4 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 NewRegionalAreaIPv4(defaultPrefixLen RegionalAreaIPv4GetDefaultPrefixLenArgType, maxPrefixLen RegionalAreaIPv4GetMaxPrefixLenArgType, minPrefixLen RegionalAreaIPv4GetMinPrefixLenArgType, networkRanges RegionalAreaIPv4GetNetworkRangesArgType, transferNetwork RegionalAreaIPv4GetTransferNetworkArgType) *RegionalAreaIPv4 { + this := RegionalAreaIPv4{} + setRegionalAreaIPv4GetDefaultPrefixLenAttributeType(&this.DefaultPrefixLen, defaultPrefixLen) + setRegionalAreaIPv4GetMaxPrefixLenAttributeType(&this.MaxPrefixLen, maxPrefixLen) + setRegionalAreaIPv4GetMinPrefixLenAttributeType(&this.MinPrefixLen, minPrefixLen) + setRegionalAreaIPv4GetNetworkRangesAttributeType(&this.NetworkRanges, networkRanges) + setRegionalAreaIPv4GetTransferNetworkAttributeType(&this.TransferNetwork, transferNetwork) + return &this +} + +// NewRegionalAreaIPv4WithDefaults instantiates a new RegionalAreaIPv4 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 NewRegionalAreaIPv4WithDefaults() *RegionalAreaIPv4 { + this := RegionalAreaIPv4{} + var defaultPrefixLen int64 = 25 + this.DefaultPrefixLen = &defaultPrefixLen + var maxPrefixLen int64 = 29 + this.MaxPrefixLen = &maxPrefixLen + var minPrefixLen int64 = 24 + this.MinPrefixLen = &minPrefixLen + return &this +} + +// GetDefaultNameservers returns the DefaultNameservers field value if set, zero value otherwise. +func (o *RegionalAreaIPv4) GetDefaultNameservers() (res RegionalAreaIPv4GetDefaultNameserversRetType) { + res, _ = o.GetDefaultNameserversOk() + return +} + +// GetDefaultNameserversOk returns a tuple with the DefaultNameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetDefaultNameserversOk() (ret RegionalAreaIPv4GetDefaultNameserversRetType, ok bool) { + return getRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers) +} + +// HasDefaultNameservers returns a boolean if a field has been set. +func (o *RegionalAreaIPv4) HasDefaultNameservers() bool { + _, ok := o.GetDefaultNameserversOk() + return ok +} + +// SetDefaultNameservers gets a reference to the given []string and assigns it to the DefaultNameservers field. +func (o *RegionalAreaIPv4) SetDefaultNameservers(v RegionalAreaIPv4GetDefaultNameserversRetType) { + setRegionalAreaIPv4GetDefaultNameserversAttributeType(&o.DefaultNameservers, v) +} + +// GetDefaultPrefixLen returns the DefaultPrefixLen field value +func (o *RegionalAreaIPv4) GetDefaultPrefixLen() (ret RegionalAreaIPv4GetDefaultPrefixLenRetType) { + ret, _ = o.GetDefaultPrefixLenOk() + return ret +} + +// GetDefaultPrefixLenOk returns a tuple with the DefaultPrefixLen field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetDefaultPrefixLenOk() (ret RegionalAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + return getRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen) +} + +// SetDefaultPrefixLen sets field value +func (o *RegionalAreaIPv4) SetDefaultPrefixLen(v RegionalAreaIPv4GetDefaultPrefixLenRetType) { + setRegionalAreaIPv4GetDefaultPrefixLenAttributeType(&o.DefaultPrefixLen, v) +} + +// GetMaxPrefixLen returns the MaxPrefixLen field value +func (o *RegionalAreaIPv4) GetMaxPrefixLen() (ret RegionalAreaIPv4GetMaxPrefixLenRetType) { + ret, _ = o.GetMaxPrefixLenOk() + return ret +} + +// GetMaxPrefixLenOk returns a tuple with the MaxPrefixLen field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetMaxPrefixLenOk() (ret RegionalAreaIPv4GetMaxPrefixLenRetType, ok bool) { + return getRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen) +} + +// SetMaxPrefixLen sets field value +func (o *RegionalAreaIPv4) SetMaxPrefixLen(v RegionalAreaIPv4GetMaxPrefixLenRetType) { + setRegionalAreaIPv4GetMaxPrefixLenAttributeType(&o.MaxPrefixLen, v) +} + +// GetMinPrefixLen returns the MinPrefixLen field value +func (o *RegionalAreaIPv4) GetMinPrefixLen() (ret RegionalAreaIPv4GetMinPrefixLenRetType) { + ret, _ = o.GetMinPrefixLenOk() + return ret +} + +// GetMinPrefixLenOk returns a tuple with the MinPrefixLen field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetMinPrefixLenOk() (ret RegionalAreaIPv4GetMinPrefixLenRetType, ok bool) { + return getRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen) +} + +// SetMinPrefixLen sets field value +func (o *RegionalAreaIPv4) SetMinPrefixLen(v RegionalAreaIPv4GetMinPrefixLenRetType) { + setRegionalAreaIPv4GetMinPrefixLenAttributeType(&o.MinPrefixLen, v) +} + +// GetNetworkRanges returns the NetworkRanges field value +func (o *RegionalAreaIPv4) GetNetworkRanges() (ret RegionalAreaIPv4GetNetworkRangesRetType) { + ret, _ = o.GetNetworkRangesOk() + return ret +} + +// GetNetworkRangesOk returns a tuple with the NetworkRanges field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetNetworkRangesOk() (ret RegionalAreaIPv4GetNetworkRangesRetType, ok bool) { + return getRegionalAreaIPv4GetNetworkRangesAttributeTypeOk(o.NetworkRanges) +} + +// SetNetworkRanges sets field value +func (o *RegionalAreaIPv4) SetNetworkRanges(v RegionalAreaIPv4GetNetworkRangesRetType) { + setRegionalAreaIPv4GetNetworkRangesAttributeType(&o.NetworkRanges, v) +} + +// GetTransferNetwork returns the TransferNetwork field value +func (o *RegionalAreaIPv4) GetTransferNetwork() (ret RegionalAreaIPv4GetTransferNetworkRetType) { + ret, _ = o.GetTransferNetworkOk() + return ret +} + +// GetTransferNetworkOk returns a tuple with the TransferNetwork field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetTransferNetworkOk() (ret RegionalAreaIPv4GetTransferNetworkRetType, ok bool) { + return getRegionalAreaIPv4GetTransferNetworkAttributeTypeOk(o.TransferNetwork) +} + +// SetTransferNetwork sets field value +func (o *RegionalAreaIPv4) SetTransferNetwork(v RegionalAreaIPv4GetTransferNetworkRetType) { + setRegionalAreaIPv4GetTransferNetworkAttributeType(&o.TransferNetwork, v) +} + +func (o RegionalAreaIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers); ok { + toSerialize["DefaultNameservers"] = val + } + if val, ok := getRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen); ok { + toSerialize["DefaultPrefixLen"] = val + } + if val, ok := getRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen); ok { + toSerialize["MaxPrefixLen"] = val + } + if val, ok := getRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen); ok { + toSerialize["MinPrefixLen"] = val + } + if val, ok := getRegionalAreaIPv4GetNetworkRangesAttributeTypeOk(o.NetworkRanges); ok { + toSerialize["NetworkRanges"] = val + } + if val, ok := getRegionalAreaIPv4GetTransferNetworkAttributeTypeOk(o.TransferNetwork); ok { + toSerialize["TransferNetwork"] = val + } + return toSerialize, nil +} + +type NullableRegionalAreaIPv4 struct { + value *RegionalAreaIPv4 + isSet bool +} + +func (v NullableRegionalAreaIPv4) Get() *RegionalAreaIPv4 { + return v.value +} + +func (v *NullableRegionalAreaIPv4) Set(val *RegionalAreaIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableRegionalAreaIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionalAreaIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionalAreaIPv4(val *RegionalAreaIPv4) *NullableRegionalAreaIPv4 { + return &NullableRegionalAreaIPv4{value: val, isSet: true} +} + +func (v NullableRegionalAreaIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionalAreaIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_regional_area_ipv4_test.go b/pkg/iaasbeta/model_regional_area_ipv4_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_regional_area_ipv4_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_regional_area_list_response.go b/pkg/iaasbeta/model_regional_area_list_response.go new file mode 100644 index 00000000..c47a9058 --- /dev/null +++ b/pkg/iaasbeta/model_regional_area_list_response.go @@ -0,0 +1,125 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the RegionalAreaListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegionalAreaListResponse{} + +/* + types and functions for regions +*/ + +// isContainer +type RegionalAreaListResponseGetRegionsAttributeType = *map[string]RegionalArea +type RegionalAreaListResponseGetRegionsArgType = map[string]RegionalArea +type RegionalAreaListResponseGetRegionsRetType = map[string]RegionalArea + +func getRegionalAreaListResponseGetRegionsAttributeTypeOk(arg RegionalAreaListResponseGetRegionsAttributeType) (ret RegionalAreaListResponseGetRegionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaListResponseGetRegionsAttributeType(arg *RegionalAreaListResponseGetRegionsAttributeType, val RegionalAreaListResponseGetRegionsRetType) { + *arg = &val +} + +// RegionalAreaListResponse Regional area list response. +type RegionalAreaListResponse struct { + // REQUIRED + Regions RegionalAreaListResponseGetRegionsAttributeType `json:"regions" required:"true"` +} + +type _RegionalAreaListResponse RegionalAreaListResponse + +// NewRegionalAreaListResponse instantiates a new RegionalAreaListResponse 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 NewRegionalAreaListResponse(regions RegionalAreaListResponseGetRegionsArgType) *RegionalAreaListResponse { + this := RegionalAreaListResponse{} + setRegionalAreaListResponseGetRegionsAttributeType(&this.Regions, regions) + return &this +} + +// NewRegionalAreaListResponseWithDefaults instantiates a new RegionalAreaListResponse 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 NewRegionalAreaListResponseWithDefaults() *RegionalAreaListResponse { + this := RegionalAreaListResponse{} + return &this +} + +// GetRegions returns the Regions field value +func (o *RegionalAreaListResponse) GetRegions() (ret RegionalAreaListResponseGetRegionsRetType) { + ret, _ = o.GetRegionsOk() + return ret +} + +// GetRegionsOk returns a tuple with the Regions field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaListResponse) GetRegionsOk() (ret RegionalAreaListResponseGetRegionsRetType, ok bool) { + return getRegionalAreaListResponseGetRegionsAttributeTypeOk(o.Regions) +} + +// SetRegions sets field value +func (o *RegionalAreaListResponse) SetRegions(v RegionalAreaListResponseGetRegionsRetType) { + setRegionalAreaListResponseGetRegionsAttributeType(&o.Regions, v) +} + +func (o RegionalAreaListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRegionalAreaListResponseGetRegionsAttributeTypeOk(o.Regions); ok { + toSerialize["Regions"] = val + } + return toSerialize, nil +} + +type NullableRegionalAreaListResponse struct { + value *RegionalAreaListResponse + isSet bool +} + +func (v NullableRegionalAreaListResponse) Get() *RegionalAreaListResponse { + return v.value +} + +func (v *NullableRegionalAreaListResponse) Set(val *RegionalAreaListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRegionalAreaListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionalAreaListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionalAreaListResponse(val *RegionalAreaListResponse) *NullableRegionalAreaListResponse { + return &NullableRegionalAreaListResponse{value: val, isSet: true} +} + +func (v NullableRegionalAreaListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionalAreaListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_regional_area_list_response_test.go b/pkg/iaasbeta/model_regional_area_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_regional_area_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_regional_area_test.go b/pkg/iaasbeta/model_regional_area_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_regional_area_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_request.go b/pkg/iaasbeta/model_request.go new file mode 100644 index 00000000..e07fb081 --- /dev/null +++ b/pkg/iaasbeta/model_request.go @@ -0,0 +1,353 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the Request type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Request{} + +/* + types and functions for details +*/ + +// isNotNullableString +type RequestGetDetailsAttributeType = *string + +func getRequestGetDetailsAttributeTypeOk(arg RequestGetDetailsAttributeType) (ret RequestGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetDetailsAttributeType(arg *RequestGetDetailsAttributeType, val RequestGetDetailsRetType) { + *arg = &val +} + +type RequestGetDetailsArgType = string +type RequestGetDetailsRetType = string + +/* + types and functions for requestAction +*/ + +// isNotNullableString +type RequestGetRequestActionAttributeType = *string + +func getRequestGetRequestActionAttributeTypeOk(arg RequestGetRequestActionAttributeType) (ret RequestGetRequestActionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetRequestActionAttributeType(arg *RequestGetRequestActionAttributeType, val RequestGetRequestActionRetType) { + *arg = &val +} + +type RequestGetRequestActionArgType = string +type RequestGetRequestActionRetType = string + +/* + types and functions for requestId +*/ + +// isNotNullableString +type RequestGetRequestIdAttributeType = *string + +func getRequestGetRequestIdAttributeTypeOk(arg RequestGetRequestIdAttributeType) (ret RequestGetRequestIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetRequestIdAttributeType(arg *RequestGetRequestIdAttributeType, val RequestGetRequestIdRetType) { + *arg = &val +} + +type RequestGetRequestIdArgType = string +type RequestGetRequestIdRetType = string + +/* + types and functions for requestType +*/ + +// isNotNullableString +type RequestGetRequestTypeAttributeType = *string + +func getRequestGetRequestTypeAttributeTypeOk(arg RequestGetRequestTypeAttributeType) (ret RequestGetRequestTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetRequestTypeAttributeType(arg *RequestGetRequestTypeAttributeType, val RequestGetRequestTypeRetType) { + *arg = &val +} + +type RequestGetRequestTypeArgType = string +type RequestGetRequestTypeRetType = string + +/* + types and functions for resources +*/ + +// isArray +type RequestGetResourcesAttributeType = *[]RequestResource +type RequestGetResourcesArgType = []RequestResource +type RequestGetResourcesRetType = []RequestResource + +func getRequestGetResourcesAttributeTypeOk(arg RequestGetResourcesAttributeType) (ret RequestGetResourcesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetResourcesAttributeType(arg *RequestGetResourcesAttributeType, val RequestGetResourcesRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type RequestGetStatusAttributeType = *string + +func getRequestGetStatusAttributeTypeOk(arg RequestGetStatusAttributeType) (ret RequestGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetStatusAttributeType(arg *RequestGetStatusAttributeType, val RequestGetStatusRetType) { + *arg = &val +} + +type RequestGetStatusArgType = string +type RequestGetStatusRetType = string + +// Request Object that represents a request. +type Request struct { + Details RequestGetDetailsAttributeType `json:"details,omitempty"` + // Object that represents a resource action. Possible values: `CREATE`, `DELETE`, `UPDATE`. + // REQUIRED + RequestAction RequestGetRequestActionAttributeType `json:"requestAction" required:"true"` + // Identifier (ID) representing a single API request. + // REQUIRED + RequestId RequestGetRequestIdAttributeType `json:"requestId" required:"true"` + // Object that represents a resource type. Possible values: `BACKUP`, `IMAGE`, `NETWORK`, `NETWORKAREA`, `NIC`, `PROJECT`, `ROUTE`, `SERVER`, `SERVICEACCOUNT`, `SNAPSHOT`, `VIRTUALIP`, `VOLUME`. + // REQUIRED + RequestType RequestGetRequestTypeAttributeType `json:"requestType" required:"true"` + // REQUIRED + Resources RequestGetResourcesAttributeType `json:"resources" required:"true"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + // REQUIRED + Status RequestGetStatusAttributeType `json:"status" required:"true"` +} + +type _Request Request + +// NewRequest instantiates a new Request 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 NewRequest(requestAction RequestGetRequestActionArgType, requestId RequestGetRequestIdArgType, requestType RequestGetRequestTypeArgType, resources RequestGetResourcesArgType, status RequestGetStatusArgType) *Request { + this := Request{} + setRequestGetRequestActionAttributeType(&this.RequestAction, requestAction) + setRequestGetRequestIdAttributeType(&this.RequestId, requestId) + setRequestGetRequestTypeAttributeType(&this.RequestType, requestType) + setRequestGetResourcesAttributeType(&this.Resources, resources) + setRequestGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewRequestWithDefaults instantiates a new Request 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 NewRequestWithDefaults() *Request { + this := Request{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *Request) GetDetails() (res RequestGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Request) GetDetailsOk() (ret RequestGetDetailsRetType, ok bool) { + return getRequestGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *Request) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *Request) SetDetails(v RequestGetDetailsRetType) { + setRequestGetDetailsAttributeType(&o.Details, v) +} + +// GetRequestAction returns the RequestAction field value +func (o *Request) GetRequestAction() (ret RequestGetRequestActionRetType) { + ret, _ = o.GetRequestActionOk() + return ret +} + +// GetRequestActionOk returns a tuple with the RequestAction field value +// and a boolean to check if the value has been set. +func (o *Request) GetRequestActionOk() (ret RequestGetRequestActionRetType, ok bool) { + return getRequestGetRequestActionAttributeTypeOk(o.RequestAction) +} + +// SetRequestAction sets field value +func (o *Request) SetRequestAction(v RequestGetRequestActionRetType) { + setRequestGetRequestActionAttributeType(&o.RequestAction, v) +} + +// GetRequestId returns the RequestId field value +func (o *Request) GetRequestId() (ret RequestGetRequestIdRetType) { + ret, _ = o.GetRequestIdOk() + return ret +} + +// GetRequestIdOk returns a tuple with the RequestId field value +// and a boolean to check if the value has been set. +func (o *Request) GetRequestIdOk() (ret RequestGetRequestIdRetType, ok bool) { + return getRequestGetRequestIdAttributeTypeOk(o.RequestId) +} + +// SetRequestId sets field value +func (o *Request) SetRequestId(v RequestGetRequestIdRetType) { + setRequestGetRequestIdAttributeType(&o.RequestId, v) +} + +// GetRequestType returns the RequestType field value +func (o *Request) GetRequestType() (ret RequestGetRequestTypeRetType) { + ret, _ = o.GetRequestTypeOk() + return ret +} + +// GetRequestTypeOk returns a tuple with the RequestType field value +// and a boolean to check if the value has been set. +func (o *Request) GetRequestTypeOk() (ret RequestGetRequestTypeRetType, ok bool) { + return getRequestGetRequestTypeAttributeTypeOk(o.RequestType) +} + +// SetRequestType sets field value +func (o *Request) SetRequestType(v RequestGetRequestTypeRetType) { + setRequestGetRequestTypeAttributeType(&o.RequestType, v) +} + +// GetResources returns the Resources field value +func (o *Request) GetResources() (ret RequestGetResourcesRetType) { + ret, _ = o.GetResourcesOk() + return ret +} + +// GetResourcesOk returns a tuple with the Resources field value +// and a boolean to check if the value has been set. +func (o *Request) GetResourcesOk() (ret RequestGetResourcesRetType, ok bool) { + return getRequestGetResourcesAttributeTypeOk(o.Resources) +} + +// SetResources sets field value +func (o *Request) SetResources(v RequestGetResourcesRetType) { + setRequestGetResourcesAttributeType(&o.Resources, v) +} + +// GetStatus returns the Status field value +func (o *Request) GetStatus() (ret RequestGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Request) GetStatusOk() (ret RequestGetStatusRetType, ok bool) { + return getRequestGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Request) SetStatus(v RequestGetStatusRetType) { + setRequestGetStatusAttributeType(&o.Status, v) +} + +func (o Request) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRequestGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getRequestGetRequestActionAttributeTypeOk(o.RequestAction); ok { + toSerialize["RequestAction"] = val + } + if val, ok := getRequestGetRequestIdAttributeTypeOk(o.RequestId); ok { + toSerialize["RequestId"] = val + } + if val, ok := getRequestGetRequestTypeAttributeTypeOk(o.RequestType); ok { + toSerialize["RequestType"] = val + } + if val, ok := getRequestGetResourcesAttributeTypeOk(o.Resources); ok { + toSerialize["Resources"] = val + } + if val, ok := getRequestGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableRequest struct { + value *Request + isSet bool +} + +func (v NullableRequest) Get() *Request { + return v.value +} + +func (v *NullableRequest) Set(val *Request) { + v.value = val + v.isSet = true +} + +func (v NullableRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequest(val *Request) *NullableRequest { + return &NullableRequest{value: val, isSet: true} +} + +func (v NullableRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_request_resource.go b/pkg/iaasbeta/model_request_resource.go new file mode 100644 index 00000000..f1f337d3 --- /dev/null +++ b/pkg/iaasbeta/model_request_resource.go @@ -0,0 +1,217 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the RequestResource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestResource{} + +/* + types and functions for id +*/ + +// isNotNullableString +type RequestResourceGetIdAttributeType = *string + +func getRequestResourceGetIdAttributeTypeOk(arg RequestResourceGetIdAttributeType) (ret RequestResourceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestResourceGetIdAttributeType(arg *RequestResourceGetIdAttributeType, val RequestResourceGetIdRetType) { + *arg = &val +} + +type RequestResourceGetIdArgType = string +type RequestResourceGetIdRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type RequestResourceGetStatusAttributeType = *string + +func getRequestResourceGetStatusAttributeTypeOk(arg RequestResourceGetStatusAttributeType) (ret RequestResourceGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestResourceGetStatusAttributeType(arg *RequestResourceGetStatusAttributeType, val RequestResourceGetStatusRetType) { + *arg = &val +} + +type RequestResourceGetStatusArgType = string +type RequestResourceGetStatusRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type RequestResourceGetTypeAttributeType = *string + +func getRequestResourceGetTypeAttributeTypeOk(arg RequestResourceGetTypeAttributeType) (ret RequestResourceGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestResourceGetTypeAttributeType(arg *RequestResourceGetTypeAttributeType, val RequestResourceGetTypeRetType) { + *arg = &val +} + +type RequestResourceGetTypeArgType = string +type RequestResourceGetTypeRetType = string + +// RequestResource Object that represents a resource as part of a request. +type RequestResource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id RequestResourceGetIdAttributeType `json:"id" required:"true"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + // REQUIRED + Status RequestResourceGetStatusAttributeType `json:"status" required:"true"` + // Object that represents a resource type. Possible values: `BACKUP`, `IMAGE`, `NETWORK`, `NETWORKAREA`, `NIC`, `PROJECT`, `ROUTE`, `SERVER`, `SERVICEACCOUNT`, `SNAPSHOT`, `VIRTUALIP`, `VOLUME`. + // REQUIRED + Type RequestResourceGetTypeAttributeType `json:"type" required:"true"` +} + +type _RequestResource RequestResource + +// NewRequestResource instantiates a new RequestResource 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 NewRequestResource(id RequestResourceGetIdArgType, status RequestResourceGetStatusArgType, types RequestResourceGetTypeArgType) *RequestResource { + this := RequestResource{} + setRequestResourceGetIdAttributeType(&this.Id, id) + setRequestResourceGetStatusAttributeType(&this.Status, status) + setRequestResourceGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewRequestResourceWithDefaults instantiates a new RequestResource 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 NewRequestResourceWithDefaults() *RequestResource { + this := RequestResource{} + return &this +} + +// GetId returns the Id field value +func (o *RequestResource) GetId() (ret RequestResourceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RequestResource) GetIdOk() (ret RequestResourceGetIdRetType, ok bool) { + return getRequestResourceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *RequestResource) SetId(v RequestResourceGetIdRetType) { + setRequestResourceGetIdAttributeType(&o.Id, v) +} + +// GetStatus returns the Status field value +func (o *RequestResource) GetStatus() (ret RequestResourceGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *RequestResource) GetStatusOk() (ret RequestResourceGetStatusRetType, ok bool) { + return getRequestResourceGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *RequestResource) SetStatus(v RequestResourceGetStatusRetType) { + setRequestResourceGetStatusAttributeType(&o.Status, v) +} + +// GetType returns the Type field value +func (o *RequestResource) GetType() (ret RequestResourceGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *RequestResource) GetTypeOk() (ret RequestResourceGetTypeRetType, ok bool) { + return getRequestResourceGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *RequestResource) SetType(v RequestResourceGetTypeRetType) { + setRequestResourceGetTypeAttributeType(&o.Type, v) +} + +func (o RequestResource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRequestResourceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRequestResourceGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getRequestResourceGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableRequestResource struct { + value *RequestResource + isSet bool +} + +func (v NullableRequestResource) Get() *RequestResource { + return v.value +} + +func (v *NullableRequestResource) Set(val *RequestResource) { + v.value = val + v.isSet = true +} + +func (v NullableRequestResource) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestResource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestResource(val *RequestResource) *NullableRequestResource { + return &NullableRequestResource{value: val, isSet: true} +} + +func (v NullableRequestResource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestResource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_request_resource_test.go b/pkg/iaasbeta/model_request_resource_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_request_resource_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_request_test.go b/pkg/iaasbeta/model_request_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_request_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_rescue_server_payload.go b/pkg/iaasbeta/model_rescue_server_payload.go new file mode 100644 index 00000000..01ef55a4 --- /dev/null +++ b/pkg/iaasbeta/model_rescue_server_payload.go @@ -0,0 +1,127 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the RescueServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RescueServerPayload{} + +/* + types and functions for image +*/ + +// isNotNullableString +type RescueServerPayloadGetImageAttributeType = *string + +func getRescueServerPayloadGetImageAttributeTypeOk(arg RescueServerPayloadGetImageAttributeType) (ret RescueServerPayloadGetImageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRescueServerPayloadGetImageAttributeType(arg *RescueServerPayloadGetImageAttributeType, val RescueServerPayloadGetImageRetType) { + *arg = &val +} + +type RescueServerPayloadGetImageArgType = string +type RescueServerPayloadGetImageRetType = string + +// RescueServerPayload struct for RescueServerPayload +type RescueServerPayload struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Image RescueServerPayloadGetImageAttributeType `json:"image" required:"true"` +} + +type _RescueServerPayload RescueServerPayload + +// NewRescueServerPayload instantiates a new RescueServerPayload 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 NewRescueServerPayload(image RescueServerPayloadGetImageArgType) *RescueServerPayload { + this := RescueServerPayload{} + setRescueServerPayloadGetImageAttributeType(&this.Image, image) + return &this +} + +// NewRescueServerPayloadWithDefaults instantiates a new RescueServerPayload 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 NewRescueServerPayloadWithDefaults() *RescueServerPayload { + this := RescueServerPayload{} + return &this +} + +// GetImage returns the Image field value +func (o *RescueServerPayload) GetImage() (ret RescueServerPayloadGetImageRetType) { + ret, _ = o.GetImageOk() + return ret +} + +// GetImageOk returns a tuple with the Image field value +// and a boolean to check if the value has been set. +func (o *RescueServerPayload) GetImageOk() (ret RescueServerPayloadGetImageRetType, ok bool) { + return getRescueServerPayloadGetImageAttributeTypeOk(o.Image) +} + +// SetImage sets field value +func (o *RescueServerPayload) SetImage(v RescueServerPayloadGetImageRetType) { + setRescueServerPayloadGetImageAttributeType(&o.Image, v) +} + +func (o RescueServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRescueServerPayloadGetImageAttributeTypeOk(o.Image); ok { + toSerialize["Image"] = val + } + return toSerialize, nil +} + +type NullableRescueServerPayload struct { + value *RescueServerPayload + isSet bool +} + +func (v NullableRescueServerPayload) Get() *RescueServerPayload { + return v.value +} + +func (v *NullableRescueServerPayload) Set(val *RescueServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableRescueServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableRescueServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRescueServerPayload(val *RescueServerPayload) *NullableRescueServerPayload { + return &NullableRescueServerPayload{value: val, isSet: true} +} + +func (v NullableRescueServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRescueServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_rescue_server_payload_test.go b/pkg/iaasbeta/model_rescue_server_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_rescue_server_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_resize_server_payload.go b/pkg/iaasbeta/model_resize_server_payload.go new file mode 100644 index 00000000..e4451bf5 --- /dev/null +++ b/pkg/iaasbeta/model_resize_server_payload.go @@ -0,0 +1,127 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ResizeServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResizeServerPayload{} + +/* + types and functions for machineType +*/ + +// isNotNullableString +type ResizeServerPayloadGetMachineTypeAttributeType = *string + +func getResizeServerPayloadGetMachineTypeAttributeTypeOk(arg ResizeServerPayloadGetMachineTypeAttributeType) (ret ResizeServerPayloadGetMachineTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResizeServerPayloadGetMachineTypeAttributeType(arg *ResizeServerPayloadGetMachineTypeAttributeType, val ResizeServerPayloadGetMachineTypeRetType) { + *arg = &val +} + +type ResizeServerPayloadGetMachineTypeArgType = string +type ResizeServerPayloadGetMachineTypeRetType = string + +// ResizeServerPayload struct for ResizeServerPayload +type ResizeServerPayload struct { + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + MachineType ResizeServerPayloadGetMachineTypeAttributeType `json:"machineType" required:"true"` +} + +type _ResizeServerPayload ResizeServerPayload + +// NewResizeServerPayload instantiates a new ResizeServerPayload 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 NewResizeServerPayload(machineType ResizeServerPayloadGetMachineTypeArgType) *ResizeServerPayload { + this := ResizeServerPayload{} + setResizeServerPayloadGetMachineTypeAttributeType(&this.MachineType, machineType) + return &this +} + +// NewResizeServerPayloadWithDefaults instantiates a new ResizeServerPayload 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 NewResizeServerPayloadWithDefaults() *ResizeServerPayload { + this := ResizeServerPayload{} + return &this +} + +// GetMachineType returns the MachineType field value +func (o *ResizeServerPayload) GetMachineType() (ret ResizeServerPayloadGetMachineTypeRetType) { + ret, _ = o.GetMachineTypeOk() + return ret +} + +// GetMachineTypeOk returns a tuple with the MachineType field value +// and a boolean to check if the value has been set. +func (o *ResizeServerPayload) GetMachineTypeOk() (ret ResizeServerPayloadGetMachineTypeRetType, ok bool) { + return getResizeServerPayloadGetMachineTypeAttributeTypeOk(o.MachineType) +} + +// SetMachineType sets field value +func (o *ResizeServerPayload) SetMachineType(v ResizeServerPayloadGetMachineTypeRetType) { + setResizeServerPayloadGetMachineTypeAttributeType(&o.MachineType, v) +} + +func (o ResizeServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getResizeServerPayloadGetMachineTypeAttributeTypeOk(o.MachineType); ok { + toSerialize["MachineType"] = val + } + return toSerialize, nil +} + +type NullableResizeServerPayload struct { + value *ResizeServerPayload + isSet bool +} + +func (v NullableResizeServerPayload) Get() *ResizeServerPayload { + return v.value +} + +func (v *NullableResizeServerPayload) Set(val *ResizeServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableResizeServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableResizeServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResizeServerPayload(val *ResizeServerPayload) *NullableResizeServerPayload { + return &NullableResizeServerPayload{value: val, isSet: true} +} + +func (v NullableResizeServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResizeServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_resize_server_payload_test.go b/pkg/iaasbeta/model_resize_server_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_resize_server_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_resize_volume_payload.go b/pkg/iaasbeta/model_resize_volume_payload.go new file mode 100644 index 00000000..8a277c06 --- /dev/null +++ b/pkg/iaasbeta/model_resize_volume_payload.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ResizeVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResizeVolumePayload{} + +/* + types and functions for size +*/ + +// isLong +type ResizeVolumePayloadGetSizeAttributeType = *int64 +type ResizeVolumePayloadGetSizeArgType = int64 +type ResizeVolumePayloadGetSizeRetType = int64 + +func getResizeVolumePayloadGetSizeAttributeTypeOk(arg ResizeVolumePayloadGetSizeAttributeType) (ret ResizeVolumePayloadGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResizeVolumePayloadGetSizeAttributeType(arg *ResizeVolumePayloadGetSizeAttributeType, val ResizeVolumePayloadGetSizeRetType) { + *arg = &val +} + +// ResizeVolumePayload struct for ResizeVolumePayload +type ResizeVolumePayload struct { + // Size in Gigabyte. + // REQUIRED + Size ResizeVolumePayloadGetSizeAttributeType `json:"size" required:"true"` +} + +type _ResizeVolumePayload ResizeVolumePayload + +// NewResizeVolumePayload instantiates a new ResizeVolumePayload 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 NewResizeVolumePayload(size ResizeVolumePayloadGetSizeArgType) *ResizeVolumePayload { + this := ResizeVolumePayload{} + setResizeVolumePayloadGetSizeAttributeType(&this.Size, size) + return &this +} + +// NewResizeVolumePayloadWithDefaults instantiates a new ResizeVolumePayload 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 NewResizeVolumePayloadWithDefaults() *ResizeVolumePayload { + this := ResizeVolumePayload{} + return &this +} + +// GetSize returns the Size field value +func (o *ResizeVolumePayload) GetSize() (ret ResizeVolumePayloadGetSizeRetType) { + ret, _ = o.GetSizeOk() + return ret +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *ResizeVolumePayload) GetSizeOk() (ret ResizeVolumePayloadGetSizeRetType, ok bool) { + return getResizeVolumePayloadGetSizeAttributeTypeOk(o.Size) +} + +// SetSize sets field value +func (o *ResizeVolumePayload) SetSize(v ResizeVolumePayloadGetSizeRetType) { + setResizeVolumePayloadGetSizeAttributeType(&o.Size, v) +} + +func (o ResizeVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getResizeVolumePayloadGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + return toSerialize, nil +} + +type NullableResizeVolumePayload struct { + value *ResizeVolumePayload + isSet bool +} + +func (v NullableResizeVolumePayload) Get() *ResizeVolumePayload { + return v.value +} + +func (v *NullableResizeVolumePayload) Set(val *ResizeVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableResizeVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableResizeVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResizeVolumePayload(val *ResizeVolumePayload) *NullableResizeVolumePayload { + return &NullableResizeVolumePayload{value: val, isSet: true} +} + +func (v NullableResizeVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResizeVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_resize_volume_payload_test.go b/pkg/iaasbeta/model_resize_volume_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_resize_volume_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_route.go b/pkg/iaasbeta/model_route.go new file mode 100644 index 00000000..d8b919a0 --- /dev/null +++ b/pkg/iaasbeta/model_route.go @@ -0,0 +1,362 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Route type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Route{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type RouteGetCreatedAtAttributeType = *time.Time +type RouteGetCreatedAtArgType = time.Time +type RouteGetCreatedAtRetType = time.Time + +func getRouteGetCreatedAtAttributeTypeOk(arg RouteGetCreatedAtAttributeType) (ret RouteGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetCreatedAtAttributeType(arg *RouteGetCreatedAtAttributeType, val RouteGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for destination +*/ + +// isModel +type RouteGetDestinationAttributeType = *RouteDestination +type RouteGetDestinationArgType = RouteDestination +type RouteGetDestinationRetType = RouteDestination + +func getRouteGetDestinationAttributeTypeOk(arg RouteGetDestinationAttributeType) (ret RouteGetDestinationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetDestinationAttributeType(arg *RouteGetDestinationAttributeType, val RouteGetDestinationRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type RouteGetIdAttributeType = *string + +func getRouteGetIdAttributeTypeOk(arg RouteGetIdAttributeType) (ret RouteGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetIdAttributeType(arg *RouteGetIdAttributeType, val RouteGetIdRetType) { + *arg = &val +} + +type RouteGetIdArgType = string +type RouteGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type RouteGetLabelsAttributeType = *map[string]interface{} +type RouteGetLabelsArgType = map[string]interface{} +type RouteGetLabelsRetType = map[string]interface{} + +func getRouteGetLabelsAttributeTypeOk(arg RouteGetLabelsAttributeType) (ret RouteGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetLabelsAttributeType(arg *RouteGetLabelsAttributeType, val RouteGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for nexthop +*/ + +// isModel +type RouteGetNexthopAttributeType = *RouteNexthop +type RouteGetNexthopArgType = RouteNexthop +type RouteGetNexthopRetType = RouteNexthop + +func getRouteGetNexthopAttributeTypeOk(arg RouteGetNexthopAttributeType) (ret RouteGetNexthopRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetNexthopAttributeType(arg *RouteGetNexthopAttributeType, val RouteGetNexthopRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type RouteGetUpdatedAtAttributeType = *time.Time +type RouteGetUpdatedAtArgType = time.Time +type RouteGetUpdatedAtRetType = time.Time + +func getRouteGetUpdatedAtAttributeTypeOk(arg RouteGetUpdatedAtAttributeType) (ret RouteGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetUpdatedAtAttributeType(arg *RouteGetUpdatedAtAttributeType, val RouteGetUpdatedAtRetType) { + *arg = &val +} + +// Route Object represents a network route. +type Route struct { + // Date-time when resource was created. + CreatedAt RouteGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // REQUIRED + Destination RouteGetDestinationAttributeType `json:"destination" required:"true"` + // Universally Unique Identifier (UUID). + Id RouteGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels RouteGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Nexthop RouteGetNexthopAttributeType `json:"nexthop" required:"true"` + // Date-time when resource was last updated. + UpdatedAt RouteGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Route Route + +// NewRoute instantiates a new Route 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 NewRoute(destination RouteGetDestinationArgType, nexthop RouteGetNexthopArgType) *Route { + this := Route{} + setRouteGetDestinationAttributeType(&this.Destination, destination) + setRouteGetNexthopAttributeType(&this.Nexthop, nexthop) + return &this +} + +// NewRouteWithDefaults instantiates a new Route 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 NewRouteWithDefaults() *Route { + this := Route{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Route) GetCreatedAt() (res RouteGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetCreatedAtOk() (ret RouteGetCreatedAtRetType, ok bool) { + return getRouteGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Route) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Route) SetCreatedAt(v RouteGetCreatedAtRetType) { + setRouteGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDestination returns the Destination field value +func (o *Route) GetDestination() (ret RouteGetDestinationRetType) { + ret, _ = o.GetDestinationOk() + return ret +} + +// GetDestinationOk returns a tuple with the Destination field value +// and a boolean to check if the value has been set. +func (o *Route) GetDestinationOk() (ret RouteGetDestinationRetType, ok bool) { + return getRouteGetDestinationAttributeTypeOk(o.Destination) +} + +// SetDestination sets field value +func (o *Route) SetDestination(v RouteGetDestinationRetType) { + setRouteGetDestinationAttributeType(&o.Destination, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Route) GetId() (res RouteGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetIdOk() (ret RouteGetIdRetType, ok bool) { + return getRouteGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Route) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Route) SetId(v RouteGetIdRetType) { + setRouteGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Route) GetLabels() (res RouteGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetLabelsOk() (ret RouteGetLabelsRetType, ok bool) { + return getRouteGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Route) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Route) SetLabels(v RouteGetLabelsRetType) { + setRouteGetLabelsAttributeType(&o.Labels, v) +} + +// GetNexthop returns the Nexthop field value +func (o *Route) GetNexthop() (ret RouteGetNexthopRetType) { + ret, _ = o.GetNexthopOk() + return ret +} + +// GetNexthopOk returns a tuple with the Nexthop field value +// and a boolean to check if the value has been set. +func (o *Route) GetNexthopOk() (ret RouteGetNexthopRetType, ok bool) { + return getRouteGetNexthopAttributeTypeOk(o.Nexthop) +} + +// SetNexthop sets field value +func (o *Route) SetNexthop(v RouteGetNexthopRetType) { + setRouteGetNexthopAttributeType(&o.Nexthop, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Route) GetUpdatedAt() (res RouteGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetUpdatedAtOk() (ret RouteGetUpdatedAtRetType, ok bool) { + return getRouteGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Route) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Route) SetUpdatedAt(v RouteGetUpdatedAtRetType) { + setRouteGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Route) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRouteGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getRouteGetDestinationAttributeTypeOk(o.Destination); ok { + toSerialize["Destination"] = val + } + if val, ok := getRouteGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRouteGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getRouteGetNexthopAttributeTypeOk(o.Nexthop); ok { + toSerialize["Nexthop"] = val + } + if val, ok := getRouteGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableRoute struct { + value *Route + isSet bool +} + +func (v NullableRoute) Get() *Route { + return v.value +} + +func (v *NullableRoute) Set(val *Route) { + v.value = val + v.isSet = true +} + +func (v NullableRoute) IsSet() bool { + return v.isSet +} + +func (v *NullableRoute) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoute(val *Route) *NullableRoute { + return &NullableRoute{value: val, isSet: true} +} + +func (v NullableRoute) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoute) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_route_destination.go b/pkg/iaasbeta/model_route_destination.go new file mode 100644 index 00000000..8f5a5f6b --- /dev/null +++ b/pkg/iaasbeta/model_route_destination.go @@ -0,0 +1,163 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "fmt" +) + +// RouteDestination - struct for RouteDestination +type RouteDestination struct { + DestinationCIDRv4 *DestinationCIDRv4 + DestinationCIDRv6 *DestinationCIDRv6 +} + +// DestinationCIDRv4AsRouteDestination is a convenience function that returns DestinationCIDRv4 wrapped in RouteDestination +func DestinationCIDRv4AsRouteDestination(v *DestinationCIDRv4) RouteDestination { + return RouteDestination{ + DestinationCIDRv4: v, + } +} + +// DestinationCIDRv6AsRouteDestination is a convenience function that returns DestinationCIDRv6 wrapped in RouteDestination +func DestinationCIDRv6AsRouteDestination(v *DestinationCIDRv6) RouteDestination { + return RouteDestination{ + DestinationCIDRv6: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *RouteDestination) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'DestinationCIDRv4' + if jsonDict["type"] == "DestinationCIDRv4" { + // try to unmarshal JSON data into DestinationCIDRv4 + err = json.Unmarshal(data, &dst.DestinationCIDRv4) + if err == nil { + return nil // data stored in dst.DestinationCIDRv4, return on the first match + } else { + dst.DestinationCIDRv4 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'DestinationCIDRv6' + if jsonDict["type"] == "DestinationCIDRv6" { + // try to unmarshal JSON data into DestinationCIDRv6 + err = json.Unmarshal(data, &dst.DestinationCIDRv6) + if err == nil { + return nil // data stored in dst.DestinationCIDRv6, return on the first match + } else { + dst.DestinationCIDRv6 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv6: %s", err.Error()) + } + } + + // check if the discriminator value is 'cidrv4' + if jsonDict["type"] == "cidrv4" { + // try to unmarshal JSON data into DestinationCIDRv4 + err = json.Unmarshal(data, &dst.DestinationCIDRv4) + if err == nil { + return nil // data stored in dst.DestinationCIDRv4, return on the first match + } else { + dst.DestinationCIDRv4 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'cidrv6' + if jsonDict["type"] == "cidrv6" { + // try to unmarshal JSON data into DestinationCIDRv6 + err = json.Unmarshal(data, &dst.DestinationCIDRv6) + if err == nil { + return nil // data stored in dst.DestinationCIDRv6, return on the first match + } else { + dst.DestinationCIDRv6 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv6: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src RouteDestination) MarshalJSON() ([]byte, error) { + if src.DestinationCIDRv4 != nil { + return json.Marshal(&src.DestinationCIDRv4) + } + + if src.DestinationCIDRv6 != nil { + return json.Marshal(&src.DestinationCIDRv6) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *RouteDestination) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.DestinationCIDRv4 != nil { + return obj.DestinationCIDRv4 + } + + if obj.DestinationCIDRv6 != nil { + return obj.DestinationCIDRv6 + } + + // all schemas are nil + return nil +} + +type NullableRouteDestination struct { + value *RouteDestination + isSet bool +} + +func (v NullableRouteDestination) Get() *RouteDestination { + return v.value +} + +func (v *NullableRouteDestination) Set(val *RouteDestination) { + v.value = val + v.isSet = true +} + +func (v NullableRouteDestination) IsSet() bool { + return v.isSet +} + +func (v *NullableRouteDestination) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRouteDestination(val *RouteDestination) *NullableRouteDestination { + return &NullableRouteDestination{value: val, isSet: true} +} + +func (v NullableRouteDestination) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRouteDestination) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_route_destination_test.go b/pkg/iaasbeta/model_route_destination_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_route_destination_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_route_list_response.go b/pkg/iaasbeta/model_route_list_response.go new file mode 100644 index 00000000..219a60af --- /dev/null +++ b/pkg/iaasbeta/model_route_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the RouteListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RouteListResponse{} + +/* + types and functions for items +*/ + +// isArray +type RouteListResponseGetItemsAttributeType = *[]Route +type RouteListResponseGetItemsArgType = []Route +type RouteListResponseGetItemsRetType = []Route + +func getRouteListResponseGetItemsAttributeTypeOk(arg RouteListResponseGetItemsAttributeType) (ret RouteListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteListResponseGetItemsAttributeType(arg *RouteListResponseGetItemsAttributeType, val RouteListResponseGetItemsRetType) { + *arg = &val +} + +// RouteListResponse Route list response. +type RouteListResponse struct { + // A list of routes. + // REQUIRED + Items RouteListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _RouteListResponse RouteListResponse + +// NewRouteListResponse instantiates a new RouteListResponse 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 NewRouteListResponse(items RouteListResponseGetItemsArgType) *RouteListResponse { + this := RouteListResponse{} + setRouteListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewRouteListResponseWithDefaults instantiates a new RouteListResponse 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 NewRouteListResponseWithDefaults() *RouteListResponse { + this := RouteListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *RouteListResponse) GetItems() (ret RouteListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *RouteListResponse) GetItemsOk() (ret RouteListResponseGetItemsRetType, ok bool) { + return getRouteListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *RouteListResponse) SetItems(v RouteListResponseGetItemsRetType) { + setRouteListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o RouteListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRouteListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableRouteListResponse struct { + value *RouteListResponse + isSet bool +} + +func (v NullableRouteListResponse) Get() *RouteListResponse { + return v.value +} + +func (v *NullableRouteListResponse) Set(val *RouteListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRouteListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRouteListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRouteListResponse(val *RouteListResponse) *NullableRouteListResponse { + return &NullableRouteListResponse{value: val, isSet: true} +} + +func (v NullableRouteListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRouteListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_route_list_response_test.go b/pkg/iaasbeta/model_route_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_route_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_route_nexthop.go b/pkg/iaasbeta/model_route_nexthop.go new file mode 100644 index 00000000..6edfdbd2 --- /dev/null +++ b/pkg/iaasbeta/model_route_nexthop.go @@ -0,0 +1,243 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "fmt" +) + +// RouteNexthop - struct for RouteNexthop +type RouteNexthop struct { + NexthopBlackhole *NexthopBlackhole + NexthopIPv4 *NexthopIPv4 + NexthopIPv6 *NexthopIPv6 + NexthopInternet *NexthopInternet +} + +// NexthopBlackholeAsRouteNexthop is a convenience function that returns NexthopBlackhole wrapped in RouteNexthop +func NexthopBlackholeAsRouteNexthop(v *NexthopBlackhole) RouteNexthop { + return RouteNexthop{ + NexthopBlackhole: v, + } +} + +// NexthopIPv4AsRouteNexthop is a convenience function that returns NexthopIPv4 wrapped in RouteNexthop +func NexthopIPv4AsRouteNexthop(v *NexthopIPv4) RouteNexthop { + return RouteNexthop{ + NexthopIPv4: v, + } +} + +// NexthopIPv6AsRouteNexthop is a convenience function that returns NexthopIPv6 wrapped in RouteNexthop +func NexthopIPv6AsRouteNexthop(v *NexthopIPv6) RouteNexthop { + return RouteNexthop{ + NexthopIPv6: v, + } +} + +// NexthopInternetAsRouteNexthop is a convenience function that returns NexthopInternet wrapped in RouteNexthop +func NexthopInternetAsRouteNexthop(v *NexthopInternet) RouteNexthop { + return RouteNexthop{ + NexthopInternet: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *RouteNexthop) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'NexthopBlackhole' + if jsonDict["type"] == "NexthopBlackhole" { + // try to unmarshal JSON data into NexthopBlackhole + err = json.Unmarshal(data, &dst.NexthopBlackhole) + if err == nil { + return nil // data stored in dst.NexthopBlackhole, return on the first match + } else { + dst.NexthopBlackhole = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopBlackhole: %s", err.Error()) + } + } + + // check if the discriminator value is 'NexthopIPv4' + if jsonDict["type"] == "NexthopIPv4" { + // try to unmarshal JSON data into NexthopIPv4 + err = json.Unmarshal(data, &dst.NexthopIPv4) + if err == nil { + return nil // data stored in dst.NexthopIPv4, return on the first match + } else { + dst.NexthopIPv4 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'NexthopIPv6' + if jsonDict["type"] == "NexthopIPv6" { + // try to unmarshal JSON data into NexthopIPv6 + err = json.Unmarshal(data, &dst.NexthopIPv6) + if err == nil { + return nil // data stored in dst.NexthopIPv6, return on the first match + } else { + dst.NexthopIPv6 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv6: %s", err.Error()) + } + } + + // check if the discriminator value is 'NexthopInternet' + if jsonDict["type"] == "NexthopInternet" { + // try to unmarshal JSON data into NexthopInternet + err = json.Unmarshal(data, &dst.NexthopInternet) + if err == nil { + return nil // data stored in dst.NexthopInternet, return on the first match + } else { + dst.NexthopInternet = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopInternet: %s", err.Error()) + } + } + + // check if the discriminator value is 'blackhole' + if jsonDict["type"] == "blackhole" { + // try to unmarshal JSON data into NexthopBlackhole + err = json.Unmarshal(data, &dst.NexthopBlackhole) + if err == nil { + return nil // data stored in dst.NexthopBlackhole, return on the first match + } else { + dst.NexthopBlackhole = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopBlackhole: %s", err.Error()) + } + } + + // check if the discriminator value is 'internet' + if jsonDict["type"] == "internet" { + // try to unmarshal JSON data into NexthopInternet + err = json.Unmarshal(data, &dst.NexthopInternet) + if err == nil { + return nil // data stored in dst.NexthopInternet, return on the first match + } else { + dst.NexthopInternet = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopInternet: %s", err.Error()) + } + } + + // check if the discriminator value is 'ipv4' + if jsonDict["type"] == "ipv4" { + // try to unmarshal JSON data into NexthopIPv4 + err = json.Unmarshal(data, &dst.NexthopIPv4) + if err == nil { + return nil // data stored in dst.NexthopIPv4, return on the first match + } else { + dst.NexthopIPv4 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'ipv6' + if jsonDict["type"] == "ipv6" { + // try to unmarshal JSON data into NexthopIPv6 + err = json.Unmarshal(data, &dst.NexthopIPv6) + if err == nil { + return nil // data stored in dst.NexthopIPv6, return on the first match + } else { + dst.NexthopIPv6 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv6: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src RouteNexthop) MarshalJSON() ([]byte, error) { + if src.NexthopBlackhole != nil { + return json.Marshal(&src.NexthopBlackhole) + } + + if src.NexthopIPv4 != nil { + return json.Marshal(&src.NexthopIPv4) + } + + if src.NexthopIPv6 != nil { + return json.Marshal(&src.NexthopIPv6) + } + + if src.NexthopInternet != nil { + return json.Marshal(&src.NexthopInternet) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *RouteNexthop) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.NexthopBlackhole != nil { + return obj.NexthopBlackhole + } + + if obj.NexthopIPv4 != nil { + return obj.NexthopIPv4 + } + + if obj.NexthopIPv6 != nil { + return obj.NexthopIPv6 + } + + if obj.NexthopInternet != nil { + return obj.NexthopInternet + } + + // all schemas are nil + return nil +} + +type NullableRouteNexthop struct { + value *RouteNexthop + isSet bool +} + +func (v NullableRouteNexthop) Get() *RouteNexthop { + return v.value +} + +func (v *NullableRouteNexthop) Set(val *RouteNexthop) { + v.value = val + v.isSet = true +} + +func (v NullableRouteNexthop) IsSet() bool { + return v.isSet +} + +func (v *NullableRouteNexthop) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRouteNexthop(val *RouteNexthop) *NullableRouteNexthop { + return &NullableRouteNexthop{value: val, isSet: true} +} + +func (v NullableRouteNexthop) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRouteNexthop) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_route_nexthop_test.go b/pkg/iaasbeta/model_route_nexthop_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_route_nexthop_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_route_test.go b/pkg/iaasbeta/model_route_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_route_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_routing_table.go b/pkg/iaasbeta/model_routing_table.go new file mode 100644 index 00000000..b975b818 --- /dev/null +++ b/pkg/iaasbeta/model_routing_table.go @@ -0,0 +1,518 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the RoutingTable type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RoutingTable{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type RoutingTableGetCreatedAtAttributeType = *time.Time +type RoutingTableGetCreatedAtArgType = time.Time +type RoutingTableGetCreatedAtRetType = time.Time + +func getRoutingTableGetCreatedAtAttributeTypeOk(arg RoutingTableGetCreatedAtAttributeType) (ret RoutingTableGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetCreatedAtAttributeType(arg *RoutingTableGetCreatedAtAttributeType, val RoutingTableGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for default +*/ + +// isBoolean +type RoutingTablegetDefaultAttributeType = *bool +type RoutingTablegetDefaultArgType = bool +type RoutingTablegetDefaultRetType = bool + +func getRoutingTablegetDefaultAttributeTypeOk(arg RoutingTablegetDefaultAttributeType) (ret RoutingTablegetDefaultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTablegetDefaultAttributeType(arg *RoutingTablegetDefaultAttributeType, val RoutingTablegetDefaultRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type RoutingTableGetDescriptionAttributeType = *string + +func getRoutingTableGetDescriptionAttributeTypeOk(arg RoutingTableGetDescriptionAttributeType) (ret RoutingTableGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetDescriptionAttributeType(arg *RoutingTableGetDescriptionAttributeType, val RoutingTableGetDescriptionRetType) { + *arg = &val +} + +type RoutingTableGetDescriptionArgType = string +type RoutingTableGetDescriptionRetType = string + +/* + types and functions for dynamicRoutes +*/ + +// isBoolean +type RoutingTablegetDynamicRoutesAttributeType = *bool +type RoutingTablegetDynamicRoutesArgType = bool +type RoutingTablegetDynamicRoutesRetType = bool + +func getRoutingTablegetDynamicRoutesAttributeTypeOk(arg RoutingTablegetDynamicRoutesAttributeType) (ret RoutingTablegetDynamicRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTablegetDynamicRoutesAttributeType(arg *RoutingTablegetDynamicRoutesAttributeType, val RoutingTablegetDynamicRoutesRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type RoutingTableGetIdAttributeType = *string + +func getRoutingTableGetIdAttributeTypeOk(arg RoutingTableGetIdAttributeType) (ret RoutingTableGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetIdAttributeType(arg *RoutingTableGetIdAttributeType, val RoutingTableGetIdRetType) { + *arg = &val +} + +type RoutingTableGetIdArgType = string +type RoutingTableGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type RoutingTableGetLabelsAttributeType = *map[string]interface{} +type RoutingTableGetLabelsArgType = map[string]interface{} +type RoutingTableGetLabelsRetType = map[string]interface{} + +func getRoutingTableGetLabelsAttributeTypeOk(arg RoutingTableGetLabelsAttributeType) (ret RoutingTableGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetLabelsAttributeType(arg *RoutingTableGetLabelsAttributeType, val RoutingTableGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type RoutingTableGetNameAttributeType = *string + +func getRoutingTableGetNameAttributeTypeOk(arg RoutingTableGetNameAttributeType) (ret RoutingTableGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetNameAttributeType(arg *RoutingTableGetNameAttributeType, val RoutingTableGetNameRetType) { + *arg = &val +} + +type RoutingTableGetNameArgType = string +type RoutingTableGetNameRetType = string + +/* + types and functions for systemRoutes +*/ + +// isBoolean +type RoutingTablegetSystemRoutesAttributeType = *bool +type RoutingTablegetSystemRoutesArgType = bool +type RoutingTablegetSystemRoutesRetType = bool + +func getRoutingTablegetSystemRoutesAttributeTypeOk(arg RoutingTablegetSystemRoutesAttributeType) (ret RoutingTablegetSystemRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTablegetSystemRoutesAttributeType(arg *RoutingTablegetSystemRoutesAttributeType, val RoutingTablegetSystemRoutesRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type RoutingTableGetUpdatedAtAttributeType = *time.Time +type RoutingTableGetUpdatedAtArgType = time.Time +type RoutingTableGetUpdatedAtRetType = time.Time + +func getRoutingTableGetUpdatedAtAttributeTypeOk(arg RoutingTableGetUpdatedAtAttributeType) (ret RoutingTableGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetUpdatedAtAttributeType(arg *RoutingTableGetUpdatedAtAttributeType, val RoutingTableGetUpdatedAtRetType) { + *arg = &val +} + +// RoutingTable An object representing a routing table. +type RoutingTable struct { + // Date-time when resource was created. + CreatedAt RoutingTableGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // This is the default routing table. It can't be deleted and is used if the user does not specify it otherwise. + Default RoutingTablegetDefaultAttributeType `json:"default,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description RoutingTableGetDescriptionAttributeType `json:"description,omitempty"` + // A config setting for a routing table which allows propagation of dynamic routes to this routing table. + DynamicRoutes RoutingTablegetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"` + // Universally Unique Identifier (UUID). + Id RoutingTableGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels RoutingTableGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name RoutingTableGetNameAttributeType `json:"name" required:"true"` + // A config setting for a routing table which allows installation of automatic system routes for connectivity between projects in the same SNA. + SystemRoutes RoutingTablegetSystemRoutesAttributeType `json:"systemRoutes,omitempty"` + // Date-time when resource was last updated. + UpdatedAt RoutingTableGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _RoutingTable RoutingTable + +// NewRoutingTable instantiates a new RoutingTable 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 NewRoutingTable(name RoutingTableGetNameArgType) *RoutingTable { + this := RoutingTable{} + setRoutingTableGetNameAttributeType(&this.Name, name) + return &this +} + +// NewRoutingTableWithDefaults instantiates a new RoutingTable 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 NewRoutingTableWithDefaults() *RoutingTable { + this := RoutingTable{} + var dynamicRoutes bool = true + this.DynamicRoutes = &dynamicRoutes + var systemRoutes bool = true + this.SystemRoutes = &systemRoutes + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *RoutingTable) GetCreatedAt() (res RoutingTableGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetCreatedAtOk() (ret RoutingTableGetCreatedAtRetType, ok bool) { + return getRoutingTableGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *RoutingTable) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *RoutingTable) SetCreatedAt(v RoutingTableGetCreatedAtRetType) { + setRoutingTableGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *RoutingTable) GetDefault() (res RoutingTablegetDefaultRetType) { + res, _ = o.GetDefaultOk() + return +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetDefaultOk() (ret RoutingTablegetDefaultRetType, ok bool) { + return getRoutingTablegetDefaultAttributeTypeOk(o.Default) +} + +// HasDefault returns a boolean if a field has been set. +func (o *RoutingTable) HasDefault() bool { + _, ok := o.GetDefaultOk() + return ok +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *RoutingTable) SetDefault(v RoutingTablegetDefaultRetType) { + setRoutingTablegetDefaultAttributeType(&o.Default, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *RoutingTable) GetDescription() (res RoutingTableGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetDescriptionOk() (ret RoutingTableGetDescriptionRetType, ok bool) { + return getRoutingTableGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *RoutingTable) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *RoutingTable) SetDescription(v RoutingTableGetDescriptionRetType) { + setRoutingTableGetDescriptionAttributeType(&o.Description, v) +} + +// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise. +func (o *RoutingTable) GetDynamicRoutes() (res RoutingTablegetDynamicRoutesRetType) { + res, _ = o.GetDynamicRoutesOk() + return +} + +// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetDynamicRoutesOk() (ret RoutingTablegetDynamicRoutesRetType, ok bool) { + return getRoutingTablegetDynamicRoutesAttributeTypeOk(o.DynamicRoutes) +} + +// HasDynamicRoutes returns a boolean if a field has been set. +func (o *RoutingTable) HasDynamicRoutes() bool { + _, ok := o.GetDynamicRoutesOk() + return ok +} + +// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field. +func (o *RoutingTable) SetDynamicRoutes(v RoutingTablegetDynamicRoutesRetType) { + setRoutingTablegetDynamicRoutesAttributeType(&o.DynamicRoutes, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RoutingTable) GetId() (res RoutingTableGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetIdOk() (ret RoutingTableGetIdRetType, ok bool) { + return getRoutingTableGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *RoutingTable) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RoutingTable) SetId(v RoutingTableGetIdRetType) { + setRoutingTableGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *RoutingTable) GetLabels() (res RoutingTableGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetLabelsOk() (ret RoutingTableGetLabelsRetType, ok bool) { + return getRoutingTableGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *RoutingTable) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *RoutingTable) SetLabels(v RoutingTableGetLabelsRetType) { + setRoutingTableGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *RoutingTable) GetName() (ret RoutingTableGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetNameOk() (ret RoutingTableGetNameRetType, ok bool) { + return getRoutingTableGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *RoutingTable) SetName(v RoutingTableGetNameRetType) { + setRoutingTableGetNameAttributeType(&o.Name, v) +} + +// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise. +func (o *RoutingTable) GetSystemRoutes() (res RoutingTablegetSystemRoutesRetType) { + res, _ = o.GetSystemRoutesOk() + return +} + +// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetSystemRoutesOk() (ret RoutingTablegetSystemRoutesRetType, ok bool) { + return getRoutingTablegetSystemRoutesAttributeTypeOk(o.SystemRoutes) +} + +// HasSystemRoutes returns a boolean if a field has been set. +func (o *RoutingTable) HasSystemRoutes() bool { + _, ok := o.GetSystemRoutesOk() + return ok +} + +// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field. +func (o *RoutingTable) SetSystemRoutes(v RoutingTablegetSystemRoutesRetType) { + setRoutingTablegetSystemRoutesAttributeType(&o.SystemRoutes, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *RoutingTable) GetUpdatedAt() (res RoutingTableGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetUpdatedAtOk() (ret RoutingTableGetUpdatedAtRetType, ok bool) { + return getRoutingTableGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *RoutingTable) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *RoutingTable) SetUpdatedAt(v RoutingTableGetUpdatedAtRetType) { + setRoutingTableGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o RoutingTable) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRoutingTableGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getRoutingTablegetDefaultAttributeTypeOk(o.Default); ok { + toSerialize["Default"] = val + } + if val, ok := getRoutingTableGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getRoutingTablegetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok { + toSerialize["DynamicRoutes"] = val + } + if val, ok := getRoutingTableGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRoutingTableGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getRoutingTableGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getRoutingTablegetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok { + toSerialize["SystemRoutes"] = val + } + if val, ok := getRoutingTableGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableRoutingTable struct { + value *RoutingTable + isSet bool +} + +func (v NullableRoutingTable) Get() *RoutingTable { + return v.value +} + +func (v *NullableRoutingTable) Set(val *RoutingTable) { + v.value = val + v.isSet = true +} + +func (v NullableRoutingTable) IsSet() bool { + return v.isSet +} + +func (v *NullableRoutingTable) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoutingTable(val *RoutingTable) *NullableRoutingTable { + return &NullableRoutingTable{value: val, isSet: true} +} + +func (v NullableRoutingTable) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoutingTable) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_routing_table_list_response.go b/pkg/iaasbeta/model_routing_table_list_response.go new file mode 100644 index 00000000..707a19c1 --- /dev/null +++ b/pkg/iaasbeta/model_routing_table_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the RoutingTableListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RoutingTableListResponse{} + +/* + types and functions for items +*/ + +// isArray +type RoutingTableListResponseGetItemsAttributeType = *[]RoutingTable +type RoutingTableListResponseGetItemsArgType = []RoutingTable +type RoutingTableListResponseGetItemsRetType = []RoutingTable + +func getRoutingTableListResponseGetItemsAttributeTypeOk(arg RoutingTableListResponseGetItemsAttributeType) (ret RoutingTableListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableListResponseGetItemsAttributeType(arg *RoutingTableListResponseGetItemsAttributeType, val RoutingTableListResponseGetItemsRetType) { + *arg = &val +} + +// RoutingTableListResponse Routing table response. +type RoutingTableListResponse struct { + // A list of routing tables. + // REQUIRED + Items RoutingTableListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _RoutingTableListResponse RoutingTableListResponse + +// NewRoutingTableListResponse instantiates a new RoutingTableListResponse 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 NewRoutingTableListResponse(items RoutingTableListResponseGetItemsArgType) *RoutingTableListResponse { + this := RoutingTableListResponse{} + setRoutingTableListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewRoutingTableListResponseWithDefaults instantiates a new RoutingTableListResponse 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 NewRoutingTableListResponseWithDefaults() *RoutingTableListResponse { + this := RoutingTableListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *RoutingTableListResponse) GetItems() (ret RoutingTableListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *RoutingTableListResponse) GetItemsOk() (ret RoutingTableListResponseGetItemsRetType, ok bool) { + return getRoutingTableListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *RoutingTableListResponse) SetItems(v RoutingTableListResponseGetItemsRetType) { + setRoutingTableListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o RoutingTableListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRoutingTableListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableRoutingTableListResponse struct { + value *RoutingTableListResponse + isSet bool +} + +func (v NullableRoutingTableListResponse) Get() *RoutingTableListResponse { + return v.value +} + +func (v *NullableRoutingTableListResponse) Set(val *RoutingTableListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRoutingTableListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRoutingTableListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoutingTableListResponse(val *RoutingTableListResponse) *NullableRoutingTableListResponse { + return &NullableRoutingTableListResponse{value: val, isSet: true} +} + +func (v NullableRoutingTableListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoutingTableListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_routing_table_list_response_test.go b/pkg/iaasbeta/model_routing_table_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_routing_table_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_routing_table_test.go b/pkg/iaasbeta/model_routing_table_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_routing_table_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_security_group.go b/pkg/iaasbeta/model_security_group.go new file mode 100644 index 00000000..0f821505 --- /dev/null +++ b/pkg/iaasbeta/model_security_group.go @@ -0,0 +1,468 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the SecurityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroup{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type SecurityGroupGetCreatedAtAttributeType = *time.Time +type SecurityGroupGetCreatedAtArgType = time.Time +type SecurityGroupGetCreatedAtRetType = time.Time + +func getSecurityGroupGetCreatedAtAttributeTypeOk(arg SecurityGroupGetCreatedAtAttributeType) (ret SecurityGroupGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetCreatedAtAttributeType(arg *SecurityGroupGetCreatedAtAttributeType, val SecurityGroupGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type SecurityGroupGetDescriptionAttributeType = *string + +func getSecurityGroupGetDescriptionAttributeTypeOk(arg SecurityGroupGetDescriptionAttributeType) (ret SecurityGroupGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetDescriptionAttributeType(arg *SecurityGroupGetDescriptionAttributeType, val SecurityGroupGetDescriptionRetType) { + *arg = &val +} + +type SecurityGroupGetDescriptionArgType = string +type SecurityGroupGetDescriptionRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type SecurityGroupGetIdAttributeType = *string + +func getSecurityGroupGetIdAttributeTypeOk(arg SecurityGroupGetIdAttributeType) (ret SecurityGroupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetIdAttributeType(arg *SecurityGroupGetIdAttributeType, val SecurityGroupGetIdRetType) { + *arg = &val +} + +type SecurityGroupGetIdArgType = string +type SecurityGroupGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type SecurityGroupGetLabelsAttributeType = *map[string]interface{} +type SecurityGroupGetLabelsArgType = map[string]interface{} +type SecurityGroupGetLabelsRetType = map[string]interface{} + +func getSecurityGroupGetLabelsAttributeTypeOk(arg SecurityGroupGetLabelsAttributeType) (ret SecurityGroupGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetLabelsAttributeType(arg *SecurityGroupGetLabelsAttributeType, val SecurityGroupGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type SecurityGroupGetNameAttributeType = *string + +func getSecurityGroupGetNameAttributeTypeOk(arg SecurityGroupGetNameAttributeType) (ret SecurityGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetNameAttributeType(arg *SecurityGroupGetNameAttributeType, val SecurityGroupGetNameRetType) { + *arg = &val +} + +type SecurityGroupGetNameArgType = string +type SecurityGroupGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type SecurityGroupGetRulesAttributeType = *[]SecurityGroupRule +type SecurityGroupGetRulesArgType = []SecurityGroupRule +type SecurityGroupGetRulesRetType = []SecurityGroupRule + +func getSecurityGroupGetRulesAttributeTypeOk(arg SecurityGroupGetRulesAttributeType) (ret SecurityGroupGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetRulesAttributeType(arg *SecurityGroupGetRulesAttributeType, val SecurityGroupGetRulesRetType) { + *arg = &val +} + +/* + types and functions for stateful +*/ + +// isBoolean +type SecurityGroupgetStatefulAttributeType = *bool +type SecurityGroupgetStatefulArgType = bool +type SecurityGroupgetStatefulRetType = bool + +func getSecurityGroupgetStatefulAttributeTypeOk(arg SecurityGroupgetStatefulAttributeType) (ret SecurityGroupgetStatefulRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupgetStatefulAttributeType(arg *SecurityGroupgetStatefulAttributeType, val SecurityGroupgetStatefulRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type SecurityGroupGetUpdatedAtAttributeType = *time.Time +type SecurityGroupGetUpdatedAtArgType = time.Time +type SecurityGroupGetUpdatedAtRetType = time.Time + +func getSecurityGroupGetUpdatedAtAttributeTypeOk(arg SecurityGroupGetUpdatedAtAttributeType) (ret SecurityGroupGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetUpdatedAtAttributeType(arg *SecurityGroupGetUpdatedAtAttributeType, val SecurityGroupGetUpdatedAtRetType) { + *arg = &val +} + +// SecurityGroup Object that represents a security group. +type SecurityGroup struct { + // Date-time when resource was created. + CreatedAt SecurityGroupGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description SecurityGroupGetDescriptionAttributeType `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Id SecurityGroupGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels SecurityGroupGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name SecurityGroupGetNameAttributeType `json:"name" required:"true"` + // A list containing security group rule objects. + Rules SecurityGroupGetRulesAttributeType `json:"rules,omitempty"` + // Shows if a security group is stateful or stateless. You can only have one type of security groups per network interface/server. + Stateful SecurityGroupgetStatefulAttributeType `json:"stateful,omitempty"` + // Date-time when resource was last updated. + UpdatedAt SecurityGroupGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _SecurityGroup SecurityGroup + +// NewSecurityGroup instantiates a new SecurityGroup 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 NewSecurityGroup(name SecurityGroupGetNameArgType) *SecurityGroup { + this := SecurityGroup{} + setSecurityGroupGetNameAttributeType(&this.Name, name) + return &this +} + +// NewSecurityGroupWithDefaults instantiates a new SecurityGroup 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 NewSecurityGroupWithDefaults() *SecurityGroup { + this := SecurityGroup{} + var stateful bool = true + this.Stateful = &stateful + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SecurityGroup) GetCreatedAt() (res SecurityGroupGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetCreatedAtOk() (ret SecurityGroupGetCreatedAtRetType, ok bool) { + return getSecurityGroupGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SecurityGroup) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *SecurityGroup) SetCreatedAt(v SecurityGroupGetCreatedAtRetType) { + setSecurityGroupGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SecurityGroup) GetDescription() (res SecurityGroupGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetDescriptionOk() (ret SecurityGroupGetDescriptionRetType, ok bool) { + return getSecurityGroupGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *SecurityGroup) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SecurityGroup) SetDescription(v SecurityGroupGetDescriptionRetType) { + setSecurityGroupGetDescriptionAttributeType(&o.Description, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityGroup) GetId() (res SecurityGroupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetIdOk() (ret SecurityGroupGetIdRetType, ok bool) { + return getSecurityGroupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityGroup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityGroup) SetId(v SecurityGroupGetIdRetType) { + setSecurityGroupGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *SecurityGroup) GetLabels() (res SecurityGroupGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetLabelsOk() (ret SecurityGroupGetLabelsRetType, ok bool) { + return getSecurityGroupGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *SecurityGroup) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *SecurityGroup) SetLabels(v SecurityGroupGetLabelsRetType) { + setSecurityGroupGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *SecurityGroup) GetName() (ret SecurityGroupGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetNameOk() (ret SecurityGroupGetNameRetType, ok bool) { + return getSecurityGroupGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *SecurityGroup) SetName(v SecurityGroupGetNameRetType) { + setSecurityGroupGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *SecurityGroup) GetRules() (res SecurityGroupGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetRulesOk() (ret SecurityGroupGetRulesRetType, ok bool) { + return getSecurityGroupGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *SecurityGroup) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given []SecurityGroupRule and assigns it to the Rules field. +func (o *SecurityGroup) SetRules(v SecurityGroupGetRulesRetType) { + setSecurityGroupGetRulesAttributeType(&o.Rules, v) +} + +// GetStateful returns the Stateful field value if set, zero value otherwise. +func (o *SecurityGroup) GetStateful() (res SecurityGroupgetStatefulRetType) { + res, _ = o.GetStatefulOk() + return +} + +// GetStatefulOk returns a tuple with the Stateful field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetStatefulOk() (ret SecurityGroupgetStatefulRetType, ok bool) { + return getSecurityGroupgetStatefulAttributeTypeOk(o.Stateful) +} + +// HasStateful returns a boolean if a field has been set. +func (o *SecurityGroup) HasStateful() bool { + _, ok := o.GetStatefulOk() + return ok +} + +// SetStateful gets a reference to the given bool and assigns it to the Stateful field. +func (o *SecurityGroup) SetStateful(v SecurityGroupgetStatefulRetType) { + setSecurityGroupgetStatefulAttributeType(&o.Stateful, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *SecurityGroup) GetUpdatedAt() (res SecurityGroupGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetUpdatedAtOk() (ret SecurityGroupGetUpdatedAtRetType, ok bool) { + return getSecurityGroupGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *SecurityGroup) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *SecurityGroup) SetUpdatedAt(v SecurityGroupGetUpdatedAtRetType) { + setSecurityGroupGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o SecurityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getSecurityGroupGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getSecurityGroupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getSecurityGroupGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getSecurityGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getSecurityGroupGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + if val, ok := getSecurityGroupgetStatefulAttributeTypeOk(o.Stateful); ok { + toSerialize["Stateful"] = val + } + if val, ok := getSecurityGroupGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroup struct { + value *SecurityGroup + isSet bool +} + +func (v NullableSecurityGroup) Get() *SecurityGroup { + return v.value +} + +func (v *NullableSecurityGroup) Set(val *SecurityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroup(val *SecurityGroup) *NullableSecurityGroup { + return &NullableSecurityGroup{value: val, isSet: true} +} + +func (v NullableSecurityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_security_group_list_response.go b/pkg/iaasbeta/model_security_group_list_response.go new file mode 100644 index 00000000..c34b0ffb --- /dev/null +++ b/pkg/iaasbeta/model_security_group_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the SecurityGroupListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupListResponse{} + +/* + types and functions for items +*/ + +// isArray +type SecurityGroupListResponseGetItemsAttributeType = *[]SecurityGroup +type SecurityGroupListResponseGetItemsArgType = []SecurityGroup +type SecurityGroupListResponseGetItemsRetType = []SecurityGroup + +func getSecurityGroupListResponseGetItemsAttributeTypeOk(arg SecurityGroupListResponseGetItemsAttributeType) (ret SecurityGroupListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupListResponseGetItemsAttributeType(arg *SecurityGroupListResponseGetItemsAttributeType, val SecurityGroupListResponseGetItemsRetType) { + *arg = &val +} + +// SecurityGroupListResponse Security group list response. +type SecurityGroupListResponse struct { + // A list containing security group objects. + // REQUIRED + Items SecurityGroupListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _SecurityGroupListResponse SecurityGroupListResponse + +// NewSecurityGroupListResponse instantiates a new SecurityGroupListResponse 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 NewSecurityGroupListResponse(items SecurityGroupListResponseGetItemsArgType) *SecurityGroupListResponse { + this := SecurityGroupListResponse{} + setSecurityGroupListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewSecurityGroupListResponseWithDefaults instantiates a new SecurityGroupListResponse 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 NewSecurityGroupListResponseWithDefaults() *SecurityGroupListResponse { + this := SecurityGroupListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *SecurityGroupListResponse) GetItems() (ret SecurityGroupListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *SecurityGroupListResponse) GetItemsOk() (ret SecurityGroupListResponseGetItemsRetType, ok bool) { + return getSecurityGroupListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *SecurityGroupListResponse) SetItems(v SecurityGroupListResponseGetItemsRetType) { + setSecurityGroupListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o SecurityGroupListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroupListResponse struct { + value *SecurityGroupListResponse + isSet bool +} + +func (v NullableSecurityGroupListResponse) Get() *SecurityGroupListResponse { + return v.value +} + +func (v *NullableSecurityGroupListResponse) Set(val *SecurityGroupListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupListResponse(val *SecurityGroupListResponse) *NullableSecurityGroupListResponse { + return &NullableSecurityGroupListResponse{value: val, isSet: true} +} + +func (v NullableSecurityGroupListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_security_group_list_response_test.go b/pkg/iaasbeta/model_security_group_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_security_group_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_security_group_rule.go b/pkg/iaasbeta/model_security_group_rule.go new file mode 100644 index 00000000..806cfab0 --- /dev/null +++ b/pkg/iaasbeta/model_security_group_rule.go @@ -0,0 +1,661 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the SecurityGroupRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupRule{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type SecurityGroupRuleGetCreatedAtAttributeType = *time.Time +type SecurityGroupRuleGetCreatedAtArgType = time.Time +type SecurityGroupRuleGetCreatedAtRetType = time.Time + +func getSecurityGroupRuleGetCreatedAtAttributeTypeOk(arg SecurityGroupRuleGetCreatedAtAttributeType) (ret SecurityGroupRuleGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetCreatedAtAttributeType(arg *SecurityGroupRuleGetCreatedAtAttributeType, val SecurityGroupRuleGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type SecurityGroupRuleGetDescriptionAttributeType = *string + +func getSecurityGroupRuleGetDescriptionAttributeTypeOk(arg SecurityGroupRuleGetDescriptionAttributeType) (ret SecurityGroupRuleGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetDescriptionAttributeType(arg *SecurityGroupRuleGetDescriptionAttributeType, val SecurityGroupRuleGetDescriptionRetType) { + *arg = &val +} + +type SecurityGroupRuleGetDescriptionArgType = string +type SecurityGroupRuleGetDescriptionRetType = string + +/* + types and functions for direction +*/ + +// isNotNullableString +type SecurityGroupRuleGetDirectionAttributeType = *string + +func getSecurityGroupRuleGetDirectionAttributeTypeOk(arg SecurityGroupRuleGetDirectionAttributeType) (ret SecurityGroupRuleGetDirectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetDirectionAttributeType(arg *SecurityGroupRuleGetDirectionAttributeType, val SecurityGroupRuleGetDirectionRetType) { + *arg = &val +} + +type SecurityGroupRuleGetDirectionArgType = string +type SecurityGroupRuleGetDirectionRetType = string + +/* + types and functions for ethertype +*/ + +// isNotNullableString +type SecurityGroupRuleGetEthertypeAttributeType = *string + +func getSecurityGroupRuleGetEthertypeAttributeTypeOk(arg SecurityGroupRuleGetEthertypeAttributeType) (ret SecurityGroupRuleGetEthertypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetEthertypeAttributeType(arg *SecurityGroupRuleGetEthertypeAttributeType, val SecurityGroupRuleGetEthertypeRetType) { + *arg = &val +} + +type SecurityGroupRuleGetEthertypeArgType = string +type SecurityGroupRuleGetEthertypeRetType = string + +/* + types and functions for icmpParameters +*/ + +// isModel +type SecurityGroupRuleGetIcmpParametersAttributeType = *ICMPParameters +type SecurityGroupRuleGetIcmpParametersArgType = ICMPParameters +type SecurityGroupRuleGetIcmpParametersRetType = ICMPParameters + +func getSecurityGroupRuleGetIcmpParametersAttributeTypeOk(arg SecurityGroupRuleGetIcmpParametersAttributeType) (ret SecurityGroupRuleGetIcmpParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetIcmpParametersAttributeType(arg *SecurityGroupRuleGetIcmpParametersAttributeType, val SecurityGroupRuleGetIcmpParametersRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type SecurityGroupRuleGetIdAttributeType = *string + +func getSecurityGroupRuleGetIdAttributeTypeOk(arg SecurityGroupRuleGetIdAttributeType) (ret SecurityGroupRuleGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetIdAttributeType(arg *SecurityGroupRuleGetIdAttributeType, val SecurityGroupRuleGetIdRetType) { + *arg = &val +} + +type SecurityGroupRuleGetIdArgType = string +type SecurityGroupRuleGetIdRetType = string + +/* + types and functions for ipRange +*/ + +// isNotNullableString +type SecurityGroupRuleGetIpRangeAttributeType = *string + +func getSecurityGroupRuleGetIpRangeAttributeTypeOk(arg SecurityGroupRuleGetIpRangeAttributeType) (ret SecurityGroupRuleGetIpRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetIpRangeAttributeType(arg *SecurityGroupRuleGetIpRangeAttributeType, val SecurityGroupRuleGetIpRangeRetType) { + *arg = &val +} + +type SecurityGroupRuleGetIpRangeArgType = string +type SecurityGroupRuleGetIpRangeRetType = string + +/* + types and functions for portRange +*/ + +// isModel +type SecurityGroupRuleGetPortRangeAttributeType = *PortRange +type SecurityGroupRuleGetPortRangeArgType = PortRange +type SecurityGroupRuleGetPortRangeRetType = PortRange + +func getSecurityGroupRuleGetPortRangeAttributeTypeOk(arg SecurityGroupRuleGetPortRangeAttributeType) (ret SecurityGroupRuleGetPortRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetPortRangeAttributeType(arg *SecurityGroupRuleGetPortRangeAttributeType, val SecurityGroupRuleGetPortRangeRetType) { + *arg = &val +} + +/* + types and functions for remoteSecurityGroupId +*/ + +// isNotNullableString +type SecurityGroupRuleGetRemoteSecurityGroupIdAttributeType = *string + +func getSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(arg SecurityGroupRuleGetRemoteSecurityGroupIdAttributeType) (ret SecurityGroupRuleGetRemoteSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType(arg *SecurityGroupRuleGetRemoteSecurityGroupIdAttributeType, val SecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + *arg = &val +} + +type SecurityGroupRuleGetRemoteSecurityGroupIdArgType = string +type SecurityGroupRuleGetRemoteSecurityGroupIdRetType = string + +/* + types and functions for securityGroupId +*/ + +// isNotNullableString +type SecurityGroupRuleGetSecurityGroupIdAttributeType = *string + +func getSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(arg SecurityGroupRuleGetSecurityGroupIdAttributeType) (ret SecurityGroupRuleGetSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetSecurityGroupIdAttributeType(arg *SecurityGroupRuleGetSecurityGroupIdAttributeType, val SecurityGroupRuleGetSecurityGroupIdRetType) { + *arg = &val +} + +type SecurityGroupRuleGetSecurityGroupIdArgType = string +type SecurityGroupRuleGetSecurityGroupIdRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type SecurityGroupRuleGetUpdatedAtAttributeType = *time.Time +type SecurityGroupRuleGetUpdatedAtArgType = time.Time +type SecurityGroupRuleGetUpdatedAtRetType = time.Time + +func getSecurityGroupRuleGetUpdatedAtAttributeTypeOk(arg SecurityGroupRuleGetUpdatedAtAttributeType) (ret SecurityGroupRuleGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetUpdatedAtAttributeType(arg *SecurityGroupRuleGetUpdatedAtAttributeType, val SecurityGroupRuleGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for protocol +*/ + +// isModel +type SecurityGroupRuleGetProtocolAttributeType = *Protocol +type SecurityGroupRuleGetProtocolArgType = Protocol +type SecurityGroupRuleGetProtocolRetType = Protocol + +func getSecurityGroupRuleGetProtocolAttributeTypeOk(arg SecurityGroupRuleGetProtocolAttributeType) (ret SecurityGroupRuleGetProtocolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetProtocolAttributeType(arg *SecurityGroupRuleGetProtocolAttributeType, val SecurityGroupRuleGetProtocolRetType) { + *arg = &val +} + +// SecurityGroupRule Object that represents a security group rule. +type SecurityGroupRule struct { + // Date-time when resource was created. + CreatedAt SecurityGroupRuleGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description SecurityGroupRuleGetDescriptionAttributeType `json:"description,omitempty"` + // The direction of the traffic which the rule should match. Possible values: `ingress`, `egress`. + // REQUIRED + Direction SecurityGroupRuleGetDirectionAttributeType `json:"direction" required:"true"` + // The ethertype which the rule should match. Possible values: `IPv4`, `IPv6`. + Ethertype SecurityGroupRuleGetEthertypeAttributeType `json:"ethertype,omitempty"` + IcmpParameters SecurityGroupRuleGetIcmpParametersAttributeType `json:"icmpParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id SecurityGroupRuleGetIdAttributeType `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + IpRange SecurityGroupRuleGetIpRangeAttributeType `json:"ipRange,omitempty"` + PortRange SecurityGroupRuleGetPortRangeAttributeType `json:"portRange,omitempty"` + // Universally Unique Identifier (UUID). + RemoteSecurityGroupId SecurityGroupRuleGetRemoteSecurityGroupIdAttributeType `json:"remoteSecurityGroupId,omitempty"` + // Universally Unique Identifier (UUID). + SecurityGroupId SecurityGroupRuleGetSecurityGroupIdAttributeType `json:"securityGroupId,omitempty"` + // Date-time when resource was last updated. + UpdatedAt SecurityGroupRuleGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + Protocol SecurityGroupRuleGetProtocolAttributeType `json:"protocol,omitempty"` +} + +type _SecurityGroupRule SecurityGroupRule + +// NewSecurityGroupRule instantiates a new SecurityGroupRule 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 NewSecurityGroupRule(direction SecurityGroupRuleGetDirectionArgType) *SecurityGroupRule { + this := SecurityGroupRule{} + setSecurityGroupRuleGetDirectionAttributeType(&this.Direction, direction) + return &this +} + +// NewSecurityGroupRuleWithDefaults instantiates a new SecurityGroupRule 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 NewSecurityGroupRuleWithDefaults() *SecurityGroupRule { + this := SecurityGroupRule{} + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetCreatedAt() (res SecurityGroupRuleGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetCreatedAtOk() (ret SecurityGroupRuleGetCreatedAtRetType, ok bool) { + return getSecurityGroupRuleGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *SecurityGroupRule) SetCreatedAt(v SecurityGroupRuleGetCreatedAtRetType) { + setSecurityGroupRuleGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetDescription() (res SecurityGroupRuleGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetDescriptionOk() (ret SecurityGroupRuleGetDescriptionRetType, ok bool) { + return getSecurityGroupRuleGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SecurityGroupRule) SetDescription(v SecurityGroupRuleGetDescriptionRetType) { + setSecurityGroupRuleGetDescriptionAttributeType(&o.Description, v) +} + +// GetDirection returns the Direction field value +func (o *SecurityGroupRule) GetDirection() (ret SecurityGroupRuleGetDirectionRetType) { + ret, _ = o.GetDirectionOk() + return ret +} + +// GetDirectionOk returns a tuple with the Direction field value +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetDirectionOk() (ret SecurityGroupRuleGetDirectionRetType, ok bool) { + return getSecurityGroupRuleGetDirectionAttributeTypeOk(o.Direction) +} + +// SetDirection sets field value +func (o *SecurityGroupRule) SetDirection(v SecurityGroupRuleGetDirectionRetType) { + setSecurityGroupRuleGetDirectionAttributeType(&o.Direction, v) +} + +// GetEthertype returns the Ethertype field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetEthertype() (res SecurityGroupRuleGetEthertypeRetType) { + res, _ = o.GetEthertypeOk() + return +} + +// GetEthertypeOk returns a tuple with the Ethertype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetEthertypeOk() (ret SecurityGroupRuleGetEthertypeRetType, ok bool) { + return getSecurityGroupRuleGetEthertypeAttributeTypeOk(o.Ethertype) +} + +// HasEthertype returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasEthertype() bool { + _, ok := o.GetEthertypeOk() + return ok +} + +// SetEthertype gets a reference to the given string and assigns it to the Ethertype field. +func (o *SecurityGroupRule) SetEthertype(v SecurityGroupRuleGetEthertypeRetType) { + setSecurityGroupRuleGetEthertypeAttributeType(&o.Ethertype, v) +} + +// GetIcmpParameters returns the IcmpParameters field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetIcmpParameters() (res SecurityGroupRuleGetIcmpParametersRetType) { + res, _ = o.GetIcmpParametersOk() + return +} + +// GetIcmpParametersOk returns a tuple with the IcmpParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetIcmpParametersOk() (ret SecurityGroupRuleGetIcmpParametersRetType, ok bool) { + return getSecurityGroupRuleGetIcmpParametersAttributeTypeOk(o.IcmpParameters) +} + +// HasIcmpParameters returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasIcmpParameters() bool { + _, ok := o.GetIcmpParametersOk() + return ok +} + +// SetIcmpParameters gets a reference to the given ICMPParameters and assigns it to the IcmpParameters field. +func (o *SecurityGroupRule) SetIcmpParameters(v SecurityGroupRuleGetIcmpParametersRetType) { + setSecurityGroupRuleGetIcmpParametersAttributeType(&o.IcmpParameters, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetId() (res SecurityGroupRuleGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetIdOk() (ret SecurityGroupRuleGetIdRetType, ok bool) { + return getSecurityGroupRuleGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityGroupRule) SetId(v SecurityGroupRuleGetIdRetType) { + setSecurityGroupRuleGetIdAttributeType(&o.Id, v) +} + +// GetIpRange returns the IpRange field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetIpRange() (res SecurityGroupRuleGetIpRangeRetType) { + res, _ = o.GetIpRangeOk() + return +} + +// GetIpRangeOk returns a tuple with the IpRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetIpRangeOk() (ret SecurityGroupRuleGetIpRangeRetType, ok bool) { + return getSecurityGroupRuleGetIpRangeAttributeTypeOk(o.IpRange) +} + +// HasIpRange returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasIpRange() bool { + _, ok := o.GetIpRangeOk() + return ok +} + +// SetIpRange gets a reference to the given string and assigns it to the IpRange field. +func (o *SecurityGroupRule) SetIpRange(v SecurityGroupRuleGetIpRangeRetType) { + setSecurityGroupRuleGetIpRangeAttributeType(&o.IpRange, v) +} + +// GetPortRange returns the PortRange field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetPortRange() (res SecurityGroupRuleGetPortRangeRetType) { + res, _ = o.GetPortRangeOk() + return +} + +// GetPortRangeOk returns a tuple with the PortRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetPortRangeOk() (ret SecurityGroupRuleGetPortRangeRetType, ok bool) { + return getSecurityGroupRuleGetPortRangeAttributeTypeOk(o.PortRange) +} + +// HasPortRange returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasPortRange() bool { + _, ok := o.GetPortRangeOk() + return ok +} + +// SetPortRange gets a reference to the given PortRange and assigns it to the PortRange field. +func (o *SecurityGroupRule) SetPortRange(v SecurityGroupRuleGetPortRangeRetType) { + setSecurityGroupRuleGetPortRangeAttributeType(&o.PortRange, v) +} + +// GetRemoteSecurityGroupId returns the RemoteSecurityGroupId field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetRemoteSecurityGroupId() (res SecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + res, _ = o.GetRemoteSecurityGroupIdOk() + return +} + +// GetRemoteSecurityGroupIdOk returns a tuple with the RemoteSecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetRemoteSecurityGroupIdOk() (ret SecurityGroupRuleGetRemoteSecurityGroupIdRetType, ok bool) { + return getSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId) +} + +// HasRemoteSecurityGroupId returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasRemoteSecurityGroupId() bool { + _, ok := o.GetRemoteSecurityGroupIdOk() + return ok +} + +// SetRemoteSecurityGroupId gets a reference to the given string and assigns it to the RemoteSecurityGroupId field. +func (o *SecurityGroupRule) SetRemoteSecurityGroupId(v SecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + setSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType(&o.RemoteSecurityGroupId, v) +} + +// GetSecurityGroupId returns the SecurityGroupId field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetSecurityGroupId() (res SecurityGroupRuleGetSecurityGroupIdRetType) { + res, _ = o.GetSecurityGroupIdOk() + return +} + +// GetSecurityGroupIdOk returns a tuple with the SecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetSecurityGroupIdOk() (ret SecurityGroupRuleGetSecurityGroupIdRetType, ok bool) { + return getSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId) +} + +// HasSecurityGroupId returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasSecurityGroupId() bool { + _, ok := o.GetSecurityGroupIdOk() + return ok +} + +// SetSecurityGroupId gets a reference to the given string and assigns it to the SecurityGroupId field. +func (o *SecurityGroupRule) SetSecurityGroupId(v SecurityGroupRuleGetSecurityGroupIdRetType) { + setSecurityGroupRuleGetSecurityGroupIdAttributeType(&o.SecurityGroupId, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetUpdatedAt() (res SecurityGroupRuleGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetUpdatedAtOk() (ret SecurityGroupRuleGetUpdatedAtRetType, ok bool) { + return getSecurityGroupRuleGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *SecurityGroupRule) SetUpdatedAt(v SecurityGroupRuleGetUpdatedAtRetType) { + setSecurityGroupRuleGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetProtocol() (res SecurityGroupRuleGetProtocolRetType) { + res, _ = o.GetProtocolOk() + return +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetProtocolOk() (ret SecurityGroupRuleGetProtocolRetType, ok bool) { + return getSecurityGroupRuleGetProtocolAttributeTypeOk(o.Protocol) +} + +// HasProtocol returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasProtocol() bool { + _, ok := o.GetProtocolOk() + return ok +} + +// SetProtocol gets a reference to the given Protocol and assigns it to the Protocol field. +func (o *SecurityGroupRule) SetProtocol(v SecurityGroupRuleGetProtocolRetType) { + setSecurityGroupRuleGetProtocolAttributeType(&o.Protocol, v) +} + +func (o SecurityGroupRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupRuleGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getSecurityGroupRuleGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getSecurityGroupRuleGetDirectionAttributeTypeOk(o.Direction); ok { + toSerialize["Direction"] = val + } + if val, ok := getSecurityGroupRuleGetEthertypeAttributeTypeOk(o.Ethertype); ok { + toSerialize["Ethertype"] = val + } + if val, ok := getSecurityGroupRuleGetIcmpParametersAttributeTypeOk(o.IcmpParameters); ok { + toSerialize["IcmpParameters"] = val + } + if val, ok := getSecurityGroupRuleGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getSecurityGroupRuleGetIpRangeAttributeTypeOk(o.IpRange); ok { + toSerialize["IpRange"] = val + } + if val, ok := getSecurityGroupRuleGetPortRangeAttributeTypeOk(o.PortRange); ok { + toSerialize["PortRange"] = val + } + if val, ok := getSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId); ok { + toSerialize["RemoteSecurityGroupId"] = val + } + if val, ok := getSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId); ok { + toSerialize["SecurityGroupId"] = val + } + if val, ok := getSecurityGroupRuleGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getSecurityGroupRuleGetProtocolAttributeTypeOk(o.Protocol); ok { + toSerialize["Protocol"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroupRule struct { + value *SecurityGroupRule + isSet bool +} + +func (v NullableSecurityGroupRule) Get() *SecurityGroupRule { + return v.value +} + +func (v *NullableSecurityGroupRule) Set(val *SecurityGroupRule) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupRule) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupRule(val *SecurityGroupRule) *NullableSecurityGroupRule { + return &NullableSecurityGroupRule{value: val, isSet: true} +} + +func (v NullableSecurityGroupRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_security_group_rule_list_response.go b/pkg/iaasbeta/model_security_group_rule_list_response.go new file mode 100644 index 00000000..eb8396dc --- /dev/null +++ b/pkg/iaasbeta/model_security_group_rule_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the SecurityGroupRuleListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupRuleListResponse{} + +/* + types and functions for items +*/ + +// isArray +type SecurityGroupRuleListResponseGetItemsAttributeType = *[]SecurityGroupRule +type SecurityGroupRuleListResponseGetItemsArgType = []SecurityGroupRule +type SecurityGroupRuleListResponseGetItemsRetType = []SecurityGroupRule + +func getSecurityGroupRuleListResponseGetItemsAttributeTypeOk(arg SecurityGroupRuleListResponseGetItemsAttributeType) (ret SecurityGroupRuleListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleListResponseGetItemsAttributeType(arg *SecurityGroupRuleListResponseGetItemsAttributeType, val SecurityGroupRuleListResponseGetItemsRetType) { + *arg = &val +} + +// SecurityGroupRuleListResponse Security group rule list response. +type SecurityGroupRuleListResponse struct { + // A list containing security group rule objects. + // REQUIRED + Items SecurityGroupRuleListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _SecurityGroupRuleListResponse SecurityGroupRuleListResponse + +// NewSecurityGroupRuleListResponse instantiates a new SecurityGroupRuleListResponse 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 NewSecurityGroupRuleListResponse(items SecurityGroupRuleListResponseGetItemsArgType) *SecurityGroupRuleListResponse { + this := SecurityGroupRuleListResponse{} + setSecurityGroupRuleListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewSecurityGroupRuleListResponseWithDefaults instantiates a new SecurityGroupRuleListResponse 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 NewSecurityGroupRuleListResponseWithDefaults() *SecurityGroupRuleListResponse { + this := SecurityGroupRuleListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *SecurityGroupRuleListResponse) GetItems() (ret SecurityGroupRuleListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *SecurityGroupRuleListResponse) GetItemsOk() (ret SecurityGroupRuleListResponseGetItemsRetType, ok bool) { + return getSecurityGroupRuleListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *SecurityGroupRuleListResponse) SetItems(v SecurityGroupRuleListResponseGetItemsRetType) { + setSecurityGroupRuleListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o SecurityGroupRuleListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupRuleListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroupRuleListResponse struct { + value *SecurityGroupRuleListResponse + isSet bool +} + +func (v NullableSecurityGroupRuleListResponse) Get() *SecurityGroupRuleListResponse { + return v.value +} + +func (v *NullableSecurityGroupRuleListResponse) Set(val *SecurityGroupRuleListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupRuleListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupRuleListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupRuleListResponse(val *SecurityGroupRuleListResponse) *NullableSecurityGroupRuleListResponse { + return &NullableSecurityGroupRuleListResponse{value: val, isSet: true} +} + +func (v NullableSecurityGroupRuleListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupRuleListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_security_group_rule_list_response_test.go b/pkg/iaasbeta/model_security_group_rule_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_security_group_rule_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_security_group_rule_protocol.go b/pkg/iaasbeta/model_security_group_rule_protocol.go new file mode 100644 index 00000000..af3a3c89 --- /dev/null +++ b/pkg/iaasbeta/model_security_group_rule_protocol.go @@ -0,0 +1,127 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the SecurityGroupRuleProtocol type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupRuleProtocol{} + +/* + types and functions for protocol +*/ + +// isModel +type SecurityGroupRuleProtocolGetProtocolAttributeType = *Protocol +type SecurityGroupRuleProtocolGetProtocolArgType = Protocol +type SecurityGroupRuleProtocolGetProtocolRetType = Protocol + +func getSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(arg SecurityGroupRuleProtocolGetProtocolAttributeType) (ret SecurityGroupRuleProtocolGetProtocolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleProtocolGetProtocolAttributeType(arg *SecurityGroupRuleProtocolGetProtocolAttributeType, val SecurityGroupRuleProtocolGetProtocolRetType) { + *arg = &val +} + +// SecurityGroupRuleProtocol The internet protocol which the rule matches. +type SecurityGroupRuleProtocol struct { + Protocol SecurityGroupRuleProtocolGetProtocolAttributeType `json:"protocol,omitempty"` +} + +// NewSecurityGroupRuleProtocol instantiates a new SecurityGroupRuleProtocol 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 NewSecurityGroupRuleProtocol() *SecurityGroupRuleProtocol { + this := SecurityGroupRuleProtocol{} + return &this +} + +// NewSecurityGroupRuleProtocolWithDefaults instantiates a new SecurityGroupRuleProtocol 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 NewSecurityGroupRuleProtocolWithDefaults() *SecurityGroupRuleProtocol { + this := SecurityGroupRuleProtocol{} + return &this +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *SecurityGroupRuleProtocol) GetProtocol() (res SecurityGroupRuleProtocolGetProtocolRetType) { + res, _ = o.GetProtocolOk() + return +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRuleProtocol) GetProtocolOk() (ret SecurityGroupRuleProtocolGetProtocolRetType, ok bool) { + return getSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(o.Protocol) +} + +// HasProtocol returns a boolean if a field has been set. +func (o *SecurityGroupRuleProtocol) HasProtocol() bool { + _, ok := o.GetProtocolOk() + return ok +} + +// SetProtocol gets a reference to the given Protocol and assigns it to the Protocol field. +func (o *SecurityGroupRuleProtocol) SetProtocol(v SecurityGroupRuleProtocolGetProtocolRetType) { + setSecurityGroupRuleProtocolGetProtocolAttributeType(&o.Protocol, v) +} + +func (o SecurityGroupRuleProtocol) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(o.Protocol); ok { + toSerialize["Protocol"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroupRuleProtocol struct { + value *SecurityGroupRuleProtocol + isSet bool +} + +func (v NullableSecurityGroupRuleProtocol) Get() *SecurityGroupRuleProtocol { + return v.value +} + +func (v *NullableSecurityGroupRuleProtocol) Set(val *SecurityGroupRuleProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupRuleProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupRuleProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupRuleProtocol(val *SecurityGroupRuleProtocol) *NullableSecurityGroupRuleProtocol { + return &NullableSecurityGroupRuleProtocol{value: val, isSet: true} +} + +func (v NullableSecurityGroupRuleProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupRuleProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_security_group_rule_protocol_test.go b/pkg/iaasbeta/model_security_group_rule_protocol_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_security_group_rule_protocol_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_security_group_rule_test.go b/pkg/iaasbeta/model_security_group_rule_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_security_group_rule_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_security_group_test.go b/pkg/iaasbeta/model_security_group_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_security_group_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_server.go b/pkg/iaasbeta/model_server.go new file mode 100644 index 00000000..2373ec54 --- /dev/null +++ b/pkg/iaasbeta/model_server.go @@ -0,0 +1,1233 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Server type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Server{} + +/* + types and functions for affinityGroup +*/ + +// isNotNullableString +type ServerGetAffinityGroupAttributeType = *string + +func getServerGetAffinityGroupAttributeTypeOk(arg ServerGetAffinityGroupAttributeType) (ret ServerGetAffinityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetAffinityGroupAttributeType(arg *ServerGetAffinityGroupAttributeType, val ServerGetAffinityGroupRetType) { + *arg = &val +} + +type ServerGetAffinityGroupArgType = string +type ServerGetAffinityGroupRetType = string + +/* + types and functions for agent +*/ + +// isModel +type ServerGetAgentAttributeType = *ServerAgent +type ServerGetAgentArgType = ServerAgent +type ServerGetAgentRetType = ServerAgent + +func getServerGetAgentAttributeTypeOk(arg ServerGetAgentAttributeType) (ret ServerGetAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetAgentAttributeType(arg *ServerGetAgentAttributeType, val ServerGetAgentRetType) { + *arg = &val +} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type ServerGetAvailabilityZoneAttributeType = *string + +func getServerGetAvailabilityZoneAttributeTypeOk(arg ServerGetAvailabilityZoneAttributeType) (ret ServerGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetAvailabilityZoneAttributeType(arg *ServerGetAvailabilityZoneAttributeType, val ServerGetAvailabilityZoneRetType) { + *arg = &val +} + +type ServerGetAvailabilityZoneArgType = string +type ServerGetAvailabilityZoneRetType = string + +/* + types and functions for bootVolume +*/ + +// isModel +type ServerGetBootVolumeAttributeType = *ServerBootVolume +type ServerGetBootVolumeArgType = ServerBootVolume +type ServerGetBootVolumeRetType = ServerBootVolume + +func getServerGetBootVolumeAttributeTypeOk(arg ServerGetBootVolumeAttributeType) (ret ServerGetBootVolumeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetBootVolumeAttributeType(arg *ServerGetBootVolumeAttributeType, val ServerGetBootVolumeRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type ServerGetCreatedAtAttributeType = *time.Time +type ServerGetCreatedAtArgType = time.Time +type ServerGetCreatedAtRetType = time.Time + +func getServerGetCreatedAtAttributeTypeOk(arg ServerGetCreatedAtAttributeType) (ret ServerGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetCreatedAtAttributeType(arg *ServerGetCreatedAtAttributeType, val ServerGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for errorMessage +*/ + +// isNotNullableString +type ServerGetErrorMessageAttributeType = *string + +func getServerGetErrorMessageAttributeTypeOk(arg ServerGetErrorMessageAttributeType) (ret ServerGetErrorMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetErrorMessageAttributeType(arg *ServerGetErrorMessageAttributeType, val ServerGetErrorMessageRetType) { + *arg = &val +} + +type ServerGetErrorMessageArgType = string +type ServerGetErrorMessageRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type ServerGetIdAttributeType = *string + +func getServerGetIdAttributeTypeOk(arg ServerGetIdAttributeType) (ret ServerGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetIdAttributeType(arg *ServerGetIdAttributeType, val ServerGetIdRetType) { + *arg = &val +} + +type ServerGetIdArgType = string +type ServerGetIdRetType = string + +/* + types and functions for imageId +*/ + +// isNotNullableString +type ServerGetImageIdAttributeType = *string + +func getServerGetImageIdAttributeTypeOk(arg ServerGetImageIdAttributeType) (ret ServerGetImageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetImageIdAttributeType(arg *ServerGetImageIdAttributeType, val ServerGetImageIdRetType) { + *arg = &val +} + +type ServerGetImageIdArgType = string +type ServerGetImageIdRetType = string + +/* + types and functions for keypairName +*/ + +// isNotNullableString +type ServerGetKeypairNameAttributeType = *string + +func getServerGetKeypairNameAttributeTypeOk(arg ServerGetKeypairNameAttributeType) (ret ServerGetKeypairNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetKeypairNameAttributeType(arg *ServerGetKeypairNameAttributeType, val ServerGetKeypairNameRetType) { + *arg = &val +} + +type ServerGetKeypairNameArgType = string +type ServerGetKeypairNameRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type ServerGetLabelsAttributeType = *map[string]interface{} +type ServerGetLabelsArgType = map[string]interface{} +type ServerGetLabelsRetType = map[string]interface{} + +func getServerGetLabelsAttributeTypeOk(arg ServerGetLabelsAttributeType) (ret ServerGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetLabelsAttributeType(arg *ServerGetLabelsAttributeType, val ServerGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for launchedAt +*/ + +// isDateTime +type ServerGetLaunchedAtAttributeType = *time.Time +type ServerGetLaunchedAtArgType = time.Time +type ServerGetLaunchedAtRetType = time.Time + +func getServerGetLaunchedAtAttributeTypeOk(arg ServerGetLaunchedAtAttributeType) (ret ServerGetLaunchedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetLaunchedAtAttributeType(arg *ServerGetLaunchedAtAttributeType, val ServerGetLaunchedAtRetType) { + *arg = &val +} + +/* + types and functions for machineType +*/ + +// isNotNullableString +type ServerGetMachineTypeAttributeType = *string + +func getServerGetMachineTypeAttributeTypeOk(arg ServerGetMachineTypeAttributeType) (ret ServerGetMachineTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetMachineTypeAttributeType(arg *ServerGetMachineTypeAttributeType, val ServerGetMachineTypeRetType) { + *arg = &val +} + +type ServerGetMachineTypeArgType = string +type ServerGetMachineTypeRetType = string + +/* + types and functions for maintenanceWindow +*/ + +// isModel +type ServerGetMaintenanceWindowAttributeType = *ServerMaintenance +type ServerGetMaintenanceWindowArgType = ServerMaintenance +type ServerGetMaintenanceWindowRetType = ServerMaintenance + +func getServerGetMaintenanceWindowAttributeTypeOk(arg ServerGetMaintenanceWindowAttributeType) (ret ServerGetMaintenanceWindowRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetMaintenanceWindowAttributeType(arg *ServerGetMaintenanceWindowAttributeType, val ServerGetMaintenanceWindowRetType) { + *arg = &val +} + +/* + types and functions for metadata +*/ + +// isFreeform +type ServerGetMetadataAttributeType = *map[string]interface{} +type ServerGetMetadataArgType = map[string]interface{} +type ServerGetMetadataRetType = map[string]interface{} + +func getServerGetMetadataAttributeTypeOk(arg ServerGetMetadataAttributeType) (ret ServerGetMetadataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetMetadataAttributeType(arg *ServerGetMetadataAttributeType, val ServerGetMetadataRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type ServerGetNameAttributeType = *string + +func getServerGetNameAttributeTypeOk(arg ServerGetNameAttributeType) (ret ServerGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetNameAttributeType(arg *ServerGetNameAttributeType, val ServerGetNameRetType) { + *arg = &val +} + +type ServerGetNameArgType = string +type ServerGetNameRetType = string + +/* + types and functions for networking +*/ + +// isModel +type ServerGetNetworkingAttributeType = *ServerNetworking +type ServerGetNetworkingArgType = ServerNetworking +type ServerGetNetworkingRetType = ServerNetworking + +func getServerGetNetworkingAttributeTypeOk(arg ServerGetNetworkingAttributeType) (ret ServerGetNetworkingRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetNetworkingAttributeType(arg *ServerGetNetworkingAttributeType, val ServerGetNetworkingRetType) { + *arg = &val +} + +/* + types and functions for nics +*/ + +// isArray +type ServerGetNicsAttributeType = *[]ServerNetwork +type ServerGetNicsArgType = []ServerNetwork +type ServerGetNicsRetType = []ServerNetwork + +func getServerGetNicsAttributeTypeOk(arg ServerGetNicsAttributeType) (ret ServerGetNicsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetNicsAttributeType(arg *ServerGetNicsAttributeType, val ServerGetNicsRetType) { + *arg = &val +} + +/* + types and functions for powerStatus +*/ + +// isNotNullableString +type ServerGetPowerStatusAttributeType = *string + +func getServerGetPowerStatusAttributeTypeOk(arg ServerGetPowerStatusAttributeType) (ret ServerGetPowerStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetPowerStatusAttributeType(arg *ServerGetPowerStatusAttributeType, val ServerGetPowerStatusRetType) { + *arg = &val +} + +type ServerGetPowerStatusArgType = string +type ServerGetPowerStatusRetType = string + +/* + types and functions for securityGroups +*/ + +// isArray +type ServerGetSecurityGroupsAttributeType = *[]string +type ServerGetSecurityGroupsArgType = []string +type ServerGetSecurityGroupsRetType = []string + +func getServerGetSecurityGroupsAttributeTypeOk(arg ServerGetSecurityGroupsAttributeType) (ret ServerGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetSecurityGroupsAttributeType(arg *ServerGetSecurityGroupsAttributeType, val ServerGetSecurityGroupsRetType) { + *arg = &val +} + +/* + types and functions for serviceAccountMails +*/ + +// isArray +type ServerGetServiceAccountMailsAttributeType = *[]string +type ServerGetServiceAccountMailsArgType = []string +type ServerGetServiceAccountMailsRetType = []string + +func getServerGetServiceAccountMailsAttributeTypeOk(arg ServerGetServiceAccountMailsAttributeType) (ret ServerGetServiceAccountMailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetServiceAccountMailsAttributeType(arg *ServerGetServiceAccountMailsAttributeType, val ServerGetServiceAccountMailsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type ServerGetStatusAttributeType = *string + +func getServerGetStatusAttributeTypeOk(arg ServerGetStatusAttributeType) (ret ServerGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetStatusAttributeType(arg *ServerGetStatusAttributeType, val ServerGetStatusRetType) { + *arg = &val +} + +type ServerGetStatusArgType = string +type ServerGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type ServerGetUpdatedAtAttributeType = *time.Time +type ServerGetUpdatedAtArgType = time.Time +type ServerGetUpdatedAtRetType = time.Time + +func getServerGetUpdatedAtAttributeTypeOk(arg ServerGetUpdatedAtAttributeType) (ret ServerGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetUpdatedAtAttributeType(arg *ServerGetUpdatedAtAttributeType, val ServerGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for userData +*/ + +// isByteArray +type ServerGetUserDataAttributeType = *[]byte +type ServerGetUserDataArgType = []byte +type ServerGetUserDataRetType = []byte + +func getServerGetUserDataAttributeTypeOk(arg ServerGetUserDataAttributeType) (ret ServerGetUserDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetUserDataAttributeType(arg *ServerGetUserDataAttributeType, val ServerGetUserDataRetType) { + *arg = &val +} + +/* + types and functions for volumes +*/ + +// isArray +type ServerGetVolumesAttributeType = *[]string +type ServerGetVolumesArgType = []string +type ServerGetVolumesRetType = []string + +func getServerGetVolumesAttributeTypeOk(arg ServerGetVolumesAttributeType) (ret ServerGetVolumesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetVolumesAttributeType(arg *ServerGetVolumesAttributeType, val ServerGetVolumesRetType) { + *arg = &val +} + +// Server Representation of a single server object. +type Server struct { + // Universally Unique Identifier (UUID). + AffinityGroup ServerGetAffinityGroupAttributeType `json:"affinityGroup,omitempty"` + Agent ServerGetAgentAttributeType `json:"agent,omitempty"` + // Object that represents an availability zone. + AvailabilityZone ServerGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + BootVolume ServerGetBootVolumeAttributeType `json:"bootVolume,omitempty"` + // Date-time when resource was created. + CreatedAt ServerGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // An error message. + ErrorMessage ServerGetErrorMessageAttributeType `json:"errorMessage,omitempty"` + // Universally Unique Identifier (UUID). + Id ServerGetIdAttributeType `json:"id,omitempty"` + // Universally Unique Identifier (UUID). + ImageId ServerGetImageIdAttributeType `json:"imageId,omitempty"` + // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. + KeypairName ServerGetKeypairNameAttributeType `json:"keypairName,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels ServerGetLabelsAttributeType `json:"labels,omitempty"` + // Date-time when resource was launched. + LaunchedAt ServerGetLaunchedAtAttributeType `json:"launchedAt,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + MachineType ServerGetMachineTypeAttributeType `json:"machineType" required:"true"` + MaintenanceWindow ServerGetMaintenanceWindowAttributeType `json:"maintenanceWindow,omitempty"` + // Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value for a key will remove that key. + Metadata ServerGetMetadataAttributeType `json:"metadata,omitempty"` + // The name for a Server. + // REQUIRED + Name ServerGetNameAttributeType `json:"name" required:"true"` + Networking ServerGetNetworkingAttributeType `json:"networking,omitempty"` + // A list of networks attached to a server. + Nics ServerGetNicsAttributeType `json:"nics,omitempty"` + // The power status of a server. Possible values: `CRASHED`, `ERROR`, `RUNNING`, `STOPPED`. + PowerStatus ServerGetPowerStatusAttributeType `json:"powerStatus,omitempty"` + // A list of General Objects. + SecurityGroups ServerGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` + // A list of service account mails. + ServiceAccountMails ServerGetServiceAccountMailsAttributeType `json:"serviceAccountMails,omitempty"` + // The status of a server object. Possible values: `ACTIVE`, `BACKING-UP`, `CREATING`, `DEALLOCATED`, `DEALLOCATING`, `DELETED`, `DELETING`, `ERROR`, `INACTIVE`, `MIGRATING`, `PAUSED`, `REBOOT`, `REBOOTING`, `REBUILD`, `REBUILDING`, `RESCUE`, `RESCUING`, `RESIZING`, `RESTORING`, `SNAPSHOTTING`, `STARTING`, `STOPPING`, `UNRESCUING`, `UPDATING`. + Status ServerGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt ServerGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // User Data that is provided to the server. Must be base64 encoded and is passed via cloud-init to the server. + UserData ServerGetUserDataAttributeType `json:"userData,omitempty"` + // A list of UUIDs. + Volumes ServerGetVolumesAttributeType `json:"volumes,omitempty"` +} + +type _Server Server + +// NewServer instantiates a new Server 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 NewServer(machineType ServerGetMachineTypeArgType, name ServerGetNameArgType) *Server { + this := Server{} + setServerGetMachineTypeAttributeType(&this.MachineType, machineType) + setServerGetNameAttributeType(&this.Name, name) + return &this +} + +// NewServerWithDefaults instantiates a new Server 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 NewServerWithDefaults() *Server { + this := Server{} + return &this +} + +// GetAffinityGroup returns the AffinityGroup field value if set, zero value otherwise. +func (o *Server) GetAffinityGroup() (res ServerGetAffinityGroupRetType) { + res, _ = o.GetAffinityGroupOk() + return +} + +// GetAffinityGroupOk returns a tuple with the AffinityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetAffinityGroupOk() (ret ServerGetAffinityGroupRetType, ok bool) { + return getServerGetAffinityGroupAttributeTypeOk(o.AffinityGroup) +} + +// HasAffinityGroup returns a boolean if a field has been set. +func (o *Server) HasAffinityGroup() bool { + _, ok := o.GetAffinityGroupOk() + return ok +} + +// SetAffinityGroup gets a reference to the given string and assigns it to the AffinityGroup field. +func (o *Server) SetAffinityGroup(v ServerGetAffinityGroupRetType) { + setServerGetAffinityGroupAttributeType(&o.AffinityGroup, v) +} + +// GetAgent returns the Agent field value if set, zero value otherwise. +func (o *Server) GetAgent() (res ServerGetAgentRetType) { + res, _ = o.GetAgentOk() + return +} + +// GetAgentOk returns a tuple with the Agent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetAgentOk() (ret ServerGetAgentRetType, ok bool) { + return getServerGetAgentAttributeTypeOk(o.Agent) +} + +// HasAgent returns a boolean if a field has been set. +func (o *Server) HasAgent() bool { + _, ok := o.GetAgentOk() + return ok +} + +// SetAgent gets a reference to the given ServerAgent and assigns it to the Agent field. +func (o *Server) SetAgent(v ServerGetAgentRetType) { + setServerGetAgentAttributeType(&o.Agent, v) +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *Server) GetAvailabilityZone() (res ServerGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetAvailabilityZoneOk() (ret ServerGetAvailabilityZoneRetType, ok bool) { + return getServerGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *Server) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *Server) SetAvailabilityZone(v ServerGetAvailabilityZoneRetType) { + setServerGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetBootVolume returns the BootVolume field value if set, zero value otherwise. +func (o *Server) GetBootVolume() (res ServerGetBootVolumeRetType) { + res, _ = o.GetBootVolumeOk() + return +} + +// GetBootVolumeOk returns a tuple with the BootVolume field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetBootVolumeOk() (ret ServerGetBootVolumeRetType, ok bool) { + return getServerGetBootVolumeAttributeTypeOk(o.BootVolume) +} + +// HasBootVolume returns a boolean if a field has been set. +func (o *Server) HasBootVolume() bool { + _, ok := o.GetBootVolumeOk() + return ok +} + +// SetBootVolume gets a reference to the given ServerBootVolume and assigns it to the BootVolume field. +func (o *Server) SetBootVolume(v ServerGetBootVolumeRetType) { + setServerGetBootVolumeAttributeType(&o.BootVolume, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Server) GetCreatedAt() (res ServerGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetCreatedAtOk() (ret ServerGetCreatedAtRetType, ok bool) { + return getServerGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Server) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Server) SetCreatedAt(v ServerGetCreatedAtRetType) { + setServerGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *Server) GetErrorMessage() (res ServerGetErrorMessageRetType) { + res, _ = o.GetErrorMessageOk() + return +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetErrorMessageOk() (ret ServerGetErrorMessageRetType, ok bool) { + return getServerGetErrorMessageAttributeTypeOk(o.ErrorMessage) +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *Server) HasErrorMessage() bool { + _, ok := o.GetErrorMessageOk() + return ok +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *Server) SetErrorMessage(v ServerGetErrorMessageRetType) { + setServerGetErrorMessageAttributeType(&o.ErrorMessage, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Server) GetId() (res ServerGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetIdOk() (ret ServerGetIdRetType, ok bool) { + return getServerGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Server) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Server) SetId(v ServerGetIdRetType) { + setServerGetIdAttributeType(&o.Id, v) +} + +// GetImageId returns the ImageId field value if set, zero value otherwise. +func (o *Server) GetImageId() (res ServerGetImageIdRetType) { + res, _ = o.GetImageIdOk() + return +} + +// GetImageIdOk returns a tuple with the ImageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetImageIdOk() (ret ServerGetImageIdRetType, ok bool) { + return getServerGetImageIdAttributeTypeOk(o.ImageId) +} + +// HasImageId returns a boolean if a field has been set. +func (o *Server) HasImageId() bool { + _, ok := o.GetImageIdOk() + return ok +} + +// SetImageId gets a reference to the given string and assigns it to the ImageId field. +func (o *Server) SetImageId(v ServerGetImageIdRetType) { + setServerGetImageIdAttributeType(&o.ImageId, v) +} + +// GetKeypairName returns the KeypairName field value if set, zero value otherwise. +func (o *Server) GetKeypairName() (res ServerGetKeypairNameRetType) { + res, _ = o.GetKeypairNameOk() + return +} + +// GetKeypairNameOk returns a tuple with the KeypairName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetKeypairNameOk() (ret ServerGetKeypairNameRetType, ok bool) { + return getServerGetKeypairNameAttributeTypeOk(o.KeypairName) +} + +// HasKeypairName returns a boolean if a field has been set. +func (o *Server) HasKeypairName() bool { + _, ok := o.GetKeypairNameOk() + return ok +} + +// SetKeypairName gets a reference to the given string and assigns it to the KeypairName field. +func (o *Server) SetKeypairName(v ServerGetKeypairNameRetType) { + setServerGetKeypairNameAttributeType(&o.KeypairName, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Server) GetLabels() (res ServerGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetLabelsOk() (ret ServerGetLabelsRetType, ok bool) { + return getServerGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Server) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Server) SetLabels(v ServerGetLabelsRetType) { + setServerGetLabelsAttributeType(&o.Labels, v) +} + +// GetLaunchedAt returns the LaunchedAt field value if set, zero value otherwise. +func (o *Server) GetLaunchedAt() (res ServerGetLaunchedAtRetType) { + res, _ = o.GetLaunchedAtOk() + return +} + +// GetLaunchedAtOk returns a tuple with the LaunchedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetLaunchedAtOk() (ret ServerGetLaunchedAtRetType, ok bool) { + return getServerGetLaunchedAtAttributeTypeOk(o.LaunchedAt) +} + +// HasLaunchedAt returns a boolean if a field has been set. +func (o *Server) HasLaunchedAt() bool { + _, ok := o.GetLaunchedAtOk() + return ok +} + +// SetLaunchedAt gets a reference to the given time.Time and assigns it to the LaunchedAt field. +func (o *Server) SetLaunchedAt(v ServerGetLaunchedAtRetType) { + setServerGetLaunchedAtAttributeType(&o.LaunchedAt, v) +} + +// GetMachineType returns the MachineType field value +func (o *Server) GetMachineType() (ret ServerGetMachineTypeRetType) { + ret, _ = o.GetMachineTypeOk() + return ret +} + +// GetMachineTypeOk returns a tuple with the MachineType field value +// and a boolean to check if the value has been set. +func (o *Server) GetMachineTypeOk() (ret ServerGetMachineTypeRetType, ok bool) { + return getServerGetMachineTypeAttributeTypeOk(o.MachineType) +} + +// SetMachineType sets field value +func (o *Server) SetMachineType(v ServerGetMachineTypeRetType) { + setServerGetMachineTypeAttributeType(&o.MachineType, v) +} + +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *Server) GetMaintenanceWindow() (res ServerGetMaintenanceWindowRetType) { + res, _ = o.GetMaintenanceWindowOk() + return +} + +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetMaintenanceWindowOk() (ret ServerGetMaintenanceWindowRetType, ok bool) { + return getServerGetMaintenanceWindowAttributeTypeOk(o.MaintenanceWindow) +} + +// HasMaintenanceWindow returns a boolean if a field has been set. +func (o *Server) HasMaintenanceWindow() bool { + _, ok := o.GetMaintenanceWindowOk() + return ok +} + +// SetMaintenanceWindow gets a reference to the given ServerMaintenance and assigns it to the MaintenanceWindow field. +func (o *Server) SetMaintenanceWindow(v ServerGetMaintenanceWindowRetType) { + setServerGetMaintenanceWindowAttributeType(&o.MaintenanceWindow, v) +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Server) GetMetadata() (res ServerGetMetadataRetType) { + res, _ = o.GetMetadataOk() + return +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetMetadataOk() (ret ServerGetMetadataRetType, ok bool) { + return getServerGetMetadataAttributeTypeOk(o.Metadata) +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Server) HasMetadata() bool { + _, ok := o.GetMetadataOk() + return ok +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *Server) SetMetadata(v ServerGetMetadataRetType) { + setServerGetMetadataAttributeType(&o.Metadata, v) +} + +// GetName returns the Name field value +func (o *Server) GetName() (ret ServerGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Server) GetNameOk() (ret ServerGetNameRetType, ok bool) { + return getServerGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Server) SetName(v ServerGetNameRetType) { + setServerGetNameAttributeType(&o.Name, v) +} + +// GetNetworking returns the Networking field value if set, zero value otherwise. +func (o *Server) GetNetworking() (res ServerGetNetworkingRetType) { + res, _ = o.GetNetworkingOk() + return +} + +// GetNetworkingOk returns a tuple with the Networking field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetNetworkingOk() (ret ServerGetNetworkingRetType, ok bool) { + return getServerGetNetworkingAttributeTypeOk(o.Networking) +} + +// HasNetworking returns a boolean if a field has been set. +func (o *Server) HasNetworking() bool { + _, ok := o.GetNetworkingOk() + return ok +} + +// SetNetworking gets a reference to the given ServerNetworking and assigns it to the Networking field. +func (o *Server) SetNetworking(v ServerGetNetworkingRetType) { + setServerGetNetworkingAttributeType(&o.Networking, v) +} + +// GetNics returns the Nics field value if set, zero value otherwise. +func (o *Server) GetNics() (res ServerGetNicsRetType) { + res, _ = o.GetNicsOk() + return +} + +// GetNicsOk returns a tuple with the Nics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetNicsOk() (ret ServerGetNicsRetType, ok bool) { + return getServerGetNicsAttributeTypeOk(o.Nics) +} + +// HasNics returns a boolean if a field has been set. +func (o *Server) HasNics() bool { + _, ok := o.GetNicsOk() + return ok +} + +// SetNics gets a reference to the given []ServerNetwork and assigns it to the Nics field. +func (o *Server) SetNics(v ServerGetNicsRetType) { + setServerGetNicsAttributeType(&o.Nics, v) +} + +// GetPowerStatus returns the PowerStatus field value if set, zero value otherwise. +func (o *Server) GetPowerStatus() (res ServerGetPowerStatusRetType) { + res, _ = o.GetPowerStatusOk() + return +} + +// GetPowerStatusOk returns a tuple with the PowerStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetPowerStatusOk() (ret ServerGetPowerStatusRetType, ok bool) { + return getServerGetPowerStatusAttributeTypeOk(o.PowerStatus) +} + +// HasPowerStatus returns a boolean if a field has been set. +func (o *Server) HasPowerStatus() bool { + _, ok := o.GetPowerStatusOk() + return ok +} + +// SetPowerStatus gets a reference to the given string and assigns it to the PowerStatus field. +func (o *Server) SetPowerStatus(v ServerGetPowerStatusRetType) { + setServerGetPowerStatusAttributeType(&o.PowerStatus, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *Server) GetSecurityGroups() (res ServerGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// 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 *Server) GetSecurityGroupsOk() (ret ServerGetSecurityGroupsRetType, ok bool) { + return getServerGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *Server) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *Server) SetSecurityGroups(v ServerGetSecurityGroupsRetType) { + setServerGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +// GetServiceAccountMails returns the ServiceAccountMails field value if set, zero value otherwise. +func (o *Server) GetServiceAccountMails() (res ServerGetServiceAccountMailsRetType) { + res, _ = o.GetServiceAccountMailsOk() + return +} + +// GetServiceAccountMailsOk returns a tuple with the ServiceAccountMails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetServiceAccountMailsOk() (ret ServerGetServiceAccountMailsRetType, ok bool) { + return getServerGetServiceAccountMailsAttributeTypeOk(o.ServiceAccountMails) +} + +// HasServiceAccountMails returns a boolean if a field has been set. +func (o *Server) HasServiceAccountMails() bool { + _, ok := o.GetServiceAccountMailsOk() + return ok +} + +// SetServiceAccountMails gets a reference to the given []string and assigns it to the ServiceAccountMails field. +func (o *Server) SetServiceAccountMails(v ServerGetServiceAccountMailsRetType) { + setServerGetServiceAccountMailsAttributeType(&o.ServiceAccountMails, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Server) GetStatus() (res ServerGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetStatusOk() (ret ServerGetStatusRetType, ok bool) { + return getServerGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Server) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Server) SetStatus(v ServerGetStatusRetType) { + setServerGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Server) GetUpdatedAt() (res ServerGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetUpdatedAtOk() (ret ServerGetUpdatedAtRetType, ok bool) { + return getServerGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Server) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Server) SetUpdatedAt(v ServerGetUpdatedAtRetType) { + setServerGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetUserData returns the UserData field value if set, zero value otherwise. +func (o *Server) GetUserData() (res ServerGetUserDataRetType) { + res, _ = o.GetUserDataOk() + return +} + +// GetUserDataOk returns a tuple with the UserData field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetUserDataOk() (ret ServerGetUserDataRetType, ok bool) { + return getServerGetUserDataAttributeTypeOk(o.UserData) +} + +// HasUserData returns a boolean if a field has been set. +func (o *Server) HasUserData() bool { + _, ok := o.GetUserDataOk() + return ok +} + +// SetUserData gets a reference to the given string and assigns it to the UserData field. +func (o *Server) SetUserData(v ServerGetUserDataRetType) { + setServerGetUserDataAttributeType(&o.UserData, v) +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *Server) GetVolumes() (res ServerGetVolumesRetType) { + res, _ = o.GetVolumesOk() + return +} + +// 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 *Server) GetVolumesOk() (ret ServerGetVolumesRetType, ok bool) { + return getServerGetVolumesAttributeTypeOk(o.Volumes) +} + +// HasVolumes returns a boolean if a field has been set. +func (o *Server) HasVolumes() bool { + _, ok := o.GetVolumesOk() + return ok +} + +// SetVolumes gets a reference to the given []string and assigns it to the Volumes field. +func (o *Server) SetVolumes(v ServerGetVolumesRetType) { + setServerGetVolumesAttributeType(&o.Volumes, v) +} + +func (o Server) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerGetAffinityGroupAttributeTypeOk(o.AffinityGroup); ok { + toSerialize["AffinityGroup"] = val + } + if val, ok := getServerGetAgentAttributeTypeOk(o.Agent); ok { + toSerialize["Agent"] = val + } + if val, ok := getServerGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getServerGetBootVolumeAttributeTypeOk(o.BootVolume); ok { + toSerialize["BootVolume"] = val + } + if val, ok := getServerGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getServerGetErrorMessageAttributeTypeOk(o.ErrorMessage); ok { + toSerialize["ErrorMessage"] = val + } + if val, ok := getServerGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getServerGetImageIdAttributeTypeOk(o.ImageId); ok { + toSerialize["ImageId"] = val + } + if val, ok := getServerGetKeypairNameAttributeTypeOk(o.KeypairName); ok { + toSerialize["KeypairName"] = val + } + if val, ok := getServerGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getServerGetLaunchedAtAttributeTypeOk(o.LaunchedAt); ok { + toSerialize["LaunchedAt"] = val + } + if val, ok := getServerGetMachineTypeAttributeTypeOk(o.MachineType); ok { + toSerialize["MachineType"] = val + } + if val, ok := getServerGetMaintenanceWindowAttributeTypeOk(o.MaintenanceWindow); ok { + toSerialize["MaintenanceWindow"] = val + } + if val, ok := getServerGetMetadataAttributeTypeOk(o.Metadata); ok { + toSerialize["Metadata"] = val + } + if val, ok := getServerGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getServerGetNetworkingAttributeTypeOk(o.Networking); ok { + toSerialize["Networking"] = val + } + if val, ok := getServerGetNicsAttributeTypeOk(o.Nics); ok { + toSerialize["Nics"] = val + } + if val, ok := getServerGetPowerStatusAttributeTypeOk(o.PowerStatus); ok { + toSerialize["PowerStatus"] = val + } + if val, ok := getServerGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + if val, ok := getServerGetServiceAccountMailsAttributeTypeOk(o.ServiceAccountMails); ok { + toSerialize["ServiceAccountMails"] = val + } + if val, ok := getServerGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getServerGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getServerGetUserDataAttributeTypeOk(o.UserData); ok { + toSerialize["UserData"] = val + } + if val, ok := getServerGetVolumesAttributeTypeOk(o.Volumes); ok { + toSerialize["Volumes"] = val + } + return toSerialize, nil +} + +type NullableServer struct { + value *Server + isSet bool +} + +func (v NullableServer) Get() *Server { + return v.value +} + +func (v *NullableServer) Set(val *Server) { + v.value = val + v.isSet = true +} + +func (v NullableServer) IsSet() bool { + return v.isSet +} + +func (v *NullableServer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServer(val *Server) *NullableServer { + return &NullableServer{value: val, isSet: true} +} + +func (v NullableServer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_server_agent.go b/pkg/iaasbeta/model_server_agent.go new file mode 100644 index 00000000..fa31f55b --- /dev/null +++ b/pkg/iaasbeta/model_server_agent.go @@ -0,0 +1,128 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ServerAgent type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerAgent{} + +/* + types and functions for provisioned +*/ + +// isBoolean +type ServerAgentgetProvisionedAttributeType = *bool +type ServerAgentgetProvisionedArgType = bool +type ServerAgentgetProvisionedRetType = bool + +func getServerAgentgetProvisionedAttributeTypeOk(arg ServerAgentgetProvisionedAttributeType) (ret ServerAgentgetProvisionedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerAgentgetProvisionedAttributeType(arg *ServerAgentgetProvisionedAttributeType, val ServerAgentgetProvisionedRetType) { + *arg = &val +} + +// ServerAgent STACKIT server agent options for a server. +type ServerAgent struct { + // Configure the STACKIT server agent provisioning during the first boot of the server. Only works when booting from an images that supports the STACKIT server agent. When `false` the agent IS NOT installed. When `true` the agent IS installed. When its not set the result depend on the used image and its default provisioning setting. + Provisioned ServerAgentgetProvisionedAttributeType `json:"provisioned,omitempty"` +} + +// NewServerAgent instantiates a new ServerAgent 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 NewServerAgent() *ServerAgent { + this := ServerAgent{} + return &this +} + +// NewServerAgentWithDefaults instantiates a new ServerAgent 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 NewServerAgentWithDefaults() *ServerAgent { + this := ServerAgent{} + return &this +} + +// GetProvisioned returns the Provisioned field value if set, zero value otherwise. +func (o *ServerAgent) GetProvisioned() (res ServerAgentgetProvisionedRetType) { + res, _ = o.GetProvisionedOk() + return +} + +// GetProvisionedOk returns a tuple with the Provisioned field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerAgent) GetProvisionedOk() (ret ServerAgentgetProvisionedRetType, ok bool) { + return getServerAgentgetProvisionedAttributeTypeOk(o.Provisioned) +} + +// HasProvisioned returns a boolean if a field has been set. +func (o *ServerAgent) HasProvisioned() bool { + _, ok := o.GetProvisionedOk() + return ok +} + +// SetProvisioned gets a reference to the given bool and assigns it to the Provisioned field. +func (o *ServerAgent) SetProvisioned(v ServerAgentgetProvisionedRetType) { + setServerAgentgetProvisionedAttributeType(&o.Provisioned, v) +} + +func (o ServerAgent) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerAgentgetProvisionedAttributeTypeOk(o.Provisioned); ok { + toSerialize["Provisioned"] = val + } + return toSerialize, nil +} + +type NullableServerAgent struct { + value *ServerAgent + isSet bool +} + +func (v NullableServerAgent) Get() *ServerAgent { + return v.value +} + +func (v *NullableServerAgent) Set(val *ServerAgent) { + v.value = val + v.isSet = true +} + +func (v NullableServerAgent) IsSet() bool { + return v.isSet +} + +func (v *NullableServerAgent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerAgent(val *ServerAgent) *NullableServerAgent { + return &NullableServerAgent{value: val, isSet: true} +} + +func (v NullableServerAgent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerAgent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_server_agent_test.go b/pkg/iaasbeta/model_server_agent_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_server_agent_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_server_boot_volume.go b/pkg/iaasbeta/model_server_boot_volume.go new file mode 100644 index 00000000..b9fa208f --- /dev/null +++ b/pkg/iaasbeta/model_server_boot_volume.go @@ -0,0 +1,321 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ServerBootVolume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerBootVolume{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type ServerBootVolumegetDeleteOnTerminationAttributeType = *bool +type ServerBootVolumegetDeleteOnTerminationArgType = bool +type ServerBootVolumegetDeleteOnTerminationRetType = bool + +func getServerBootVolumegetDeleteOnTerminationAttributeTypeOk(arg ServerBootVolumegetDeleteOnTerminationAttributeType) (ret ServerBootVolumegetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerBootVolumegetDeleteOnTerminationAttributeType(arg *ServerBootVolumegetDeleteOnTerminationAttributeType, val ServerBootVolumegetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type ServerBootVolumeGetIdAttributeType = *string + +func getServerBootVolumeGetIdAttributeTypeOk(arg ServerBootVolumeGetIdAttributeType) (ret ServerBootVolumeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerBootVolumeGetIdAttributeType(arg *ServerBootVolumeGetIdAttributeType, val ServerBootVolumeGetIdRetType) { + *arg = &val +} + +type ServerBootVolumeGetIdArgType = string +type ServerBootVolumeGetIdRetType = string + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type ServerBootVolumeGetPerformanceClassAttributeType = *string + +func getServerBootVolumeGetPerformanceClassAttributeTypeOk(arg ServerBootVolumeGetPerformanceClassAttributeType) (ret ServerBootVolumeGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerBootVolumeGetPerformanceClassAttributeType(arg *ServerBootVolumeGetPerformanceClassAttributeType, val ServerBootVolumeGetPerformanceClassRetType) { + *arg = &val +} + +type ServerBootVolumeGetPerformanceClassArgType = string +type ServerBootVolumeGetPerformanceClassRetType = string + +/* + types and functions for size +*/ + +// isLong +type ServerBootVolumeGetSizeAttributeType = *int64 +type ServerBootVolumeGetSizeArgType = int64 +type ServerBootVolumeGetSizeRetType = int64 + +func getServerBootVolumeGetSizeAttributeTypeOk(arg ServerBootVolumeGetSizeAttributeType) (ret ServerBootVolumeGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerBootVolumeGetSizeAttributeType(arg *ServerBootVolumeGetSizeAttributeType, val ServerBootVolumeGetSizeRetType) { + *arg = &val +} + +/* + types and functions for source +*/ + +// isModel +type ServerBootVolumeGetSourceAttributeType = *BootVolumeSource +type ServerBootVolumeGetSourceArgType = BootVolumeSource +type ServerBootVolumeGetSourceRetType = BootVolumeSource + +func getServerBootVolumeGetSourceAttributeTypeOk(arg ServerBootVolumeGetSourceAttributeType) (ret ServerBootVolumeGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerBootVolumeGetSourceAttributeType(arg *ServerBootVolumeGetSourceAttributeType, val ServerBootVolumeGetSourceRetType) { + *arg = &val +} + +// ServerBootVolume struct for ServerBootVolume +type ServerBootVolume struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination ServerBootVolumegetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + Id ServerBootVolumeGetIdAttributeType `json:"id,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass ServerBootVolumeGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Size in Gigabyte. + Size ServerBootVolumeGetSizeAttributeType `json:"size,omitempty"` + Source ServerBootVolumeGetSourceAttributeType `json:"source,omitempty"` +} + +// NewServerBootVolume instantiates a new ServerBootVolume 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 NewServerBootVolume() *ServerBootVolume { + this := ServerBootVolume{} + return &this +} + +// NewServerBootVolumeWithDefaults instantiates a new ServerBootVolume 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 NewServerBootVolumeWithDefaults() *ServerBootVolume { + this := ServerBootVolume{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *ServerBootVolume) GetDeleteOnTermination() (res ServerBootVolumegetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerBootVolume) GetDeleteOnTerminationOk() (ret ServerBootVolumegetDeleteOnTerminationRetType, ok bool) { + return getServerBootVolumegetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *ServerBootVolume) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *ServerBootVolume) SetDeleteOnTermination(v ServerBootVolumegetDeleteOnTerminationRetType) { + setServerBootVolumegetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ServerBootVolume) GetId() (res ServerBootVolumeGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerBootVolume) GetIdOk() (ret ServerBootVolumeGetIdRetType, ok bool) { + return getServerBootVolumeGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *ServerBootVolume) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ServerBootVolume) SetId(v ServerBootVolumeGetIdRetType) { + setServerBootVolumeGetIdAttributeType(&o.Id, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *ServerBootVolume) GetPerformanceClass() (res ServerBootVolumeGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerBootVolume) GetPerformanceClassOk() (ret ServerBootVolumeGetPerformanceClassRetType, ok bool) { + return getServerBootVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *ServerBootVolume) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *ServerBootVolume) SetPerformanceClass(v ServerBootVolumeGetPerformanceClassRetType) { + setServerBootVolumeGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *ServerBootVolume) GetSize() (res ServerBootVolumeGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerBootVolume) GetSizeOk() (ret ServerBootVolumeGetSizeRetType, ok bool) { + return getServerBootVolumeGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *ServerBootVolume) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *ServerBootVolume) SetSize(v ServerBootVolumeGetSizeRetType) { + setServerBootVolumeGetSizeAttributeType(&o.Size, v) +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *ServerBootVolume) GetSource() (res ServerBootVolumeGetSourceRetType) { + res, _ = o.GetSourceOk() + return +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerBootVolume) GetSourceOk() (ret ServerBootVolumeGetSourceRetType, ok bool) { + return getServerBootVolumeGetSourceAttributeTypeOk(o.Source) +} + +// HasSource returns a boolean if a field has been set. +func (o *ServerBootVolume) HasSource() bool { + _, ok := o.GetSourceOk() + return ok +} + +// SetSource gets a reference to the given BootVolumeSource and assigns it to the Source field. +func (o *ServerBootVolume) SetSource(v ServerBootVolumeGetSourceRetType) { + setServerBootVolumeGetSourceAttributeType(&o.Source, v) +} + +func (o ServerBootVolume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerBootVolumegetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getServerBootVolumeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getServerBootVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getServerBootVolumeGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getServerBootVolumeGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + return toSerialize, nil +} + +type NullableServerBootVolume struct { + value *ServerBootVolume + isSet bool +} + +func (v NullableServerBootVolume) Get() *ServerBootVolume { + return v.value +} + +func (v *NullableServerBootVolume) Set(val *ServerBootVolume) { + v.value = val + v.isSet = true +} + +func (v NullableServerBootVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableServerBootVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerBootVolume(val *ServerBootVolume) *NullableServerBootVolume { + return &NullableServerBootVolume{value: val, isSet: true} +} + +func (v NullableServerBootVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerBootVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_server_boot_volume_test.go b/pkg/iaasbeta/model_server_boot_volume_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_server_boot_volume_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_server_console_url.go b/pkg/iaasbeta/model_server_console_url.go new file mode 100644 index 00000000..f7368273 --- /dev/null +++ b/pkg/iaasbeta/model_server_console_url.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ServerConsoleUrl type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerConsoleUrl{} + +/* + types and functions for url +*/ + +// isNotNullableString +type ServerConsoleUrlGetUrlAttributeType = *string + +func getServerConsoleUrlGetUrlAttributeTypeOk(arg ServerConsoleUrlGetUrlAttributeType) (ret ServerConsoleUrlGetUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerConsoleUrlGetUrlAttributeType(arg *ServerConsoleUrlGetUrlAttributeType, val ServerConsoleUrlGetUrlRetType) { + *arg = &val +} + +type ServerConsoleUrlGetUrlArgType = string +type ServerConsoleUrlGetUrlRetType = string + +// ServerConsoleUrl Object that represents a server console URL. +type ServerConsoleUrl struct { + // REQUIRED + Url ServerConsoleUrlGetUrlAttributeType `json:"url" required:"true"` +} + +type _ServerConsoleUrl ServerConsoleUrl + +// NewServerConsoleUrl instantiates a new ServerConsoleUrl 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 NewServerConsoleUrl(url ServerConsoleUrlGetUrlArgType) *ServerConsoleUrl { + this := ServerConsoleUrl{} + setServerConsoleUrlGetUrlAttributeType(&this.Url, url) + return &this +} + +// NewServerConsoleUrlWithDefaults instantiates a new ServerConsoleUrl 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 NewServerConsoleUrlWithDefaults() *ServerConsoleUrl { + this := ServerConsoleUrl{} + return &this +} + +// GetUrl returns the Url field value +func (o *ServerConsoleUrl) GetUrl() (ret ServerConsoleUrlGetUrlRetType) { + ret, _ = o.GetUrlOk() + return ret +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *ServerConsoleUrl) GetUrlOk() (ret ServerConsoleUrlGetUrlRetType, ok bool) { + return getServerConsoleUrlGetUrlAttributeTypeOk(o.Url) +} + +// SetUrl sets field value +func (o *ServerConsoleUrl) SetUrl(v ServerConsoleUrlGetUrlRetType) { + setServerConsoleUrlGetUrlAttributeType(&o.Url, v) +} + +func (o ServerConsoleUrl) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerConsoleUrlGetUrlAttributeTypeOk(o.Url); ok { + toSerialize["Url"] = val + } + return toSerialize, nil +} + +type NullableServerConsoleUrl struct { + value *ServerConsoleUrl + isSet bool +} + +func (v NullableServerConsoleUrl) Get() *ServerConsoleUrl { + return v.value +} + +func (v *NullableServerConsoleUrl) Set(val *ServerConsoleUrl) { + v.value = val + v.isSet = true +} + +func (v NullableServerConsoleUrl) IsSet() bool { + return v.isSet +} + +func (v *NullableServerConsoleUrl) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerConsoleUrl(val *ServerConsoleUrl) *NullableServerConsoleUrl { + return &NullableServerConsoleUrl{value: val, isSet: true} +} + +func (v NullableServerConsoleUrl) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerConsoleUrl) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_server_console_url_test.go b/pkg/iaasbeta/model_server_console_url_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_server_console_url_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_server_list_response.go b/pkg/iaasbeta/model_server_list_response.go new file mode 100644 index 00000000..64d5ccb6 --- /dev/null +++ b/pkg/iaasbeta/model_server_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ServerListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerListResponse{} + +/* + types and functions for items +*/ + +// isArray +type ServerListResponseGetItemsAttributeType = *[]Server +type ServerListResponseGetItemsArgType = []Server +type ServerListResponseGetItemsRetType = []Server + +func getServerListResponseGetItemsAttributeTypeOk(arg ServerListResponseGetItemsAttributeType) (ret ServerListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerListResponseGetItemsAttributeType(arg *ServerListResponseGetItemsAttributeType, val ServerListResponseGetItemsRetType) { + *arg = &val +} + +// ServerListResponse Response object for server list request. +type ServerListResponse struct { + // A list of servers. + // REQUIRED + Items ServerListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _ServerListResponse ServerListResponse + +// NewServerListResponse instantiates a new ServerListResponse 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 NewServerListResponse(items ServerListResponseGetItemsArgType) *ServerListResponse { + this := ServerListResponse{} + setServerListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewServerListResponseWithDefaults instantiates a new ServerListResponse 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 NewServerListResponseWithDefaults() *ServerListResponse { + this := ServerListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ServerListResponse) GetItems() (ret ServerListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ServerListResponse) GetItemsOk() (ret ServerListResponseGetItemsRetType, ok bool) { + return getServerListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *ServerListResponse) SetItems(v ServerListResponseGetItemsRetType) { + setServerListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o ServerListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableServerListResponse struct { + value *ServerListResponse + isSet bool +} + +func (v NullableServerListResponse) Get() *ServerListResponse { + return v.value +} + +func (v *NullableServerListResponse) Set(val *ServerListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableServerListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableServerListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerListResponse(val *ServerListResponse) *NullableServerListResponse { + return &NullableServerListResponse{value: val, isSet: true} +} + +func (v NullableServerListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_server_list_response_test.go b/pkg/iaasbeta/model_server_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_server_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_server_maintenance.go b/pkg/iaasbeta/model_server_maintenance.go new file mode 100644 index 00000000..ba9b5c24 --- /dev/null +++ b/pkg/iaasbeta/model_server_maintenance.go @@ -0,0 +1,264 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the ServerMaintenance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerMaintenance{} + +/* + types and functions for details +*/ + +// isNotNullableString +type ServerMaintenanceGetDetailsAttributeType = *string + +func getServerMaintenanceGetDetailsAttributeTypeOk(arg ServerMaintenanceGetDetailsAttributeType) (ret ServerMaintenanceGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerMaintenanceGetDetailsAttributeType(arg *ServerMaintenanceGetDetailsAttributeType, val ServerMaintenanceGetDetailsRetType) { + *arg = &val +} + +type ServerMaintenanceGetDetailsArgType = string +type ServerMaintenanceGetDetailsRetType = string + +/* + types and functions for endsAt +*/ + +// isDateTime +type ServerMaintenanceGetEndsAtAttributeType = *time.Time +type ServerMaintenanceGetEndsAtArgType = time.Time +type ServerMaintenanceGetEndsAtRetType = time.Time + +func getServerMaintenanceGetEndsAtAttributeTypeOk(arg ServerMaintenanceGetEndsAtAttributeType) (ret ServerMaintenanceGetEndsAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerMaintenanceGetEndsAtAttributeType(arg *ServerMaintenanceGetEndsAtAttributeType, val ServerMaintenanceGetEndsAtRetType) { + *arg = &val +} + +/* + types and functions for startsAt +*/ + +// isDateTime +type ServerMaintenanceGetStartsAtAttributeType = *time.Time +type ServerMaintenanceGetStartsAtArgType = time.Time +type ServerMaintenanceGetStartsAtRetType = time.Time + +func getServerMaintenanceGetStartsAtAttributeTypeOk(arg ServerMaintenanceGetStartsAtAttributeType) (ret ServerMaintenanceGetStartsAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerMaintenanceGetStartsAtAttributeType(arg *ServerMaintenanceGetStartsAtAttributeType, val ServerMaintenanceGetStartsAtRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type ServerMaintenanceGetStatusAttributeType = *string + +func getServerMaintenanceGetStatusAttributeTypeOk(arg ServerMaintenanceGetStatusAttributeType) (ret ServerMaintenanceGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerMaintenanceGetStatusAttributeType(arg *ServerMaintenanceGetStatusAttributeType, val ServerMaintenanceGetStatusRetType) { + *arg = &val +} + +type ServerMaintenanceGetStatusArgType = string +type ServerMaintenanceGetStatusRetType = string + +// ServerMaintenance Object that represents the information about the next planned server maintenance window. +type ServerMaintenance struct { + Details ServerMaintenanceGetDetailsAttributeType `json:"details,omitempty"` + // End of the maintenance window. + // REQUIRED + EndsAt ServerMaintenanceGetEndsAtAttributeType `json:"endsAt" required:"true"` + // Start of the maintenance window. + // REQUIRED + StartsAt ServerMaintenanceGetStartsAtAttributeType `json:"startsAt" required:"true"` + // Possible values: `PLANNED`, `ONGOING`. + // REQUIRED + Status ServerMaintenanceGetStatusAttributeType `json:"status" required:"true"` +} + +type _ServerMaintenance ServerMaintenance + +// NewServerMaintenance instantiates a new ServerMaintenance 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 NewServerMaintenance(endsAt ServerMaintenanceGetEndsAtArgType, startsAt ServerMaintenanceGetStartsAtArgType, status ServerMaintenanceGetStatusArgType) *ServerMaintenance { + this := ServerMaintenance{} + setServerMaintenanceGetEndsAtAttributeType(&this.EndsAt, endsAt) + setServerMaintenanceGetStartsAtAttributeType(&this.StartsAt, startsAt) + setServerMaintenanceGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewServerMaintenanceWithDefaults instantiates a new ServerMaintenance 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 NewServerMaintenanceWithDefaults() *ServerMaintenance { + this := ServerMaintenance{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *ServerMaintenance) GetDetails() (res ServerMaintenanceGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetDetailsOk() (ret ServerMaintenanceGetDetailsRetType, ok bool) { + return getServerMaintenanceGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *ServerMaintenance) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *ServerMaintenance) SetDetails(v ServerMaintenanceGetDetailsRetType) { + setServerMaintenanceGetDetailsAttributeType(&o.Details, v) +} + +// GetEndsAt returns the EndsAt field value +func (o *ServerMaintenance) GetEndsAt() (ret ServerMaintenanceGetEndsAtRetType) { + ret, _ = o.GetEndsAtOk() + return ret +} + +// GetEndsAtOk returns a tuple with the EndsAt field value +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetEndsAtOk() (ret ServerMaintenanceGetEndsAtRetType, ok bool) { + return getServerMaintenanceGetEndsAtAttributeTypeOk(o.EndsAt) +} + +// SetEndsAt sets field value +func (o *ServerMaintenance) SetEndsAt(v ServerMaintenanceGetEndsAtRetType) { + setServerMaintenanceGetEndsAtAttributeType(&o.EndsAt, v) +} + +// GetStartsAt returns the StartsAt field value +func (o *ServerMaintenance) GetStartsAt() (ret ServerMaintenanceGetStartsAtRetType) { + ret, _ = o.GetStartsAtOk() + return ret +} + +// GetStartsAtOk returns a tuple with the StartsAt field value +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetStartsAtOk() (ret ServerMaintenanceGetStartsAtRetType, ok bool) { + return getServerMaintenanceGetStartsAtAttributeTypeOk(o.StartsAt) +} + +// SetStartsAt sets field value +func (o *ServerMaintenance) SetStartsAt(v ServerMaintenanceGetStartsAtRetType) { + setServerMaintenanceGetStartsAtAttributeType(&o.StartsAt, v) +} + +// GetStatus returns the Status field value +func (o *ServerMaintenance) GetStatus() (ret ServerMaintenanceGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetStatusOk() (ret ServerMaintenanceGetStatusRetType, ok bool) { + return getServerMaintenanceGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *ServerMaintenance) SetStatus(v ServerMaintenanceGetStatusRetType) { + setServerMaintenanceGetStatusAttributeType(&o.Status, v) +} + +func (o ServerMaintenance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerMaintenanceGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getServerMaintenanceGetEndsAtAttributeTypeOk(o.EndsAt); ok { + toSerialize["EndsAt"] = val + } + if val, ok := getServerMaintenanceGetStartsAtAttributeTypeOk(o.StartsAt); ok { + toSerialize["StartsAt"] = val + } + if val, ok := getServerMaintenanceGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableServerMaintenance struct { + value *ServerMaintenance + isSet bool +} + +func (v NullableServerMaintenance) Get() *ServerMaintenance { + return v.value +} + +func (v *NullableServerMaintenance) Set(val *ServerMaintenance) { + v.value = val + v.isSet = true +} + +func (v NullableServerMaintenance) IsSet() bool { + return v.isSet +} + +func (v *NullableServerMaintenance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerMaintenance(val *ServerMaintenance) *NullableServerMaintenance { + return &NullableServerMaintenance{value: val, isSet: true} +} + +func (v NullableServerMaintenance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerMaintenance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_server_maintenance_test.go b/pkg/iaasbeta/model_server_maintenance_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_server_maintenance_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_server_network.go b/pkg/iaasbeta/model_server_network.go new file mode 100644 index 00000000..ffbbeb59 --- /dev/null +++ b/pkg/iaasbeta/model_server_network.go @@ -0,0 +1,549 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ServerNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerNetwork{} + +/* + types and functions for allowedAddresses +*/ + +// isArray +type ServerNetworkGetAllowedAddressesAttributeType = *[]AllowedAddressesInner +type ServerNetworkGetAllowedAddressesArgType = []AllowedAddressesInner +type ServerNetworkGetAllowedAddressesRetType = []AllowedAddressesInner + +func getServerNetworkGetAllowedAddressesAttributeTypeOk(arg ServerNetworkGetAllowedAddressesAttributeType) (ret ServerNetworkGetAllowedAddressesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetAllowedAddressesAttributeType(arg *ServerNetworkGetAllowedAddressesAttributeType, val ServerNetworkGetAllowedAddressesRetType) { + *arg = &val +} + +/* + types and functions for ipv4 +*/ + +// isNotNullableString +type ServerNetworkGetIpv4AttributeType = *string + +func getServerNetworkGetIpv4AttributeTypeOk(arg ServerNetworkGetIpv4AttributeType) (ret ServerNetworkGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetIpv4AttributeType(arg *ServerNetworkGetIpv4AttributeType, val ServerNetworkGetIpv4RetType) { + *arg = &val +} + +type ServerNetworkGetIpv4ArgType = string +type ServerNetworkGetIpv4RetType = string + +/* + types and functions for ipv6 +*/ + +// isNotNullableString +type ServerNetworkGetIpv6AttributeType = *string + +func getServerNetworkGetIpv6AttributeTypeOk(arg ServerNetworkGetIpv6AttributeType) (ret ServerNetworkGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetIpv6AttributeType(arg *ServerNetworkGetIpv6AttributeType, val ServerNetworkGetIpv6RetType) { + *arg = &val +} + +type ServerNetworkGetIpv6ArgType = string +type ServerNetworkGetIpv6RetType = string + +/* + types and functions for mac +*/ + +// isNotNullableString +type ServerNetworkGetMacAttributeType = *string + +func getServerNetworkGetMacAttributeTypeOk(arg ServerNetworkGetMacAttributeType) (ret ServerNetworkGetMacRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetMacAttributeType(arg *ServerNetworkGetMacAttributeType, val ServerNetworkGetMacRetType) { + *arg = &val +} + +type ServerNetworkGetMacArgType = string +type ServerNetworkGetMacRetType = string + +/* + types and functions for networkId +*/ + +// isNotNullableString +type ServerNetworkGetNetworkIdAttributeType = *string + +func getServerNetworkGetNetworkIdAttributeTypeOk(arg ServerNetworkGetNetworkIdAttributeType) (ret ServerNetworkGetNetworkIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetNetworkIdAttributeType(arg *ServerNetworkGetNetworkIdAttributeType, val ServerNetworkGetNetworkIdRetType) { + *arg = &val +} + +type ServerNetworkGetNetworkIdArgType = string +type ServerNetworkGetNetworkIdRetType = string + +/* + types and functions for networkName +*/ + +// isNotNullableString +type ServerNetworkGetNetworkNameAttributeType = *string + +func getServerNetworkGetNetworkNameAttributeTypeOk(arg ServerNetworkGetNetworkNameAttributeType) (ret ServerNetworkGetNetworkNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetNetworkNameAttributeType(arg *ServerNetworkGetNetworkNameAttributeType, val ServerNetworkGetNetworkNameRetType) { + *arg = &val +} + +type ServerNetworkGetNetworkNameArgType = string +type ServerNetworkGetNetworkNameRetType = string + +/* + types and functions for nicId +*/ + +// isNotNullableString +type ServerNetworkGetNicIdAttributeType = *string + +func getServerNetworkGetNicIdAttributeTypeOk(arg ServerNetworkGetNicIdAttributeType) (ret ServerNetworkGetNicIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetNicIdAttributeType(arg *ServerNetworkGetNicIdAttributeType, val ServerNetworkGetNicIdRetType) { + *arg = &val +} + +type ServerNetworkGetNicIdArgType = string +type ServerNetworkGetNicIdRetType = string + +/* + types and functions for nicSecurity +*/ + +// isBoolean +type ServerNetworkgetNicSecurityAttributeType = *bool +type ServerNetworkgetNicSecurityArgType = bool +type ServerNetworkgetNicSecurityRetType = bool + +func getServerNetworkgetNicSecurityAttributeTypeOk(arg ServerNetworkgetNicSecurityAttributeType) (ret ServerNetworkgetNicSecurityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkgetNicSecurityAttributeType(arg *ServerNetworkgetNicSecurityAttributeType, val ServerNetworkgetNicSecurityRetType) { + *arg = &val +} + +/* + types and functions for publicIp +*/ + +// isNotNullableString +type ServerNetworkGetPublicIpAttributeType = *string + +func getServerNetworkGetPublicIpAttributeTypeOk(arg ServerNetworkGetPublicIpAttributeType) (ret ServerNetworkGetPublicIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetPublicIpAttributeType(arg *ServerNetworkGetPublicIpAttributeType, val ServerNetworkGetPublicIpRetType) { + *arg = &val +} + +type ServerNetworkGetPublicIpArgType = string +type ServerNetworkGetPublicIpRetType = string + +/* + types and functions for securityGroups +*/ + +// isArray +type ServerNetworkGetSecurityGroupsAttributeType = *[]string +type ServerNetworkGetSecurityGroupsArgType = []string +type ServerNetworkGetSecurityGroupsRetType = []string + +func getServerNetworkGetSecurityGroupsAttributeTypeOk(arg ServerNetworkGetSecurityGroupsAttributeType) (ret ServerNetworkGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetSecurityGroupsAttributeType(arg *ServerNetworkGetSecurityGroupsAttributeType, val ServerNetworkGetSecurityGroupsRetType) { + *arg = &val +} + +// ServerNetwork Describes the object that matches servers to its networks. +type ServerNetwork struct { + // A list of IPs or CIDR notations. + AllowedAddresses ServerNetworkGetAllowedAddressesAttributeType `json:"allowedAddresses,omitempty"` + // Object that represents an IP address. + Ipv4 ServerNetworkGetIpv4AttributeType `json:"ipv4,omitempty"` + // String that represents an IPv6 address. + Ipv6 ServerNetworkGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents an MAC address. + // REQUIRED + Mac ServerNetworkGetMacAttributeType `json:"mac" required:"true"` + // Universally Unique Identifier (UUID). + // REQUIRED + NetworkId ServerNetworkGetNetworkIdAttributeType `json:"networkId" required:"true"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + NetworkName ServerNetworkGetNetworkNameAttributeType `json:"networkName" required:"true"` + // Universally Unique Identifier (UUID). + // REQUIRED + NicId ServerNetworkGetNicIdAttributeType `json:"nicId" required:"true"` + // If this is set to false, then no security groups will apply to this server network interface. + // REQUIRED + NicSecurity ServerNetworkgetNicSecurityAttributeType `json:"nicSecurity" required:"true"` + // Object that represents an IP address. + PublicIp ServerNetworkGetPublicIpAttributeType `json:"publicIp,omitempty"` + // A list of UUIDs. + SecurityGroups ServerNetworkGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` +} + +type _ServerNetwork ServerNetwork + +// NewServerNetwork instantiates a new ServerNetwork 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 NewServerNetwork(mac ServerNetworkGetMacArgType, networkId ServerNetworkGetNetworkIdArgType, networkName ServerNetworkGetNetworkNameArgType, nicId ServerNetworkGetNicIdArgType, nicSecurity ServerNetworkgetNicSecurityArgType) *ServerNetwork { + this := ServerNetwork{} + setServerNetworkGetMacAttributeType(&this.Mac, mac) + setServerNetworkGetNetworkIdAttributeType(&this.NetworkId, networkId) + setServerNetworkGetNetworkNameAttributeType(&this.NetworkName, networkName) + setServerNetworkGetNicIdAttributeType(&this.NicId, nicId) + setServerNetworkgetNicSecurityAttributeType(&this.NicSecurity, nicSecurity) + return &this +} + +// NewServerNetworkWithDefaults instantiates a new ServerNetwork 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 NewServerNetworkWithDefaults() *ServerNetwork { + this := ServerNetwork{} + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *ServerNetwork) GetAllowedAddresses() (res ServerNetworkGetAllowedAddressesRetType) { + res, _ = o.GetAllowedAddressesOk() + return +} + +// GetAllowedAddressesOk returns a tuple with the AllowedAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetAllowedAddressesOk() (ret ServerNetworkGetAllowedAddressesRetType, ok bool) { + return getServerNetworkGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses) +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *ServerNetwork) HasAllowedAddresses() bool { + _, ok := o.GetAllowedAddressesOk() + return ok +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +func (o *ServerNetwork) SetAllowedAddresses(v ServerNetworkGetAllowedAddressesRetType) { + setServerNetworkGetAllowedAddressesAttributeType(&o.AllowedAddresses, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *ServerNetwork) GetIpv4() (res ServerNetworkGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetIpv4Ok() (ret ServerNetworkGetIpv4RetType, ok bool) { + return getServerNetworkGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *ServerNetwork) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given string and assigns it to the Ipv4 field. +func (o *ServerNetwork) SetIpv4(v ServerNetworkGetIpv4RetType) { + setServerNetworkGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *ServerNetwork) GetIpv6() (res ServerNetworkGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetIpv6Ok() (ret ServerNetworkGetIpv6RetType, ok bool) { + return getServerNetworkGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *ServerNetwork) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given string and assigns it to the Ipv6 field. +func (o *ServerNetwork) SetIpv6(v ServerNetworkGetIpv6RetType) { + setServerNetworkGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetMac returns the Mac field value +func (o *ServerNetwork) GetMac() (ret ServerNetworkGetMacRetType) { + ret, _ = o.GetMacOk() + return ret +} + +// GetMacOk returns a tuple with the Mac field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetMacOk() (ret ServerNetworkGetMacRetType, ok bool) { + return getServerNetworkGetMacAttributeTypeOk(o.Mac) +} + +// SetMac sets field value +func (o *ServerNetwork) SetMac(v ServerNetworkGetMacRetType) { + setServerNetworkGetMacAttributeType(&o.Mac, v) +} + +// GetNetworkId returns the NetworkId field value +func (o *ServerNetwork) GetNetworkId() (ret ServerNetworkGetNetworkIdRetType) { + ret, _ = o.GetNetworkIdOk() + return ret +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNetworkIdOk() (ret ServerNetworkGetNetworkIdRetType, ok bool) { + return getServerNetworkGetNetworkIdAttributeTypeOk(o.NetworkId) +} + +// SetNetworkId sets field value +func (o *ServerNetwork) SetNetworkId(v ServerNetworkGetNetworkIdRetType) { + setServerNetworkGetNetworkIdAttributeType(&o.NetworkId, v) +} + +// GetNetworkName returns the NetworkName field value +func (o *ServerNetwork) GetNetworkName() (ret ServerNetworkGetNetworkNameRetType) { + ret, _ = o.GetNetworkNameOk() + return ret +} + +// GetNetworkNameOk returns a tuple with the NetworkName field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNetworkNameOk() (ret ServerNetworkGetNetworkNameRetType, ok bool) { + return getServerNetworkGetNetworkNameAttributeTypeOk(o.NetworkName) +} + +// SetNetworkName sets field value +func (o *ServerNetwork) SetNetworkName(v ServerNetworkGetNetworkNameRetType) { + setServerNetworkGetNetworkNameAttributeType(&o.NetworkName, v) +} + +// GetNicId returns the NicId field value +func (o *ServerNetwork) GetNicId() (ret ServerNetworkGetNicIdRetType) { + ret, _ = o.GetNicIdOk() + return ret +} + +// GetNicIdOk returns a tuple with the NicId field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNicIdOk() (ret ServerNetworkGetNicIdRetType, ok bool) { + return getServerNetworkGetNicIdAttributeTypeOk(o.NicId) +} + +// SetNicId sets field value +func (o *ServerNetwork) SetNicId(v ServerNetworkGetNicIdRetType) { + setServerNetworkGetNicIdAttributeType(&o.NicId, v) +} + +// GetNicSecurity returns the NicSecurity field value +func (o *ServerNetwork) GetNicSecurity() (ret ServerNetworkgetNicSecurityRetType) { + ret, _ = o.GetNicSecurityOk() + return ret +} + +// GetNicSecurityOk returns a tuple with the NicSecurity field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNicSecurityOk() (ret ServerNetworkgetNicSecurityRetType, ok bool) { + return getServerNetworkgetNicSecurityAttributeTypeOk(o.NicSecurity) +} + +// SetNicSecurity sets field value +func (o *ServerNetwork) SetNicSecurity(v ServerNetworkgetNicSecurityRetType) { + setServerNetworkgetNicSecurityAttributeType(&o.NicSecurity, v) +} + +// GetPublicIp returns the PublicIp field value if set, zero value otherwise. +func (o *ServerNetwork) GetPublicIp() (res ServerNetworkGetPublicIpRetType) { + res, _ = o.GetPublicIpOk() + return +} + +// GetPublicIpOk returns a tuple with the PublicIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetPublicIpOk() (ret ServerNetworkGetPublicIpRetType, ok bool) { + return getServerNetworkGetPublicIpAttributeTypeOk(o.PublicIp) +} + +// HasPublicIp returns a boolean if a field has been set. +func (o *ServerNetwork) HasPublicIp() bool { + _, ok := o.GetPublicIpOk() + return ok +} + +// SetPublicIp gets a reference to the given string and assigns it to the PublicIp field. +func (o *ServerNetwork) SetPublicIp(v ServerNetworkGetPublicIpRetType) { + setServerNetworkGetPublicIpAttributeType(&o.PublicIp, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *ServerNetwork) GetSecurityGroups() (res ServerNetworkGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// 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 *ServerNetwork) GetSecurityGroupsOk() (ret ServerNetworkGetSecurityGroupsRetType, ok bool) { + return getServerNetworkGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *ServerNetwork) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *ServerNetwork) SetSecurityGroups(v ServerNetworkGetSecurityGroupsRetType) { + setServerNetworkGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +func (o ServerNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerNetworkGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses); ok { + toSerialize["AllowedAddresses"] = val + } + if val, ok := getServerNetworkGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getServerNetworkGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getServerNetworkGetMacAttributeTypeOk(o.Mac); ok { + toSerialize["Mac"] = val + } + if val, ok := getServerNetworkGetNetworkIdAttributeTypeOk(o.NetworkId); ok { + toSerialize["NetworkId"] = val + } + if val, ok := getServerNetworkGetNetworkNameAttributeTypeOk(o.NetworkName); ok { + toSerialize["NetworkName"] = val + } + if val, ok := getServerNetworkGetNicIdAttributeTypeOk(o.NicId); ok { + toSerialize["NicId"] = val + } + if val, ok := getServerNetworkgetNicSecurityAttributeTypeOk(o.NicSecurity); ok { + toSerialize["NicSecurity"] = val + } + if val, ok := getServerNetworkGetPublicIpAttributeTypeOk(o.PublicIp); ok { + toSerialize["PublicIp"] = val + } + if val, ok := getServerNetworkGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + return toSerialize, nil +} + +type NullableServerNetwork struct { + value *ServerNetwork + isSet bool +} + +func (v NullableServerNetwork) Get() *ServerNetwork { + return v.value +} + +func (v *NullableServerNetwork) Set(val *ServerNetwork) { + v.value = val + v.isSet = true +} + +func (v NullableServerNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableServerNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerNetwork(val *ServerNetwork) *NullableServerNetwork { + return &NullableServerNetwork{value: val, isSet: true} +} + +func (v NullableServerNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_server_network_test.go b/pkg/iaasbeta/model_server_network_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_server_network_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_server_networking.go b/pkg/iaasbeta/model_server_networking.go new file mode 100644 index 00000000..f5b494f1 --- /dev/null +++ b/pkg/iaasbeta/model_server_networking.go @@ -0,0 +1,144 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "fmt" +) + +// ServerNetworking - The initial networking setup for the server creation. A network, a nic or nothing can be given. +type ServerNetworking struct { + CreateServerNetworking *CreateServerNetworking + CreateServerNetworkingWithNics *CreateServerNetworkingWithNics +} + +// CreateServerNetworkingAsServerNetworking is a convenience function that returns CreateServerNetworking wrapped in ServerNetworking +func CreateServerNetworkingAsServerNetworking(v *CreateServerNetworking) ServerNetworking { + return ServerNetworking{ + CreateServerNetworking: v, + } +} + +// CreateServerNetworkingWithNicsAsServerNetworking is a convenience function that returns CreateServerNetworkingWithNics wrapped in ServerNetworking +func CreateServerNetworkingWithNicsAsServerNetworking(v *CreateServerNetworkingWithNics) ServerNetworking { + return ServerNetworking{ + CreateServerNetworkingWithNics: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ServerNetworking) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateServerNetworking + dstServerNetworking1 := &ServerNetworking{} + err = json.Unmarshal(data, &dstServerNetworking1.CreateServerNetworking) + if err == nil { + jsonCreateServerNetworking, _ := json.Marshal(&dstServerNetworking1.CreateServerNetworking) + if string(jsonCreateServerNetworking) != "{}" { // empty struct + dst.CreateServerNetworking = dstServerNetworking1.CreateServerNetworking + match++ + } + } + + // try to unmarshal data into CreateServerNetworkingWithNics + dstServerNetworking2 := &ServerNetworking{} + err = json.Unmarshal(data, &dstServerNetworking2.CreateServerNetworkingWithNics) + if err == nil { + jsonCreateServerNetworkingWithNics, _ := json.Marshal(&dstServerNetworking2.CreateServerNetworkingWithNics) + if string(jsonCreateServerNetworkingWithNics) != "{}" { // empty struct + dst.CreateServerNetworkingWithNics = dstServerNetworking2.CreateServerNetworkingWithNics + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateServerNetworking = nil + dst.CreateServerNetworkingWithNics = nil + + return fmt.Errorf("data matches more than one schema in oneOf(ServerNetworking)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(ServerNetworking)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ServerNetworking) MarshalJSON() ([]byte, error) { + if src.CreateServerNetworking != nil { + return json.Marshal(&src.CreateServerNetworking) + } + + if src.CreateServerNetworkingWithNics != nil { + return json.Marshal(&src.CreateServerNetworkingWithNics) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *ServerNetworking) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateServerNetworking != nil { + return obj.CreateServerNetworking + } + + if obj.CreateServerNetworkingWithNics != nil { + return obj.CreateServerNetworkingWithNics + } + + // all schemas are nil + return nil +} + +type NullableServerNetworking struct { + value *ServerNetworking + isSet bool +} + +func (v NullableServerNetworking) Get() *ServerNetworking { + return v.value +} + +func (v *NullableServerNetworking) Set(val *ServerNetworking) { + v.value = val + v.isSet = true +} + +func (v NullableServerNetworking) IsSet() bool { + return v.isSet +} + +func (v *NullableServerNetworking) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerNetworking(val *ServerNetworking) *NullableServerNetworking { + return &NullableServerNetworking{value: val, isSet: true} +} + +func (v NullableServerNetworking) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerNetworking) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_server_networking_test.go b/pkg/iaasbeta/model_server_networking_test.go new file mode 100644 index 00000000..93968f5c --- /dev/null +++ b/pkg/iaasbeta/model_server_networking_test.go @@ -0,0 +1,43 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "testing" +) + +// isOneOf + +func TestServerNetworking_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := &ServerNetworking{} + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + marshalJson, err := v.MarshalJSON() + if err != nil { + t.Fatalf("failed marshalling ServerNetworking: %v", err) + } + if string(marshalJson) != string(tt.args.src) { + t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson) + } + }) + } +} diff --git a/pkg/iaasbeta/model_server_test.go b/pkg/iaasbeta/model_server_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_server_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_service_account_mail_list_response.go b/pkg/iaasbeta/model_service_account_mail_list_response.go new file mode 100644 index 00000000..05a720fd --- /dev/null +++ b/pkg/iaasbeta/model_service_account_mail_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the ServiceAccountMailListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServiceAccountMailListResponse{} + +/* + types and functions for items +*/ + +// isArray +type ServiceAccountMailListResponseGetItemsAttributeType = *[]string +type ServiceAccountMailListResponseGetItemsArgType = []string +type ServiceAccountMailListResponseGetItemsRetType = []string + +func getServiceAccountMailListResponseGetItemsAttributeTypeOk(arg ServiceAccountMailListResponseGetItemsAttributeType) (ret ServiceAccountMailListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServiceAccountMailListResponseGetItemsAttributeType(arg *ServiceAccountMailListResponseGetItemsAttributeType, val ServiceAccountMailListResponseGetItemsRetType) { + *arg = &val +} + +// ServiceAccountMailListResponse Service account mail list response. +type ServiceAccountMailListResponse struct { + // A list of service account mails. + // REQUIRED + Items ServiceAccountMailListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _ServiceAccountMailListResponse ServiceAccountMailListResponse + +// NewServiceAccountMailListResponse instantiates a new ServiceAccountMailListResponse 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 NewServiceAccountMailListResponse(items ServiceAccountMailListResponseGetItemsArgType) *ServiceAccountMailListResponse { + this := ServiceAccountMailListResponse{} + setServiceAccountMailListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewServiceAccountMailListResponseWithDefaults instantiates a new ServiceAccountMailListResponse 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 NewServiceAccountMailListResponseWithDefaults() *ServiceAccountMailListResponse { + this := ServiceAccountMailListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ServiceAccountMailListResponse) GetItems() (ret ServiceAccountMailListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ServiceAccountMailListResponse) GetItemsOk() (ret ServiceAccountMailListResponseGetItemsRetType, ok bool) { + return getServiceAccountMailListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *ServiceAccountMailListResponse) SetItems(v ServiceAccountMailListResponseGetItemsRetType) { + setServiceAccountMailListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o ServiceAccountMailListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServiceAccountMailListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableServiceAccountMailListResponse struct { + value *ServiceAccountMailListResponse + isSet bool +} + +func (v NullableServiceAccountMailListResponse) Get() *ServiceAccountMailListResponse { + return v.value +} + +func (v *NullableServiceAccountMailListResponse) Set(val *ServiceAccountMailListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableServiceAccountMailListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceAccountMailListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceAccountMailListResponse(val *ServiceAccountMailListResponse) *NullableServiceAccountMailListResponse { + return &NullableServiceAccountMailListResponse{value: val, isSet: true} +} + +func (v NullableServiceAccountMailListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceAccountMailListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_service_account_mail_list_response_test.go b/pkg/iaasbeta/model_service_account_mail_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_service_account_mail_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_set_image_share_payload.go b/pkg/iaasbeta/model_set_image_share_payload.go new file mode 100644 index 00000000..70fb99ee --- /dev/null +++ b/pkg/iaasbeta/model_set_image_share_payload.go @@ -0,0 +1,176 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the SetImageSharePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SetImageSharePayload{} + +/* + types and functions for parentOrganization +*/ + +// isBoolean +type SetImageSharePayloadgetParentOrganizationAttributeType = *bool +type SetImageSharePayloadgetParentOrganizationArgType = bool +type SetImageSharePayloadgetParentOrganizationRetType = bool + +func getSetImageSharePayloadgetParentOrganizationAttributeTypeOk(arg SetImageSharePayloadgetParentOrganizationAttributeType) (ret SetImageSharePayloadgetParentOrganizationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSetImageSharePayloadgetParentOrganizationAttributeType(arg *SetImageSharePayloadgetParentOrganizationAttributeType, val SetImageSharePayloadgetParentOrganizationRetType) { + *arg = &val +} + +/* + types and functions for projects +*/ + +// isArray +type SetImageSharePayloadGetProjectsAttributeType = *[]string +type SetImageSharePayloadGetProjectsArgType = []string +type SetImageSharePayloadGetProjectsRetType = []string + +func getSetImageSharePayloadGetProjectsAttributeTypeOk(arg SetImageSharePayloadGetProjectsAttributeType) (ret SetImageSharePayloadGetProjectsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSetImageSharePayloadGetProjectsAttributeType(arg *SetImageSharePayloadGetProjectsAttributeType, val SetImageSharePayloadGetProjectsRetType) { + *arg = &val +} + +// SetImageSharePayload Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. +type SetImageSharePayload struct { + // Image is shared with all projects inside the image owners organization. + ParentOrganization SetImageSharePayloadgetParentOrganizationAttributeType `json:"parentOrganization,omitempty"` + // List of all projects the Image is shared with. + Projects SetImageSharePayloadGetProjectsAttributeType `json:"projects,omitempty"` +} + +// NewSetImageSharePayload instantiates a new SetImageSharePayload 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 NewSetImageSharePayload() *SetImageSharePayload { + this := SetImageSharePayload{} + return &this +} + +// NewSetImageSharePayloadWithDefaults instantiates a new SetImageSharePayload 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 NewSetImageSharePayloadWithDefaults() *SetImageSharePayload { + this := SetImageSharePayload{} + return &this +} + +// GetParentOrganization returns the ParentOrganization field value if set, zero value otherwise. +func (o *SetImageSharePayload) GetParentOrganization() (res SetImageSharePayloadgetParentOrganizationRetType) { + res, _ = o.GetParentOrganizationOk() + return +} + +// GetParentOrganizationOk returns a tuple with the ParentOrganization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SetImageSharePayload) GetParentOrganizationOk() (ret SetImageSharePayloadgetParentOrganizationRetType, ok bool) { + return getSetImageSharePayloadgetParentOrganizationAttributeTypeOk(o.ParentOrganization) +} + +// HasParentOrganization returns a boolean if a field has been set. +func (o *SetImageSharePayload) HasParentOrganization() bool { + _, ok := o.GetParentOrganizationOk() + return ok +} + +// SetParentOrganization gets a reference to the given bool and assigns it to the ParentOrganization field. +func (o *SetImageSharePayload) SetParentOrganization(v SetImageSharePayloadgetParentOrganizationRetType) { + setSetImageSharePayloadgetParentOrganizationAttributeType(&o.ParentOrganization, v) +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *SetImageSharePayload) GetProjects() (res SetImageSharePayloadGetProjectsRetType) { + res, _ = o.GetProjectsOk() + return +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SetImageSharePayload) GetProjectsOk() (ret SetImageSharePayloadGetProjectsRetType, ok bool) { + return getSetImageSharePayloadGetProjectsAttributeTypeOk(o.Projects) +} + +// HasProjects returns a boolean if a field has been set. +func (o *SetImageSharePayload) HasProjects() bool { + _, ok := o.GetProjectsOk() + return ok +} + +// SetProjects gets a reference to the given []string and assigns it to the Projects field. +func (o *SetImageSharePayload) SetProjects(v SetImageSharePayloadGetProjectsRetType) { + setSetImageSharePayloadGetProjectsAttributeType(&o.Projects, v) +} + +func (o SetImageSharePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSetImageSharePayloadgetParentOrganizationAttributeTypeOk(o.ParentOrganization); ok { + toSerialize["ParentOrganization"] = val + } + if val, ok := getSetImageSharePayloadGetProjectsAttributeTypeOk(o.Projects); ok { + toSerialize["Projects"] = val + } + return toSerialize, nil +} + +type NullableSetImageSharePayload struct { + value *SetImageSharePayload + isSet bool +} + +func (v NullableSetImageSharePayload) Get() *SetImageSharePayload { + return v.value +} + +func (v *NullableSetImageSharePayload) Set(val *SetImageSharePayload) { + v.value = val + v.isSet = true +} + +func (v NullableSetImageSharePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableSetImageSharePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSetImageSharePayload(val *SetImageSharePayload) *NullableSetImageSharePayload { + return &NullableSetImageSharePayload{value: val, isSet: true} +} + +func (v NullableSetImageSharePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSetImageSharePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_set_image_share_payload_test.go b/pkg/iaasbeta/model_set_image_share_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_set_image_share_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_snapshot.go b/pkg/iaasbeta/model_snapshot.go new file mode 100644 index 00000000..c23efc30 --- /dev/null +++ b/pkg/iaasbeta/model_snapshot.go @@ -0,0 +1,467 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Snapshot type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Snapshot{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type SnapshotGetCreatedAtAttributeType = *time.Time +type SnapshotGetCreatedAtArgType = time.Time +type SnapshotGetCreatedAtRetType = time.Time + +func getSnapshotGetCreatedAtAttributeTypeOk(arg SnapshotGetCreatedAtAttributeType) (ret SnapshotGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetCreatedAtAttributeType(arg *SnapshotGetCreatedAtAttributeType, val SnapshotGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type SnapshotGetIdAttributeType = *string + +func getSnapshotGetIdAttributeTypeOk(arg SnapshotGetIdAttributeType) (ret SnapshotGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetIdAttributeType(arg *SnapshotGetIdAttributeType, val SnapshotGetIdRetType) { + *arg = &val +} + +type SnapshotGetIdArgType = string +type SnapshotGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type SnapshotGetLabelsAttributeType = *map[string]interface{} +type SnapshotGetLabelsArgType = map[string]interface{} +type SnapshotGetLabelsRetType = map[string]interface{} + +func getSnapshotGetLabelsAttributeTypeOk(arg SnapshotGetLabelsAttributeType) (ret SnapshotGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetLabelsAttributeType(arg *SnapshotGetLabelsAttributeType, val SnapshotGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type SnapshotGetNameAttributeType = *string + +func getSnapshotGetNameAttributeTypeOk(arg SnapshotGetNameAttributeType) (ret SnapshotGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetNameAttributeType(arg *SnapshotGetNameAttributeType, val SnapshotGetNameRetType) { + *arg = &val +} + +type SnapshotGetNameArgType = string +type SnapshotGetNameRetType = string + +/* + types and functions for size +*/ + +// isLong +type SnapshotGetSizeAttributeType = *int64 +type SnapshotGetSizeArgType = int64 +type SnapshotGetSizeRetType = int64 + +func getSnapshotGetSizeAttributeTypeOk(arg SnapshotGetSizeAttributeType) (ret SnapshotGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetSizeAttributeType(arg *SnapshotGetSizeAttributeType, val SnapshotGetSizeRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type SnapshotGetStatusAttributeType = *string + +func getSnapshotGetStatusAttributeTypeOk(arg SnapshotGetStatusAttributeType) (ret SnapshotGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetStatusAttributeType(arg *SnapshotGetStatusAttributeType, val SnapshotGetStatusRetType) { + *arg = &val +} + +type SnapshotGetStatusArgType = string +type SnapshotGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type SnapshotGetUpdatedAtAttributeType = *time.Time +type SnapshotGetUpdatedAtArgType = time.Time +type SnapshotGetUpdatedAtRetType = time.Time + +func getSnapshotGetUpdatedAtAttributeTypeOk(arg SnapshotGetUpdatedAtAttributeType) (ret SnapshotGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetUpdatedAtAttributeType(arg *SnapshotGetUpdatedAtAttributeType, val SnapshotGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type SnapshotGetVolumeIdAttributeType = *string + +func getSnapshotGetVolumeIdAttributeTypeOk(arg SnapshotGetVolumeIdAttributeType) (ret SnapshotGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetVolumeIdAttributeType(arg *SnapshotGetVolumeIdAttributeType, val SnapshotGetVolumeIdRetType) { + *arg = &val +} + +type SnapshotGetVolumeIdArgType = string +type SnapshotGetVolumeIdRetType = string + +// Snapshot Object that represents a snapshot. +type Snapshot struct { + // Date-time when resource was created. + CreatedAt SnapshotGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id SnapshotGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels SnapshotGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name SnapshotGetNameAttributeType `json:"name,omitempty"` + // Size in Gigabyte. + Size SnapshotGetSizeAttributeType `json:"size,omitempty"` + // The status of a snapshot object. Possible values: `AVAILABLE`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`, `UNMANAGING`, `UPDATING`. + Status SnapshotGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt SnapshotGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + VolumeId SnapshotGetVolumeIdAttributeType `json:"volumeId" required:"true"` +} + +type _Snapshot Snapshot + +// NewSnapshot instantiates a new Snapshot 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 NewSnapshot(volumeId SnapshotGetVolumeIdArgType) *Snapshot { + this := Snapshot{} + setSnapshotGetVolumeIdAttributeType(&this.VolumeId, volumeId) + return &this +} + +// NewSnapshotWithDefaults instantiates a new Snapshot 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 NewSnapshotWithDefaults() *Snapshot { + this := Snapshot{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Snapshot) GetCreatedAt() (res SnapshotGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetCreatedAtOk() (ret SnapshotGetCreatedAtRetType, ok bool) { + return getSnapshotGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Snapshot) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Snapshot) SetCreatedAt(v SnapshotGetCreatedAtRetType) { + setSnapshotGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Snapshot) GetId() (res SnapshotGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetIdOk() (ret SnapshotGetIdRetType, ok bool) { + return getSnapshotGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Snapshot) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Snapshot) SetId(v SnapshotGetIdRetType) { + setSnapshotGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Snapshot) GetLabels() (res SnapshotGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetLabelsOk() (ret SnapshotGetLabelsRetType, ok bool) { + return getSnapshotGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Snapshot) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Snapshot) SetLabels(v SnapshotGetLabelsRetType) { + setSnapshotGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Snapshot) GetName() (res SnapshotGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetNameOk() (ret SnapshotGetNameRetType, ok bool) { + return getSnapshotGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Snapshot) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Snapshot) SetName(v SnapshotGetNameRetType) { + setSnapshotGetNameAttributeType(&o.Name, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Snapshot) GetSize() (res SnapshotGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetSizeOk() (ret SnapshotGetSizeRetType, ok bool) { + return getSnapshotGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *Snapshot) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Snapshot) SetSize(v SnapshotGetSizeRetType) { + setSnapshotGetSizeAttributeType(&o.Size, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Snapshot) GetStatus() (res SnapshotGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetStatusOk() (ret SnapshotGetStatusRetType, ok bool) { + return getSnapshotGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Snapshot) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Snapshot) SetStatus(v SnapshotGetStatusRetType) { + setSnapshotGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Snapshot) GetUpdatedAt() (res SnapshotGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetUpdatedAtOk() (ret SnapshotGetUpdatedAtRetType, ok bool) { + return getSnapshotGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Snapshot) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Snapshot) SetUpdatedAt(v SnapshotGetUpdatedAtRetType) { + setSnapshotGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetVolumeId returns the VolumeId field value +func (o *Snapshot) GetVolumeId() (ret SnapshotGetVolumeIdRetType) { + ret, _ = o.GetVolumeIdOk() + return ret +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value +// and a boolean to check if the value has been set. +func (o *Snapshot) GetVolumeIdOk() (ret SnapshotGetVolumeIdRetType, ok bool) { + return getSnapshotGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// SetVolumeId sets field value +func (o *Snapshot) SetVolumeId(v SnapshotGetVolumeIdRetType) { + setSnapshotGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o Snapshot) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSnapshotGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getSnapshotGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getSnapshotGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getSnapshotGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getSnapshotGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getSnapshotGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getSnapshotGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getSnapshotGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableSnapshot struct { + value *Snapshot + isSet bool +} + +func (v NullableSnapshot) Get() *Snapshot { + return v.value +} + +func (v *NullableSnapshot) Set(val *Snapshot) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshot) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshot) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshot(val *Snapshot) *NullableSnapshot { + return &NullableSnapshot{value: val, isSet: true} +} + +func (v NullableSnapshot) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshot) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_snapshot_list_response.go b/pkg/iaasbeta/model_snapshot_list_response.go new file mode 100644 index 00000000..a10e71e4 --- /dev/null +++ b/pkg/iaasbeta/model_snapshot_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the SnapshotListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SnapshotListResponse{} + +/* + types and functions for items +*/ + +// isArray +type SnapshotListResponseGetItemsAttributeType = *[]Snapshot +type SnapshotListResponseGetItemsArgType = []Snapshot +type SnapshotListResponseGetItemsRetType = []Snapshot + +func getSnapshotListResponseGetItemsAttributeTypeOk(arg SnapshotListResponseGetItemsAttributeType) (ret SnapshotListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotListResponseGetItemsAttributeType(arg *SnapshotListResponseGetItemsAttributeType, val SnapshotListResponseGetItemsRetType) { + *arg = &val +} + +// SnapshotListResponse Snapshot list response. +type SnapshotListResponse struct { + // A list containing snapshot objects. + // REQUIRED + Items SnapshotListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _SnapshotListResponse SnapshotListResponse + +// NewSnapshotListResponse instantiates a new SnapshotListResponse 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 NewSnapshotListResponse(items SnapshotListResponseGetItemsArgType) *SnapshotListResponse { + this := SnapshotListResponse{} + setSnapshotListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewSnapshotListResponseWithDefaults instantiates a new SnapshotListResponse 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 NewSnapshotListResponseWithDefaults() *SnapshotListResponse { + this := SnapshotListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *SnapshotListResponse) GetItems() (ret SnapshotListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *SnapshotListResponse) GetItemsOk() (ret SnapshotListResponseGetItemsRetType, ok bool) { + return getSnapshotListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *SnapshotListResponse) SetItems(v SnapshotListResponseGetItemsRetType) { + setSnapshotListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o SnapshotListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSnapshotListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableSnapshotListResponse struct { + value *SnapshotListResponse + isSet bool +} + +func (v NullableSnapshotListResponse) Get() *SnapshotListResponse { + return v.value +} + +func (v *NullableSnapshotListResponse) Set(val *SnapshotListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotListResponse(val *SnapshotListResponse) *NullableSnapshotListResponse { + return &NullableSnapshotListResponse{value: val, isSet: true} +} + +func (v NullableSnapshotListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_snapshot_list_response_test.go b/pkg/iaasbeta/model_snapshot_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_snapshot_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_snapshot_test.go b/pkg/iaasbeta/model_snapshot_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_snapshot_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_static_area_id.go b/pkg/iaasbeta/model_static_area_id.go new file mode 100644 index 00000000..ddce05f8 --- /dev/null +++ b/pkg/iaasbeta/model_static_area_id.go @@ -0,0 +1,115 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "fmt" +) + +// StaticAreaID The identifier (ID) of a static area. +type StaticAreaID string + +// List of StaticAreaID +const ( + STATICAREAID_PUBLIC StaticAreaID = "PUBLIC" + STATICAREAID_SCHWARZ StaticAreaID = "SCHWARZ" +) + +// All allowed values of StaticAreaID enum +var AllowedStaticAreaIDEnumValues = []StaticAreaID{ + "PUBLIC", + "SCHWARZ", +} + +func (v *StaticAreaID) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := StaticAreaID(value) + for _, existing := range AllowedStaticAreaIDEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid StaticAreaID", value) +} + +// NewStaticAreaIDFromValue returns a pointer to a valid StaticAreaID +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewStaticAreaIDFromValue(v string) (*StaticAreaID, error) { + ev := StaticAreaID(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for StaticAreaID: valid values are %v", v, AllowedStaticAreaIDEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v StaticAreaID) IsValid() bool { + for _, existing := range AllowedStaticAreaIDEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StaticAreaID value +func (v StaticAreaID) Ptr() *StaticAreaID { + return &v +} + +type NullableStaticAreaID struct { + value *StaticAreaID + isSet bool +} + +func (v NullableStaticAreaID) Get() *StaticAreaID { + return v.value +} + +func (v *NullableStaticAreaID) Set(val *StaticAreaID) { + v.value = val + v.isSet = true +} + +func (v NullableStaticAreaID) IsSet() bool { + return v.isSet +} + +func (v *NullableStaticAreaID) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStaticAreaID(val *StaticAreaID) *NullableStaticAreaID { + return &NullableStaticAreaID{value: val, isSet: true} +} + +func (v NullableStaticAreaID) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStaticAreaID) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_static_area_id_test.go b/pkg/iaasbeta/model_static_area_id_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_static_area_id_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_attached_volume_payload.go b/pkg/iaasbeta/model_update_attached_volume_payload.go new file mode 100644 index 00000000..ba6cb4e3 --- /dev/null +++ b/pkg/iaasbeta/model_update_attached_volume_payload.go @@ -0,0 +1,226 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateAttachedVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAttachedVolumePayload{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type UpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType = *bool +type UpdateAttachedVolumePayloadgetDeleteOnTerminationArgType = bool +type UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType = bool + +func getUpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeTypeOk(arg UpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType) (ret UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType(arg *UpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType, val UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for serverId +*/ + +// isNotNullableString +type UpdateAttachedVolumePayloadGetServerIdAttributeType = *string + +func getUpdateAttachedVolumePayloadGetServerIdAttributeTypeOk(arg UpdateAttachedVolumePayloadGetServerIdAttributeType) (ret UpdateAttachedVolumePayloadGetServerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAttachedVolumePayloadGetServerIdAttributeType(arg *UpdateAttachedVolumePayloadGetServerIdAttributeType, val UpdateAttachedVolumePayloadGetServerIdRetType) { + *arg = &val +} + +type UpdateAttachedVolumePayloadGetServerIdArgType = string +type UpdateAttachedVolumePayloadGetServerIdRetType = string + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type UpdateAttachedVolumePayloadGetVolumeIdAttributeType = *string + +func getUpdateAttachedVolumePayloadGetVolumeIdAttributeTypeOk(arg UpdateAttachedVolumePayloadGetVolumeIdAttributeType) (ret UpdateAttachedVolumePayloadGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAttachedVolumePayloadGetVolumeIdAttributeType(arg *UpdateAttachedVolumePayloadGetVolumeIdAttributeType, val UpdateAttachedVolumePayloadGetVolumeIdRetType) { + *arg = &val +} + +type UpdateAttachedVolumePayloadGetVolumeIdArgType = string +type UpdateAttachedVolumePayloadGetVolumeIdRetType = string + +// UpdateAttachedVolumePayload Object that represents a Volume attachment to a server. +type UpdateAttachedVolumePayload struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination UpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + ServerId UpdateAttachedVolumePayloadGetServerIdAttributeType `json:"serverId,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId UpdateAttachedVolumePayloadGetVolumeIdAttributeType `json:"volumeId,omitempty"` +} + +// NewUpdateAttachedVolumePayload instantiates a new UpdateAttachedVolumePayload 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 NewUpdateAttachedVolumePayload() *UpdateAttachedVolumePayload { + this := UpdateAttachedVolumePayload{} + return &this +} + +// NewUpdateAttachedVolumePayloadWithDefaults instantiates a new UpdateAttachedVolumePayload 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 NewUpdateAttachedVolumePayloadWithDefaults() *UpdateAttachedVolumePayload { + this := UpdateAttachedVolumePayload{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *UpdateAttachedVolumePayload) GetDeleteOnTermination() (res UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAttachedVolumePayload) GetDeleteOnTerminationOk() (ret UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType, ok bool) { + return getUpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *UpdateAttachedVolumePayload) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *UpdateAttachedVolumePayload) SetDeleteOnTermination(v UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType) { + setUpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *UpdateAttachedVolumePayload) GetServerId() (res UpdateAttachedVolumePayloadGetServerIdRetType) { + res, _ = o.GetServerIdOk() + return +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAttachedVolumePayload) GetServerIdOk() (ret UpdateAttachedVolumePayloadGetServerIdRetType, ok bool) { + return getUpdateAttachedVolumePayloadGetServerIdAttributeTypeOk(o.ServerId) +} + +// HasServerId returns a boolean if a field has been set. +func (o *UpdateAttachedVolumePayload) HasServerId() bool { + _, ok := o.GetServerIdOk() + return ok +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *UpdateAttachedVolumePayload) SetServerId(v UpdateAttachedVolumePayloadGetServerIdRetType) { + setUpdateAttachedVolumePayloadGetServerIdAttributeType(&o.ServerId, v) +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *UpdateAttachedVolumePayload) GetVolumeId() (res UpdateAttachedVolumePayloadGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAttachedVolumePayload) GetVolumeIdOk() (ret UpdateAttachedVolumePayloadGetVolumeIdRetType, ok bool) { + return getUpdateAttachedVolumePayloadGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *UpdateAttachedVolumePayload) HasVolumeId() bool { + _, ok := o.GetVolumeIdOk() + return ok +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *UpdateAttachedVolumePayload) SetVolumeId(v UpdateAttachedVolumePayloadGetVolumeIdRetType) { + setUpdateAttachedVolumePayloadGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o UpdateAttachedVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getUpdateAttachedVolumePayloadGetServerIdAttributeTypeOk(o.ServerId); ok { + toSerialize["ServerId"] = val + } + if val, ok := getUpdateAttachedVolumePayloadGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableUpdateAttachedVolumePayload struct { + value *UpdateAttachedVolumePayload + isSet bool +} + +func (v NullableUpdateAttachedVolumePayload) Get() *UpdateAttachedVolumePayload { + return v.value +} + +func (v *NullableUpdateAttachedVolumePayload) Set(val *UpdateAttachedVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAttachedVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAttachedVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAttachedVolumePayload(val *UpdateAttachedVolumePayload) *NullableUpdateAttachedVolumePayload { + return &NullableUpdateAttachedVolumePayload{value: val, isSet: true} +} + +func (v NullableUpdateAttachedVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAttachedVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_attached_volume_payload_test.go b/pkg/iaasbeta/model_update_attached_volume_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_attached_volume_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_image_payload.go b/pkg/iaasbeta/model_update_image_payload.go new file mode 100644 index 00000000..28b32731 --- /dev/null +++ b/pkg/iaasbeta/model_update_image_payload.go @@ -0,0 +1,464 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateImagePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateImagePayload{} + +/* + types and functions for agent +*/ + +// isModel +type UpdateImagePayloadGetAgentAttributeType = *ImageAgent +type UpdateImagePayloadGetAgentArgType = ImageAgent +type UpdateImagePayloadGetAgentRetType = ImageAgent + +func getUpdateImagePayloadGetAgentAttributeTypeOk(arg UpdateImagePayloadGetAgentAttributeType) (ret UpdateImagePayloadGetAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetAgentAttributeType(arg *UpdateImagePayloadGetAgentAttributeType, val UpdateImagePayloadGetAgentRetType) { + *arg = &val +} + +/* + types and functions for config +*/ + +// isModel +type UpdateImagePayloadGetConfigAttributeType = *ImageConfig +type UpdateImagePayloadGetConfigArgType = ImageConfig +type UpdateImagePayloadGetConfigRetType = ImageConfig + +func getUpdateImagePayloadGetConfigAttributeTypeOk(arg UpdateImagePayloadGetConfigAttributeType) (ret UpdateImagePayloadGetConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetConfigAttributeType(arg *UpdateImagePayloadGetConfigAttributeType, val UpdateImagePayloadGetConfigRetType) { + *arg = &val +} + +/* + types and functions for diskFormat +*/ + +// isNotNullableString +type UpdateImagePayloadGetDiskFormatAttributeType = *string + +func getUpdateImagePayloadGetDiskFormatAttributeTypeOk(arg UpdateImagePayloadGetDiskFormatAttributeType) (ret UpdateImagePayloadGetDiskFormatRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetDiskFormatAttributeType(arg *UpdateImagePayloadGetDiskFormatAttributeType, val UpdateImagePayloadGetDiskFormatRetType) { + *arg = &val +} + +type UpdateImagePayloadGetDiskFormatArgType = string +type UpdateImagePayloadGetDiskFormatRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateImagePayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateImagePayloadGetLabelsArgType = map[string]interface{} +type UpdateImagePayloadGetLabelsRetType = map[string]interface{} + +func getUpdateImagePayloadGetLabelsAttributeTypeOk(arg UpdateImagePayloadGetLabelsAttributeType) (ret UpdateImagePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetLabelsAttributeType(arg *UpdateImagePayloadGetLabelsAttributeType, val UpdateImagePayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for minDiskSize +*/ + +// isLong +type UpdateImagePayloadGetMinDiskSizeAttributeType = *int64 +type UpdateImagePayloadGetMinDiskSizeArgType = int64 +type UpdateImagePayloadGetMinDiskSizeRetType = int64 + +func getUpdateImagePayloadGetMinDiskSizeAttributeTypeOk(arg UpdateImagePayloadGetMinDiskSizeAttributeType) (ret UpdateImagePayloadGetMinDiskSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetMinDiskSizeAttributeType(arg *UpdateImagePayloadGetMinDiskSizeAttributeType, val UpdateImagePayloadGetMinDiskSizeRetType) { + *arg = &val +} + +/* + types and functions for minRam +*/ + +// isLong +type UpdateImagePayloadGetMinRamAttributeType = *int64 +type UpdateImagePayloadGetMinRamArgType = int64 +type UpdateImagePayloadGetMinRamRetType = int64 + +func getUpdateImagePayloadGetMinRamAttributeTypeOk(arg UpdateImagePayloadGetMinRamAttributeType) (ret UpdateImagePayloadGetMinRamRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetMinRamAttributeType(arg *UpdateImagePayloadGetMinRamAttributeType, val UpdateImagePayloadGetMinRamRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateImagePayloadGetNameAttributeType = *string + +func getUpdateImagePayloadGetNameAttributeTypeOk(arg UpdateImagePayloadGetNameAttributeType) (ret UpdateImagePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetNameAttributeType(arg *UpdateImagePayloadGetNameAttributeType, val UpdateImagePayloadGetNameRetType) { + *arg = &val +} + +type UpdateImagePayloadGetNameArgType = string +type UpdateImagePayloadGetNameRetType = string + +/* + types and functions for protected +*/ + +// isBoolean +type UpdateImagePayloadgetProtectedAttributeType = *bool +type UpdateImagePayloadgetProtectedArgType = bool +type UpdateImagePayloadgetProtectedRetType = bool + +func getUpdateImagePayloadgetProtectedAttributeTypeOk(arg UpdateImagePayloadgetProtectedAttributeType) (ret UpdateImagePayloadgetProtectedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadgetProtectedAttributeType(arg *UpdateImagePayloadgetProtectedAttributeType, val UpdateImagePayloadgetProtectedRetType) { + *arg = &val +} + +// UpdateImagePayload Object that represents an update request body of an Image. +type UpdateImagePayload struct { + Agent UpdateImagePayloadGetAgentAttributeType `json:"agent,omitempty"` + Config UpdateImagePayloadGetConfigAttributeType `json:"config,omitempty"` + // Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`. + DiskFormat UpdateImagePayloadGetDiskFormatAttributeType `json:"diskFormat,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateImagePayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize UpdateImagePayloadGetMinDiskSizeAttributeType `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam UpdateImagePayloadGetMinRamAttributeType `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateImagePayloadGetNameAttributeType `json:"name,omitempty"` + // When true the image is prevented from being deleted. + Protected UpdateImagePayloadgetProtectedAttributeType `json:"protected,omitempty"` +} + +// NewUpdateImagePayload instantiates a new UpdateImagePayload 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 NewUpdateImagePayload() *UpdateImagePayload { + this := UpdateImagePayload{} + return &this +} + +// NewUpdateImagePayloadWithDefaults instantiates a new UpdateImagePayload 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 NewUpdateImagePayloadWithDefaults() *UpdateImagePayload { + this := UpdateImagePayload{} + return &this +} + +// GetAgent returns the Agent field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetAgent() (res UpdateImagePayloadGetAgentRetType) { + res, _ = o.GetAgentOk() + return +} + +// GetAgentOk returns a tuple with the Agent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetAgentOk() (ret UpdateImagePayloadGetAgentRetType, ok bool) { + return getUpdateImagePayloadGetAgentAttributeTypeOk(o.Agent) +} + +// HasAgent returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasAgent() bool { + _, ok := o.GetAgentOk() + return ok +} + +// SetAgent gets a reference to the given ImageAgent and assigns it to the Agent field. +func (o *UpdateImagePayload) SetAgent(v UpdateImagePayloadGetAgentRetType) { + setUpdateImagePayloadGetAgentAttributeType(&o.Agent, v) +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetConfig() (res UpdateImagePayloadGetConfigRetType) { + res, _ = o.GetConfigOk() + return +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetConfigOk() (ret UpdateImagePayloadGetConfigRetType, ok bool) { + return getUpdateImagePayloadGetConfigAttributeTypeOk(o.Config) +} + +// HasConfig returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasConfig() bool { + _, ok := o.GetConfigOk() + return ok +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *UpdateImagePayload) SetConfig(v UpdateImagePayloadGetConfigRetType) { + setUpdateImagePayloadGetConfigAttributeType(&o.Config, v) +} + +// GetDiskFormat returns the DiskFormat field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetDiskFormat() (res UpdateImagePayloadGetDiskFormatRetType) { + res, _ = o.GetDiskFormatOk() + return +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetDiskFormatOk() (ret UpdateImagePayloadGetDiskFormatRetType, ok bool) { + return getUpdateImagePayloadGetDiskFormatAttributeTypeOk(o.DiskFormat) +} + +// HasDiskFormat returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasDiskFormat() bool { + _, ok := o.GetDiskFormatOk() + return ok +} + +// SetDiskFormat gets a reference to the given string and assigns it to the DiskFormat field. +func (o *UpdateImagePayload) SetDiskFormat(v UpdateImagePayloadGetDiskFormatRetType) { + setUpdateImagePayloadGetDiskFormatAttributeType(&o.DiskFormat, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetLabels() (res UpdateImagePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetLabelsOk() (ret UpdateImagePayloadGetLabelsRetType, ok bool) { + return getUpdateImagePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateImagePayload) SetLabels(v UpdateImagePayloadGetLabelsRetType) { + setUpdateImagePayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetMinDiskSize() (res UpdateImagePayloadGetMinDiskSizeRetType) { + res, _ = o.GetMinDiskSizeOk() + return +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetMinDiskSizeOk() (ret UpdateImagePayloadGetMinDiskSizeRetType, ok bool) { + return getUpdateImagePayloadGetMinDiskSizeAttributeTypeOk(o.MinDiskSize) +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasMinDiskSize() bool { + _, ok := o.GetMinDiskSizeOk() + return ok +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *UpdateImagePayload) SetMinDiskSize(v UpdateImagePayloadGetMinDiskSizeRetType) { + setUpdateImagePayloadGetMinDiskSizeAttributeType(&o.MinDiskSize, v) +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetMinRam() (res UpdateImagePayloadGetMinRamRetType) { + res, _ = o.GetMinRamOk() + return +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetMinRamOk() (ret UpdateImagePayloadGetMinRamRetType, ok bool) { + return getUpdateImagePayloadGetMinRamAttributeTypeOk(o.MinRam) +} + +// HasMinRam returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasMinRam() bool { + _, ok := o.GetMinRamOk() + return ok +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *UpdateImagePayload) SetMinRam(v UpdateImagePayloadGetMinRamRetType) { + setUpdateImagePayloadGetMinRamAttributeType(&o.MinRam, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetName() (res UpdateImagePayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetNameOk() (ret UpdateImagePayloadGetNameRetType, ok bool) { + return getUpdateImagePayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateImagePayload) SetName(v UpdateImagePayloadGetNameRetType) { + setUpdateImagePayloadGetNameAttributeType(&o.Name, v) +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetProtected() (res UpdateImagePayloadgetProtectedRetType) { + res, _ = o.GetProtectedOk() + return +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetProtectedOk() (ret UpdateImagePayloadgetProtectedRetType, ok bool) { + return getUpdateImagePayloadgetProtectedAttributeTypeOk(o.Protected) +} + +// HasProtected returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasProtected() bool { + _, ok := o.GetProtectedOk() + return ok +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *UpdateImagePayload) SetProtected(v UpdateImagePayloadgetProtectedRetType) { + setUpdateImagePayloadgetProtectedAttributeType(&o.Protected, v) +} + +func (o UpdateImagePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateImagePayloadGetAgentAttributeTypeOk(o.Agent); ok { + toSerialize["Agent"] = val + } + if val, ok := getUpdateImagePayloadGetConfigAttributeTypeOk(o.Config); ok { + toSerialize["Config"] = val + } + if val, ok := getUpdateImagePayloadGetDiskFormatAttributeTypeOk(o.DiskFormat); ok { + toSerialize["DiskFormat"] = val + } + if val, ok := getUpdateImagePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateImagePayloadGetMinDiskSizeAttributeTypeOk(o.MinDiskSize); ok { + toSerialize["MinDiskSize"] = val + } + if val, ok := getUpdateImagePayloadGetMinRamAttributeTypeOk(o.MinRam); ok { + toSerialize["MinRam"] = val + } + if val, ok := getUpdateImagePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateImagePayloadgetProtectedAttributeTypeOk(o.Protected); ok { + toSerialize["Protected"] = val + } + return toSerialize, nil +} + +type NullableUpdateImagePayload struct { + value *UpdateImagePayload + isSet bool +} + +func (v NullableUpdateImagePayload) Get() *UpdateImagePayload { + return v.value +} + +func (v *NullableUpdateImagePayload) Set(val *UpdateImagePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateImagePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateImagePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateImagePayload(val *UpdateImagePayload) *NullableUpdateImagePayload { + return &NullableUpdateImagePayload{value: val, isSet: true} +} + +func (v NullableUpdateImagePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateImagePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_image_payload_test.go b/pkg/iaasbeta/model_update_image_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_image_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_image_share_payload.go b/pkg/iaasbeta/model_update_image_share_payload.go new file mode 100644 index 00000000..99334163 --- /dev/null +++ b/pkg/iaasbeta/model_update_image_share_payload.go @@ -0,0 +1,176 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateImageSharePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateImageSharePayload{} + +/* + types and functions for parentOrganization +*/ + +// isBoolean +type UpdateImageSharePayloadgetParentOrganizationAttributeType = *bool +type UpdateImageSharePayloadgetParentOrganizationArgType = bool +type UpdateImageSharePayloadgetParentOrganizationRetType = bool + +func getUpdateImageSharePayloadgetParentOrganizationAttributeTypeOk(arg UpdateImageSharePayloadgetParentOrganizationAttributeType) (ret UpdateImageSharePayloadgetParentOrganizationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImageSharePayloadgetParentOrganizationAttributeType(arg *UpdateImageSharePayloadgetParentOrganizationAttributeType, val UpdateImageSharePayloadgetParentOrganizationRetType) { + *arg = &val +} + +/* + types and functions for projects +*/ + +// isArray +type UpdateImageSharePayloadGetProjectsAttributeType = *[]string +type UpdateImageSharePayloadGetProjectsArgType = []string +type UpdateImageSharePayloadGetProjectsRetType = []string + +func getUpdateImageSharePayloadGetProjectsAttributeTypeOk(arg UpdateImageSharePayloadGetProjectsAttributeType) (ret UpdateImageSharePayloadGetProjectsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImageSharePayloadGetProjectsAttributeType(arg *UpdateImageSharePayloadGetProjectsAttributeType, val UpdateImageSharePayloadGetProjectsRetType) { + *arg = &val +} + +// UpdateImageSharePayload Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. +type UpdateImageSharePayload struct { + // Image is shared with all projects inside the image owners organization. + ParentOrganization UpdateImageSharePayloadgetParentOrganizationAttributeType `json:"parentOrganization,omitempty"` + // List of all projects the Image is shared with. + Projects UpdateImageSharePayloadGetProjectsAttributeType `json:"projects,omitempty"` +} + +// NewUpdateImageSharePayload instantiates a new UpdateImageSharePayload 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 NewUpdateImageSharePayload() *UpdateImageSharePayload { + this := UpdateImageSharePayload{} + return &this +} + +// NewUpdateImageSharePayloadWithDefaults instantiates a new UpdateImageSharePayload 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 NewUpdateImageSharePayloadWithDefaults() *UpdateImageSharePayload { + this := UpdateImageSharePayload{} + return &this +} + +// GetParentOrganization returns the ParentOrganization field value if set, zero value otherwise. +func (o *UpdateImageSharePayload) GetParentOrganization() (res UpdateImageSharePayloadgetParentOrganizationRetType) { + res, _ = o.GetParentOrganizationOk() + return +} + +// GetParentOrganizationOk returns a tuple with the ParentOrganization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImageSharePayload) GetParentOrganizationOk() (ret UpdateImageSharePayloadgetParentOrganizationRetType, ok bool) { + return getUpdateImageSharePayloadgetParentOrganizationAttributeTypeOk(o.ParentOrganization) +} + +// HasParentOrganization returns a boolean if a field has been set. +func (o *UpdateImageSharePayload) HasParentOrganization() bool { + _, ok := o.GetParentOrganizationOk() + return ok +} + +// SetParentOrganization gets a reference to the given bool and assigns it to the ParentOrganization field. +func (o *UpdateImageSharePayload) SetParentOrganization(v UpdateImageSharePayloadgetParentOrganizationRetType) { + setUpdateImageSharePayloadgetParentOrganizationAttributeType(&o.ParentOrganization, v) +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *UpdateImageSharePayload) GetProjects() (res UpdateImageSharePayloadGetProjectsRetType) { + res, _ = o.GetProjectsOk() + return +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImageSharePayload) GetProjectsOk() (ret UpdateImageSharePayloadGetProjectsRetType, ok bool) { + return getUpdateImageSharePayloadGetProjectsAttributeTypeOk(o.Projects) +} + +// HasProjects returns a boolean if a field has been set. +func (o *UpdateImageSharePayload) HasProjects() bool { + _, ok := o.GetProjectsOk() + return ok +} + +// SetProjects gets a reference to the given []string and assigns it to the Projects field. +func (o *UpdateImageSharePayload) SetProjects(v UpdateImageSharePayloadGetProjectsRetType) { + setUpdateImageSharePayloadGetProjectsAttributeType(&o.Projects, v) +} + +func (o UpdateImageSharePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateImageSharePayloadgetParentOrganizationAttributeTypeOk(o.ParentOrganization); ok { + toSerialize["ParentOrganization"] = val + } + if val, ok := getUpdateImageSharePayloadGetProjectsAttributeTypeOk(o.Projects); ok { + toSerialize["Projects"] = val + } + return toSerialize, nil +} + +type NullableUpdateImageSharePayload struct { + value *UpdateImageSharePayload + isSet bool +} + +func (v NullableUpdateImageSharePayload) Get() *UpdateImageSharePayload { + return v.value +} + +func (v *NullableUpdateImageSharePayload) Set(val *UpdateImageSharePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateImageSharePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateImageSharePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateImageSharePayload(val *UpdateImageSharePayload) *NullableUpdateImageSharePayload { + return &NullableUpdateImageSharePayload{value: val, isSet: true} +} + +func (v NullableUpdateImageSharePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateImageSharePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_image_share_payload_test.go b/pkg/iaasbeta/model_update_image_share_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_image_share_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_key_pair_payload.go b/pkg/iaasbeta/model_update_key_pair_payload.go new file mode 100644 index 00000000..d64dce52 --- /dev/null +++ b/pkg/iaasbeta/model_update_key_pair_payload.go @@ -0,0 +1,128 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateKeyPairPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateKeyPairPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateKeyPairPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateKeyPairPayloadGetLabelsArgType = map[string]interface{} +type UpdateKeyPairPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateKeyPairPayloadGetLabelsAttributeTypeOk(arg UpdateKeyPairPayloadGetLabelsAttributeType) (ret UpdateKeyPairPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateKeyPairPayloadGetLabelsAttributeType(arg *UpdateKeyPairPayloadGetLabelsAttributeType, val UpdateKeyPairPayloadGetLabelsRetType) { + *arg = &val +} + +// UpdateKeyPairPayload Object that represents an update request body of a public key of an SSH keypair. +type UpdateKeyPairPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateKeyPairPayloadGetLabelsAttributeType `json:"labels,omitempty"` +} + +// NewUpdateKeyPairPayload instantiates a new UpdateKeyPairPayload 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 NewUpdateKeyPairPayload() *UpdateKeyPairPayload { + this := UpdateKeyPairPayload{} + return &this +} + +// NewUpdateKeyPairPayloadWithDefaults instantiates a new UpdateKeyPairPayload 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 NewUpdateKeyPairPayloadWithDefaults() *UpdateKeyPairPayload { + this := UpdateKeyPairPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateKeyPairPayload) GetLabels() (res UpdateKeyPairPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateKeyPairPayload) GetLabelsOk() (ret UpdateKeyPairPayloadGetLabelsRetType, ok bool) { + return getUpdateKeyPairPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateKeyPairPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateKeyPairPayload) SetLabels(v UpdateKeyPairPayloadGetLabelsRetType) { + setUpdateKeyPairPayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o UpdateKeyPairPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateKeyPairPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableUpdateKeyPairPayload struct { + value *UpdateKeyPairPayload + isSet bool +} + +func (v NullableUpdateKeyPairPayload) Get() *UpdateKeyPairPayload { + return v.value +} + +func (v *NullableUpdateKeyPairPayload) Set(val *UpdateKeyPairPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateKeyPairPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateKeyPairPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateKeyPairPayload(val *UpdateKeyPairPayload) *NullableUpdateKeyPairPayload { + return &NullableUpdateKeyPairPayload{value: val, isSet: true} +} + +func (v NullableUpdateKeyPairPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateKeyPairPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_key_pair_payload_test.go b/pkg/iaasbeta/model_update_key_pair_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_key_pair_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_network_ipv4_body.go b/pkg/iaasbeta/model_update_network_ipv4_body.go new file mode 100644 index 00000000..cccb8612 --- /dev/null +++ b/pkg/iaasbeta/model_update_network_ipv4_body.go @@ -0,0 +1,192 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateNetworkIPv4Body type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNetworkIPv4Body{} + +/* + types and functions for gateway +*/ + +// isNullableString +type UpdateNetworkIPv4BodyGetGatewayAttributeType = *NullableString + +func getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(arg UpdateNetworkIPv4BodyGetGatewayAttributeType) (ret UpdateNetworkIPv4BodyGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setUpdateNetworkIPv4BodyGetGatewayAttributeType(arg *UpdateNetworkIPv4BodyGetGatewayAttributeType, val UpdateNetworkIPv4BodyGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type UpdateNetworkIPv4BodyGetGatewayArgType = *string +type UpdateNetworkIPv4BodyGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type UpdateNetworkIPv4BodyGetNameserversAttributeType = *[]string +type UpdateNetworkIPv4BodyGetNameserversArgType = []string +type UpdateNetworkIPv4BodyGetNameserversRetType = []string + +func getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(arg UpdateNetworkIPv4BodyGetNameserversAttributeType) (ret UpdateNetworkIPv4BodyGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNetworkIPv4BodyGetNameserversAttributeType(arg *UpdateNetworkIPv4BodyGetNameserversAttributeType, val UpdateNetworkIPv4BodyGetNameserversRetType) { + *arg = &val +} + +// UpdateNetworkIPv4Body The config object for a IPv4 network update. +type UpdateNetworkIPv4Body struct { + // The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway UpdateNetworkIPv4BodyGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers UpdateNetworkIPv4BodyGetNameserversAttributeType `json:"nameservers,omitempty"` +} + +// NewUpdateNetworkIPv4Body instantiates a new UpdateNetworkIPv4Body 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 NewUpdateNetworkIPv4Body() *UpdateNetworkIPv4Body { + this := UpdateNetworkIPv4Body{} + return &this +} + +// NewUpdateNetworkIPv4BodyWithDefaults instantiates a new UpdateNetworkIPv4Body 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 NewUpdateNetworkIPv4BodyWithDefaults() *UpdateNetworkIPv4Body { + this := UpdateNetworkIPv4Body{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateNetworkIPv4Body) GetGateway() (res UpdateNetworkIPv4BodyGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateNetworkIPv4Body) GetGatewayOk() (ret UpdateNetworkIPv4BodyGetGatewayRetType, ok bool) { + return getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *UpdateNetworkIPv4Body) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *UpdateNetworkIPv4Body) SetGateway(v UpdateNetworkIPv4BodyGetGatewayRetType) { + setUpdateNetworkIPv4BodyGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *UpdateNetworkIPv4Body) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *UpdateNetworkIPv4Body) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *UpdateNetworkIPv4Body) GetNameservers() (res UpdateNetworkIPv4BodyGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNetworkIPv4Body) GetNameserversOk() (ret UpdateNetworkIPv4BodyGetNameserversRetType, ok bool) { + return getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *UpdateNetworkIPv4Body) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *UpdateNetworkIPv4Body) SetNameservers(v UpdateNetworkIPv4BodyGetNameserversRetType) { + setUpdateNetworkIPv4BodyGetNameserversAttributeType(&o.Nameservers, v) +} + +func (o UpdateNetworkIPv4Body) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + return toSerialize, nil +} + +type NullableUpdateNetworkIPv4Body struct { + value *UpdateNetworkIPv4Body + isSet bool +} + +func (v NullableUpdateNetworkIPv4Body) Get() *UpdateNetworkIPv4Body { + return v.value +} + +func (v *NullableUpdateNetworkIPv4Body) Set(val *UpdateNetworkIPv4Body) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNetworkIPv4Body) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNetworkIPv4Body) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNetworkIPv4Body(val *UpdateNetworkIPv4Body) *NullableUpdateNetworkIPv4Body { + return &NullableUpdateNetworkIPv4Body{value: val, isSet: true} +} + +func (v NullableUpdateNetworkIPv4Body) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNetworkIPv4Body) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_network_ipv4_body_test.go b/pkg/iaasbeta/model_update_network_ipv4_body_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_network_ipv4_body_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_network_ipv6_body.go b/pkg/iaasbeta/model_update_network_ipv6_body.go new file mode 100644 index 00000000..ca7af7a5 --- /dev/null +++ b/pkg/iaasbeta/model_update_network_ipv6_body.go @@ -0,0 +1,192 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateNetworkIPv6Body type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNetworkIPv6Body{} + +/* + types and functions for gateway +*/ + +// isNullableString +type UpdateNetworkIPv6BodyGetGatewayAttributeType = *NullableString + +func getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(arg UpdateNetworkIPv6BodyGetGatewayAttributeType) (ret UpdateNetworkIPv6BodyGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setUpdateNetworkIPv6BodyGetGatewayAttributeType(arg *UpdateNetworkIPv6BodyGetGatewayAttributeType, val UpdateNetworkIPv6BodyGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type UpdateNetworkIPv6BodyGetGatewayArgType = *string +type UpdateNetworkIPv6BodyGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type UpdateNetworkIPv6BodyGetNameserversAttributeType = *[]string +type UpdateNetworkIPv6BodyGetNameserversArgType = []string +type UpdateNetworkIPv6BodyGetNameserversRetType = []string + +func getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(arg UpdateNetworkIPv6BodyGetNameserversAttributeType) (ret UpdateNetworkIPv6BodyGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNetworkIPv6BodyGetNameserversAttributeType(arg *UpdateNetworkIPv6BodyGetNameserversAttributeType, val UpdateNetworkIPv6BodyGetNameserversRetType) { + *arg = &val +} + +// UpdateNetworkIPv6Body The config object for a IPv6 network update. +type UpdateNetworkIPv6Body struct { + // The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway UpdateNetworkIPv6BodyGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers UpdateNetworkIPv6BodyGetNameserversAttributeType `json:"nameservers,omitempty"` +} + +// NewUpdateNetworkIPv6Body instantiates a new UpdateNetworkIPv6Body 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 NewUpdateNetworkIPv6Body() *UpdateNetworkIPv6Body { + this := UpdateNetworkIPv6Body{} + return &this +} + +// NewUpdateNetworkIPv6BodyWithDefaults instantiates a new UpdateNetworkIPv6Body 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 NewUpdateNetworkIPv6BodyWithDefaults() *UpdateNetworkIPv6Body { + this := UpdateNetworkIPv6Body{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateNetworkIPv6Body) GetGateway() (res UpdateNetworkIPv6BodyGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateNetworkIPv6Body) GetGatewayOk() (ret UpdateNetworkIPv6BodyGetGatewayRetType, ok bool) { + return getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *UpdateNetworkIPv6Body) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *UpdateNetworkIPv6Body) SetGateway(v UpdateNetworkIPv6BodyGetGatewayRetType) { + setUpdateNetworkIPv6BodyGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *UpdateNetworkIPv6Body) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *UpdateNetworkIPv6Body) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *UpdateNetworkIPv6Body) GetNameservers() (res UpdateNetworkIPv6BodyGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNetworkIPv6Body) GetNameserversOk() (ret UpdateNetworkIPv6BodyGetNameserversRetType, ok bool) { + return getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *UpdateNetworkIPv6Body) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *UpdateNetworkIPv6Body) SetNameservers(v UpdateNetworkIPv6BodyGetNameserversRetType) { + setUpdateNetworkIPv6BodyGetNameserversAttributeType(&o.Nameservers, v) +} + +func (o UpdateNetworkIPv6Body) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + return toSerialize, nil +} + +type NullableUpdateNetworkIPv6Body struct { + value *UpdateNetworkIPv6Body + isSet bool +} + +func (v NullableUpdateNetworkIPv6Body) Get() *UpdateNetworkIPv6Body { + return v.value +} + +func (v *NullableUpdateNetworkIPv6Body) Set(val *UpdateNetworkIPv6Body) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNetworkIPv6Body) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNetworkIPv6Body) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNetworkIPv6Body(val *UpdateNetworkIPv6Body) *NullableUpdateNetworkIPv6Body { + return &NullableUpdateNetworkIPv6Body{value: val, isSet: true} +} + +func (v NullableUpdateNetworkIPv6Body) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNetworkIPv6Body) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_network_ipv6_body_test.go b/pkg/iaasbeta/model_update_network_ipv6_body_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_network_ipv6_body_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_nic_payload.go b/pkg/iaasbeta/model_update_nic_payload.go new file mode 100644 index 00000000..6157d9fc --- /dev/null +++ b/pkg/iaasbeta/model_update_nic_payload.go @@ -0,0 +1,370 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateNicPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNicPayload{} + +/* + types and functions for allowedAddresses +*/ + +// isArray +type UpdateNicPayloadGetAllowedAddressesAttributeType = *[]AllowedAddressesInner +type UpdateNicPayloadGetAllowedAddressesArgType = []AllowedAddressesInner +type UpdateNicPayloadGetAllowedAddressesRetType = []AllowedAddressesInner + +func getUpdateNicPayloadGetAllowedAddressesAttributeTypeOk(arg UpdateNicPayloadGetAllowedAddressesAttributeType) (ret UpdateNicPayloadGetAllowedAddressesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadGetAllowedAddressesAttributeType(arg *UpdateNicPayloadGetAllowedAddressesAttributeType, val UpdateNicPayloadGetAllowedAddressesRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateNicPayloadGetDescriptionAttributeType = *string + +func getUpdateNicPayloadGetDescriptionAttributeTypeOk(arg UpdateNicPayloadGetDescriptionAttributeType) (ret UpdateNicPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadGetDescriptionAttributeType(arg *UpdateNicPayloadGetDescriptionAttributeType, val UpdateNicPayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateNicPayloadGetDescriptionArgType = string +type UpdateNicPayloadGetDescriptionRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateNicPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateNicPayloadGetLabelsArgType = map[string]interface{} +type UpdateNicPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateNicPayloadGetLabelsAttributeTypeOk(arg UpdateNicPayloadGetLabelsAttributeType) (ret UpdateNicPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadGetLabelsAttributeType(arg *UpdateNicPayloadGetLabelsAttributeType, val UpdateNicPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateNicPayloadGetNameAttributeType = *string + +func getUpdateNicPayloadGetNameAttributeTypeOk(arg UpdateNicPayloadGetNameAttributeType) (ret UpdateNicPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadGetNameAttributeType(arg *UpdateNicPayloadGetNameAttributeType, val UpdateNicPayloadGetNameRetType) { + *arg = &val +} + +type UpdateNicPayloadGetNameArgType = string +type UpdateNicPayloadGetNameRetType = string + +/* + types and functions for nicSecurity +*/ + +// isBoolean +type UpdateNicPayloadgetNicSecurityAttributeType = *bool +type UpdateNicPayloadgetNicSecurityArgType = bool +type UpdateNicPayloadgetNicSecurityRetType = bool + +func getUpdateNicPayloadgetNicSecurityAttributeTypeOk(arg UpdateNicPayloadgetNicSecurityAttributeType) (ret UpdateNicPayloadgetNicSecurityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadgetNicSecurityAttributeType(arg *UpdateNicPayloadgetNicSecurityAttributeType, val UpdateNicPayloadgetNicSecurityRetType) { + *arg = &val +} + +/* + types and functions for securityGroups +*/ + +// isArray +type UpdateNicPayloadGetSecurityGroupsAttributeType = *[]string +type UpdateNicPayloadGetSecurityGroupsArgType = []string +type UpdateNicPayloadGetSecurityGroupsRetType = []string + +func getUpdateNicPayloadGetSecurityGroupsAttributeTypeOk(arg UpdateNicPayloadGetSecurityGroupsAttributeType) (ret UpdateNicPayloadGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadGetSecurityGroupsAttributeType(arg *UpdateNicPayloadGetSecurityGroupsAttributeType, val UpdateNicPayloadGetSecurityGroupsRetType) { + *arg = &val +} + +// UpdateNicPayload Object that represents a network interface update. +type UpdateNicPayload struct { + // A list of IPs or CIDR notations. + AllowedAddresses UpdateNicPayloadGetAllowedAddressesAttributeType `json:"allowedAddresses,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description UpdateNicPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateNicPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateNicPayloadGetNameAttributeType `json:"name,omitempty"` + // If this is set to false, then no security groups will apply to this network interface. + NicSecurity UpdateNicPayloadgetNicSecurityAttributeType `json:"nicSecurity,omitempty"` + // A list of UUIDs. + SecurityGroups UpdateNicPayloadGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` +} + +// NewUpdateNicPayload instantiates a new UpdateNicPayload 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 NewUpdateNicPayload() *UpdateNicPayload { + this := UpdateNicPayload{} + return &this +} + +// NewUpdateNicPayloadWithDefaults instantiates a new UpdateNicPayload 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 NewUpdateNicPayloadWithDefaults() *UpdateNicPayload { + this := UpdateNicPayload{} + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetAllowedAddresses() (res UpdateNicPayloadGetAllowedAddressesRetType) { + res, _ = o.GetAllowedAddressesOk() + return +} + +// GetAllowedAddressesOk returns a tuple with the AllowedAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetAllowedAddressesOk() (ret UpdateNicPayloadGetAllowedAddressesRetType, ok bool) { + return getUpdateNicPayloadGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses) +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasAllowedAddresses() bool { + _, ok := o.GetAllowedAddressesOk() + return ok +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +func (o *UpdateNicPayload) SetAllowedAddresses(v UpdateNicPayloadGetAllowedAddressesRetType) { + setUpdateNicPayloadGetAllowedAddressesAttributeType(&o.AllowedAddresses, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetDescription() (res UpdateNicPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetDescriptionOk() (ret UpdateNicPayloadGetDescriptionRetType, ok bool) { + return getUpdateNicPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateNicPayload) SetDescription(v UpdateNicPayloadGetDescriptionRetType) { + setUpdateNicPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetLabels() (res UpdateNicPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetLabelsOk() (ret UpdateNicPayloadGetLabelsRetType, ok bool) { + return getUpdateNicPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateNicPayload) SetLabels(v UpdateNicPayloadGetLabelsRetType) { + setUpdateNicPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetName() (res UpdateNicPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetNameOk() (ret UpdateNicPayloadGetNameRetType, ok bool) { + return getUpdateNicPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateNicPayload) SetName(v UpdateNicPayloadGetNameRetType) { + setUpdateNicPayloadGetNameAttributeType(&o.Name, v) +} + +// GetNicSecurity returns the NicSecurity field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetNicSecurity() (res UpdateNicPayloadgetNicSecurityRetType) { + res, _ = o.GetNicSecurityOk() + return +} + +// GetNicSecurityOk returns a tuple with the NicSecurity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetNicSecurityOk() (ret UpdateNicPayloadgetNicSecurityRetType, ok bool) { + return getUpdateNicPayloadgetNicSecurityAttributeTypeOk(o.NicSecurity) +} + +// HasNicSecurity returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasNicSecurity() bool { + _, ok := o.GetNicSecurityOk() + return ok +} + +// SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. +func (o *UpdateNicPayload) SetNicSecurity(v UpdateNicPayloadgetNicSecurityRetType) { + setUpdateNicPayloadgetNicSecurityAttributeType(&o.NicSecurity, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetSecurityGroups() (res UpdateNicPayloadGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// 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 *UpdateNicPayload) GetSecurityGroupsOk() (ret UpdateNicPayloadGetSecurityGroupsRetType, ok bool) { + return getUpdateNicPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *UpdateNicPayload) SetSecurityGroups(v UpdateNicPayloadGetSecurityGroupsRetType) { + setUpdateNicPayloadGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +func (o UpdateNicPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNicPayloadGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses); ok { + toSerialize["AllowedAddresses"] = val + } + if val, ok := getUpdateNicPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateNicPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateNicPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateNicPayloadgetNicSecurityAttributeTypeOk(o.NicSecurity); ok { + toSerialize["NicSecurity"] = val + } + if val, ok := getUpdateNicPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + return toSerialize, nil +} + +type NullableUpdateNicPayload struct { + value *UpdateNicPayload + isSet bool +} + +func (v NullableUpdateNicPayload) Get() *UpdateNicPayload { + return v.value +} + +func (v *NullableUpdateNicPayload) Set(val *UpdateNicPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNicPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNicPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNicPayload(val *UpdateNicPayload) *NullableUpdateNicPayload { + return &NullableUpdateNicPayload{value: val, isSet: true} +} + +func (v NullableUpdateNicPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNicPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_nic_payload_test.go b/pkg/iaasbeta/model_update_nic_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_nic_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_public_ip_payload.go b/pkg/iaasbeta/model_update_public_ip_payload.go new file mode 100644 index 00000000..85d7ce94 --- /dev/null +++ b/pkg/iaasbeta/model_update_public_ip_payload.go @@ -0,0 +1,290 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdatePublicIPPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdatePublicIPPayload{} + +/* + types and functions for id +*/ + +// isNotNullableString +type UpdatePublicIPPayloadGetIdAttributeType = *string + +func getUpdatePublicIPPayloadGetIdAttributeTypeOk(arg UpdatePublicIPPayloadGetIdAttributeType) (ret UpdatePublicIPPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdatePublicIPPayloadGetIdAttributeType(arg *UpdatePublicIPPayloadGetIdAttributeType, val UpdatePublicIPPayloadGetIdRetType) { + *arg = &val +} + +type UpdatePublicIPPayloadGetIdArgType = string +type UpdatePublicIPPayloadGetIdRetType = string + +/* + types and functions for ip +*/ + +// isNotNullableString +type UpdatePublicIPPayloadGetIpAttributeType = *string + +func getUpdatePublicIPPayloadGetIpAttributeTypeOk(arg UpdatePublicIPPayloadGetIpAttributeType) (ret UpdatePublicIPPayloadGetIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdatePublicIPPayloadGetIpAttributeType(arg *UpdatePublicIPPayloadGetIpAttributeType, val UpdatePublicIPPayloadGetIpRetType) { + *arg = &val +} + +type UpdatePublicIPPayloadGetIpArgType = string +type UpdatePublicIPPayloadGetIpRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type UpdatePublicIPPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdatePublicIPPayloadGetLabelsArgType = map[string]interface{} +type UpdatePublicIPPayloadGetLabelsRetType = map[string]interface{} + +func getUpdatePublicIPPayloadGetLabelsAttributeTypeOk(arg UpdatePublicIPPayloadGetLabelsAttributeType) (ret UpdatePublicIPPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdatePublicIPPayloadGetLabelsAttributeType(arg *UpdatePublicIPPayloadGetLabelsAttributeType, val UpdatePublicIPPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for networkInterface +*/ + +// isNullableString +type UpdatePublicIPPayloadGetNetworkInterfaceAttributeType = *NullableString + +func getUpdatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(arg UpdatePublicIPPayloadGetNetworkInterfaceAttributeType) (ret UpdatePublicIPPayloadGetNetworkInterfaceRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setUpdatePublicIPPayloadGetNetworkInterfaceAttributeType(arg *UpdatePublicIPPayloadGetNetworkInterfaceAttributeType, val UpdatePublicIPPayloadGetNetworkInterfaceRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type UpdatePublicIPPayloadGetNetworkInterfaceArgType = *string +type UpdatePublicIPPayloadGetNetworkInterfaceRetType = *string + +// UpdatePublicIPPayload Object that represents a public IP. +type UpdatePublicIPPayload struct { + // Universally Unique Identifier (UUID). + Id UpdatePublicIPPayloadGetIdAttributeType `json:"id,omitempty"` + // String that represents an IPv4 address. + Ip UpdatePublicIPPayloadGetIpAttributeType `json:"ip,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdatePublicIPPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Universally Unique Identifier (UUID). + NetworkInterface UpdatePublicIPPayloadGetNetworkInterfaceAttributeType `json:"networkInterface,omitempty"` +} + +// NewUpdatePublicIPPayload instantiates a new UpdatePublicIPPayload 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 NewUpdatePublicIPPayload() *UpdatePublicIPPayload { + this := UpdatePublicIPPayload{} + return &this +} + +// NewUpdatePublicIPPayloadWithDefaults instantiates a new UpdatePublicIPPayload 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 NewUpdatePublicIPPayloadWithDefaults() *UpdatePublicIPPayload { + this := UpdatePublicIPPayload{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdatePublicIPPayload) GetId() (res UpdatePublicIPPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdatePublicIPPayload) GetIdOk() (ret UpdatePublicIPPayloadGetIdRetType, ok bool) { + return getUpdatePublicIPPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *UpdatePublicIPPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdatePublicIPPayload) SetId(v UpdatePublicIPPayloadGetIdRetType) { + setUpdatePublicIPPayloadGetIdAttributeType(&o.Id, v) +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *UpdatePublicIPPayload) GetIp() (res UpdatePublicIPPayloadGetIpRetType) { + res, _ = o.GetIpOk() + return +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdatePublicIPPayload) GetIpOk() (ret UpdatePublicIPPayloadGetIpRetType, ok bool) { + return getUpdatePublicIPPayloadGetIpAttributeTypeOk(o.Ip) +} + +// HasIp returns a boolean if a field has been set. +func (o *UpdatePublicIPPayload) HasIp() bool { + _, ok := o.GetIpOk() + return ok +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *UpdatePublicIPPayload) SetIp(v UpdatePublicIPPayloadGetIpRetType) { + setUpdatePublicIPPayloadGetIpAttributeType(&o.Ip, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdatePublicIPPayload) GetLabels() (res UpdatePublicIPPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdatePublicIPPayload) GetLabelsOk() (ret UpdatePublicIPPayloadGetLabelsRetType, ok bool) { + return getUpdatePublicIPPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdatePublicIPPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdatePublicIPPayload) SetLabels(v UpdatePublicIPPayloadGetLabelsRetType) { + setUpdatePublicIPPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdatePublicIPPayload) GetNetworkInterface() (res UpdatePublicIPPayloadGetNetworkInterfaceRetType) { + res, _ = o.GetNetworkInterfaceOk() + return +} + +// GetNetworkInterfaceOk returns a tuple with the NetworkInterface field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdatePublicIPPayload) GetNetworkInterfaceOk() (ret UpdatePublicIPPayloadGetNetworkInterfaceRetType, ok bool) { + return getUpdatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface) +} + +// HasNetworkInterface returns a boolean if a field has been set. +func (o *UpdatePublicIPPayload) HasNetworkInterface() bool { + _, ok := o.GetNetworkInterfaceOk() + return ok +} + +// SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. +func (o *UpdatePublicIPPayload) SetNetworkInterface(v UpdatePublicIPPayloadGetNetworkInterfaceRetType) { + setUpdatePublicIPPayloadGetNetworkInterfaceAttributeType(&o.NetworkInterface, v) +} + +// SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil +func (o *UpdatePublicIPPayload) SetNetworkInterfaceNil() { + o.NetworkInterface = nil +} + +// UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil +func (o *UpdatePublicIPPayload) UnsetNetworkInterface() { + o.NetworkInterface = nil +} + +func (o UpdatePublicIPPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdatePublicIPPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getUpdatePublicIPPayloadGetIpAttributeTypeOk(o.Ip); ok { + toSerialize["Ip"] = val + } + if val, ok := getUpdatePublicIPPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface); ok { + toSerialize["NetworkInterface"] = val + } + return toSerialize, nil +} + +type NullableUpdatePublicIPPayload struct { + value *UpdatePublicIPPayload + isSet bool +} + +func (v NullableUpdatePublicIPPayload) Get() *UpdatePublicIPPayload { + return v.value +} + +func (v *NullableUpdatePublicIPPayload) Set(val *UpdatePublicIPPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdatePublicIPPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdatePublicIPPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdatePublicIPPayload(val *UpdatePublicIPPayload) *NullableUpdatePublicIPPayload { + return &NullableUpdatePublicIPPayload{value: val, isSet: true} +} + +func (v NullableUpdatePublicIPPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdatePublicIPPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_public_ip_payload_test.go b/pkg/iaasbeta/model_update_public_ip_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_public_ip_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_regional_area_ipv4.go b/pkg/iaasbeta/model_update_regional_area_ipv4.go new file mode 100644 index 00000000..03fad9b5 --- /dev/null +++ b/pkg/iaasbeta/model_update_regional_area_ipv4.go @@ -0,0 +1,271 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateRegionalAreaIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRegionalAreaIPv4{} + +/* + types and functions for defaultNameservers +*/ + +// isArray +type UpdateRegionalAreaIPv4GetDefaultNameserversAttributeType = *[]string +type UpdateRegionalAreaIPv4GetDefaultNameserversArgType = []string +type UpdateRegionalAreaIPv4GetDefaultNameserversRetType = []string + +func getUpdateRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(arg UpdateRegionalAreaIPv4GetDefaultNameserversAttributeType) (ret UpdateRegionalAreaIPv4GetDefaultNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRegionalAreaIPv4GetDefaultNameserversAttributeType(arg *UpdateRegionalAreaIPv4GetDefaultNameserversAttributeType, val UpdateRegionalAreaIPv4GetDefaultNameserversRetType) { + *arg = &val +} + +/* + types and functions for defaultPrefixLen +*/ + +// isLong +type UpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType = *int64 +type UpdateRegionalAreaIPv4GetDefaultPrefixLenArgType = int64 +type UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType = int64 + +func getUpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(arg UpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType) (ret UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType(arg *UpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType, val UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for maxPrefixLen +*/ + +// isLong +type UpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType = *int64 +type UpdateRegionalAreaIPv4GetMaxPrefixLenArgType = int64 +type UpdateRegionalAreaIPv4GetMaxPrefixLenRetType = int64 + +func getUpdateRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(arg UpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType) (ret UpdateRegionalAreaIPv4GetMaxPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType(arg *UpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType, val UpdateRegionalAreaIPv4GetMaxPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for minPrefixLen +*/ + +// isLong +type UpdateRegionalAreaIPv4GetMinPrefixLenAttributeType = *int64 +type UpdateRegionalAreaIPv4GetMinPrefixLenArgType = int64 +type UpdateRegionalAreaIPv4GetMinPrefixLenRetType = int64 + +func getUpdateRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(arg UpdateRegionalAreaIPv4GetMinPrefixLenAttributeType) (ret UpdateRegionalAreaIPv4GetMinPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRegionalAreaIPv4GetMinPrefixLenAttributeType(arg *UpdateRegionalAreaIPv4GetMinPrefixLenAttributeType, val UpdateRegionalAreaIPv4GetMinPrefixLenRetType) { + *arg = &val +} + +// UpdateRegionalAreaIPv4 Object that represents the request body for a regional network area IPv4 configuration update. +type UpdateRegionalAreaIPv4 struct { + DefaultNameservers UpdateRegionalAreaIPv4GetDefaultNameserversAttributeType `json:"defaultNameservers,omitempty"` + // The default prefix length for networks in the network area. + DefaultPrefixLen UpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType `json:"defaultPrefixLen,omitempty"` + // The maximal prefix length for networks in the network area. + MaxPrefixLen UpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType `json:"maxPrefixLen,omitempty"` + // The minimal prefix length for networks in the network area. + MinPrefixLen UpdateRegionalAreaIPv4GetMinPrefixLenAttributeType `json:"minPrefixLen,omitempty"` +} + +// NewUpdateRegionalAreaIPv4 instantiates a new UpdateRegionalAreaIPv4 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 NewUpdateRegionalAreaIPv4() *UpdateRegionalAreaIPv4 { + this := UpdateRegionalAreaIPv4{} + return &this +} + +// NewUpdateRegionalAreaIPv4WithDefaults instantiates a new UpdateRegionalAreaIPv4 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 NewUpdateRegionalAreaIPv4WithDefaults() *UpdateRegionalAreaIPv4 { + this := UpdateRegionalAreaIPv4{} + return &this +} + +// GetDefaultNameservers returns the DefaultNameservers field value if set, zero value otherwise. +func (o *UpdateRegionalAreaIPv4) GetDefaultNameservers() (res UpdateRegionalAreaIPv4GetDefaultNameserversRetType) { + res, _ = o.GetDefaultNameserversOk() + return +} + +// GetDefaultNameserversOk returns a tuple with the DefaultNameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRegionalAreaIPv4) GetDefaultNameserversOk() (ret UpdateRegionalAreaIPv4GetDefaultNameserversRetType, ok bool) { + return getUpdateRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers) +} + +// HasDefaultNameservers returns a boolean if a field has been set. +func (o *UpdateRegionalAreaIPv4) HasDefaultNameservers() bool { + _, ok := o.GetDefaultNameserversOk() + return ok +} + +// SetDefaultNameservers gets a reference to the given []string and assigns it to the DefaultNameservers field. +func (o *UpdateRegionalAreaIPv4) SetDefaultNameservers(v UpdateRegionalAreaIPv4GetDefaultNameserversRetType) { + setUpdateRegionalAreaIPv4GetDefaultNameserversAttributeType(&o.DefaultNameservers, v) +} + +// GetDefaultPrefixLen returns the DefaultPrefixLen field value if set, zero value otherwise. +func (o *UpdateRegionalAreaIPv4) GetDefaultPrefixLen() (res UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType) { + res, _ = o.GetDefaultPrefixLenOk() + return +} + +// GetDefaultPrefixLenOk returns a tuple with the DefaultPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRegionalAreaIPv4) GetDefaultPrefixLenOk() (ret UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + return getUpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen) +} + +// HasDefaultPrefixLen returns a boolean if a field has been set. +func (o *UpdateRegionalAreaIPv4) HasDefaultPrefixLen() bool { + _, ok := o.GetDefaultPrefixLenOk() + return ok +} + +// SetDefaultPrefixLen gets a reference to the given int64 and assigns it to the DefaultPrefixLen field. +func (o *UpdateRegionalAreaIPv4) SetDefaultPrefixLen(v UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType) { + setUpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType(&o.DefaultPrefixLen, v) +} + +// GetMaxPrefixLen returns the MaxPrefixLen field value if set, zero value otherwise. +func (o *UpdateRegionalAreaIPv4) GetMaxPrefixLen() (res UpdateRegionalAreaIPv4GetMaxPrefixLenRetType) { + res, _ = o.GetMaxPrefixLenOk() + return +} + +// GetMaxPrefixLenOk returns a tuple with the MaxPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRegionalAreaIPv4) GetMaxPrefixLenOk() (ret UpdateRegionalAreaIPv4GetMaxPrefixLenRetType, ok bool) { + return getUpdateRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen) +} + +// HasMaxPrefixLen returns a boolean if a field has been set. +func (o *UpdateRegionalAreaIPv4) HasMaxPrefixLen() bool { + _, ok := o.GetMaxPrefixLenOk() + return ok +} + +// SetMaxPrefixLen gets a reference to the given int64 and assigns it to the MaxPrefixLen field. +func (o *UpdateRegionalAreaIPv4) SetMaxPrefixLen(v UpdateRegionalAreaIPv4GetMaxPrefixLenRetType) { + setUpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType(&o.MaxPrefixLen, v) +} + +// GetMinPrefixLen returns the MinPrefixLen field value if set, zero value otherwise. +func (o *UpdateRegionalAreaIPv4) GetMinPrefixLen() (res UpdateRegionalAreaIPv4GetMinPrefixLenRetType) { + res, _ = o.GetMinPrefixLenOk() + return +} + +// GetMinPrefixLenOk returns a tuple with the MinPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRegionalAreaIPv4) GetMinPrefixLenOk() (ret UpdateRegionalAreaIPv4GetMinPrefixLenRetType, ok bool) { + return getUpdateRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen) +} + +// HasMinPrefixLen returns a boolean if a field has been set. +func (o *UpdateRegionalAreaIPv4) HasMinPrefixLen() bool { + _, ok := o.GetMinPrefixLenOk() + return ok +} + +// SetMinPrefixLen gets a reference to the given int64 and assigns it to the MinPrefixLen field. +func (o *UpdateRegionalAreaIPv4) SetMinPrefixLen(v UpdateRegionalAreaIPv4GetMinPrefixLenRetType) { + setUpdateRegionalAreaIPv4GetMinPrefixLenAttributeType(&o.MinPrefixLen, v) +} + +func (o UpdateRegionalAreaIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers); ok { + toSerialize["DefaultNameservers"] = val + } + if val, ok := getUpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen); ok { + toSerialize["DefaultPrefixLen"] = val + } + if val, ok := getUpdateRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen); ok { + toSerialize["MaxPrefixLen"] = val + } + if val, ok := getUpdateRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen); ok { + toSerialize["MinPrefixLen"] = val + } + return toSerialize, nil +} + +type NullableUpdateRegionalAreaIPv4 struct { + value *UpdateRegionalAreaIPv4 + isSet bool +} + +func (v NullableUpdateRegionalAreaIPv4) Get() *UpdateRegionalAreaIPv4 { + return v.value +} + +func (v *NullableUpdateRegionalAreaIPv4) Set(val *UpdateRegionalAreaIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRegionalAreaIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRegionalAreaIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRegionalAreaIPv4(val *UpdateRegionalAreaIPv4) *NullableUpdateRegionalAreaIPv4 { + return &NullableUpdateRegionalAreaIPv4{value: val, isSet: true} +} + +func (v NullableUpdateRegionalAreaIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRegionalAreaIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_regional_area_ipv4_test.go b/pkg/iaasbeta/model_update_regional_area_ipv4_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_regional_area_ipv4_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_route_of_routing_table_payload.go b/pkg/iaasbeta/model_update_route_of_routing_table_payload.go new file mode 100644 index 00000000..cd8b5a50 --- /dev/null +++ b/pkg/iaasbeta/model_update_route_of_routing_table_payload.go @@ -0,0 +1,128 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateRouteOfRoutingTablePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRouteOfRoutingTablePayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateRouteOfRoutingTablePayloadGetLabelsArgType = map[string]interface{} +type UpdateRouteOfRoutingTablePayloadGetLabelsRetType = map[string]interface{} + +func getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(arg UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType) (ret UpdateRouteOfRoutingTablePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRouteOfRoutingTablePayloadGetLabelsAttributeType(arg *UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType, val UpdateRouteOfRoutingTablePayloadGetLabelsRetType) { + *arg = &val +} + +// UpdateRouteOfRoutingTablePayload Object that represents the request body for a route update. +type UpdateRouteOfRoutingTablePayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType `json:"labels,omitempty"` +} + +// NewUpdateRouteOfRoutingTablePayload instantiates a new UpdateRouteOfRoutingTablePayload 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 NewUpdateRouteOfRoutingTablePayload() *UpdateRouteOfRoutingTablePayload { + this := UpdateRouteOfRoutingTablePayload{} + return &this +} + +// NewUpdateRouteOfRoutingTablePayloadWithDefaults instantiates a new UpdateRouteOfRoutingTablePayload 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 NewUpdateRouteOfRoutingTablePayloadWithDefaults() *UpdateRouteOfRoutingTablePayload { + this := UpdateRouteOfRoutingTablePayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateRouteOfRoutingTablePayload) GetLabels() (res UpdateRouteOfRoutingTablePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRouteOfRoutingTablePayload) GetLabelsOk() (ret UpdateRouteOfRoutingTablePayloadGetLabelsRetType, ok bool) { + return getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateRouteOfRoutingTablePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateRouteOfRoutingTablePayload) SetLabels(v UpdateRouteOfRoutingTablePayloadGetLabelsRetType) { + setUpdateRouteOfRoutingTablePayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o UpdateRouteOfRoutingTablePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableUpdateRouteOfRoutingTablePayload struct { + value *UpdateRouteOfRoutingTablePayload + isSet bool +} + +func (v NullableUpdateRouteOfRoutingTablePayload) Get() *UpdateRouteOfRoutingTablePayload { + return v.value +} + +func (v *NullableUpdateRouteOfRoutingTablePayload) Set(val *UpdateRouteOfRoutingTablePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRouteOfRoutingTablePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRouteOfRoutingTablePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRouteOfRoutingTablePayload(val *UpdateRouteOfRoutingTablePayload) *NullableUpdateRouteOfRoutingTablePayload { + return &NullableUpdateRouteOfRoutingTablePayload{value: val, isSet: true} +} + +func (v NullableUpdateRouteOfRoutingTablePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRouteOfRoutingTablePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_route_of_routing_table_payload_test.go b/pkg/iaasbeta/model_update_route_of_routing_table_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_route_of_routing_table_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_routing_table_of_area_payload.go b/pkg/iaasbeta/model_update_routing_table_of_area_payload.go new file mode 100644 index 00000000..00580606 --- /dev/null +++ b/pkg/iaasbeta/model_update_routing_table_of_area_payload.go @@ -0,0 +1,322 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateRoutingTableOfAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRoutingTableOfAreaPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType = *string + +func getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType, val UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateRoutingTableOfAreaPayloadGetDescriptionArgType = string +type UpdateRoutingTableOfAreaPayloadGetDescriptionRetType = string + +/* + types and functions for dynamicRoutes +*/ + +// isBoolean +type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType = *bool +type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesArgType = bool +type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType = bool + +func getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType) (ret UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType(arg *UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType, val UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateRoutingTableOfAreaPayloadGetLabelsArgType = map[string]interface{} +type UpdateRoutingTableOfAreaPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadGetLabelsAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType, val UpdateRoutingTableOfAreaPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateRoutingTableOfAreaPayloadGetNameAttributeType = *string + +func getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetNameAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadGetNameAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetNameAttributeType, val UpdateRoutingTableOfAreaPayloadGetNameRetType) { + *arg = &val +} + +type UpdateRoutingTableOfAreaPayloadGetNameArgType = string +type UpdateRoutingTableOfAreaPayloadGetNameRetType = string + +/* + types and functions for systemRoutes +*/ + +// isBoolean +type UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType = *bool +type UpdateRoutingTableOfAreaPayloadgetSystemRoutesArgType = bool +type UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType = bool + +func getUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType) (ret UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType(arg *UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType, val UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType) { + *arg = &val +} + +// UpdateRoutingTableOfAreaPayload Object that represents the request body for a routing table update. +type UpdateRoutingTableOfAreaPayload struct { + // Description Object. Allows string up to 255 Characters. + Description UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The update config setting for a routing table which allows propagation of dynamic routes to this routing table. + DynamicRoutes UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateRoutingTableOfAreaPayloadGetNameAttributeType `json:"name,omitempty"` + // The update config setting for a routing table which allows installation of automatic system routes for connectivity between projects in the same SNA. + SystemRoutes UpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType `json:"systemRoutes,omitempty"` +} + +// NewUpdateRoutingTableOfAreaPayload instantiates a new UpdateRoutingTableOfAreaPayload 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 NewUpdateRoutingTableOfAreaPayload() *UpdateRoutingTableOfAreaPayload { + this := UpdateRoutingTableOfAreaPayload{} + return &this +} + +// NewUpdateRoutingTableOfAreaPayloadWithDefaults instantiates a new UpdateRoutingTableOfAreaPayload 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 NewUpdateRoutingTableOfAreaPayloadWithDefaults() *UpdateRoutingTableOfAreaPayload { + this := UpdateRoutingTableOfAreaPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetDescription() (res UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetDescriptionOk() (ret UpdateRoutingTableOfAreaPayloadGetDescriptionRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateRoutingTableOfAreaPayload) SetDescription(v UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) { + setUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetDynamicRoutes() (res UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) { + res, _ = o.GetDynamicRoutesOk() + return +} + +// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetDynamicRoutesOk() (ret UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes) +} + +// HasDynamicRoutes returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasDynamicRoutes() bool { + _, ok := o.GetDynamicRoutesOk() + return ok +} + +// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field. +func (o *UpdateRoutingTableOfAreaPayload) SetDynamicRoutes(v UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) { + setUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType(&o.DynamicRoutes, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetLabels() (res UpdateRoutingTableOfAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetLabelsOk() (ret UpdateRoutingTableOfAreaPayloadGetLabelsRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateRoutingTableOfAreaPayload) SetLabels(v UpdateRoutingTableOfAreaPayloadGetLabelsRetType) { + setUpdateRoutingTableOfAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetName() (res UpdateRoutingTableOfAreaPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetNameOk() (ret UpdateRoutingTableOfAreaPayloadGetNameRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateRoutingTableOfAreaPayload) SetName(v UpdateRoutingTableOfAreaPayloadGetNameRetType) { + setUpdateRoutingTableOfAreaPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetSystemRoutes() (res UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType) { + res, _ = o.GetSystemRoutesOk() + return +} + +// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetSystemRoutesOk() (ret UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes) +} + +// HasSystemRoutes returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasSystemRoutes() bool { + _, ok := o.GetSystemRoutesOk() + return ok +} + +// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field. +func (o *UpdateRoutingTableOfAreaPayload) SetSystemRoutes(v UpdateRoutingTableOfAreaPayloadgetSystemRoutesRetType) { + setUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeType(&o.SystemRoutes, v) +} + +func (o UpdateRoutingTableOfAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok { + toSerialize["DynamicRoutes"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok { + toSerialize["SystemRoutes"] = val + } + return toSerialize, nil +} + +type NullableUpdateRoutingTableOfAreaPayload struct { + value *UpdateRoutingTableOfAreaPayload + isSet bool +} + +func (v NullableUpdateRoutingTableOfAreaPayload) Get() *UpdateRoutingTableOfAreaPayload { + return v.value +} + +func (v *NullableUpdateRoutingTableOfAreaPayload) Set(val *UpdateRoutingTableOfAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRoutingTableOfAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRoutingTableOfAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRoutingTableOfAreaPayload(val *UpdateRoutingTableOfAreaPayload) *NullableUpdateRoutingTableOfAreaPayload { + return &NullableUpdateRoutingTableOfAreaPayload{value: val, isSet: true} +} + +func (v NullableUpdateRoutingTableOfAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRoutingTableOfAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_routing_table_of_area_payload_test.go b/pkg/iaasbeta/model_update_routing_table_of_area_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_routing_table_of_area_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_server_payload.go b/pkg/iaasbeta/model_update_server_payload.go new file mode 100644 index 00000000..58ad3241 --- /dev/null +++ b/pkg/iaasbeta/model_update_server_payload.go @@ -0,0 +1,225 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateServerPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateServerPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateServerPayloadGetLabelsArgType = map[string]interface{} +type UpdateServerPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateServerPayloadGetLabelsAttributeTypeOk(arg UpdateServerPayloadGetLabelsAttributeType) (ret UpdateServerPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateServerPayloadGetLabelsAttributeType(arg *UpdateServerPayloadGetLabelsAttributeType, val UpdateServerPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for metadata +*/ + +// isFreeform +type UpdateServerPayloadGetMetadataAttributeType = *map[string]interface{} +type UpdateServerPayloadGetMetadataArgType = map[string]interface{} +type UpdateServerPayloadGetMetadataRetType = map[string]interface{} + +func getUpdateServerPayloadGetMetadataAttributeTypeOk(arg UpdateServerPayloadGetMetadataAttributeType) (ret UpdateServerPayloadGetMetadataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateServerPayloadGetMetadataAttributeType(arg *UpdateServerPayloadGetMetadataAttributeType, val UpdateServerPayloadGetMetadataRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateServerPayloadGetNameAttributeType = *string + +func getUpdateServerPayloadGetNameAttributeTypeOk(arg UpdateServerPayloadGetNameAttributeType) (ret UpdateServerPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateServerPayloadGetNameAttributeType(arg *UpdateServerPayloadGetNameAttributeType, val UpdateServerPayloadGetNameRetType) { + *arg = &val +} + +type UpdateServerPayloadGetNameArgType = string +type UpdateServerPayloadGetNameRetType = string + +// UpdateServerPayload Object that represents an update request body of a server. +type UpdateServerPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateServerPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value for a key will remove that key. + Metadata UpdateServerPayloadGetMetadataAttributeType `json:"metadata,omitempty"` + // The name for a Server. + Name UpdateServerPayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewUpdateServerPayload instantiates a new UpdateServerPayload 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 NewUpdateServerPayload() *UpdateServerPayload { + this := UpdateServerPayload{} + return &this +} + +// NewUpdateServerPayloadWithDefaults instantiates a new UpdateServerPayload 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 NewUpdateServerPayloadWithDefaults() *UpdateServerPayload { + this := UpdateServerPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateServerPayload) GetLabels() (res UpdateServerPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateServerPayload) GetLabelsOk() (ret UpdateServerPayloadGetLabelsRetType, ok bool) { + return getUpdateServerPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateServerPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateServerPayload) SetLabels(v UpdateServerPayloadGetLabelsRetType) { + setUpdateServerPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *UpdateServerPayload) GetMetadata() (res UpdateServerPayloadGetMetadataRetType) { + res, _ = o.GetMetadataOk() + return +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateServerPayload) GetMetadataOk() (ret UpdateServerPayloadGetMetadataRetType, ok bool) { + return getUpdateServerPayloadGetMetadataAttributeTypeOk(o.Metadata) +} + +// HasMetadata returns a boolean if a field has been set. +func (o *UpdateServerPayload) HasMetadata() bool { + _, ok := o.GetMetadataOk() + return ok +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *UpdateServerPayload) SetMetadata(v UpdateServerPayloadGetMetadataRetType) { + setUpdateServerPayloadGetMetadataAttributeType(&o.Metadata, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateServerPayload) GetName() (res UpdateServerPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateServerPayload) GetNameOk() (ret UpdateServerPayloadGetNameRetType, ok bool) { + return getUpdateServerPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateServerPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateServerPayload) SetName(v UpdateServerPayloadGetNameRetType) { + setUpdateServerPayloadGetNameAttributeType(&o.Name, v) +} + +func (o UpdateServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateServerPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateServerPayloadGetMetadataAttributeTypeOk(o.Metadata); ok { + toSerialize["Metadata"] = val + } + if val, ok := getUpdateServerPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableUpdateServerPayload struct { + value *UpdateServerPayload + isSet bool +} + +func (v NullableUpdateServerPayload) Get() *UpdateServerPayload { + return v.value +} + +func (v *NullableUpdateServerPayload) Set(val *UpdateServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateServerPayload(val *UpdateServerPayload) *NullableUpdateServerPayload { + return &NullableUpdateServerPayload{value: val, isSet: true} +} + +func (v NullableUpdateServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_server_payload_test.go b/pkg/iaasbeta/model_update_server_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_server_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_update_volume_payload.go b/pkg/iaasbeta/model_update_volume_payload.go new file mode 100644 index 00000000..fdf33f27 --- /dev/null +++ b/pkg/iaasbeta/model_update_volume_payload.go @@ -0,0 +1,321 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the UpdateVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVolumePayload{} + +/* + types and functions for bootable +*/ + +// isBoolean +type UpdateVolumePayloadgetBootableAttributeType = *bool +type UpdateVolumePayloadgetBootableArgType = bool +type UpdateVolumePayloadgetBootableRetType = bool + +func getUpdateVolumePayloadgetBootableAttributeTypeOk(arg UpdateVolumePayloadgetBootableAttributeType) (ret UpdateVolumePayloadgetBootableRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVolumePayloadgetBootableAttributeType(arg *UpdateVolumePayloadgetBootableAttributeType, val UpdateVolumePayloadgetBootableRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateVolumePayloadGetDescriptionAttributeType = *string + +func getUpdateVolumePayloadGetDescriptionAttributeTypeOk(arg UpdateVolumePayloadGetDescriptionAttributeType) (ret UpdateVolumePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVolumePayloadGetDescriptionAttributeType(arg *UpdateVolumePayloadGetDescriptionAttributeType, val UpdateVolumePayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateVolumePayloadGetDescriptionArgType = string +type UpdateVolumePayloadGetDescriptionRetType = string + +/* + types and functions for imageConfig +*/ + +// isModel +type UpdateVolumePayloadGetImageConfigAttributeType = *ImageConfig +type UpdateVolumePayloadGetImageConfigArgType = ImageConfig +type UpdateVolumePayloadGetImageConfigRetType = ImageConfig + +func getUpdateVolumePayloadGetImageConfigAttributeTypeOk(arg UpdateVolumePayloadGetImageConfigAttributeType) (ret UpdateVolumePayloadGetImageConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVolumePayloadGetImageConfigAttributeType(arg *UpdateVolumePayloadGetImageConfigAttributeType, val UpdateVolumePayloadGetImageConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateVolumePayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateVolumePayloadGetLabelsArgType = map[string]interface{} +type UpdateVolumePayloadGetLabelsRetType = map[string]interface{} + +func getUpdateVolumePayloadGetLabelsAttributeTypeOk(arg UpdateVolumePayloadGetLabelsAttributeType) (ret UpdateVolumePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVolumePayloadGetLabelsAttributeType(arg *UpdateVolumePayloadGetLabelsAttributeType, val UpdateVolumePayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateVolumePayloadGetNameAttributeType = *string + +func getUpdateVolumePayloadGetNameAttributeTypeOk(arg UpdateVolumePayloadGetNameAttributeType) (ret UpdateVolumePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVolumePayloadGetNameAttributeType(arg *UpdateVolumePayloadGetNameAttributeType, val UpdateVolumePayloadGetNameRetType) { + *arg = &val +} + +type UpdateVolumePayloadGetNameArgType = string +type UpdateVolumePayloadGetNameRetType = string + +// UpdateVolumePayload Object that represents an update request body of a volume. +type UpdateVolumePayload struct { + // Indicates if a volume is bootable. + Bootable UpdateVolumePayloadgetBootableAttributeType `json:"bootable,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description UpdateVolumePayloadGetDescriptionAttributeType `json:"description,omitempty"` + ImageConfig UpdateVolumePayloadGetImageConfigAttributeType `json:"imageConfig,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateVolumePayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateVolumePayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewUpdateVolumePayload instantiates a new UpdateVolumePayload 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 NewUpdateVolumePayload() *UpdateVolumePayload { + this := UpdateVolumePayload{} + return &this +} + +// NewUpdateVolumePayloadWithDefaults instantiates a new UpdateVolumePayload 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 NewUpdateVolumePayloadWithDefaults() *UpdateVolumePayload { + this := UpdateVolumePayload{} + return &this +} + +// GetBootable returns the Bootable field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetBootable() (res UpdateVolumePayloadgetBootableRetType) { + res, _ = o.GetBootableOk() + return +} + +// GetBootableOk returns a tuple with the Bootable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetBootableOk() (ret UpdateVolumePayloadgetBootableRetType, ok bool) { + return getUpdateVolumePayloadgetBootableAttributeTypeOk(o.Bootable) +} + +// HasBootable returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasBootable() bool { + _, ok := o.GetBootableOk() + return ok +} + +// SetBootable gets a reference to the given bool and assigns it to the Bootable field. +func (o *UpdateVolumePayload) SetBootable(v UpdateVolumePayloadgetBootableRetType) { + setUpdateVolumePayloadgetBootableAttributeType(&o.Bootable, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetDescription() (res UpdateVolumePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetDescriptionOk() (ret UpdateVolumePayloadGetDescriptionRetType, ok bool) { + return getUpdateVolumePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateVolumePayload) SetDescription(v UpdateVolumePayloadGetDescriptionRetType) { + setUpdateVolumePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetImageConfig returns the ImageConfig field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetImageConfig() (res UpdateVolumePayloadGetImageConfigRetType) { + res, _ = o.GetImageConfigOk() + return +} + +// GetImageConfigOk returns a tuple with the ImageConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetImageConfigOk() (ret UpdateVolumePayloadGetImageConfigRetType, ok bool) { + return getUpdateVolumePayloadGetImageConfigAttributeTypeOk(o.ImageConfig) +} + +// HasImageConfig returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasImageConfig() bool { + _, ok := o.GetImageConfigOk() + return ok +} + +// SetImageConfig gets a reference to the given ImageConfig and assigns it to the ImageConfig field. +func (o *UpdateVolumePayload) SetImageConfig(v UpdateVolumePayloadGetImageConfigRetType) { + setUpdateVolumePayloadGetImageConfigAttributeType(&o.ImageConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetLabels() (res UpdateVolumePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetLabelsOk() (ret UpdateVolumePayloadGetLabelsRetType, ok bool) { + return getUpdateVolumePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateVolumePayload) SetLabels(v UpdateVolumePayloadGetLabelsRetType) { + setUpdateVolumePayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetName() (res UpdateVolumePayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetNameOk() (ret UpdateVolumePayloadGetNameRetType, ok bool) { + return getUpdateVolumePayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateVolumePayload) SetName(v UpdateVolumePayloadGetNameRetType) { + setUpdateVolumePayloadGetNameAttributeType(&o.Name, v) +} + +func (o UpdateVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateVolumePayloadgetBootableAttributeTypeOk(o.Bootable); ok { + toSerialize["Bootable"] = val + } + if val, ok := getUpdateVolumePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateVolumePayloadGetImageConfigAttributeTypeOk(o.ImageConfig); ok { + toSerialize["ImageConfig"] = val + } + if val, ok := getUpdateVolumePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateVolumePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableUpdateVolumePayload struct { + value *UpdateVolumePayload + isSet bool +} + +func (v NullableUpdateVolumePayload) Get() *UpdateVolumePayload { + return v.value +} + +func (v *NullableUpdateVolumePayload) Set(val *UpdateVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateVolumePayload(val *UpdateVolumePayload) *NullableUpdateVolumePayload { + return &NullableUpdateVolumePayload{value: val, isSet: true} +} + +func (v NullableUpdateVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_update_volume_payload_test.go b/pkg/iaasbeta/model_update_volume_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_update_volume_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_v2beta1_configure_network_area_region_payload.go b/pkg/iaasbeta/model_v2beta1_configure_network_area_region_payload.go new file mode 100644 index 00000000..fbf586b1 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_configure_network_area_region_payload.go @@ -0,0 +1,176 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the V2beta1ConfigureNetworkAreaRegionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V2beta1ConfigureNetworkAreaRegionPayload{} + +/* + types and functions for ipv4 +*/ + +// isModel +type V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4AttributeType = *RegionalAreaIPv4 +type V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4ArgType = RegionalAreaIPv4 +type V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4RetType = RegionalAreaIPv4 + +func getV2beta1ConfigureNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(arg V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4AttributeType) (ret V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1ConfigureNetworkAreaRegionPayloadGetIpv4AttributeType(arg *V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4AttributeType, val V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type V2beta1ConfigureNetworkAreaRegionPayloadGetStatusAttributeType = *string + +func getV2beta1ConfigureNetworkAreaRegionPayloadGetStatusAttributeTypeOk(arg V2beta1ConfigureNetworkAreaRegionPayloadGetStatusAttributeType) (ret V2beta1ConfigureNetworkAreaRegionPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1ConfigureNetworkAreaRegionPayloadGetStatusAttributeType(arg *V2beta1ConfigureNetworkAreaRegionPayloadGetStatusAttributeType, val V2beta1ConfigureNetworkAreaRegionPayloadGetStatusRetType) { + *arg = &val +} + +type V2beta1ConfigureNetworkAreaRegionPayloadGetStatusArgType = string +type V2beta1ConfigureNetworkAreaRegionPayloadGetStatusRetType = string + +// V2beta1ConfigureNetworkAreaRegionPayload The basic properties of a regional network area. +type V2beta1ConfigureNetworkAreaRegionPayload struct { + Ipv4 V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + Status V2beta1ConfigureNetworkAreaRegionPayloadGetStatusAttributeType `json:"status,omitempty"` +} + +// NewV2beta1ConfigureNetworkAreaRegionPayload instantiates a new V2beta1ConfigureNetworkAreaRegionPayload 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 NewV2beta1ConfigureNetworkAreaRegionPayload() *V2beta1ConfigureNetworkAreaRegionPayload { + this := V2beta1ConfigureNetworkAreaRegionPayload{} + return &this +} + +// NewV2beta1ConfigureNetworkAreaRegionPayloadWithDefaults instantiates a new V2beta1ConfigureNetworkAreaRegionPayload 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 NewV2beta1ConfigureNetworkAreaRegionPayloadWithDefaults() *V2beta1ConfigureNetworkAreaRegionPayload { + this := V2beta1ConfigureNetworkAreaRegionPayload{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *V2beta1ConfigureNetworkAreaRegionPayload) GetIpv4() (res V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1ConfigureNetworkAreaRegionPayload) GetIpv4Ok() (ret V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4RetType, ok bool) { + return getV2beta1ConfigureNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *V2beta1ConfigureNetworkAreaRegionPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given RegionalAreaIPv4 and assigns it to the Ipv4 field. +func (o *V2beta1ConfigureNetworkAreaRegionPayload) SetIpv4(v V2beta1ConfigureNetworkAreaRegionPayloadGetIpv4RetType) { + setV2beta1ConfigureNetworkAreaRegionPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *V2beta1ConfigureNetworkAreaRegionPayload) GetStatus() (res V2beta1ConfigureNetworkAreaRegionPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1ConfigureNetworkAreaRegionPayload) GetStatusOk() (ret V2beta1ConfigureNetworkAreaRegionPayloadGetStatusRetType, ok bool) { + return getV2beta1ConfigureNetworkAreaRegionPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *V2beta1ConfigureNetworkAreaRegionPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *V2beta1ConfigureNetworkAreaRegionPayload) SetStatus(v V2beta1ConfigureNetworkAreaRegionPayloadGetStatusRetType) { + setV2beta1ConfigureNetworkAreaRegionPayloadGetStatusAttributeType(&o.Status, v) +} + +func (o V2beta1ConfigureNetworkAreaRegionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getV2beta1ConfigureNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getV2beta1ConfigureNetworkAreaRegionPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableV2beta1ConfigureNetworkAreaRegionPayload struct { + value *V2beta1ConfigureNetworkAreaRegionPayload + isSet bool +} + +func (v NullableV2beta1ConfigureNetworkAreaRegionPayload) Get() *V2beta1ConfigureNetworkAreaRegionPayload { + return v.value +} + +func (v *NullableV2beta1ConfigureNetworkAreaRegionPayload) Set(val *V2beta1ConfigureNetworkAreaRegionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableV2beta1ConfigureNetworkAreaRegionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableV2beta1ConfigureNetworkAreaRegionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV2beta1ConfigureNetworkAreaRegionPayload(val *V2beta1ConfigureNetworkAreaRegionPayload) *NullableV2beta1ConfigureNetworkAreaRegionPayload { + return &NullableV2beta1ConfigureNetworkAreaRegionPayload{value: val, isSet: true} +} + +func (v NullableV2beta1ConfigureNetworkAreaRegionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV2beta1ConfigureNetworkAreaRegionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_v2beta1_configure_network_area_region_payload_test.go b/pkg/iaasbeta/model_v2beta1_configure_network_area_region_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_configure_network_area_region_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_v2beta1_create_snapshot_payload.go b/pkg/iaasbeta/model_v2beta1_create_snapshot_payload.go new file mode 100644 index 00000000..7556fc50 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_create_snapshot_payload.go @@ -0,0 +1,467 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the V2beta1CreateSnapshotPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V2beta1CreateSnapshotPayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type V2beta1CreateSnapshotPayloadGetCreatedAtAttributeType = *time.Time +type V2beta1CreateSnapshotPayloadGetCreatedAtArgType = time.Time +type V2beta1CreateSnapshotPayloadGetCreatedAtRetType = time.Time + +func getV2beta1CreateSnapshotPayloadGetCreatedAtAttributeTypeOk(arg V2beta1CreateSnapshotPayloadGetCreatedAtAttributeType) (ret V2beta1CreateSnapshotPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1CreateSnapshotPayloadGetCreatedAtAttributeType(arg *V2beta1CreateSnapshotPayloadGetCreatedAtAttributeType, val V2beta1CreateSnapshotPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type V2beta1CreateSnapshotPayloadGetIdAttributeType = *string + +func getV2beta1CreateSnapshotPayloadGetIdAttributeTypeOk(arg V2beta1CreateSnapshotPayloadGetIdAttributeType) (ret V2beta1CreateSnapshotPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1CreateSnapshotPayloadGetIdAttributeType(arg *V2beta1CreateSnapshotPayloadGetIdAttributeType, val V2beta1CreateSnapshotPayloadGetIdRetType) { + *arg = &val +} + +type V2beta1CreateSnapshotPayloadGetIdArgType = string +type V2beta1CreateSnapshotPayloadGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type V2beta1CreateSnapshotPayloadGetLabelsAttributeType = *map[string]interface{} +type V2beta1CreateSnapshotPayloadGetLabelsArgType = map[string]interface{} +type V2beta1CreateSnapshotPayloadGetLabelsRetType = map[string]interface{} + +func getV2beta1CreateSnapshotPayloadGetLabelsAttributeTypeOk(arg V2beta1CreateSnapshotPayloadGetLabelsAttributeType) (ret V2beta1CreateSnapshotPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1CreateSnapshotPayloadGetLabelsAttributeType(arg *V2beta1CreateSnapshotPayloadGetLabelsAttributeType, val V2beta1CreateSnapshotPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type V2beta1CreateSnapshotPayloadGetNameAttributeType = *string + +func getV2beta1CreateSnapshotPayloadGetNameAttributeTypeOk(arg V2beta1CreateSnapshotPayloadGetNameAttributeType) (ret V2beta1CreateSnapshotPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1CreateSnapshotPayloadGetNameAttributeType(arg *V2beta1CreateSnapshotPayloadGetNameAttributeType, val V2beta1CreateSnapshotPayloadGetNameRetType) { + *arg = &val +} + +type V2beta1CreateSnapshotPayloadGetNameArgType = string +type V2beta1CreateSnapshotPayloadGetNameRetType = string + +/* + types and functions for size +*/ + +// isLong +type V2beta1CreateSnapshotPayloadGetSizeAttributeType = *int64 +type V2beta1CreateSnapshotPayloadGetSizeArgType = int64 +type V2beta1CreateSnapshotPayloadGetSizeRetType = int64 + +func getV2beta1CreateSnapshotPayloadGetSizeAttributeTypeOk(arg V2beta1CreateSnapshotPayloadGetSizeAttributeType) (ret V2beta1CreateSnapshotPayloadGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1CreateSnapshotPayloadGetSizeAttributeType(arg *V2beta1CreateSnapshotPayloadGetSizeAttributeType, val V2beta1CreateSnapshotPayloadGetSizeRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type V2beta1CreateSnapshotPayloadGetStatusAttributeType = *string + +func getV2beta1CreateSnapshotPayloadGetStatusAttributeTypeOk(arg V2beta1CreateSnapshotPayloadGetStatusAttributeType) (ret V2beta1CreateSnapshotPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1CreateSnapshotPayloadGetStatusAttributeType(arg *V2beta1CreateSnapshotPayloadGetStatusAttributeType, val V2beta1CreateSnapshotPayloadGetStatusRetType) { + *arg = &val +} + +type V2beta1CreateSnapshotPayloadGetStatusArgType = string +type V2beta1CreateSnapshotPayloadGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type V2beta1CreateSnapshotPayloadGetUpdatedAtAttributeType = *time.Time +type V2beta1CreateSnapshotPayloadGetUpdatedAtArgType = time.Time +type V2beta1CreateSnapshotPayloadGetUpdatedAtRetType = time.Time + +func getV2beta1CreateSnapshotPayloadGetUpdatedAtAttributeTypeOk(arg V2beta1CreateSnapshotPayloadGetUpdatedAtAttributeType) (ret V2beta1CreateSnapshotPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1CreateSnapshotPayloadGetUpdatedAtAttributeType(arg *V2beta1CreateSnapshotPayloadGetUpdatedAtAttributeType, val V2beta1CreateSnapshotPayloadGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type V2beta1CreateSnapshotPayloadGetVolumeIdAttributeType = *string + +func getV2beta1CreateSnapshotPayloadGetVolumeIdAttributeTypeOk(arg V2beta1CreateSnapshotPayloadGetVolumeIdAttributeType) (ret V2beta1CreateSnapshotPayloadGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1CreateSnapshotPayloadGetVolumeIdAttributeType(arg *V2beta1CreateSnapshotPayloadGetVolumeIdAttributeType, val V2beta1CreateSnapshotPayloadGetVolumeIdRetType) { + *arg = &val +} + +type V2beta1CreateSnapshotPayloadGetVolumeIdArgType = string +type V2beta1CreateSnapshotPayloadGetVolumeIdRetType = string + +// V2beta1CreateSnapshotPayload Object that represents a snapshot. +type V2beta1CreateSnapshotPayload struct { + // Date-time when resource was created. + CreatedAt V2beta1CreateSnapshotPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id V2beta1CreateSnapshotPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels V2beta1CreateSnapshotPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name V2beta1CreateSnapshotPayloadGetNameAttributeType `json:"name,omitempty"` + // Size in Gigabyte. + Size V2beta1CreateSnapshotPayloadGetSizeAttributeType `json:"size,omitempty"` + // The status of a snapshot object. Possible values: `AVAILABLE`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`, `UNMANAGING`, `UPDATING`. + Status V2beta1CreateSnapshotPayloadGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt V2beta1CreateSnapshotPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + VolumeId V2beta1CreateSnapshotPayloadGetVolumeIdAttributeType `json:"volumeId" required:"true"` +} + +type _V2beta1CreateSnapshotPayload V2beta1CreateSnapshotPayload + +// NewV2beta1CreateSnapshotPayload instantiates a new V2beta1CreateSnapshotPayload 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 NewV2beta1CreateSnapshotPayload(volumeId V2beta1CreateSnapshotPayloadGetVolumeIdArgType) *V2beta1CreateSnapshotPayload { + this := V2beta1CreateSnapshotPayload{} + setV2beta1CreateSnapshotPayloadGetVolumeIdAttributeType(&this.VolumeId, volumeId) + return &this +} + +// NewV2beta1CreateSnapshotPayloadWithDefaults instantiates a new V2beta1CreateSnapshotPayload 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 NewV2beta1CreateSnapshotPayloadWithDefaults() *V2beta1CreateSnapshotPayload { + this := V2beta1CreateSnapshotPayload{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *V2beta1CreateSnapshotPayload) GetCreatedAt() (res V2beta1CreateSnapshotPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1CreateSnapshotPayload) GetCreatedAtOk() (ret V2beta1CreateSnapshotPayloadGetCreatedAtRetType, ok bool) { + return getV2beta1CreateSnapshotPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *V2beta1CreateSnapshotPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *V2beta1CreateSnapshotPayload) SetCreatedAt(v V2beta1CreateSnapshotPayloadGetCreatedAtRetType) { + setV2beta1CreateSnapshotPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *V2beta1CreateSnapshotPayload) GetId() (res V2beta1CreateSnapshotPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1CreateSnapshotPayload) GetIdOk() (ret V2beta1CreateSnapshotPayloadGetIdRetType, ok bool) { + return getV2beta1CreateSnapshotPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *V2beta1CreateSnapshotPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *V2beta1CreateSnapshotPayload) SetId(v V2beta1CreateSnapshotPayloadGetIdRetType) { + setV2beta1CreateSnapshotPayloadGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *V2beta1CreateSnapshotPayload) GetLabels() (res V2beta1CreateSnapshotPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1CreateSnapshotPayload) GetLabelsOk() (ret V2beta1CreateSnapshotPayloadGetLabelsRetType, ok bool) { + return getV2beta1CreateSnapshotPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *V2beta1CreateSnapshotPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *V2beta1CreateSnapshotPayload) SetLabels(v V2beta1CreateSnapshotPayloadGetLabelsRetType) { + setV2beta1CreateSnapshotPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *V2beta1CreateSnapshotPayload) GetName() (res V2beta1CreateSnapshotPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1CreateSnapshotPayload) GetNameOk() (ret V2beta1CreateSnapshotPayloadGetNameRetType, ok bool) { + return getV2beta1CreateSnapshotPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *V2beta1CreateSnapshotPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *V2beta1CreateSnapshotPayload) SetName(v V2beta1CreateSnapshotPayloadGetNameRetType) { + setV2beta1CreateSnapshotPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *V2beta1CreateSnapshotPayload) GetSize() (res V2beta1CreateSnapshotPayloadGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1CreateSnapshotPayload) GetSizeOk() (ret V2beta1CreateSnapshotPayloadGetSizeRetType, ok bool) { + return getV2beta1CreateSnapshotPayloadGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *V2beta1CreateSnapshotPayload) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *V2beta1CreateSnapshotPayload) SetSize(v V2beta1CreateSnapshotPayloadGetSizeRetType) { + setV2beta1CreateSnapshotPayloadGetSizeAttributeType(&o.Size, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *V2beta1CreateSnapshotPayload) GetStatus() (res V2beta1CreateSnapshotPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1CreateSnapshotPayload) GetStatusOk() (ret V2beta1CreateSnapshotPayloadGetStatusRetType, ok bool) { + return getV2beta1CreateSnapshotPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *V2beta1CreateSnapshotPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *V2beta1CreateSnapshotPayload) SetStatus(v V2beta1CreateSnapshotPayloadGetStatusRetType) { + setV2beta1CreateSnapshotPayloadGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *V2beta1CreateSnapshotPayload) GetUpdatedAt() (res V2beta1CreateSnapshotPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1CreateSnapshotPayload) GetUpdatedAtOk() (ret V2beta1CreateSnapshotPayloadGetUpdatedAtRetType, ok bool) { + return getV2beta1CreateSnapshotPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *V2beta1CreateSnapshotPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *V2beta1CreateSnapshotPayload) SetUpdatedAt(v V2beta1CreateSnapshotPayloadGetUpdatedAtRetType) { + setV2beta1CreateSnapshotPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetVolumeId returns the VolumeId field value +func (o *V2beta1CreateSnapshotPayload) GetVolumeId() (ret V2beta1CreateSnapshotPayloadGetVolumeIdRetType) { + ret, _ = o.GetVolumeIdOk() + return ret +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value +// and a boolean to check if the value has been set. +func (o *V2beta1CreateSnapshotPayload) GetVolumeIdOk() (ret V2beta1CreateSnapshotPayloadGetVolumeIdRetType, ok bool) { + return getV2beta1CreateSnapshotPayloadGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// SetVolumeId sets field value +func (o *V2beta1CreateSnapshotPayload) SetVolumeId(v V2beta1CreateSnapshotPayloadGetVolumeIdRetType) { + setV2beta1CreateSnapshotPayloadGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o V2beta1CreateSnapshotPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getV2beta1CreateSnapshotPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getV2beta1CreateSnapshotPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getV2beta1CreateSnapshotPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getV2beta1CreateSnapshotPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getV2beta1CreateSnapshotPayloadGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getV2beta1CreateSnapshotPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getV2beta1CreateSnapshotPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getV2beta1CreateSnapshotPayloadGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableV2beta1CreateSnapshotPayload struct { + value *V2beta1CreateSnapshotPayload + isSet bool +} + +func (v NullableV2beta1CreateSnapshotPayload) Get() *V2beta1CreateSnapshotPayload { + return v.value +} + +func (v *NullableV2beta1CreateSnapshotPayload) Set(val *V2beta1CreateSnapshotPayload) { + v.value = val + v.isSet = true +} + +func (v NullableV2beta1CreateSnapshotPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableV2beta1CreateSnapshotPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV2beta1CreateSnapshotPayload(val *V2beta1CreateSnapshotPayload) *NullableV2beta1CreateSnapshotPayload { + return &NullableV2beta1CreateSnapshotPayload{value: val, isSet: true} +} + +func (v NullableV2beta1CreateSnapshotPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV2beta1CreateSnapshotPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_v2beta1_create_snapshot_payload_test.go b/pkg/iaasbeta/model_v2beta1_create_snapshot_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_create_snapshot_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_v2beta1_update_backup_payload.go b/pkg/iaasbeta/model_v2beta1_update_backup_payload.go new file mode 100644 index 00000000..3921d3b8 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_update_backup_payload.go @@ -0,0 +1,615 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the V2beta1UpdateBackupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V2beta1UpdateBackupPayload{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type V2beta1UpdateBackupPayloadGetAvailabilityZoneAttributeType = *string + +func getV2beta1UpdateBackupPayloadGetAvailabilityZoneAttributeTypeOk(arg V2beta1UpdateBackupPayloadGetAvailabilityZoneAttributeType) (ret V2beta1UpdateBackupPayloadGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadGetAvailabilityZoneAttributeType(arg *V2beta1UpdateBackupPayloadGetAvailabilityZoneAttributeType, val V2beta1UpdateBackupPayloadGetAvailabilityZoneRetType) { + *arg = &val +} + +type V2beta1UpdateBackupPayloadGetAvailabilityZoneArgType = string +type V2beta1UpdateBackupPayloadGetAvailabilityZoneRetType = string + +/* + types and functions for createdAt +*/ + +// isDateTime +type V2beta1UpdateBackupPayloadGetCreatedAtAttributeType = *time.Time +type V2beta1UpdateBackupPayloadGetCreatedAtArgType = time.Time +type V2beta1UpdateBackupPayloadGetCreatedAtRetType = time.Time + +func getV2beta1UpdateBackupPayloadGetCreatedAtAttributeTypeOk(arg V2beta1UpdateBackupPayloadGetCreatedAtAttributeType) (ret V2beta1UpdateBackupPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadGetCreatedAtAttributeType(arg *V2beta1UpdateBackupPayloadGetCreatedAtAttributeType, val V2beta1UpdateBackupPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for encrypted +*/ + +// isBoolean +type V2beta1UpdateBackupPayloadgetEncryptedAttributeType = *bool +type V2beta1UpdateBackupPayloadgetEncryptedArgType = bool +type V2beta1UpdateBackupPayloadgetEncryptedRetType = bool + +func getV2beta1UpdateBackupPayloadgetEncryptedAttributeTypeOk(arg V2beta1UpdateBackupPayloadgetEncryptedAttributeType) (ret V2beta1UpdateBackupPayloadgetEncryptedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadgetEncryptedAttributeType(arg *V2beta1UpdateBackupPayloadgetEncryptedAttributeType, val V2beta1UpdateBackupPayloadgetEncryptedRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type V2beta1UpdateBackupPayloadGetIdAttributeType = *string + +func getV2beta1UpdateBackupPayloadGetIdAttributeTypeOk(arg V2beta1UpdateBackupPayloadGetIdAttributeType) (ret V2beta1UpdateBackupPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadGetIdAttributeType(arg *V2beta1UpdateBackupPayloadGetIdAttributeType, val V2beta1UpdateBackupPayloadGetIdRetType) { + *arg = &val +} + +type V2beta1UpdateBackupPayloadGetIdArgType = string +type V2beta1UpdateBackupPayloadGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type V2beta1UpdateBackupPayloadGetLabelsAttributeType = *map[string]interface{} +type V2beta1UpdateBackupPayloadGetLabelsArgType = map[string]interface{} +type V2beta1UpdateBackupPayloadGetLabelsRetType = map[string]interface{} + +func getV2beta1UpdateBackupPayloadGetLabelsAttributeTypeOk(arg V2beta1UpdateBackupPayloadGetLabelsAttributeType) (ret V2beta1UpdateBackupPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadGetLabelsAttributeType(arg *V2beta1UpdateBackupPayloadGetLabelsAttributeType, val V2beta1UpdateBackupPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type V2beta1UpdateBackupPayloadGetNameAttributeType = *string + +func getV2beta1UpdateBackupPayloadGetNameAttributeTypeOk(arg V2beta1UpdateBackupPayloadGetNameAttributeType) (ret V2beta1UpdateBackupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadGetNameAttributeType(arg *V2beta1UpdateBackupPayloadGetNameAttributeType, val V2beta1UpdateBackupPayloadGetNameRetType) { + *arg = &val +} + +type V2beta1UpdateBackupPayloadGetNameArgType = string +type V2beta1UpdateBackupPayloadGetNameRetType = string + +/* + types and functions for size +*/ + +// isLong +type V2beta1UpdateBackupPayloadGetSizeAttributeType = *int64 +type V2beta1UpdateBackupPayloadGetSizeArgType = int64 +type V2beta1UpdateBackupPayloadGetSizeRetType = int64 + +func getV2beta1UpdateBackupPayloadGetSizeAttributeTypeOk(arg V2beta1UpdateBackupPayloadGetSizeAttributeType) (ret V2beta1UpdateBackupPayloadGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadGetSizeAttributeType(arg *V2beta1UpdateBackupPayloadGetSizeAttributeType, val V2beta1UpdateBackupPayloadGetSizeRetType) { + *arg = &val +} + +/* + types and functions for snapshotId +*/ + +// isNotNullableString +type V2beta1UpdateBackupPayloadGetSnapshotIdAttributeType = *string + +func getV2beta1UpdateBackupPayloadGetSnapshotIdAttributeTypeOk(arg V2beta1UpdateBackupPayloadGetSnapshotIdAttributeType) (ret V2beta1UpdateBackupPayloadGetSnapshotIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadGetSnapshotIdAttributeType(arg *V2beta1UpdateBackupPayloadGetSnapshotIdAttributeType, val V2beta1UpdateBackupPayloadGetSnapshotIdRetType) { + *arg = &val +} + +type V2beta1UpdateBackupPayloadGetSnapshotIdArgType = string +type V2beta1UpdateBackupPayloadGetSnapshotIdRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type V2beta1UpdateBackupPayloadGetStatusAttributeType = *string + +func getV2beta1UpdateBackupPayloadGetStatusAttributeTypeOk(arg V2beta1UpdateBackupPayloadGetStatusAttributeType) (ret V2beta1UpdateBackupPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadGetStatusAttributeType(arg *V2beta1UpdateBackupPayloadGetStatusAttributeType, val V2beta1UpdateBackupPayloadGetStatusRetType) { + *arg = &val +} + +type V2beta1UpdateBackupPayloadGetStatusArgType = string +type V2beta1UpdateBackupPayloadGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type V2beta1UpdateBackupPayloadGetUpdatedAtAttributeType = *time.Time +type V2beta1UpdateBackupPayloadGetUpdatedAtArgType = time.Time +type V2beta1UpdateBackupPayloadGetUpdatedAtRetType = time.Time + +func getV2beta1UpdateBackupPayloadGetUpdatedAtAttributeTypeOk(arg V2beta1UpdateBackupPayloadGetUpdatedAtAttributeType) (ret V2beta1UpdateBackupPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadGetUpdatedAtAttributeType(arg *V2beta1UpdateBackupPayloadGetUpdatedAtAttributeType, val V2beta1UpdateBackupPayloadGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type V2beta1UpdateBackupPayloadGetVolumeIdAttributeType = *string + +func getV2beta1UpdateBackupPayloadGetVolumeIdAttributeTypeOk(arg V2beta1UpdateBackupPayloadGetVolumeIdAttributeType) (ret V2beta1UpdateBackupPayloadGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateBackupPayloadGetVolumeIdAttributeType(arg *V2beta1UpdateBackupPayloadGetVolumeIdAttributeType, val V2beta1UpdateBackupPayloadGetVolumeIdRetType) { + *arg = &val +} + +type V2beta1UpdateBackupPayloadGetVolumeIdArgType = string +type V2beta1UpdateBackupPayloadGetVolumeIdRetType = string + +// V2beta1UpdateBackupPayload Object that represents a backup. +type V2beta1UpdateBackupPayload struct { + // Object that represents an availability zone. + AvailabilityZone V2beta1UpdateBackupPayloadGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + // Date-time when resource was created. + CreatedAt V2beta1UpdateBackupPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Indicates if a volume is encrypted. + Encrypted V2beta1UpdateBackupPayloadgetEncryptedAttributeType `json:"encrypted,omitempty"` + // Universally Unique Identifier (UUID). + Id V2beta1UpdateBackupPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels V2beta1UpdateBackupPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name V2beta1UpdateBackupPayloadGetNameAttributeType `json:"name,omitempty"` + // Size in Gigabyte. + Size V2beta1UpdateBackupPayloadGetSizeAttributeType `json:"size,omitempty"` + // Universally Unique Identifier (UUID). + SnapshotId V2beta1UpdateBackupPayloadGetSnapshotIdAttributeType `json:"snapshotId,omitempty"` + // The status of a backup object. Possible values: `AVAILABLE`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`. + Status V2beta1UpdateBackupPayloadGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt V2beta1UpdateBackupPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId V2beta1UpdateBackupPayloadGetVolumeIdAttributeType `json:"volumeId,omitempty"` +} + +// NewV2beta1UpdateBackupPayload instantiates a new V2beta1UpdateBackupPayload 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 NewV2beta1UpdateBackupPayload() *V2beta1UpdateBackupPayload { + this := V2beta1UpdateBackupPayload{} + return &this +} + +// NewV2beta1UpdateBackupPayloadWithDefaults instantiates a new V2beta1UpdateBackupPayload 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 NewV2beta1UpdateBackupPayloadWithDefaults() *V2beta1UpdateBackupPayload { + this := V2beta1UpdateBackupPayload{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetAvailabilityZone() (res V2beta1UpdateBackupPayloadGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetAvailabilityZoneOk() (ret V2beta1UpdateBackupPayloadGetAvailabilityZoneRetType, ok bool) { + return getV2beta1UpdateBackupPayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *V2beta1UpdateBackupPayload) SetAvailabilityZone(v V2beta1UpdateBackupPayloadGetAvailabilityZoneRetType) { + setV2beta1UpdateBackupPayloadGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetCreatedAt() (res V2beta1UpdateBackupPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetCreatedAtOk() (ret V2beta1UpdateBackupPayloadGetCreatedAtRetType, ok bool) { + return getV2beta1UpdateBackupPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *V2beta1UpdateBackupPayload) SetCreatedAt(v V2beta1UpdateBackupPayloadGetCreatedAtRetType) { + setV2beta1UpdateBackupPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetEncrypted returns the Encrypted field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetEncrypted() (res V2beta1UpdateBackupPayloadgetEncryptedRetType) { + res, _ = o.GetEncryptedOk() + return +} + +// GetEncryptedOk returns a tuple with the Encrypted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetEncryptedOk() (ret V2beta1UpdateBackupPayloadgetEncryptedRetType, ok bool) { + return getV2beta1UpdateBackupPayloadgetEncryptedAttributeTypeOk(o.Encrypted) +} + +// HasEncrypted returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasEncrypted() bool { + _, ok := o.GetEncryptedOk() + return ok +} + +// SetEncrypted gets a reference to the given bool and assigns it to the Encrypted field. +func (o *V2beta1UpdateBackupPayload) SetEncrypted(v V2beta1UpdateBackupPayloadgetEncryptedRetType) { + setV2beta1UpdateBackupPayloadgetEncryptedAttributeType(&o.Encrypted, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetId() (res V2beta1UpdateBackupPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetIdOk() (ret V2beta1UpdateBackupPayloadGetIdRetType, ok bool) { + return getV2beta1UpdateBackupPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *V2beta1UpdateBackupPayload) SetId(v V2beta1UpdateBackupPayloadGetIdRetType) { + setV2beta1UpdateBackupPayloadGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetLabels() (res V2beta1UpdateBackupPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetLabelsOk() (ret V2beta1UpdateBackupPayloadGetLabelsRetType, ok bool) { + return getV2beta1UpdateBackupPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *V2beta1UpdateBackupPayload) SetLabels(v V2beta1UpdateBackupPayloadGetLabelsRetType) { + setV2beta1UpdateBackupPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetName() (res V2beta1UpdateBackupPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetNameOk() (ret V2beta1UpdateBackupPayloadGetNameRetType, ok bool) { + return getV2beta1UpdateBackupPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *V2beta1UpdateBackupPayload) SetName(v V2beta1UpdateBackupPayloadGetNameRetType) { + setV2beta1UpdateBackupPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetSize() (res V2beta1UpdateBackupPayloadGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetSizeOk() (ret V2beta1UpdateBackupPayloadGetSizeRetType, ok bool) { + return getV2beta1UpdateBackupPayloadGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *V2beta1UpdateBackupPayload) SetSize(v V2beta1UpdateBackupPayloadGetSizeRetType) { + setV2beta1UpdateBackupPayloadGetSizeAttributeType(&o.Size, v) +} + +// GetSnapshotId returns the SnapshotId field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetSnapshotId() (res V2beta1UpdateBackupPayloadGetSnapshotIdRetType) { + res, _ = o.GetSnapshotIdOk() + return +} + +// GetSnapshotIdOk returns a tuple with the SnapshotId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetSnapshotIdOk() (ret V2beta1UpdateBackupPayloadGetSnapshotIdRetType, ok bool) { + return getV2beta1UpdateBackupPayloadGetSnapshotIdAttributeTypeOk(o.SnapshotId) +} + +// HasSnapshotId returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasSnapshotId() bool { + _, ok := o.GetSnapshotIdOk() + return ok +} + +// SetSnapshotId gets a reference to the given string and assigns it to the SnapshotId field. +func (o *V2beta1UpdateBackupPayload) SetSnapshotId(v V2beta1UpdateBackupPayloadGetSnapshotIdRetType) { + setV2beta1UpdateBackupPayloadGetSnapshotIdAttributeType(&o.SnapshotId, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetStatus() (res V2beta1UpdateBackupPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetStatusOk() (ret V2beta1UpdateBackupPayloadGetStatusRetType, ok bool) { + return getV2beta1UpdateBackupPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *V2beta1UpdateBackupPayload) SetStatus(v V2beta1UpdateBackupPayloadGetStatusRetType) { + setV2beta1UpdateBackupPayloadGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetUpdatedAt() (res V2beta1UpdateBackupPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetUpdatedAtOk() (ret V2beta1UpdateBackupPayloadGetUpdatedAtRetType, ok bool) { + return getV2beta1UpdateBackupPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *V2beta1UpdateBackupPayload) SetUpdatedAt(v V2beta1UpdateBackupPayloadGetUpdatedAtRetType) { + setV2beta1UpdateBackupPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *V2beta1UpdateBackupPayload) GetVolumeId() (res V2beta1UpdateBackupPayloadGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateBackupPayload) GetVolumeIdOk() (ret V2beta1UpdateBackupPayloadGetVolumeIdRetType, ok bool) { + return getV2beta1UpdateBackupPayloadGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *V2beta1UpdateBackupPayload) HasVolumeId() bool { + _, ok := o.GetVolumeIdOk() + return ok +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *V2beta1UpdateBackupPayload) SetVolumeId(v V2beta1UpdateBackupPayloadGetVolumeIdRetType) { + setV2beta1UpdateBackupPayloadGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o V2beta1UpdateBackupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getV2beta1UpdateBackupPayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getV2beta1UpdateBackupPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getV2beta1UpdateBackupPayloadgetEncryptedAttributeTypeOk(o.Encrypted); ok { + toSerialize["Encrypted"] = val + } + if val, ok := getV2beta1UpdateBackupPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getV2beta1UpdateBackupPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getV2beta1UpdateBackupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getV2beta1UpdateBackupPayloadGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getV2beta1UpdateBackupPayloadGetSnapshotIdAttributeTypeOk(o.SnapshotId); ok { + toSerialize["SnapshotId"] = val + } + if val, ok := getV2beta1UpdateBackupPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getV2beta1UpdateBackupPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getV2beta1UpdateBackupPayloadGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableV2beta1UpdateBackupPayload struct { + value *V2beta1UpdateBackupPayload + isSet bool +} + +func (v NullableV2beta1UpdateBackupPayload) Get() *V2beta1UpdateBackupPayload { + return v.value +} + +func (v *NullableV2beta1UpdateBackupPayload) Set(val *V2beta1UpdateBackupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableV2beta1UpdateBackupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableV2beta1UpdateBackupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV2beta1UpdateBackupPayload(val *V2beta1UpdateBackupPayload) *NullableV2beta1UpdateBackupPayload { + return &NullableV2beta1UpdateBackupPayload{value: val, isSet: true} +} + +func (v NullableV2beta1UpdateBackupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV2beta1UpdateBackupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_v2beta1_update_backup_payload_test.go b/pkg/iaasbeta/model_v2beta1_update_backup_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_update_backup_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_v2beta1_update_network_area_region_payload.go b/pkg/iaasbeta/model_v2beta1_update_network_area_region_payload.go new file mode 100644 index 00000000..c29d4a3c --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_update_network_area_region_payload.go @@ -0,0 +1,127 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the V2beta1UpdateNetworkAreaRegionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V2beta1UpdateNetworkAreaRegionPayload{} + +/* + types and functions for ipv4 +*/ + +// isModel +type V2beta1UpdateNetworkAreaRegionPayloadGetIpv4AttributeType = *UpdateRegionalAreaIPv4 +type V2beta1UpdateNetworkAreaRegionPayloadGetIpv4ArgType = UpdateRegionalAreaIPv4 +type V2beta1UpdateNetworkAreaRegionPayloadGetIpv4RetType = UpdateRegionalAreaIPv4 + +func getV2beta1UpdateNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(arg V2beta1UpdateNetworkAreaRegionPayloadGetIpv4AttributeType) (ret V2beta1UpdateNetworkAreaRegionPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateNetworkAreaRegionPayloadGetIpv4AttributeType(arg *V2beta1UpdateNetworkAreaRegionPayloadGetIpv4AttributeType, val V2beta1UpdateNetworkAreaRegionPayloadGetIpv4RetType) { + *arg = &val +} + +// V2beta1UpdateNetworkAreaRegionPayload Object that represents the request body for a regional network area update. +type V2beta1UpdateNetworkAreaRegionPayload struct { + Ipv4 V2beta1UpdateNetworkAreaRegionPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` +} + +// NewV2beta1UpdateNetworkAreaRegionPayload instantiates a new V2beta1UpdateNetworkAreaRegionPayload 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 NewV2beta1UpdateNetworkAreaRegionPayload() *V2beta1UpdateNetworkAreaRegionPayload { + this := V2beta1UpdateNetworkAreaRegionPayload{} + return &this +} + +// NewV2beta1UpdateNetworkAreaRegionPayloadWithDefaults instantiates a new V2beta1UpdateNetworkAreaRegionPayload 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 NewV2beta1UpdateNetworkAreaRegionPayloadWithDefaults() *V2beta1UpdateNetworkAreaRegionPayload { + this := V2beta1UpdateNetworkAreaRegionPayload{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *V2beta1UpdateNetworkAreaRegionPayload) GetIpv4() (res V2beta1UpdateNetworkAreaRegionPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateNetworkAreaRegionPayload) GetIpv4Ok() (ret V2beta1UpdateNetworkAreaRegionPayloadGetIpv4RetType, ok bool) { + return getV2beta1UpdateNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *V2beta1UpdateNetworkAreaRegionPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given UpdateRegionalAreaIPv4 and assigns it to the Ipv4 field. +func (o *V2beta1UpdateNetworkAreaRegionPayload) SetIpv4(v V2beta1UpdateNetworkAreaRegionPayloadGetIpv4RetType) { + setV2beta1UpdateNetworkAreaRegionPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +func (o V2beta1UpdateNetworkAreaRegionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getV2beta1UpdateNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + return toSerialize, nil +} + +type NullableV2beta1UpdateNetworkAreaRegionPayload struct { + value *V2beta1UpdateNetworkAreaRegionPayload + isSet bool +} + +func (v NullableV2beta1UpdateNetworkAreaRegionPayload) Get() *V2beta1UpdateNetworkAreaRegionPayload { + return v.value +} + +func (v *NullableV2beta1UpdateNetworkAreaRegionPayload) Set(val *V2beta1UpdateNetworkAreaRegionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableV2beta1UpdateNetworkAreaRegionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableV2beta1UpdateNetworkAreaRegionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV2beta1UpdateNetworkAreaRegionPayload(val *V2beta1UpdateNetworkAreaRegionPayload) *NullableV2beta1UpdateNetworkAreaRegionPayload { + return &NullableV2beta1UpdateNetworkAreaRegionPayload{value: val, isSet: true} +} + +func (v NullableV2beta1UpdateNetworkAreaRegionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV2beta1UpdateNetworkAreaRegionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_v2beta1_update_network_area_region_payload_test.go b/pkg/iaasbeta/model_v2beta1_update_network_area_region_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_update_network_area_region_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_v2beta1_update_route_of_area_payload.go b/pkg/iaasbeta/model_v2beta1_update_route_of_area_payload.go new file mode 100644 index 00000000..63f0938e --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_update_route_of_area_payload.go @@ -0,0 +1,128 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the V2beta1UpdateRouteOfAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V2beta1UpdateRouteOfAreaPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type V2beta1UpdateRouteOfAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type V2beta1UpdateRouteOfAreaPayloadGetLabelsArgType = map[string]interface{} +type V2beta1UpdateRouteOfAreaPayloadGetLabelsRetType = map[string]interface{} + +func getV2beta1UpdateRouteOfAreaPayloadGetLabelsAttributeTypeOk(arg V2beta1UpdateRouteOfAreaPayloadGetLabelsAttributeType) (ret V2beta1UpdateRouteOfAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateRouteOfAreaPayloadGetLabelsAttributeType(arg *V2beta1UpdateRouteOfAreaPayloadGetLabelsAttributeType, val V2beta1UpdateRouteOfAreaPayloadGetLabelsRetType) { + *arg = &val +} + +// V2beta1UpdateRouteOfAreaPayload Object that represents the request body for a route update. +type V2beta1UpdateRouteOfAreaPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels V2beta1UpdateRouteOfAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` +} + +// NewV2beta1UpdateRouteOfAreaPayload instantiates a new V2beta1UpdateRouteOfAreaPayload 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 NewV2beta1UpdateRouteOfAreaPayload() *V2beta1UpdateRouteOfAreaPayload { + this := V2beta1UpdateRouteOfAreaPayload{} + return &this +} + +// NewV2beta1UpdateRouteOfAreaPayloadWithDefaults instantiates a new V2beta1UpdateRouteOfAreaPayload 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 NewV2beta1UpdateRouteOfAreaPayloadWithDefaults() *V2beta1UpdateRouteOfAreaPayload { + this := V2beta1UpdateRouteOfAreaPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *V2beta1UpdateRouteOfAreaPayload) GetLabels() (res V2beta1UpdateRouteOfAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateRouteOfAreaPayload) GetLabelsOk() (ret V2beta1UpdateRouteOfAreaPayloadGetLabelsRetType, ok bool) { + return getV2beta1UpdateRouteOfAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *V2beta1UpdateRouteOfAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *V2beta1UpdateRouteOfAreaPayload) SetLabels(v V2beta1UpdateRouteOfAreaPayloadGetLabelsRetType) { + setV2beta1UpdateRouteOfAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o V2beta1UpdateRouteOfAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getV2beta1UpdateRouteOfAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableV2beta1UpdateRouteOfAreaPayload struct { + value *V2beta1UpdateRouteOfAreaPayload + isSet bool +} + +func (v NullableV2beta1UpdateRouteOfAreaPayload) Get() *V2beta1UpdateRouteOfAreaPayload { + return v.value +} + +func (v *NullableV2beta1UpdateRouteOfAreaPayload) Set(val *V2beta1UpdateRouteOfAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullableV2beta1UpdateRouteOfAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableV2beta1UpdateRouteOfAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV2beta1UpdateRouteOfAreaPayload(val *V2beta1UpdateRouteOfAreaPayload) *NullableV2beta1UpdateRouteOfAreaPayload { + return &NullableV2beta1UpdateRouteOfAreaPayload{value: val, isSet: true} +} + +func (v NullableV2beta1UpdateRouteOfAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV2beta1UpdateRouteOfAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_v2beta1_update_route_of_area_payload_test.go b/pkg/iaasbeta/model_v2beta1_update_route_of_area_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_update_route_of_area_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_v2beta1_update_security_group_payload.go b/pkg/iaasbeta/model_v2beta1_update_security_group_payload.go new file mode 100644 index 00000000..8f5eb511 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_update_security_group_payload.go @@ -0,0 +1,226 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the V2beta1UpdateSecurityGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V2beta1UpdateSecurityGroupPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type V2beta1UpdateSecurityGroupPayloadGetDescriptionAttributeType = *string + +func getV2beta1UpdateSecurityGroupPayloadGetDescriptionAttributeTypeOk(arg V2beta1UpdateSecurityGroupPayloadGetDescriptionAttributeType) (ret V2beta1UpdateSecurityGroupPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateSecurityGroupPayloadGetDescriptionAttributeType(arg *V2beta1UpdateSecurityGroupPayloadGetDescriptionAttributeType, val V2beta1UpdateSecurityGroupPayloadGetDescriptionRetType) { + *arg = &val +} + +type V2beta1UpdateSecurityGroupPayloadGetDescriptionArgType = string +type V2beta1UpdateSecurityGroupPayloadGetDescriptionRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type V2beta1UpdateSecurityGroupPayloadGetLabelsAttributeType = *map[string]interface{} +type V2beta1UpdateSecurityGroupPayloadGetLabelsArgType = map[string]interface{} +type V2beta1UpdateSecurityGroupPayloadGetLabelsRetType = map[string]interface{} + +func getV2beta1UpdateSecurityGroupPayloadGetLabelsAttributeTypeOk(arg V2beta1UpdateSecurityGroupPayloadGetLabelsAttributeType) (ret V2beta1UpdateSecurityGroupPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateSecurityGroupPayloadGetLabelsAttributeType(arg *V2beta1UpdateSecurityGroupPayloadGetLabelsAttributeType, val V2beta1UpdateSecurityGroupPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type V2beta1UpdateSecurityGroupPayloadGetNameAttributeType = *string + +func getV2beta1UpdateSecurityGroupPayloadGetNameAttributeTypeOk(arg V2beta1UpdateSecurityGroupPayloadGetNameAttributeType) (ret V2beta1UpdateSecurityGroupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateSecurityGroupPayloadGetNameAttributeType(arg *V2beta1UpdateSecurityGroupPayloadGetNameAttributeType, val V2beta1UpdateSecurityGroupPayloadGetNameRetType) { + *arg = &val +} + +type V2beta1UpdateSecurityGroupPayloadGetNameArgType = string +type V2beta1UpdateSecurityGroupPayloadGetNameRetType = string + +// V2beta1UpdateSecurityGroupPayload Object that represents an update request body of a security group. +type V2beta1UpdateSecurityGroupPayload struct { + // Description Object. Allows string up to 255 Characters. + Description V2beta1UpdateSecurityGroupPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels V2beta1UpdateSecurityGroupPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name V2beta1UpdateSecurityGroupPayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewV2beta1UpdateSecurityGroupPayload instantiates a new V2beta1UpdateSecurityGroupPayload 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 NewV2beta1UpdateSecurityGroupPayload() *V2beta1UpdateSecurityGroupPayload { + this := V2beta1UpdateSecurityGroupPayload{} + return &this +} + +// NewV2beta1UpdateSecurityGroupPayloadWithDefaults instantiates a new V2beta1UpdateSecurityGroupPayload 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 NewV2beta1UpdateSecurityGroupPayloadWithDefaults() *V2beta1UpdateSecurityGroupPayload { + this := V2beta1UpdateSecurityGroupPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *V2beta1UpdateSecurityGroupPayload) GetDescription() (res V2beta1UpdateSecurityGroupPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateSecurityGroupPayload) GetDescriptionOk() (ret V2beta1UpdateSecurityGroupPayloadGetDescriptionRetType, ok bool) { + return getV2beta1UpdateSecurityGroupPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *V2beta1UpdateSecurityGroupPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *V2beta1UpdateSecurityGroupPayload) SetDescription(v V2beta1UpdateSecurityGroupPayloadGetDescriptionRetType) { + setV2beta1UpdateSecurityGroupPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *V2beta1UpdateSecurityGroupPayload) GetLabels() (res V2beta1UpdateSecurityGroupPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateSecurityGroupPayload) GetLabelsOk() (ret V2beta1UpdateSecurityGroupPayloadGetLabelsRetType, ok bool) { + return getV2beta1UpdateSecurityGroupPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *V2beta1UpdateSecurityGroupPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *V2beta1UpdateSecurityGroupPayload) SetLabels(v V2beta1UpdateSecurityGroupPayloadGetLabelsRetType) { + setV2beta1UpdateSecurityGroupPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *V2beta1UpdateSecurityGroupPayload) GetName() (res V2beta1UpdateSecurityGroupPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateSecurityGroupPayload) GetNameOk() (ret V2beta1UpdateSecurityGroupPayloadGetNameRetType, ok bool) { + return getV2beta1UpdateSecurityGroupPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *V2beta1UpdateSecurityGroupPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *V2beta1UpdateSecurityGroupPayload) SetName(v V2beta1UpdateSecurityGroupPayloadGetNameRetType) { + setV2beta1UpdateSecurityGroupPayloadGetNameAttributeType(&o.Name, v) +} + +func (o V2beta1UpdateSecurityGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getV2beta1UpdateSecurityGroupPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getV2beta1UpdateSecurityGroupPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getV2beta1UpdateSecurityGroupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableV2beta1UpdateSecurityGroupPayload struct { + value *V2beta1UpdateSecurityGroupPayload + isSet bool +} + +func (v NullableV2beta1UpdateSecurityGroupPayload) Get() *V2beta1UpdateSecurityGroupPayload { + return v.value +} + +func (v *NullableV2beta1UpdateSecurityGroupPayload) Set(val *V2beta1UpdateSecurityGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableV2beta1UpdateSecurityGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableV2beta1UpdateSecurityGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV2beta1UpdateSecurityGroupPayload(val *V2beta1UpdateSecurityGroupPayload) *NullableV2beta1UpdateSecurityGroupPayload { + return &NullableV2beta1UpdateSecurityGroupPayload{value: val, isSet: true} +} + +func (v NullableV2beta1UpdateSecurityGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV2beta1UpdateSecurityGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_v2beta1_update_security_group_payload_test.go b/pkg/iaasbeta/model_v2beta1_update_security_group_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_update_security_group_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_v2beta1_update_snapshot_payload.go b/pkg/iaasbeta/model_v2beta1_update_snapshot_payload.go new file mode 100644 index 00000000..a553aaa8 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_update_snapshot_payload.go @@ -0,0 +1,177 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the V2beta1UpdateSnapshotPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V2beta1UpdateSnapshotPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type V2beta1UpdateSnapshotPayloadGetLabelsAttributeType = *map[string]interface{} +type V2beta1UpdateSnapshotPayloadGetLabelsArgType = map[string]interface{} +type V2beta1UpdateSnapshotPayloadGetLabelsRetType = map[string]interface{} + +func getV2beta1UpdateSnapshotPayloadGetLabelsAttributeTypeOk(arg V2beta1UpdateSnapshotPayloadGetLabelsAttributeType) (ret V2beta1UpdateSnapshotPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateSnapshotPayloadGetLabelsAttributeType(arg *V2beta1UpdateSnapshotPayloadGetLabelsAttributeType, val V2beta1UpdateSnapshotPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type V2beta1UpdateSnapshotPayloadGetNameAttributeType = *string + +func getV2beta1UpdateSnapshotPayloadGetNameAttributeTypeOk(arg V2beta1UpdateSnapshotPayloadGetNameAttributeType) (ret V2beta1UpdateSnapshotPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setV2beta1UpdateSnapshotPayloadGetNameAttributeType(arg *V2beta1UpdateSnapshotPayloadGetNameAttributeType, val V2beta1UpdateSnapshotPayloadGetNameRetType) { + *arg = &val +} + +type V2beta1UpdateSnapshotPayloadGetNameArgType = string +type V2beta1UpdateSnapshotPayloadGetNameRetType = string + +// V2beta1UpdateSnapshotPayload Object that represents an update request body of a snapshot. +type V2beta1UpdateSnapshotPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels V2beta1UpdateSnapshotPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name V2beta1UpdateSnapshotPayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewV2beta1UpdateSnapshotPayload instantiates a new V2beta1UpdateSnapshotPayload 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 NewV2beta1UpdateSnapshotPayload() *V2beta1UpdateSnapshotPayload { + this := V2beta1UpdateSnapshotPayload{} + return &this +} + +// NewV2beta1UpdateSnapshotPayloadWithDefaults instantiates a new V2beta1UpdateSnapshotPayload 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 NewV2beta1UpdateSnapshotPayloadWithDefaults() *V2beta1UpdateSnapshotPayload { + this := V2beta1UpdateSnapshotPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *V2beta1UpdateSnapshotPayload) GetLabels() (res V2beta1UpdateSnapshotPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateSnapshotPayload) GetLabelsOk() (ret V2beta1UpdateSnapshotPayloadGetLabelsRetType, ok bool) { + return getV2beta1UpdateSnapshotPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *V2beta1UpdateSnapshotPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *V2beta1UpdateSnapshotPayload) SetLabels(v V2beta1UpdateSnapshotPayloadGetLabelsRetType) { + setV2beta1UpdateSnapshotPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *V2beta1UpdateSnapshotPayload) GetName() (res V2beta1UpdateSnapshotPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V2beta1UpdateSnapshotPayload) GetNameOk() (ret V2beta1UpdateSnapshotPayloadGetNameRetType, ok bool) { + return getV2beta1UpdateSnapshotPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *V2beta1UpdateSnapshotPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *V2beta1UpdateSnapshotPayload) SetName(v V2beta1UpdateSnapshotPayloadGetNameRetType) { + setV2beta1UpdateSnapshotPayloadGetNameAttributeType(&o.Name, v) +} + +func (o V2beta1UpdateSnapshotPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getV2beta1UpdateSnapshotPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getV2beta1UpdateSnapshotPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableV2beta1UpdateSnapshotPayload struct { + value *V2beta1UpdateSnapshotPayload + isSet bool +} + +func (v NullableV2beta1UpdateSnapshotPayload) Get() *V2beta1UpdateSnapshotPayload { + return v.value +} + +func (v *NullableV2beta1UpdateSnapshotPayload) Set(val *V2beta1UpdateSnapshotPayload) { + v.value = val + v.isSet = true +} + +func (v NullableV2beta1UpdateSnapshotPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableV2beta1UpdateSnapshotPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV2beta1UpdateSnapshotPayload(val *V2beta1UpdateSnapshotPayload) *NullableV2beta1UpdateSnapshotPayload { + return &NullableV2beta1UpdateSnapshotPayload{value: val, isSet: true} +} + +func (v NullableV2beta1UpdateSnapshotPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV2beta1UpdateSnapshotPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_v2beta1_update_snapshot_payload_test.go b/pkg/iaasbeta/model_v2beta1_update_snapshot_payload_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_v2beta1_update_snapshot_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_volume.go b/pkg/iaasbeta/model_volume.go new file mode 100644 index 00000000..23a33b49 --- /dev/null +++ b/pkg/iaasbeta/model_volume.go @@ -0,0 +1,851 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Volume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Volume{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type VolumeGetAvailabilityZoneAttributeType = *string + +func getVolumeGetAvailabilityZoneAttributeTypeOk(arg VolumeGetAvailabilityZoneAttributeType) (ret VolumeGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetAvailabilityZoneAttributeType(arg *VolumeGetAvailabilityZoneAttributeType, val VolumeGetAvailabilityZoneRetType) { + *arg = &val +} + +type VolumeGetAvailabilityZoneArgType = string +type VolumeGetAvailabilityZoneRetType = string + +/* + types and functions for bootable +*/ + +// isBoolean +type VolumegetBootableAttributeType = *bool +type VolumegetBootableArgType = bool +type VolumegetBootableRetType = bool + +func getVolumegetBootableAttributeTypeOk(arg VolumegetBootableAttributeType) (ret VolumegetBootableRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumegetBootableAttributeType(arg *VolumegetBootableAttributeType, val VolumegetBootableRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type VolumeGetCreatedAtAttributeType = *time.Time +type VolumeGetCreatedAtArgType = time.Time +type VolumeGetCreatedAtRetType = time.Time + +func getVolumeGetCreatedAtAttributeTypeOk(arg VolumeGetCreatedAtAttributeType) (ret VolumeGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetCreatedAtAttributeType(arg *VolumeGetCreatedAtAttributeType, val VolumeGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type VolumeGetDescriptionAttributeType = *string + +func getVolumeGetDescriptionAttributeTypeOk(arg VolumeGetDescriptionAttributeType) (ret VolumeGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetDescriptionAttributeType(arg *VolumeGetDescriptionAttributeType, val VolumeGetDescriptionRetType) { + *arg = &val +} + +type VolumeGetDescriptionArgType = string +type VolumeGetDescriptionRetType = string + +/* + types and functions for encrypted +*/ + +// isBoolean +type VolumegetEncryptedAttributeType = *bool +type VolumegetEncryptedArgType = bool +type VolumegetEncryptedRetType = bool + +func getVolumegetEncryptedAttributeTypeOk(arg VolumegetEncryptedAttributeType) (ret VolumegetEncryptedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumegetEncryptedAttributeType(arg *VolumegetEncryptedAttributeType, val VolumegetEncryptedRetType) { + *arg = &val +} + +/* + types and functions for encryptionParameters +*/ + +// isModel +type VolumeGetEncryptionParametersAttributeType = *VolumeEncryptionParameter +type VolumeGetEncryptionParametersArgType = VolumeEncryptionParameter +type VolumeGetEncryptionParametersRetType = VolumeEncryptionParameter + +func getVolumeGetEncryptionParametersAttributeTypeOk(arg VolumeGetEncryptionParametersAttributeType) (ret VolumeGetEncryptionParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetEncryptionParametersAttributeType(arg *VolumeGetEncryptionParametersAttributeType, val VolumeGetEncryptionParametersRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type VolumeGetIdAttributeType = *string + +func getVolumeGetIdAttributeTypeOk(arg VolumeGetIdAttributeType) (ret VolumeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetIdAttributeType(arg *VolumeGetIdAttributeType, val VolumeGetIdRetType) { + *arg = &val +} + +type VolumeGetIdArgType = string +type VolumeGetIdRetType = string + +/* + types and functions for imageConfig +*/ + +// isModel +type VolumeGetImageConfigAttributeType = *ImageConfig +type VolumeGetImageConfigArgType = ImageConfig +type VolumeGetImageConfigRetType = ImageConfig + +func getVolumeGetImageConfigAttributeTypeOk(arg VolumeGetImageConfigAttributeType) (ret VolumeGetImageConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetImageConfigAttributeType(arg *VolumeGetImageConfigAttributeType, val VolumeGetImageConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type VolumeGetLabelsAttributeType = *map[string]interface{} +type VolumeGetLabelsArgType = map[string]interface{} +type VolumeGetLabelsRetType = map[string]interface{} + +func getVolumeGetLabelsAttributeTypeOk(arg VolumeGetLabelsAttributeType) (ret VolumeGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetLabelsAttributeType(arg *VolumeGetLabelsAttributeType, val VolumeGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type VolumeGetNameAttributeType = *string + +func getVolumeGetNameAttributeTypeOk(arg VolumeGetNameAttributeType) (ret VolumeGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetNameAttributeType(arg *VolumeGetNameAttributeType, val VolumeGetNameRetType) { + *arg = &val +} + +type VolumeGetNameArgType = string +type VolumeGetNameRetType = string + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type VolumeGetPerformanceClassAttributeType = *string + +func getVolumeGetPerformanceClassAttributeTypeOk(arg VolumeGetPerformanceClassAttributeType) (ret VolumeGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetPerformanceClassAttributeType(arg *VolumeGetPerformanceClassAttributeType, val VolumeGetPerformanceClassRetType) { + *arg = &val +} + +type VolumeGetPerformanceClassArgType = string +type VolumeGetPerformanceClassRetType = string + +/* + types and functions for serverId +*/ + +// isNotNullableString +type VolumeGetServerIdAttributeType = *string + +func getVolumeGetServerIdAttributeTypeOk(arg VolumeGetServerIdAttributeType) (ret VolumeGetServerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetServerIdAttributeType(arg *VolumeGetServerIdAttributeType, val VolumeGetServerIdRetType) { + *arg = &val +} + +type VolumeGetServerIdArgType = string +type VolumeGetServerIdRetType = string + +/* + types and functions for size +*/ + +// isLong +type VolumeGetSizeAttributeType = *int64 +type VolumeGetSizeArgType = int64 +type VolumeGetSizeRetType = int64 + +func getVolumeGetSizeAttributeTypeOk(arg VolumeGetSizeAttributeType) (ret VolumeGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetSizeAttributeType(arg *VolumeGetSizeAttributeType, val VolumeGetSizeRetType) { + *arg = &val +} + +/* + types and functions for source +*/ + +// isModel +type VolumeGetSourceAttributeType = *VolumeSource +type VolumeGetSourceArgType = VolumeSource +type VolumeGetSourceRetType = VolumeSource + +func getVolumeGetSourceAttributeTypeOk(arg VolumeGetSourceAttributeType) (ret VolumeGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetSourceAttributeType(arg *VolumeGetSourceAttributeType, val VolumeGetSourceRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type VolumeGetStatusAttributeType = *string + +func getVolumeGetStatusAttributeTypeOk(arg VolumeGetStatusAttributeType) (ret VolumeGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetStatusAttributeType(arg *VolumeGetStatusAttributeType, val VolumeGetStatusRetType) { + *arg = &val +} + +type VolumeGetStatusArgType = string +type VolumeGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type VolumeGetUpdatedAtAttributeType = *time.Time +type VolumeGetUpdatedAtArgType = time.Time +type VolumeGetUpdatedAtRetType = time.Time + +func getVolumeGetUpdatedAtAttributeTypeOk(arg VolumeGetUpdatedAtAttributeType) (ret VolumeGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetUpdatedAtAttributeType(arg *VolumeGetUpdatedAtAttributeType, val VolumeGetUpdatedAtRetType) { + *arg = &val +} + +// Volume Object that represents a volume and its parameters. Volumes sized up to 16000GB are supported. +type Volume struct { + // Object that represents an availability zone. + // REQUIRED + AvailabilityZone VolumeGetAvailabilityZoneAttributeType `json:"availabilityZone" required:"true"` + // Indicates if a volume is bootable. + Bootable VolumegetBootableAttributeType `json:"bootable,omitempty"` + // Date-time when resource was created. + CreatedAt VolumeGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description VolumeGetDescriptionAttributeType `json:"description,omitempty"` + // Indicates if a volume is encrypted. + Encrypted VolumegetEncryptedAttributeType `json:"encrypted,omitempty"` + EncryptionParameters VolumeGetEncryptionParametersAttributeType `json:"encryptionParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id VolumeGetIdAttributeType `json:"id,omitempty"` + ImageConfig VolumeGetImageConfigAttributeType `json:"imageConfig,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels VolumeGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name VolumeGetNameAttributeType `json:"name,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass VolumeGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Universally Unique Identifier (UUID). + ServerId VolumeGetServerIdAttributeType `json:"serverId,omitempty"` + // Size in Gigabyte. + Size VolumeGetSizeAttributeType `json:"size,omitempty"` + Source VolumeGetSourceAttributeType `json:"source,omitempty"` + // The status of a volume object. Possible values: `ATTACHED`, `ATTACHING`, `AVAILABLE`, `AWAITING-TRANSFER`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `DETACHING`, `DOWNLOADING`, `ERROR`, `ERROR_BACKING-UP`, `ERROR_DELETING`, `ERROR_RESIZING`, `ERROR_RESTORING-BACKUP`, `MAINTENANCE`, `RESERVED`, `RESIZING`, `RESTORING-BACKUP`, `RETYPING`, `UPLOADING`. + Status VolumeGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt VolumeGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Volume Volume + +// NewVolume instantiates a new Volume 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 NewVolume(availabilityZone VolumeGetAvailabilityZoneArgType) *Volume { + this := Volume{} + setVolumeGetAvailabilityZoneAttributeType(&this.AvailabilityZone, availabilityZone) + return &this +} + +// NewVolumeWithDefaults instantiates a new Volume 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 NewVolumeWithDefaults() *Volume { + this := Volume{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value +func (o *Volume) GetAvailabilityZone() (ret VolumeGetAvailabilityZoneRetType) { + ret, _ = o.GetAvailabilityZoneOk() + return ret +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// and a boolean to check if the value has been set. +func (o *Volume) GetAvailabilityZoneOk() (ret VolumeGetAvailabilityZoneRetType, ok bool) { + return getVolumeGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// SetAvailabilityZone sets field value +func (o *Volume) SetAvailabilityZone(v VolumeGetAvailabilityZoneRetType) { + setVolumeGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetBootable returns the Bootable field value if set, zero value otherwise. +func (o *Volume) GetBootable() (res VolumegetBootableRetType) { + res, _ = o.GetBootableOk() + return +} + +// GetBootableOk returns a tuple with the Bootable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetBootableOk() (ret VolumegetBootableRetType, ok bool) { + return getVolumegetBootableAttributeTypeOk(o.Bootable) +} + +// HasBootable returns a boolean if a field has been set. +func (o *Volume) HasBootable() bool { + _, ok := o.GetBootableOk() + return ok +} + +// SetBootable gets a reference to the given bool and assigns it to the Bootable field. +func (o *Volume) SetBootable(v VolumegetBootableRetType) { + setVolumegetBootableAttributeType(&o.Bootable, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Volume) GetCreatedAt() (res VolumeGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetCreatedAtOk() (ret VolumeGetCreatedAtRetType, ok bool) { + return getVolumeGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Volume) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Volume) SetCreatedAt(v VolumeGetCreatedAtRetType) { + setVolumeGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Volume) GetDescription() (res VolumeGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetDescriptionOk() (ret VolumeGetDescriptionRetType, ok bool) { + return getVolumeGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *Volume) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Volume) SetDescription(v VolumeGetDescriptionRetType) { + setVolumeGetDescriptionAttributeType(&o.Description, v) +} + +// GetEncrypted returns the Encrypted field value if set, zero value otherwise. +func (o *Volume) GetEncrypted() (res VolumegetEncryptedRetType) { + res, _ = o.GetEncryptedOk() + return +} + +// GetEncryptedOk returns a tuple with the Encrypted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetEncryptedOk() (ret VolumegetEncryptedRetType, ok bool) { + return getVolumegetEncryptedAttributeTypeOk(o.Encrypted) +} + +// HasEncrypted returns a boolean if a field has been set. +func (o *Volume) HasEncrypted() bool { + _, ok := o.GetEncryptedOk() + return ok +} + +// SetEncrypted gets a reference to the given bool and assigns it to the Encrypted field. +func (o *Volume) SetEncrypted(v VolumegetEncryptedRetType) { + setVolumegetEncryptedAttributeType(&o.Encrypted, v) +} + +// GetEncryptionParameters returns the EncryptionParameters field value if set, zero value otherwise. +func (o *Volume) GetEncryptionParameters() (res VolumeGetEncryptionParametersRetType) { + res, _ = o.GetEncryptionParametersOk() + return +} + +// GetEncryptionParametersOk returns a tuple with the EncryptionParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetEncryptionParametersOk() (ret VolumeGetEncryptionParametersRetType, ok bool) { + return getVolumeGetEncryptionParametersAttributeTypeOk(o.EncryptionParameters) +} + +// HasEncryptionParameters returns a boolean if a field has been set. +func (o *Volume) HasEncryptionParameters() bool { + _, ok := o.GetEncryptionParametersOk() + return ok +} + +// SetEncryptionParameters gets a reference to the given VolumeEncryptionParameter and assigns it to the EncryptionParameters field. +func (o *Volume) SetEncryptionParameters(v VolumeGetEncryptionParametersRetType) { + setVolumeGetEncryptionParametersAttributeType(&o.EncryptionParameters, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Volume) GetId() (res VolumeGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetIdOk() (ret VolumeGetIdRetType, ok bool) { + return getVolumeGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Volume) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Volume) SetId(v VolumeGetIdRetType) { + setVolumeGetIdAttributeType(&o.Id, v) +} + +// GetImageConfig returns the ImageConfig field value if set, zero value otherwise. +func (o *Volume) GetImageConfig() (res VolumeGetImageConfigRetType) { + res, _ = o.GetImageConfigOk() + return +} + +// GetImageConfigOk returns a tuple with the ImageConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetImageConfigOk() (ret VolumeGetImageConfigRetType, ok bool) { + return getVolumeGetImageConfigAttributeTypeOk(o.ImageConfig) +} + +// HasImageConfig returns a boolean if a field has been set. +func (o *Volume) HasImageConfig() bool { + _, ok := o.GetImageConfigOk() + return ok +} + +// SetImageConfig gets a reference to the given ImageConfig and assigns it to the ImageConfig field. +func (o *Volume) SetImageConfig(v VolumeGetImageConfigRetType) { + setVolumeGetImageConfigAttributeType(&o.ImageConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Volume) GetLabels() (res VolumeGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetLabelsOk() (ret VolumeGetLabelsRetType, ok bool) { + return getVolumeGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Volume) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Volume) SetLabels(v VolumeGetLabelsRetType) { + setVolumeGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Volume) GetName() (res VolumeGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetNameOk() (ret VolumeGetNameRetType, ok bool) { + return getVolumeGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Volume) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Volume) SetName(v VolumeGetNameRetType) { + setVolumeGetNameAttributeType(&o.Name, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *Volume) GetPerformanceClass() (res VolumeGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetPerformanceClassOk() (ret VolumeGetPerformanceClassRetType, ok bool) { + return getVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *Volume) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *Volume) SetPerformanceClass(v VolumeGetPerformanceClassRetType) { + setVolumeGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *Volume) GetServerId() (res VolumeGetServerIdRetType) { + res, _ = o.GetServerIdOk() + return +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetServerIdOk() (ret VolumeGetServerIdRetType, ok bool) { + return getVolumeGetServerIdAttributeTypeOk(o.ServerId) +} + +// HasServerId returns a boolean if a field has been set. +func (o *Volume) HasServerId() bool { + _, ok := o.GetServerIdOk() + return ok +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *Volume) SetServerId(v VolumeGetServerIdRetType) { + setVolumeGetServerIdAttributeType(&o.ServerId, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Volume) GetSize() (res VolumeGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetSizeOk() (ret VolumeGetSizeRetType, ok bool) { + return getVolumeGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *Volume) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Volume) SetSize(v VolumeGetSizeRetType) { + setVolumeGetSizeAttributeType(&o.Size, v) +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *Volume) GetSource() (res VolumeGetSourceRetType) { + res, _ = o.GetSourceOk() + return +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetSourceOk() (ret VolumeGetSourceRetType, ok bool) { + return getVolumeGetSourceAttributeTypeOk(o.Source) +} + +// HasSource returns a boolean if a field has been set. +func (o *Volume) HasSource() bool { + _, ok := o.GetSourceOk() + return ok +} + +// SetSource gets a reference to the given VolumeSource and assigns it to the Source field. +func (o *Volume) SetSource(v VolumeGetSourceRetType) { + setVolumeGetSourceAttributeType(&o.Source, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Volume) GetStatus() (res VolumeGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetStatusOk() (ret VolumeGetStatusRetType, ok bool) { + return getVolumeGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Volume) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Volume) SetStatus(v VolumeGetStatusRetType) { + setVolumeGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Volume) GetUpdatedAt() (res VolumeGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetUpdatedAtOk() (ret VolumeGetUpdatedAtRetType, ok bool) { + return getVolumeGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Volume) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Volume) SetUpdatedAt(v VolumeGetUpdatedAtRetType) { + setVolumeGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Volume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getVolumegetBootableAttributeTypeOk(o.Bootable); ok { + toSerialize["Bootable"] = val + } + if val, ok := getVolumeGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getVolumeGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getVolumegetEncryptedAttributeTypeOk(o.Encrypted); ok { + toSerialize["Encrypted"] = val + } + if val, ok := getVolumeGetEncryptionParametersAttributeTypeOk(o.EncryptionParameters); ok { + toSerialize["EncryptionParameters"] = val + } + if val, ok := getVolumeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getVolumeGetImageConfigAttributeTypeOk(o.ImageConfig); ok { + toSerialize["ImageConfig"] = val + } + if val, ok := getVolumeGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getVolumeGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getVolumeGetServerIdAttributeTypeOk(o.ServerId); ok { + toSerialize["ServerId"] = val + } + if val, ok := getVolumeGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getVolumeGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + if val, ok := getVolumeGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getVolumeGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableVolume struct { + value *Volume + isSet bool +} + +func (v NullableVolume) Get() *Volume { + return v.value +} + +func (v *NullableVolume) Set(val *Volume) { + v.value = val + v.isSet = true +} + +func (v NullableVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolume(val *Volume) *NullableVolume { + return &NullableVolume{value: val, isSet: true} +} + +func (v NullableVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_volume_attachment.go b/pkg/iaasbeta/model_volume_attachment.go new file mode 100644 index 00000000..9ea35e5c --- /dev/null +++ b/pkg/iaasbeta/model_volume_attachment.go @@ -0,0 +1,226 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the VolumeAttachment type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeAttachment{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type VolumeAttachmentgetDeleteOnTerminationAttributeType = *bool +type VolumeAttachmentgetDeleteOnTerminationArgType = bool +type VolumeAttachmentgetDeleteOnTerminationRetType = bool + +func getVolumeAttachmentgetDeleteOnTerminationAttributeTypeOk(arg VolumeAttachmentgetDeleteOnTerminationAttributeType) (ret VolumeAttachmentgetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeAttachmentgetDeleteOnTerminationAttributeType(arg *VolumeAttachmentgetDeleteOnTerminationAttributeType, val VolumeAttachmentgetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for serverId +*/ + +// isNotNullableString +type VolumeAttachmentGetServerIdAttributeType = *string + +func getVolumeAttachmentGetServerIdAttributeTypeOk(arg VolumeAttachmentGetServerIdAttributeType) (ret VolumeAttachmentGetServerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeAttachmentGetServerIdAttributeType(arg *VolumeAttachmentGetServerIdAttributeType, val VolumeAttachmentGetServerIdRetType) { + *arg = &val +} + +type VolumeAttachmentGetServerIdArgType = string +type VolumeAttachmentGetServerIdRetType = string + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type VolumeAttachmentGetVolumeIdAttributeType = *string + +func getVolumeAttachmentGetVolumeIdAttributeTypeOk(arg VolumeAttachmentGetVolumeIdAttributeType) (ret VolumeAttachmentGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeAttachmentGetVolumeIdAttributeType(arg *VolumeAttachmentGetVolumeIdAttributeType, val VolumeAttachmentGetVolumeIdRetType) { + *arg = &val +} + +type VolumeAttachmentGetVolumeIdArgType = string +type VolumeAttachmentGetVolumeIdRetType = string + +// VolumeAttachment Object that represents a Volume attachment to a server. +type VolumeAttachment struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination VolumeAttachmentgetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + ServerId VolumeAttachmentGetServerIdAttributeType `json:"serverId,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId VolumeAttachmentGetVolumeIdAttributeType `json:"volumeId,omitempty"` +} + +// NewVolumeAttachment instantiates a new VolumeAttachment 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 NewVolumeAttachment() *VolumeAttachment { + this := VolumeAttachment{} + return &this +} + +// NewVolumeAttachmentWithDefaults instantiates a new VolumeAttachment 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 NewVolumeAttachmentWithDefaults() *VolumeAttachment { + this := VolumeAttachment{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *VolumeAttachment) GetDeleteOnTermination() (res VolumeAttachmentgetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAttachment) GetDeleteOnTerminationOk() (ret VolumeAttachmentgetDeleteOnTerminationRetType, ok bool) { + return getVolumeAttachmentgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *VolumeAttachment) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *VolumeAttachment) SetDeleteOnTermination(v VolumeAttachmentgetDeleteOnTerminationRetType) { + setVolumeAttachmentgetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *VolumeAttachment) GetServerId() (res VolumeAttachmentGetServerIdRetType) { + res, _ = o.GetServerIdOk() + return +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAttachment) GetServerIdOk() (ret VolumeAttachmentGetServerIdRetType, ok bool) { + return getVolumeAttachmentGetServerIdAttributeTypeOk(o.ServerId) +} + +// HasServerId returns a boolean if a field has been set. +func (o *VolumeAttachment) HasServerId() bool { + _, ok := o.GetServerIdOk() + return ok +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *VolumeAttachment) SetServerId(v VolumeAttachmentGetServerIdRetType) { + setVolumeAttachmentGetServerIdAttributeType(&o.ServerId, v) +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *VolumeAttachment) GetVolumeId() (res VolumeAttachmentGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAttachment) GetVolumeIdOk() (ret VolumeAttachmentGetVolumeIdRetType, ok bool) { + return getVolumeAttachmentGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *VolumeAttachment) HasVolumeId() bool { + _, ok := o.GetVolumeIdOk() + return ok +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *VolumeAttachment) SetVolumeId(v VolumeAttachmentGetVolumeIdRetType) { + setVolumeAttachmentGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o VolumeAttachment) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeAttachmentgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getVolumeAttachmentGetServerIdAttributeTypeOk(o.ServerId); ok { + toSerialize["ServerId"] = val + } + if val, ok := getVolumeAttachmentGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableVolumeAttachment struct { + value *VolumeAttachment + isSet bool +} + +func (v NullableVolumeAttachment) Get() *VolumeAttachment { + return v.value +} + +func (v *NullableVolumeAttachment) Set(val *VolumeAttachment) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeAttachment) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeAttachment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeAttachment(val *VolumeAttachment) *NullableVolumeAttachment { + return &NullableVolumeAttachment{value: val, isSet: true} +} + +func (v NullableVolumeAttachment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeAttachment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_volume_attachment_list_response.go b/pkg/iaasbeta/model_volume_attachment_list_response.go new file mode 100644 index 00000000..4212f084 --- /dev/null +++ b/pkg/iaasbeta/model_volume_attachment_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the VolumeAttachmentListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeAttachmentListResponse{} + +/* + types and functions for items +*/ + +// isArray +type VolumeAttachmentListResponseGetItemsAttributeType = *[]VolumeAttachment +type VolumeAttachmentListResponseGetItemsArgType = []VolumeAttachment +type VolumeAttachmentListResponseGetItemsRetType = []VolumeAttachment + +func getVolumeAttachmentListResponseGetItemsAttributeTypeOk(arg VolumeAttachmentListResponseGetItemsAttributeType) (ret VolumeAttachmentListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeAttachmentListResponseGetItemsAttributeType(arg *VolumeAttachmentListResponseGetItemsAttributeType, val VolumeAttachmentListResponseGetItemsRetType) { + *arg = &val +} + +// VolumeAttachmentListResponse Volume attachment list response. +type VolumeAttachmentListResponse struct { + // A list containing Volume attachments of a server. + // REQUIRED + Items VolumeAttachmentListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _VolumeAttachmentListResponse VolumeAttachmentListResponse + +// NewVolumeAttachmentListResponse instantiates a new VolumeAttachmentListResponse 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 NewVolumeAttachmentListResponse(items VolumeAttachmentListResponseGetItemsArgType) *VolumeAttachmentListResponse { + this := VolumeAttachmentListResponse{} + setVolumeAttachmentListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewVolumeAttachmentListResponseWithDefaults instantiates a new VolumeAttachmentListResponse 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 NewVolumeAttachmentListResponseWithDefaults() *VolumeAttachmentListResponse { + this := VolumeAttachmentListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *VolumeAttachmentListResponse) GetItems() (ret VolumeAttachmentListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *VolumeAttachmentListResponse) GetItemsOk() (ret VolumeAttachmentListResponseGetItemsRetType, ok bool) { + return getVolumeAttachmentListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *VolumeAttachmentListResponse) SetItems(v VolumeAttachmentListResponseGetItemsRetType) { + setVolumeAttachmentListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o VolumeAttachmentListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeAttachmentListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableVolumeAttachmentListResponse struct { + value *VolumeAttachmentListResponse + isSet bool +} + +func (v NullableVolumeAttachmentListResponse) Get() *VolumeAttachmentListResponse { + return v.value +} + +func (v *NullableVolumeAttachmentListResponse) Set(val *VolumeAttachmentListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeAttachmentListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeAttachmentListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeAttachmentListResponse(val *VolumeAttachmentListResponse) *NullableVolumeAttachmentListResponse { + return &NullableVolumeAttachmentListResponse{value: val, isSet: true} +} + +func (v NullableVolumeAttachmentListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeAttachmentListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_volume_attachment_list_response_test.go b/pkg/iaasbeta/model_volume_attachment_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_volume_attachment_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_volume_attachment_test.go b/pkg/iaasbeta/model_volume_attachment_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_volume_attachment_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_volume_encryption_parameter.go b/pkg/iaasbeta/model_volume_encryption_parameter.go new file mode 100644 index 00000000..c96e965e --- /dev/null +++ b/pkg/iaasbeta/model_volume_encryption_parameter.go @@ -0,0 +1,358 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the VolumeEncryptionParameter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeEncryptionParameter{} + +/* + types and functions for kekKeyId +*/ + +// isNotNullableString +type VolumeEncryptionParameterGetKekKeyIdAttributeType = *string + +func getVolumeEncryptionParameterGetKekKeyIdAttributeTypeOk(arg VolumeEncryptionParameterGetKekKeyIdAttributeType) (ret VolumeEncryptionParameterGetKekKeyIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetKekKeyIdAttributeType(arg *VolumeEncryptionParameterGetKekKeyIdAttributeType, val VolumeEncryptionParameterGetKekKeyIdRetType) { + *arg = &val +} + +type VolumeEncryptionParameterGetKekKeyIdArgType = string +type VolumeEncryptionParameterGetKekKeyIdRetType = string + +/* + types and functions for kekKeyVersion +*/ + +// isLong +type VolumeEncryptionParameterGetKekKeyVersionAttributeType = *int64 +type VolumeEncryptionParameterGetKekKeyVersionArgType = int64 +type VolumeEncryptionParameterGetKekKeyVersionRetType = int64 + +func getVolumeEncryptionParameterGetKekKeyVersionAttributeTypeOk(arg VolumeEncryptionParameterGetKekKeyVersionAttributeType) (ret VolumeEncryptionParameterGetKekKeyVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetKekKeyVersionAttributeType(arg *VolumeEncryptionParameterGetKekKeyVersionAttributeType, val VolumeEncryptionParameterGetKekKeyVersionRetType) { + *arg = &val +} + +/* + types and functions for kekKeyringId +*/ + +// isNotNullableString +type VolumeEncryptionParameterGetKekKeyringIdAttributeType = *string + +func getVolumeEncryptionParameterGetKekKeyringIdAttributeTypeOk(arg VolumeEncryptionParameterGetKekKeyringIdAttributeType) (ret VolumeEncryptionParameterGetKekKeyringIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetKekKeyringIdAttributeType(arg *VolumeEncryptionParameterGetKekKeyringIdAttributeType, val VolumeEncryptionParameterGetKekKeyringIdRetType) { + *arg = &val +} + +type VolumeEncryptionParameterGetKekKeyringIdArgType = string +type VolumeEncryptionParameterGetKekKeyringIdRetType = string + +/* + types and functions for kekProjectId +*/ + +// isNotNullableString +type VolumeEncryptionParameterGetKekProjectIdAttributeType = *string + +func getVolumeEncryptionParameterGetKekProjectIdAttributeTypeOk(arg VolumeEncryptionParameterGetKekProjectIdAttributeType) (ret VolumeEncryptionParameterGetKekProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetKekProjectIdAttributeType(arg *VolumeEncryptionParameterGetKekProjectIdAttributeType, val VolumeEncryptionParameterGetKekProjectIdRetType) { + *arg = &val +} + +type VolumeEncryptionParameterGetKekProjectIdArgType = string +type VolumeEncryptionParameterGetKekProjectIdRetType = string + +/* + types and functions for keyPayload +*/ + +// isByteArray +type VolumeEncryptionParameterGetKeyPayloadAttributeType = *[]byte +type VolumeEncryptionParameterGetKeyPayloadArgType = []byte +type VolumeEncryptionParameterGetKeyPayloadRetType = []byte + +func getVolumeEncryptionParameterGetKeyPayloadAttributeTypeOk(arg VolumeEncryptionParameterGetKeyPayloadAttributeType) (ret VolumeEncryptionParameterGetKeyPayloadRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetKeyPayloadAttributeType(arg *VolumeEncryptionParameterGetKeyPayloadAttributeType, val VolumeEncryptionParameterGetKeyPayloadRetType) { + *arg = &val +} + +/* + types and functions for serviceAccount +*/ + +// isNotNullableString +type VolumeEncryptionParameterGetServiceAccountAttributeType = *string + +func getVolumeEncryptionParameterGetServiceAccountAttributeTypeOk(arg VolumeEncryptionParameterGetServiceAccountAttributeType) (ret VolumeEncryptionParameterGetServiceAccountRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetServiceAccountAttributeType(arg *VolumeEncryptionParameterGetServiceAccountAttributeType, val VolumeEncryptionParameterGetServiceAccountRetType) { + *arg = &val +} + +type VolumeEncryptionParameterGetServiceAccountArgType = string +type VolumeEncryptionParameterGetServiceAccountRetType = string + +// VolumeEncryptionParameter Parameter to connect to a key-encryption-key within the STACKIT-KMS to create encrypted volumes. If no key_payload is set, a random passphrase is generated, which will be encrypted against the STACKIT-KMS. These parameter never leave the backend again. So these parameters are not in the responses. +type VolumeEncryptionParameter struct { + // Universally Unique Identifier (UUID). + // REQUIRED + KekKeyId VolumeEncryptionParameterGetKekKeyIdAttributeType `json:"kekKeyId" required:"true"` + // Version of a key within the STACKIT-KMS. + // REQUIRED + KekKeyVersion VolumeEncryptionParameterGetKekKeyVersionAttributeType `json:"kekKeyVersion" required:"true"` + // Universally Unique Identifier (UUID). + // REQUIRED + KekKeyringId VolumeEncryptionParameterGetKekKeyringIdAttributeType `json:"kekKeyringId" required:"true"` + // Universally Unique Identifier (UUID). + KekProjectId VolumeEncryptionParameterGetKekProjectIdAttributeType `json:"kekProjectId,omitempty"` + // base64 encoded secret. + KeyPayload VolumeEncryptionParameterGetKeyPayloadAttributeType `json:"keyPayload,omitempty"` + // Object that represents an e-mail address of a service account. + // REQUIRED + ServiceAccount VolumeEncryptionParameterGetServiceAccountAttributeType `json:"serviceAccount" required:"true"` +} + +type _VolumeEncryptionParameter VolumeEncryptionParameter + +// NewVolumeEncryptionParameter instantiates a new VolumeEncryptionParameter 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 NewVolumeEncryptionParameter(kekKeyId VolumeEncryptionParameterGetKekKeyIdArgType, kekKeyVersion VolumeEncryptionParameterGetKekKeyVersionArgType, kekKeyringId VolumeEncryptionParameterGetKekKeyringIdArgType, serviceAccount VolumeEncryptionParameterGetServiceAccountArgType) *VolumeEncryptionParameter { + this := VolumeEncryptionParameter{} + setVolumeEncryptionParameterGetKekKeyIdAttributeType(&this.KekKeyId, kekKeyId) + setVolumeEncryptionParameterGetKekKeyVersionAttributeType(&this.KekKeyVersion, kekKeyVersion) + setVolumeEncryptionParameterGetKekKeyringIdAttributeType(&this.KekKeyringId, kekKeyringId) + setVolumeEncryptionParameterGetServiceAccountAttributeType(&this.ServiceAccount, serviceAccount) + return &this +} + +// NewVolumeEncryptionParameterWithDefaults instantiates a new VolumeEncryptionParameter 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 NewVolumeEncryptionParameterWithDefaults() *VolumeEncryptionParameter { + this := VolumeEncryptionParameter{} + return &this +} + +// GetKekKeyId returns the KekKeyId field value +func (o *VolumeEncryptionParameter) GetKekKeyId() (ret VolumeEncryptionParameterGetKekKeyIdRetType) { + ret, _ = o.GetKekKeyIdOk() + return ret +} + +// GetKekKeyIdOk returns a tuple with the KekKeyId field value +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetKekKeyIdOk() (ret VolumeEncryptionParameterGetKekKeyIdRetType, ok bool) { + return getVolumeEncryptionParameterGetKekKeyIdAttributeTypeOk(o.KekKeyId) +} + +// SetKekKeyId sets field value +func (o *VolumeEncryptionParameter) SetKekKeyId(v VolumeEncryptionParameterGetKekKeyIdRetType) { + setVolumeEncryptionParameterGetKekKeyIdAttributeType(&o.KekKeyId, v) +} + +// GetKekKeyVersion returns the KekKeyVersion field value +func (o *VolumeEncryptionParameter) GetKekKeyVersion() (ret VolumeEncryptionParameterGetKekKeyVersionRetType) { + ret, _ = o.GetKekKeyVersionOk() + return ret +} + +// GetKekKeyVersionOk returns a tuple with the KekKeyVersion field value +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetKekKeyVersionOk() (ret VolumeEncryptionParameterGetKekKeyVersionRetType, ok bool) { + return getVolumeEncryptionParameterGetKekKeyVersionAttributeTypeOk(o.KekKeyVersion) +} + +// SetKekKeyVersion sets field value +func (o *VolumeEncryptionParameter) SetKekKeyVersion(v VolumeEncryptionParameterGetKekKeyVersionRetType) { + setVolumeEncryptionParameterGetKekKeyVersionAttributeType(&o.KekKeyVersion, v) +} + +// GetKekKeyringId returns the KekKeyringId field value +func (o *VolumeEncryptionParameter) GetKekKeyringId() (ret VolumeEncryptionParameterGetKekKeyringIdRetType) { + ret, _ = o.GetKekKeyringIdOk() + return ret +} + +// GetKekKeyringIdOk returns a tuple with the KekKeyringId field value +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetKekKeyringIdOk() (ret VolumeEncryptionParameterGetKekKeyringIdRetType, ok bool) { + return getVolumeEncryptionParameterGetKekKeyringIdAttributeTypeOk(o.KekKeyringId) +} + +// SetKekKeyringId sets field value +func (o *VolumeEncryptionParameter) SetKekKeyringId(v VolumeEncryptionParameterGetKekKeyringIdRetType) { + setVolumeEncryptionParameterGetKekKeyringIdAttributeType(&o.KekKeyringId, v) +} + +// GetKekProjectId returns the KekProjectId field value if set, zero value otherwise. +func (o *VolumeEncryptionParameter) GetKekProjectId() (res VolumeEncryptionParameterGetKekProjectIdRetType) { + res, _ = o.GetKekProjectIdOk() + return +} + +// GetKekProjectIdOk returns a tuple with the KekProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetKekProjectIdOk() (ret VolumeEncryptionParameterGetKekProjectIdRetType, ok bool) { + return getVolumeEncryptionParameterGetKekProjectIdAttributeTypeOk(o.KekProjectId) +} + +// HasKekProjectId returns a boolean if a field has been set. +func (o *VolumeEncryptionParameter) HasKekProjectId() bool { + _, ok := o.GetKekProjectIdOk() + return ok +} + +// SetKekProjectId gets a reference to the given string and assigns it to the KekProjectId field. +func (o *VolumeEncryptionParameter) SetKekProjectId(v VolumeEncryptionParameterGetKekProjectIdRetType) { + setVolumeEncryptionParameterGetKekProjectIdAttributeType(&o.KekProjectId, v) +} + +// GetKeyPayload returns the KeyPayload field value if set, zero value otherwise. +func (o *VolumeEncryptionParameter) GetKeyPayload() (res VolumeEncryptionParameterGetKeyPayloadRetType) { + res, _ = o.GetKeyPayloadOk() + return +} + +// GetKeyPayloadOk returns a tuple with the KeyPayload field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetKeyPayloadOk() (ret VolumeEncryptionParameterGetKeyPayloadRetType, ok bool) { + return getVolumeEncryptionParameterGetKeyPayloadAttributeTypeOk(o.KeyPayload) +} + +// HasKeyPayload returns a boolean if a field has been set. +func (o *VolumeEncryptionParameter) HasKeyPayload() bool { + _, ok := o.GetKeyPayloadOk() + return ok +} + +// SetKeyPayload gets a reference to the given string and assigns it to the KeyPayload field. +func (o *VolumeEncryptionParameter) SetKeyPayload(v VolumeEncryptionParameterGetKeyPayloadRetType) { + setVolumeEncryptionParameterGetKeyPayloadAttributeType(&o.KeyPayload, v) +} + +// GetServiceAccount returns the ServiceAccount field value +func (o *VolumeEncryptionParameter) GetServiceAccount() (ret VolumeEncryptionParameterGetServiceAccountRetType) { + ret, _ = o.GetServiceAccountOk() + return ret +} + +// GetServiceAccountOk returns a tuple with the ServiceAccount field value +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetServiceAccountOk() (ret VolumeEncryptionParameterGetServiceAccountRetType, ok bool) { + return getVolumeEncryptionParameterGetServiceAccountAttributeTypeOk(o.ServiceAccount) +} + +// SetServiceAccount sets field value +func (o *VolumeEncryptionParameter) SetServiceAccount(v VolumeEncryptionParameterGetServiceAccountRetType) { + setVolumeEncryptionParameterGetServiceAccountAttributeType(&o.ServiceAccount, v) +} + +func (o VolumeEncryptionParameter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeEncryptionParameterGetKekKeyIdAttributeTypeOk(o.KekKeyId); ok { + toSerialize["KekKeyId"] = val + } + if val, ok := getVolumeEncryptionParameterGetKekKeyVersionAttributeTypeOk(o.KekKeyVersion); ok { + toSerialize["KekKeyVersion"] = val + } + if val, ok := getVolumeEncryptionParameterGetKekKeyringIdAttributeTypeOk(o.KekKeyringId); ok { + toSerialize["KekKeyringId"] = val + } + if val, ok := getVolumeEncryptionParameterGetKekProjectIdAttributeTypeOk(o.KekProjectId); ok { + toSerialize["KekProjectId"] = val + } + if val, ok := getVolumeEncryptionParameterGetKeyPayloadAttributeTypeOk(o.KeyPayload); ok { + toSerialize["KeyPayload"] = val + } + if val, ok := getVolumeEncryptionParameterGetServiceAccountAttributeTypeOk(o.ServiceAccount); ok { + toSerialize["ServiceAccount"] = val + } + return toSerialize, nil +} + +type NullableVolumeEncryptionParameter struct { + value *VolumeEncryptionParameter + isSet bool +} + +func (v NullableVolumeEncryptionParameter) Get() *VolumeEncryptionParameter { + return v.value +} + +func (v *NullableVolumeEncryptionParameter) Set(val *VolumeEncryptionParameter) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeEncryptionParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeEncryptionParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeEncryptionParameter(val *VolumeEncryptionParameter) *NullableVolumeEncryptionParameter { + return &NullableVolumeEncryptionParameter{value: val, isSet: true} +} + +func (v NullableVolumeEncryptionParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeEncryptionParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_volume_encryption_parameter_test.go b/pkg/iaasbeta/model_volume_encryption_parameter_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_volume_encryption_parameter_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_volume_list_response.go b/pkg/iaasbeta/model_volume_list_response.go new file mode 100644 index 00000000..9a2a9556 --- /dev/null +++ b/pkg/iaasbeta/model_volume_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the VolumeListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeListResponse{} + +/* + types and functions for items +*/ + +// isArray +type VolumeListResponseGetItemsAttributeType = *[]Volume +type VolumeListResponseGetItemsArgType = []Volume +type VolumeListResponseGetItemsRetType = []Volume + +func getVolumeListResponseGetItemsAttributeTypeOk(arg VolumeListResponseGetItemsAttributeType) (ret VolumeListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeListResponseGetItemsAttributeType(arg *VolumeListResponseGetItemsAttributeType, val VolumeListResponseGetItemsRetType) { + *arg = &val +} + +// VolumeListResponse Volume list response. +type VolumeListResponse struct { + // A list containing volume objects. + // REQUIRED + Items VolumeListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _VolumeListResponse VolumeListResponse + +// NewVolumeListResponse instantiates a new VolumeListResponse 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 NewVolumeListResponse(items VolumeListResponseGetItemsArgType) *VolumeListResponse { + this := VolumeListResponse{} + setVolumeListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewVolumeListResponseWithDefaults instantiates a new VolumeListResponse 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 NewVolumeListResponseWithDefaults() *VolumeListResponse { + this := VolumeListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *VolumeListResponse) GetItems() (ret VolumeListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *VolumeListResponse) GetItemsOk() (ret VolumeListResponseGetItemsRetType, ok bool) { + return getVolumeListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *VolumeListResponse) SetItems(v VolumeListResponseGetItemsRetType) { + setVolumeListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o VolumeListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableVolumeListResponse struct { + value *VolumeListResponse + isSet bool +} + +func (v NullableVolumeListResponse) Get() *VolumeListResponse { + return v.value +} + +func (v *NullableVolumeListResponse) Set(val *VolumeListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeListResponse(val *VolumeListResponse) *NullableVolumeListResponse { + return &NullableVolumeListResponse{value: val, isSet: true} +} + +func (v NullableVolumeListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_volume_list_response_test.go b/pkg/iaasbeta/model_volume_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_volume_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_volume_performance_class.go b/pkg/iaasbeta/model_volume_performance_class.go new file mode 100644 index 00000000..07dfcbe7 --- /dev/null +++ b/pkg/iaasbeta/model_volume_performance_class.go @@ -0,0 +1,320 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the VolumePerformanceClass type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumePerformanceClass{} + +/* + types and functions for description +*/ + +// isNotNullableString +type VolumePerformanceClassGetDescriptionAttributeType = *string + +func getVolumePerformanceClassGetDescriptionAttributeTypeOk(arg VolumePerformanceClassGetDescriptionAttributeType) (ret VolumePerformanceClassGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassGetDescriptionAttributeType(arg *VolumePerformanceClassGetDescriptionAttributeType, val VolumePerformanceClassGetDescriptionRetType) { + *arg = &val +} + +type VolumePerformanceClassGetDescriptionArgType = string +type VolumePerformanceClassGetDescriptionRetType = string + +/* + types and functions for iops +*/ + +// isLong +type VolumePerformanceClassGetIopsAttributeType = *int64 +type VolumePerformanceClassGetIopsArgType = int64 +type VolumePerformanceClassGetIopsRetType = int64 + +func getVolumePerformanceClassGetIopsAttributeTypeOk(arg VolumePerformanceClassGetIopsAttributeType) (ret VolumePerformanceClassGetIopsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassGetIopsAttributeType(arg *VolumePerformanceClassGetIopsAttributeType, val VolumePerformanceClassGetIopsRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type VolumePerformanceClassGetLabelsAttributeType = *map[string]interface{} +type VolumePerformanceClassGetLabelsArgType = map[string]interface{} +type VolumePerformanceClassGetLabelsRetType = map[string]interface{} + +func getVolumePerformanceClassGetLabelsAttributeTypeOk(arg VolumePerformanceClassGetLabelsAttributeType) (ret VolumePerformanceClassGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassGetLabelsAttributeType(arg *VolumePerformanceClassGetLabelsAttributeType, val VolumePerformanceClassGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type VolumePerformanceClassGetNameAttributeType = *string + +func getVolumePerformanceClassGetNameAttributeTypeOk(arg VolumePerformanceClassGetNameAttributeType) (ret VolumePerformanceClassGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassGetNameAttributeType(arg *VolumePerformanceClassGetNameAttributeType, val VolumePerformanceClassGetNameRetType) { + *arg = &val +} + +type VolumePerformanceClassGetNameArgType = string +type VolumePerformanceClassGetNameRetType = string + +/* + types and functions for throughput +*/ + +// isLong +type VolumePerformanceClassGetThroughputAttributeType = *int64 +type VolumePerformanceClassGetThroughputArgType = int64 +type VolumePerformanceClassGetThroughputRetType = int64 + +func getVolumePerformanceClassGetThroughputAttributeTypeOk(arg VolumePerformanceClassGetThroughputAttributeType) (ret VolumePerformanceClassGetThroughputRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassGetThroughputAttributeType(arg *VolumePerformanceClassGetThroughputAttributeType, val VolumePerformanceClassGetThroughputRetType) { + *arg = &val +} + +// VolumePerformanceClass Object that represents a Volume performance class. +type VolumePerformanceClass struct { + // Description Object. Allows string up to 255 Characters. + Description VolumePerformanceClassGetDescriptionAttributeType `json:"description,omitempty"` + // Input/Output Operations per second. + Iops VolumePerformanceClassGetIopsAttributeType `json:"iops,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels VolumePerformanceClassGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name VolumePerformanceClassGetNameAttributeType `json:"name" required:"true"` + // Throughput in Megabyte per second. + Throughput VolumePerformanceClassGetThroughputAttributeType `json:"throughput,omitempty"` +} + +type _VolumePerformanceClass VolumePerformanceClass + +// NewVolumePerformanceClass instantiates a new VolumePerformanceClass 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 NewVolumePerformanceClass(name VolumePerformanceClassGetNameArgType) *VolumePerformanceClass { + this := VolumePerformanceClass{} + setVolumePerformanceClassGetNameAttributeType(&this.Name, name) + return &this +} + +// NewVolumePerformanceClassWithDefaults instantiates a new VolumePerformanceClass 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 NewVolumePerformanceClassWithDefaults() *VolumePerformanceClass { + this := VolumePerformanceClass{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VolumePerformanceClass) GetDescription() (res VolumePerformanceClassGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetDescriptionOk() (ret VolumePerformanceClassGetDescriptionRetType, ok bool) { + return getVolumePerformanceClassGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *VolumePerformanceClass) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VolumePerformanceClass) SetDescription(v VolumePerformanceClassGetDescriptionRetType) { + setVolumePerformanceClassGetDescriptionAttributeType(&o.Description, v) +} + +// GetIops returns the Iops field value if set, zero value otherwise. +func (o *VolumePerformanceClass) GetIops() (res VolumePerformanceClassGetIopsRetType) { + res, _ = o.GetIopsOk() + return +} + +// GetIopsOk returns a tuple with the Iops field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetIopsOk() (ret VolumePerformanceClassGetIopsRetType, ok bool) { + return getVolumePerformanceClassGetIopsAttributeTypeOk(o.Iops) +} + +// HasIops returns a boolean if a field has been set. +func (o *VolumePerformanceClass) HasIops() bool { + _, ok := o.GetIopsOk() + return ok +} + +// SetIops gets a reference to the given int64 and assigns it to the Iops field. +func (o *VolumePerformanceClass) SetIops(v VolumePerformanceClassGetIopsRetType) { + setVolumePerformanceClassGetIopsAttributeType(&o.Iops, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *VolumePerformanceClass) GetLabels() (res VolumePerformanceClassGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetLabelsOk() (ret VolumePerformanceClassGetLabelsRetType, ok bool) { + return getVolumePerformanceClassGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *VolumePerformanceClass) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *VolumePerformanceClass) SetLabels(v VolumePerformanceClassGetLabelsRetType) { + setVolumePerformanceClassGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *VolumePerformanceClass) GetName() (ret VolumePerformanceClassGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetNameOk() (ret VolumePerformanceClassGetNameRetType, ok bool) { + return getVolumePerformanceClassGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *VolumePerformanceClass) SetName(v VolumePerformanceClassGetNameRetType) { + setVolumePerformanceClassGetNameAttributeType(&o.Name, v) +} + +// GetThroughput returns the Throughput field value if set, zero value otherwise. +func (o *VolumePerformanceClass) GetThroughput() (res VolumePerformanceClassGetThroughputRetType) { + res, _ = o.GetThroughputOk() + return +} + +// GetThroughputOk returns a tuple with the Throughput field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetThroughputOk() (ret VolumePerformanceClassGetThroughputRetType, ok bool) { + return getVolumePerformanceClassGetThroughputAttributeTypeOk(o.Throughput) +} + +// HasThroughput returns a boolean if a field has been set. +func (o *VolumePerformanceClass) HasThroughput() bool { + _, ok := o.GetThroughputOk() + return ok +} + +// SetThroughput gets a reference to the given int64 and assigns it to the Throughput field. +func (o *VolumePerformanceClass) SetThroughput(v VolumePerformanceClassGetThroughputRetType) { + setVolumePerformanceClassGetThroughputAttributeType(&o.Throughput, v) +} + +func (o VolumePerformanceClass) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumePerformanceClassGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getVolumePerformanceClassGetIopsAttributeTypeOk(o.Iops); ok { + toSerialize["Iops"] = val + } + if val, ok := getVolumePerformanceClassGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getVolumePerformanceClassGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getVolumePerformanceClassGetThroughputAttributeTypeOk(o.Throughput); ok { + toSerialize["Throughput"] = val + } + return toSerialize, nil +} + +type NullableVolumePerformanceClass struct { + value *VolumePerformanceClass + isSet bool +} + +func (v NullableVolumePerformanceClass) Get() *VolumePerformanceClass { + return v.value +} + +func (v *NullableVolumePerformanceClass) Set(val *VolumePerformanceClass) { + v.value = val + v.isSet = true +} + +func (v NullableVolumePerformanceClass) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumePerformanceClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumePerformanceClass(val *VolumePerformanceClass) *NullableVolumePerformanceClass { + return &NullableVolumePerformanceClass{value: val, isSet: true} +} + +func (v NullableVolumePerformanceClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumePerformanceClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_volume_performance_class_list_response.go b/pkg/iaasbeta/model_volume_performance_class_list_response.go new file mode 100644 index 00000000..8d87b46a --- /dev/null +++ b/pkg/iaasbeta/model_volume_performance_class_list_response.go @@ -0,0 +1,126 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the VolumePerformanceClassListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumePerformanceClassListResponse{} + +/* + types and functions for items +*/ + +// isArray +type VolumePerformanceClassListResponseGetItemsAttributeType = *[]VolumePerformanceClass +type VolumePerformanceClassListResponseGetItemsArgType = []VolumePerformanceClass +type VolumePerformanceClassListResponseGetItemsRetType = []VolumePerformanceClass + +func getVolumePerformanceClassListResponseGetItemsAttributeTypeOk(arg VolumePerformanceClassListResponseGetItemsAttributeType) (ret VolumePerformanceClassListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassListResponseGetItemsAttributeType(arg *VolumePerformanceClassListResponseGetItemsAttributeType, val VolumePerformanceClassListResponseGetItemsRetType) { + *arg = &val +} + +// VolumePerformanceClassListResponse Volume performance class list response. +type VolumePerformanceClassListResponse struct { + // A list containing Volume performance classes. + // REQUIRED + Items VolumePerformanceClassListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _VolumePerformanceClassListResponse VolumePerformanceClassListResponse + +// NewVolumePerformanceClassListResponse instantiates a new VolumePerformanceClassListResponse 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 NewVolumePerformanceClassListResponse(items VolumePerformanceClassListResponseGetItemsArgType) *VolumePerformanceClassListResponse { + this := VolumePerformanceClassListResponse{} + setVolumePerformanceClassListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewVolumePerformanceClassListResponseWithDefaults instantiates a new VolumePerformanceClassListResponse 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 NewVolumePerformanceClassListResponseWithDefaults() *VolumePerformanceClassListResponse { + this := VolumePerformanceClassListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *VolumePerformanceClassListResponse) GetItems() (ret VolumePerformanceClassListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClassListResponse) GetItemsOk() (ret VolumePerformanceClassListResponseGetItemsRetType, ok bool) { + return getVolumePerformanceClassListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *VolumePerformanceClassListResponse) SetItems(v VolumePerformanceClassListResponseGetItemsRetType) { + setVolumePerformanceClassListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o VolumePerformanceClassListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumePerformanceClassListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableVolumePerformanceClassListResponse struct { + value *VolumePerformanceClassListResponse + isSet bool +} + +func (v NullableVolumePerformanceClassListResponse) Get() *VolumePerformanceClassListResponse { + return v.value +} + +func (v *NullableVolumePerformanceClassListResponse) Set(val *VolumePerformanceClassListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumePerformanceClassListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumePerformanceClassListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumePerformanceClassListResponse(val *VolumePerformanceClassListResponse) *NullableVolumePerformanceClassListResponse { + return &NullableVolumePerformanceClassListResponse{value: val, isSet: true} +} + +func (v NullableVolumePerformanceClassListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumePerformanceClassListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_volume_performance_class_list_response_test.go b/pkg/iaasbeta/model_volume_performance_class_list_response_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_volume_performance_class_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_volume_performance_class_test.go b/pkg/iaasbeta/model_volume_performance_class_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_volume_performance_class_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_volume_source.go b/pkg/iaasbeta/model_volume_source.go new file mode 100644 index 00000000..8c93d6a3 --- /dev/null +++ b/pkg/iaasbeta/model_volume_source.go @@ -0,0 +1,172 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" +) + +// checks if the VolumeSource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeSource{} + +/* + types and functions for id +*/ + +// isNotNullableString +type VolumeSourceGetIdAttributeType = *string + +func getVolumeSourceGetIdAttributeTypeOk(arg VolumeSourceGetIdAttributeType) (ret VolumeSourceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeSourceGetIdAttributeType(arg *VolumeSourceGetIdAttributeType, val VolumeSourceGetIdRetType) { + *arg = &val +} + +type VolumeSourceGetIdArgType = string +type VolumeSourceGetIdRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type VolumeSourceGetTypeAttributeType = *string + +func getVolumeSourceGetTypeAttributeTypeOk(arg VolumeSourceGetTypeAttributeType) (ret VolumeSourceGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeSourceGetTypeAttributeType(arg *VolumeSourceGetTypeAttributeType, val VolumeSourceGetTypeRetType) { + *arg = &val +} + +type VolumeSourceGetTypeArgType = string +type VolumeSourceGetTypeRetType = string + +// VolumeSource The source object of a volume. +type VolumeSource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id VolumeSourceGetIdAttributeType `json:"id" required:"true"` + // The source types of a volume. Possible values: `image`, `volume`, `snapshot`, `backup`. + // REQUIRED + Type VolumeSourceGetTypeAttributeType `json:"type" required:"true"` +} + +type _VolumeSource VolumeSource + +// NewVolumeSource instantiates a new VolumeSource 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 NewVolumeSource(id VolumeSourceGetIdArgType, types VolumeSourceGetTypeArgType) *VolumeSource { + this := VolumeSource{} + setVolumeSourceGetIdAttributeType(&this.Id, id) + setVolumeSourceGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewVolumeSourceWithDefaults instantiates a new VolumeSource 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 NewVolumeSourceWithDefaults() *VolumeSource { + this := VolumeSource{} + return &this +} + +// GetId returns the Id field value +func (o *VolumeSource) GetId() (ret VolumeSourceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *VolumeSource) GetIdOk() (ret VolumeSourceGetIdRetType, ok bool) { + return getVolumeSourceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *VolumeSource) SetId(v VolumeSourceGetIdRetType) { + setVolumeSourceGetIdAttributeType(&o.Id, v) +} + +// GetType returns the Type field value +func (o *VolumeSource) GetType() (ret VolumeSourceGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *VolumeSource) GetTypeOk() (ret VolumeSourceGetTypeRetType, ok bool) { + return getVolumeSourceGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *VolumeSource) SetType(v VolumeSourceGetTypeRetType) { + setVolumeSourceGetTypeAttributeType(&o.Type, v) +} + +func (o VolumeSource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeSourceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getVolumeSourceGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableVolumeSource struct { + value *VolumeSource + isSet bool +} + +func (v NullableVolumeSource) Get() *VolumeSource { + return v.value +} + +func (v *NullableVolumeSource) Set(val *VolumeSource) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeSource) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeSource(val *VolumeSource) *NullableVolumeSource { + return &NullableVolumeSource{value: val, isSet: true} +} + +func (v NullableVolumeSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/iaasbeta/model_volume_source_test.go b/pkg/iaasbeta/model_volume_source_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_volume_source_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/model_volume_test.go b/pkg/iaasbeta/model_volume_test.go new file mode 100644 index 00000000..0f454928 --- /dev/null +++ b/pkg/iaasbeta/model_volume_test.go @@ -0,0 +1,11 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta diff --git a/pkg/iaasbeta/utils.go b/pkg/iaasbeta/utils.go new file mode 100644 index 00000000..000adb8d --- /dev/null +++ b/pkg/iaasbeta/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT IaaS API + +This API allows you to create and modify IaaS resources. + +API version: 2beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaasbeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/intakebeta/.openapi-generator/VERSION b/pkg/intakebeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/intakebeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/intakebeta/api_default.go b/pkg/intakebeta/api_default.go new file mode 100644 index 00000000..77e192f1 --- /dev/null +++ b/pkg/intakebeta/api_default.go @@ -0,0 +1,2502 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateIntake Method for CreateIntake + Creates a new intake within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateIntakeRequest + */ + CreateIntake(ctx context.Context, projectId string, regionId string) ApiCreateIntakeRequest + /* + CreateIntakeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return IntakeResponse + + */ + CreateIntakeExecute(ctx context.Context, projectId string, regionId string) (*IntakeResponse, error) + /* + CreateIntakeRunner Method for CreateIntakeRunner + Creates a new intake runner within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateIntakeRunnerRequest + */ + CreateIntakeRunner(ctx context.Context, projectId string, regionId string) ApiCreateIntakeRunnerRequest + /* + CreateIntakeRunnerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return IntakeRunnerResponse + + */ + CreateIntakeRunnerExecute(ctx context.Context, projectId string, regionId string) (*IntakeRunnerResponse, error) + /* + CreateIntakeUser Method for CreateIntakeUser + Creates a new user for this intake. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ApiCreateIntakeUserRequest + */ + CreateIntakeUser(ctx context.Context, projectId string, regionId string, intakeId string) ApiCreateIntakeUserRequest + /* + CreateIntakeUserExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return IntakeUserResponse + + */ + CreateIntakeUserExecute(ctx context.Context, projectId string, regionId string, intakeId string) (*IntakeUserResponse, error) + /* + DeleteIntake Method for DeleteIntake + Deletes the given intake. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ApiDeleteIntakeRequest + */ + DeleteIntake(ctx context.Context, projectId string, regionId string, intakeId string) ApiDeleteIntakeRequest + /* + DeleteIntakeExecute executes the request + + */ + DeleteIntakeExecute(ctx context.Context, projectId string, regionId string, intakeId string) error + /* + DeleteIntakeRunner Method for DeleteIntakeRunner + Deletes the given intake runner. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeRunnerId The intake runner UUID. + @return ApiDeleteIntakeRunnerRequest + */ + DeleteIntakeRunner(ctx context.Context, projectId string, regionId string, intakeRunnerId string) ApiDeleteIntakeRunnerRequest + /* + DeleteIntakeRunnerExecute executes the request + + */ + DeleteIntakeRunnerExecute(ctx context.Context, projectId string, regionId string, intakeRunnerId string) error + /* + DeleteIntakeUser Method for DeleteIntakeUser + Deletes the given intake user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @param intakeUserId The intake user UUID. + @return ApiDeleteIntakeUserRequest + */ + DeleteIntakeUser(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) ApiDeleteIntakeUserRequest + /* + DeleteIntakeUserExecute executes the request + + */ + DeleteIntakeUserExecute(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) error + /* + GetIntake Method for GetIntake + Returns the details for the given intake. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ApiGetIntakeRequest + */ + GetIntake(ctx context.Context, projectId string, regionId string, intakeId string) ApiGetIntakeRequest + /* + GetIntakeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return IntakeResponse + + */ + GetIntakeExecute(ctx context.Context, projectId string, regionId string, intakeId string) (*IntakeResponse, error) + /* + GetIntakeRunner Method for GetIntakeRunner + Returns the details for the given intake runner. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeRunnerId The intake runner UUID. + @return ApiGetIntakeRunnerRequest + */ + GetIntakeRunner(ctx context.Context, projectId string, regionId string, intakeRunnerId string) ApiGetIntakeRunnerRequest + /* + GetIntakeRunnerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeRunnerId The intake runner UUID. + @return IntakeRunnerResponse + + */ + GetIntakeRunnerExecute(ctx context.Context, projectId string, regionId string, intakeRunnerId string) (*IntakeRunnerResponse, error) + /* + GetIntakeUser Method for GetIntakeUser + Returns the details for the given user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @param intakeUserId The intake user UUID. + @return ApiGetIntakeUserRequest + */ + GetIntakeUser(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) ApiGetIntakeUserRequest + /* + GetIntakeUserExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @param intakeUserId The intake user UUID. + @return IntakeUserResponse + + */ + GetIntakeUserExecute(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) (*IntakeUserResponse, error) + /* + ListIntakeRunners Method for ListIntakeRunners + Returns a list of all intake runners within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListIntakeRunnersRequest + */ + ListIntakeRunners(ctx context.Context, projectId string, regionId string) ApiListIntakeRunnersRequest + /* + ListIntakeRunnersExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ListIntakeRunnersResponse + + */ + ListIntakeRunnersExecute(ctx context.Context, projectId string, regionId string) (*ListIntakeRunnersResponse, error) + /* + ListIntakeUsers Method for ListIntakeUsers + Returns a list of all intake users within the project and intake. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ApiListIntakeUsersRequest + */ + ListIntakeUsers(ctx context.Context, projectId string, regionId string, intakeId string) ApiListIntakeUsersRequest + /* + ListIntakeUsersExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ListIntakeUsersResponse + + */ + ListIntakeUsersExecute(ctx context.Context, projectId string, regionId string, intakeId string) (*ListIntakeUsersResponse, error) + /* + ListIntakes Method for ListIntakes + Returns a list of all intakes within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListIntakesRequest + */ + ListIntakes(ctx context.Context, projectId string, regionId string) ApiListIntakesRequest + /* + ListIntakesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ListIntakesResponse + + */ + ListIntakesExecute(ctx context.Context, projectId string, regionId string) (*ListIntakesResponse, error) + /* + UpdateIntake Method for UpdateIntake + Updates the given intake. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ApiUpdateIntakeRequest + */ + UpdateIntake(ctx context.Context, projectId string, regionId string, intakeId string) ApiUpdateIntakeRequest + /* + UpdateIntakeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return IntakeResponse + + */ + UpdateIntakeExecute(ctx context.Context, projectId string, regionId string, intakeId string) (*IntakeResponse, error) + /* + UpdateIntakeRunner Method for UpdateIntakeRunner + Updates a intake runner within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeRunnerId The intake runner UUID. + @return ApiUpdateIntakeRunnerRequest + */ + UpdateIntakeRunner(ctx context.Context, projectId string, regionId string, intakeRunnerId string) ApiUpdateIntakeRunnerRequest + /* + UpdateIntakeRunnerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeRunnerId The intake runner UUID. + @return IntakeRunnerResponse + + */ + UpdateIntakeRunnerExecute(ctx context.Context, projectId string, regionId string, intakeRunnerId string) (*IntakeRunnerResponse, error) + /* + UpdateIntakeUser Method for UpdateIntakeUser + Updates the given intake user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @param intakeUserId The intake user UUID. + @return ApiUpdateIntakeUserRequest + */ + UpdateIntakeUser(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) ApiUpdateIntakeUserRequest + /* + UpdateIntakeUserExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @param intakeUserId The intake user UUID. + @return IntakeUserResponse + + */ + UpdateIntakeUserExecute(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) (*IntakeUserResponse, error) +} + +type ApiCreateIntakeRequest interface { + CreateIntakePayload(createIntakePayload CreateIntakePayload) ApiCreateIntakeRequest + Execute() (*IntakeResponse, error) +} + +type ApiCreateIntakeRunnerRequest interface { + CreateIntakeRunnerPayload(createIntakeRunnerPayload CreateIntakeRunnerPayload) ApiCreateIntakeRunnerRequest + Execute() (*IntakeRunnerResponse, error) +} + +type ApiCreateIntakeUserRequest interface { + CreateIntakeUserPayload(createIntakeUserPayload CreateIntakeUserPayload) ApiCreateIntakeUserRequest + Execute() (*IntakeUserResponse, error) +} + +type ApiDeleteIntakeRequest interface { + // If true, deletes all child resources. If false, the resource remains in a 'deletion state' while child resources exist. + Force(force bool) ApiDeleteIntakeRequest + Execute() error +} + +type ApiDeleteIntakeRunnerRequest interface { + // If true, deletes all child resources. If false, the resource remains in a 'deletion state' while child resources exist. + Force(force bool) ApiDeleteIntakeRunnerRequest + Execute() error +} + +type ApiDeleteIntakeUserRequest interface { + Execute() error +} + +type ApiGetIntakeRequest interface { + Execute() (*IntakeResponse, error) +} + +type ApiGetIntakeRunnerRequest interface { + Execute() (*IntakeRunnerResponse, error) +} + +type ApiGetIntakeUserRequest interface { + Execute() (*IntakeUserResponse, error) +} + +type ApiListIntakeRunnersRequest interface { + // A token to retrieve the next page of results. + PageToken(pageToken string) ApiListIntakeRunnersRequest + // Maximum number of items to return + PageSize(pageSize int32) ApiListIntakeRunnersRequest + Execute() (*ListIntakeRunnersResponse, error) +} + +type ApiListIntakeUsersRequest interface { + // A token to retrieve the next page of results. + PageToken(pageToken string) ApiListIntakeUsersRequest + // Maximum number of items to return + PageSize(pageSize int32) ApiListIntakeUsersRequest + Execute() (*ListIntakeUsersResponse, error) +} + +type ApiListIntakesRequest interface { + // A token to retrieve the next page of results. + PageToken(pageToken string) ApiListIntakesRequest + // Maximum number of items to return + PageSize(pageSize int32) ApiListIntakesRequest + Execute() (*ListIntakesResponse, error) +} + +type ApiUpdateIntakeRequest interface { + UpdateIntakePayload(updateIntakePayload UpdateIntakePayload) ApiUpdateIntakeRequest + Execute() (*IntakeResponse, error) +} + +type ApiUpdateIntakeRunnerRequest interface { + UpdateIntakeRunnerPayload(updateIntakeRunnerPayload UpdateIntakeRunnerPayload) ApiUpdateIntakeRunnerRequest + Execute() (*IntakeRunnerResponse, error) +} + +type ApiUpdateIntakeUserRequest interface { + UpdateIntakeUserPayload(updateIntakeUserPayload UpdateIntakeUserPayload) ApiUpdateIntakeUserRequest + Execute() (*IntakeUserResponse, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateIntakeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + createIntakePayload *CreateIntakePayload +} + +func (r CreateIntakeRequest) CreateIntakePayload(createIntakePayload CreateIntakePayload) ApiCreateIntakeRequest { + r.createIntakePayload = &createIntakePayload + return r +} + +func (r CreateIntakeRequest) Execute() (*IntakeResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IntakeResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateIntake") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intakes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createIntakePayload == nil { + return localVarReturnValue, fmt.Errorf("createIntakePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createIntakePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateIntake: Method for CreateIntake + +Creates a new intake within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateIntakeRequest +*/ +func (a *APIClient) CreateIntake(ctx context.Context, projectId string, regionId string) ApiCreateIntakeRequest { + return CreateIntakeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +func (a *APIClient) CreateIntakeExecute(ctx context.Context, projectId string, regionId string) (*IntakeResponse, error) { + r := CreateIntakeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type CreateIntakeRunnerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + createIntakeRunnerPayload *CreateIntakeRunnerPayload +} + +func (r CreateIntakeRunnerRequest) CreateIntakeRunnerPayload(createIntakeRunnerPayload CreateIntakeRunnerPayload) ApiCreateIntakeRunnerRequest { + r.createIntakeRunnerPayload = &createIntakeRunnerPayload + return r +} + +func (r CreateIntakeRunnerRequest) Execute() (*IntakeRunnerResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IntakeRunnerResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateIntakeRunner") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intake-runners" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createIntakeRunnerPayload == nil { + return localVarReturnValue, fmt.Errorf("createIntakeRunnerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createIntakeRunnerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateIntakeRunner: Method for CreateIntakeRunner + +Creates a new intake runner within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateIntakeRunnerRequest +*/ +func (a *APIClient) CreateIntakeRunner(ctx context.Context, projectId string, regionId string) ApiCreateIntakeRunnerRequest { + return CreateIntakeRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +func (a *APIClient) CreateIntakeRunnerExecute(ctx context.Context, projectId string, regionId string) (*IntakeRunnerResponse, error) { + r := CreateIntakeRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type CreateIntakeUserRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeId string + createIntakeUserPayload *CreateIntakeUserPayload +} + +func (r CreateIntakeUserRequest) CreateIntakeUserPayload(createIntakeUserPayload CreateIntakeUserPayload) ApiCreateIntakeUserRequest { + r.createIntakeUserPayload = &createIntakeUserPayload + return r +} + +func (r CreateIntakeUserRequest) Execute() (*IntakeUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IntakeUserResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateIntakeUser") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}/users" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(r.intakeId, "intakeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createIntakeUserPayload == nil { + return localVarReturnValue, fmt.Errorf("createIntakeUserPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createIntakeUserPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateIntakeUser: Method for CreateIntakeUser + +Creates a new user for this intake. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ApiCreateIntakeUserRequest +*/ +func (a *APIClient) CreateIntakeUser(ctx context.Context, projectId string, regionId string, intakeId string) ApiCreateIntakeUserRequest { + return CreateIntakeUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + } +} + +func (a *APIClient) CreateIntakeUserExecute(ctx context.Context, projectId string, regionId string, intakeId string) (*IntakeUserResponse, error) { + r := CreateIntakeUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + } + return r.Execute() +} + +type DeleteIntakeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeId string + force *bool +} + +// If true, deletes all child resources. If false, the resource remains in a 'deletion state' while child resources exist. + +func (r DeleteIntakeRequest) Force(force bool) ApiDeleteIntakeRequest { + r.force = &force + return r +} + +func (r DeleteIntakeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteIntake") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(r.intakeId, "intakeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.force != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "force", r.force, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return newErr + } + + return nil +} + +/* +DeleteIntake: Method for DeleteIntake + +Deletes the given intake. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ApiDeleteIntakeRequest +*/ +func (a *APIClient) DeleteIntake(ctx context.Context, projectId string, regionId string, intakeId string) ApiDeleteIntakeRequest { + return DeleteIntakeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + } +} + +func (a *APIClient) DeleteIntakeExecute(ctx context.Context, projectId string, regionId string, intakeId string) error { + r := DeleteIntakeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + } + return r.Execute() +} + +type DeleteIntakeRunnerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeRunnerId string + force *bool +} + +// If true, deletes all child resources. If false, the resource remains in a 'deletion state' while child resources exist. + +func (r DeleteIntakeRunnerRequest) Force(force bool) ApiDeleteIntakeRunnerRequest { + r.force = &force + return r +} + +func (r DeleteIntakeRunnerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteIntakeRunner") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intake-runners/{intakeRunnerId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeRunnerId"+"}", url.PathEscape(ParameterValueToString(r.intakeRunnerId, "intakeRunnerId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.force != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "force", r.force, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return newErr + } + + return nil +} + +/* +DeleteIntakeRunner: Method for DeleteIntakeRunner + +Deletes the given intake runner. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeRunnerId The intake runner UUID. + @return ApiDeleteIntakeRunnerRequest +*/ +func (a *APIClient) DeleteIntakeRunner(ctx context.Context, projectId string, regionId string, intakeRunnerId string) ApiDeleteIntakeRunnerRequest { + return DeleteIntakeRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeRunnerId: intakeRunnerId, + } +} + +func (a *APIClient) DeleteIntakeRunnerExecute(ctx context.Context, projectId string, regionId string, intakeRunnerId string) error { + r := DeleteIntakeRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeRunnerId: intakeRunnerId, + } + return r.Execute() +} + +type DeleteIntakeUserRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeId string + intakeUserId string +} + +func (r DeleteIntakeUserRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteIntakeUser") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}/users/{intakeUserId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(r.intakeId, "intakeId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeUserId"+"}", url.PathEscape(ParameterValueToString(r.intakeUserId, "intakeUserId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return newErr + } + + return nil +} + +/* +DeleteIntakeUser: Method for DeleteIntakeUser + +Deletes the given intake user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @param intakeUserId The intake user UUID. + @return ApiDeleteIntakeUserRequest +*/ +func (a *APIClient) DeleteIntakeUser(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) ApiDeleteIntakeUserRequest { + return DeleteIntakeUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + intakeUserId: intakeUserId, + } +} + +func (a *APIClient) DeleteIntakeUserExecute(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) error { + r := DeleteIntakeUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + intakeUserId: intakeUserId, + } + return r.Execute() +} + +type GetIntakeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeId string +} + +func (r GetIntakeRequest) Execute() (*IntakeResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IntakeResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetIntake") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(r.intakeId, "intakeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetIntake: Method for GetIntake + +Returns the details for the given intake. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ApiGetIntakeRequest +*/ +func (a *APIClient) GetIntake(ctx context.Context, projectId string, regionId string, intakeId string) ApiGetIntakeRequest { + return GetIntakeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + } +} + +func (a *APIClient) GetIntakeExecute(ctx context.Context, projectId string, regionId string, intakeId string) (*IntakeResponse, error) { + r := GetIntakeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + } + return r.Execute() +} + +type GetIntakeRunnerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeRunnerId string +} + +func (r GetIntakeRunnerRequest) Execute() (*IntakeRunnerResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IntakeRunnerResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetIntakeRunner") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intake-runners/{intakeRunnerId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeRunnerId"+"}", url.PathEscape(ParameterValueToString(r.intakeRunnerId, "intakeRunnerId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetIntakeRunner: Method for GetIntakeRunner + +Returns the details for the given intake runner. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeRunnerId The intake runner UUID. + @return ApiGetIntakeRunnerRequest +*/ +func (a *APIClient) GetIntakeRunner(ctx context.Context, projectId string, regionId string, intakeRunnerId string) ApiGetIntakeRunnerRequest { + return GetIntakeRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeRunnerId: intakeRunnerId, + } +} + +func (a *APIClient) GetIntakeRunnerExecute(ctx context.Context, projectId string, regionId string, intakeRunnerId string) (*IntakeRunnerResponse, error) { + r := GetIntakeRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeRunnerId: intakeRunnerId, + } + return r.Execute() +} + +type GetIntakeUserRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeId string + intakeUserId string +} + +func (r GetIntakeUserRequest) Execute() (*IntakeUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IntakeUserResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetIntakeUser") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}/users/{intakeUserId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(r.intakeId, "intakeId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeUserId"+"}", url.PathEscape(ParameterValueToString(r.intakeUserId, "intakeUserId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetIntakeUser: Method for GetIntakeUser + +Returns the details for the given user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @param intakeUserId The intake user UUID. + @return ApiGetIntakeUserRequest +*/ +func (a *APIClient) GetIntakeUser(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) ApiGetIntakeUserRequest { + return GetIntakeUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + intakeUserId: intakeUserId, + } +} + +func (a *APIClient) GetIntakeUserExecute(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) (*IntakeUserResponse, error) { + r := GetIntakeUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + intakeUserId: intakeUserId, + } + return r.Execute() +} + +type ListIntakeRunnersRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + pageToken *string + pageSize *int32 +} + +// A token to retrieve the next page of results. + +func (r ListIntakeRunnersRequest) PageToken(pageToken string) ApiListIntakeRunnersRequest { + r.pageToken = &pageToken + return r +} + +// Maximum number of items to return + +func (r ListIntakeRunnersRequest) PageSize(pageSize int32) ApiListIntakeRunnersRequest { + r.pageSize = &pageSize + return r +} + +func (r ListIntakeRunnersRequest) Execute() (*ListIntakeRunnersResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListIntakeRunnersResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListIntakeRunners") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intake-runners" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListIntakeRunners: Method for ListIntakeRunners + +Returns a list of all intake runners within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListIntakeRunnersRequest +*/ +func (a *APIClient) ListIntakeRunners(ctx context.Context, projectId string, regionId string) ApiListIntakeRunnersRequest { + return ListIntakeRunnersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +func (a *APIClient) ListIntakeRunnersExecute(ctx context.Context, projectId string, regionId string) (*ListIntakeRunnersResponse, error) { + r := ListIntakeRunnersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type ListIntakeUsersRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeId string + pageToken *string + pageSize *int32 +} + +// A token to retrieve the next page of results. + +func (r ListIntakeUsersRequest) PageToken(pageToken string) ApiListIntakeUsersRequest { + r.pageToken = &pageToken + return r +} + +// Maximum number of items to return + +func (r ListIntakeUsersRequest) PageSize(pageSize int32) ApiListIntakeUsersRequest { + r.pageSize = &pageSize + return r +} + +func (r ListIntakeUsersRequest) Execute() (*ListIntakeUsersResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListIntakeUsersResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListIntakeUsers") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}/users" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(r.intakeId, "intakeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListIntakeUsers: Method for ListIntakeUsers + +Returns a list of all intake users within the project and intake. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ApiListIntakeUsersRequest +*/ +func (a *APIClient) ListIntakeUsers(ctx context.Context, projectId string, regionId string, intakeId string) ApiListIntakeUsersRequest { + return ListIntakeUsersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + } +} + +func (a *APIClient) ListIntakeUsersExecute(ctx context.Context, projectId string, regionId string, intakeId string) (*ListIntakeUsersResponse, error) { + r := ListIntakeUsersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + } + return r.Execute() +} + +type ListIntakesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + pageToken *string + pageSize *int32 +} + +// A token to retrieve the next page of results. + +func (r ListIntakesRequest) PageToken(pageToken string) ApiListIntakesRequest { + r.pageToken = &pageToken + return r +} + +// Maximum number of items to return + +func (r ListIntakesRequest) PageSize(pageSize int32) ApiListIntakesRequest { + r.pageSize = &pageSize + return r +} + +func (r ListIntakesRequest) Execute() (*ListIntakesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListIntakesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListIntakes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intakes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListIntakes: Method for ListIntakes + +Returns a list of all intakes within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListIntakesRequest +*/ +func (a *APIClient) ListIntakes(ctx context.Context, projectId string, regionId string) ApiListIntakesRequest { + return ListIntakesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +func (a *APIClient) ListIntakesExecute(ctx context.Context, projectId string, regionId string) (*ListIntakesResponse, error) { + r := ListIntakesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type UpdateIntakeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeId string + updateIntakePayload *UpdateIntakePayload +} + +func (r UpdateIntakeRequest) UpdateIntakePayload(updateIntakePayload UpdateIntakePayload) ApiUpdateIntakeRequest { + r.updateIntakePayload = &updateIntakePayload + return r +} + +func (r UpdateIntakeRequest) Execute() (*IntakeResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IntakeResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateIntake") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(r.intakeId, "intakeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateIntakePayload == nil { + return localVarReturnValue, fmt.Errorf("updateIntakePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateIntakePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateIntake: Method for UpdateIntake + +Updates the given intake. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @return ApiUpdateIntakeRequest +*/ +func (a *APIClient) UpdateIntake(ctx context.Context, projectId string, regionId string, intakeId string) ApiUpdateIntakeRequest { + return UpdateIntakeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + } +} + +func (a *APIClient) UpdateIntakeExecute(ctx context.Context, projectId string, regionId string, intakeId string) (*IntakeResponse, error) { + r := UpdateIntakeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + } + return r.Execute() +} + +type UpdateIntakeRunnerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeRunnerId string + updateIntakeRunnerPayload *UpdateIntakeRunnerPayload +} + +func (r UpdateIntakeRunnerRequest) UpdateIntakeRunnerPayload(updateIntakeRunnerPayload UpdateIntakeRunnerPayload) ApiUpdateIntakeRunnerRequest { + r.updateIntakeRunnerPayload = &updateIntakeRunnerPayload + return r +} + +func (r UpdateIntakeRunnerRequest) Execute() (*IntakeRunnerResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IntakeRunnerResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateIntakeRunner") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intake-runners/{intakeRunnerId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeRunnerId"+"}", url.PathEscape(ParameterValueToString(r.intakeRunnerId, "intakeRunnerId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateIntakeRunnerPayload == nil { + return localVarReturnValue, fmt.Errorf("updateIntakeRunnerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateIntakeRunnerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateIntakeRunner: Method for UpdateIntakeRunner + +Updates a intake runner within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeRunnerId The intake runner UUID. + @return ApiUpdateIntakeRunnerRequest +*/ +func (a *APIClient) UpdateIntakeRunner(ctx context.Context, projectId string, regionId string, intakeRunnerId string) ApiUpdateIntakeRunnerRequest { + return UpdateIntakeRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeRunnerId: intakeRunnerId, + } +} + +func (a *APIClient) UpdateIntakeRunnerExecute(ctx context.Context, projectId string, regionId string, intakeRunnerId string) (*IntakeRunnerResponse, error) { + r := UpdateIntakeRunnerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeRunnerId: intakeRunnerId, + } + return r.Execute() +} + +type UpdateIntakeUserRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + intakeId string + intakeUserId string + updateIntakeUserPayload *UpdateIntakeUserPayload +} + +func (r UpdateIntakeUserRequest) UpdateIntakeUserPayload(updateIntakeUserPayload UpdateIntakeUserPayload) ApiUpdateIntakeUserRequest { + r.updateIntakeUserPayload = &updateIntakeUserPayload + return r +} + +func (r UpdateIntakeUserRequest) Execute() (*IntakeUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *IntakeUserResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateIntakeUser") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}/users/{intakeUserId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(r.intakeId, "intakeId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"intakeUserId"+"}", url.PathEscape(ParameterValueToString(r.intakeUserId, "intakeUserId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateIntakeUserPayload == nil { + return localVarReturnValue, fmt.Errorf("updateIntakeUserPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateIntakeUserPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateIntakeUser: Method for UpdateIntakeUser + +Updates the given intake user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param intakeId The intake UUID. + @param intakeUserId The intake user UUID. + @return ApiUpdateIntakeUserRequest +*/ +func (a *APIClient) UpdateIntakeUser(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) ApiUpdateIntakeUserRequest { + return UpdateIntakeUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + intakeUserId: intakeUserId, + } +} + +func (a *APIClient) UpdateIntakeUserExecute(ctx context.Context, projectId string, regionId string, intakeId string, intakeUserId string) (*IntakeUserResponse, error) { + r := UpdateIntakeUserRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + intakeId: intakeId, + intakeUserId: intakeUserId, + } + return r.Execute() +} diff --git a/pkg/intakebeta/api_default_test.go b/pkg/intakebeta/api_default_test.go new file mode 100644 index 00000000..db9584f4 --- /dev/null +++ b/pkg/intakebeta/api_default_test.go @@ -0,0 +1,882 @@ +/* +STACKIT Intake API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package intakebeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_intakebeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateIntake", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intakes" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := IntakeResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + createIntakePayload := CreateIntakePayload{} + + resp, reqErr := apiClient.CreateIntake(context.Background(), projectId, regionId).CreateIntakePayload(createIntakePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateIntakeRunner", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intake-runners" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := IntakeRunnerResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + createIntakeRunnerPayload := CreateIntakeRunnerPayload{} + + resp, reqErr := apiClient.CreateIntakeRunner(context.Background(), projectId, regionId).CreateIntakeRunnerPayload(createIntakeRunnerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateIntakeUser", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}/users" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(intakeIdValue, "intakeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := IntakeUserResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeId := intakeIdValue + createIntakeUserPayload := CreateIntakeUserPayload{} + + resp, reqErr := apiClient.CreateIntakeUser(context.Background(), projectId, regionId, intakeId).CreateIntakeUserPayload(createIntakeUserPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteIntake", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(intakeIdValue, "intakeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeId := intakeIdValue + + reqErr := apiClient.DeleteIntake(context.Background(), projectId, regionId, intakeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteIntakeRunner", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intake-runners/{intakeRunnerId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeRunnerIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeRunnerId"+"}", url.PathEscape(ParameterValueToString(intakeRunnerIdValue, "intakeRunnerId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeRunnerId := intakeRunnerIdValue + + reqErr := apiClient.DeleteIntakeRunner(context.Background(), projectId, regionId, intakeRunnerId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteIntakeUser", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}/users/{intakeUserId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(intakeIdValue, "intakeId")), -1) + intakeUserIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeUserId"+"}", url.PathEscape(ParameterValueToString(intakeUserIdValue, "intakeUserId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeId := intakeIdValue + intakeUserId := intakeUserIdValue + + reqErr := apiClient.DeleteIntakeUser(context.Background(), projectId, regionId, intakeId, intakeUserId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetIntake", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(intakeIdValue, "intakeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := IntakeResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeId := intakeIdValue + + resp, reqErr := apiClient.GetIntake(context.Background(), projectId, regionId, intakeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetIntakeRunner", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intake-runners/{intakeRunnerId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeRunnerIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeRunnerId"+"}", url.PathEscape(ParameterValueToString(intakeRunnerIdValue, "intakeRunnerId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := IntakeRunnerResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeRunnerId := intakeRunnerIdValue + + resp, reqErr := apiClient.GetIntakeRunner(context.Background(), projectId, regionId, intakeRunnerId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetIntakeUser", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}/users/{intakeUserId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(intakeIdValue, "intakeId")), -1) + intakeUserIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeUserId"+"}", url.PathEscape(ParameterValueToString(intakeUserIdValue, "intakeUserId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := IntakeUserResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeId := intakeIdValue + intakeUserId := intakeUserIdValue + + resp, reqErr := apiClient.GetIntakeUser(context.Background(), projectId, regionId, intakeId, intakeUserId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListIntakeRunners", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intake-runners" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListIntakeRunnersResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + + resp, reqErr := apiClient.ListIntakeRunners(context.Background(), projectId, regionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListIntakeUsers", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}/users" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(intakeIdValue, "intakeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListIntakeUsersResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeId := intakeIdValue + + resp, reqErr := apiClient.ListIntakeUsers(context.Background(), projectId, regionId, intakeId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListIntakes", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intakes" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListIntakesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + + resp, reqErr := apiClient.ListIntakes(context.Background(), projectId, regionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateIntake", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(intakeIdValue, "intakeId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := IntakeResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeId := intakeIdValue + updateIntakePayload := UpdateIntakePayload{} + + resp, reqErr := apiClient.UpdateIntake(context.Background(), projectId, regionId, intakeId).UpdateIntakePayload(updateIntakePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateIntakeRunner", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intake-runners/{intakeRunnerId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeRunnerIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeRunnerId"+"}", url.PathEscape(ParameterValueToString(intakeRunnerIdValue, "intakeRunnerId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := IntakeRunnerResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeRunnerId := intakeRunnerIdValue + updateIntakeRunnerPayload := UpdateIntakeRunnerPayload{} + + resp, reqErr := apiClient.UpdateIntakeRunner(context.Background(), projectId, regionId, intakeRunnerId).UpdateIntakeRunnerPayload(updateIntakeRunnerPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateIntakeUser", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/intakes/{intakeId}/users/{intakeUserId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + intakeIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeId"+"}", url.PathEscape(ParameterValueToString(intakeIdValue, "intakeId")), -1) + intakeUserIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"intakeUserId"+"}", url.PathEscape(ParameterValueToString(intakeUserIdValue, "intakeUserId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := IntakeUserResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for intakebeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + intakeId := intakeIdValue + intakeUserId := intakeUserIdValue + updateIntakeUserPayload := UpdateIntakeUserPayload{} + + resp, reqErr := apiClient.UpdateIntakeUser(context.Background(), projectId, regionId, intakeId, intakeUserId).UpdateIntakeUserPayload(updateIntakeUserPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/intakebeta/client.go b/pkg/intakebeta/client.go new file mode 100644 index 00000000..82b728f9 --- /dev/null +++ b/pkg/intakebeta/client.go @@ -0,0 +1,628 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Intake API API v1beta.3.5 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/intakebeta/configuration.go b/pkg/intakebeta/configuration.go new file mode 100644 index 00000000..210183f3 --- /dev/null +++ b/pkg/intakebeta/configuration.go @@ -0,0 +1,41 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/intakebeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://intake.api.{region}stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "eu01.", + EnumValues: []string{ + "eu01.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/intakebeta/model_catalog_auth.go b/pkg/intakebeta/model_catalog_auth.go new file mode 100644 index 00000000..c1f8568a --- /dev/null +++ b/pkg/intakebeta/model_catalog_auth.go @@ -0,0 +1,172 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the CatalogAuth type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogAuth{} + +/* + types and functions for dremio +*/ + +// isModel +type CatalogAuthGetDremioAttributeType = *DremioAuth +type CatalogAuthGetDremioArgType = DremioAuth +type CatalogAuthGetDremioRetType = DremioAuth + +func getCatalogAuthGetDremioAttributeTypeOk(arg CatalogAuthGetDremioAttributeType) (ret CatalogAuthGetDremioRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCatalogAuthGetDremioAttributeType(arg *CatalogAuthGetDremioAttributeType, val CatalogAuthGetDremioRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isEnumRef +type CatalogAuthGetTypeAttributeType = *CatalogAuthType +type CatalogAuthGetTypeArgType = CatalogAuthType +type CatalogAuthGetTypeRetType = CatalogAuthType + +func getCatalogAuthGetTypeAttributeTypeOk(arg CatalogAuthGetTypeAttributeType) (ret CatalogAuthGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCatalogAuthGetTypeAttributeType(arg *CatalogAuthGetTypeAttributeType, val CatalogAuthGetTypeRetType) { + *arg = &val +} + +// CatalogAuth Configures authentication for the Iceberg catalog +type CatalogAuth struct { + Dremio CatalogAuthGetDremioAttributeType `json:"dremio,omitempty"` + // REQUIRED + Type CatalogAuthGetTypeAttributeType `json:"type" required:"true"` +} + +type _CatalogAuth CatalogAuth + +// NewCatalogAuth instantiates a new CatalogAuth 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 NewCatalogAuth(types CatalogAuthGetTypeArgType) *CatalogAuth { + this := CatalogAuth{} + setCatalogAuthGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewCatalogAuthWithDefaults instantiates a new CatalogAuth 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 NewCatalogAuthWithDefaults() *CatalogAuth { + this := CatalogAuth{} + return &this +} + +// GetDremio returns the Dremio field value if set, zero value otherwise. +func (o *CatalogAuth) GetDremio() (res CatalogAuthGetDremioRetType) { + res, _ = o.GetDremioOk() + return +} + +// GetDremioOk returns a tuple with the Dremio field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogAuth) GetDremioOk() (ret CatalogAuthGetDremioRetType, ok bool) { + return getCatalogAuthGetDremioAttributeTypeOk(o.Dremio) +} + +// HasDremio returns a boolean if a field has been set. +func (o *CatalogAuth) HasDremio() bool { + _, ok := o.GetDremioOk() + return ok +} + +// SetDremio gets a reference to the given DremioAuth and assigns it to the Dremio field. +func (o *CatalogAuth) SetDremio(v CatalogAuthGetDremioRetType) { + setCatalogAuthGetDremioAttributeType(&o.Dremio, v) +} + +// GetType returns the Type field value +func (o *CatalogAuth) GetType() (ret CatalogAuthGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *CatalogAuth) GetTypeOk() (ret CatalogAuthGetTypeRetType, ok bool) { + return getCatalogAuthGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *CatalogAuth) SetType(v CatalogAuthGetTypeRetType) { + setCatalogAuthGetTypeAttributeType(&o.Type, v) +} + +func (o CatalogAuth) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCatalogAuthGetDremioAttributeTypeOk(o.Dremio); ok { + toSerialize["Dremio"] = val + } + if val, ok := getCatalogAuthGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableCatalogAuth struct { + value *CatalogAuth + isSet bool +} + +func (v NullableCatalogAuth) Get() *CatalogAuth { + return v.value +} + +func (v *NullableCatalogAuth) Set(val *CatalogAuth) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogAuth) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogAuth) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogAuth(val *CatalogAuth) *NullableCatalogAuth { + return &NullableCatalogAuth{value: val, isSet: true} +} + +func (v NullableCatalogAuth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogAuth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_catalog_auth_patch.go b/pkg/intakebeta/model_catalog_auth_patch.go new file mode 100644 index 00000000..09d13249 --- /dev/null +++ b/pkg/intakebeta/model_catalog_auth_patch.go @@ -0,0 +1,174 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the CatalogAuthPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CatalogAuthPatch{} + +/* + types and functions for dremio +*/ + +// isModel +type CatalogAuthPatchGetDremioAttributeType = *DremioAuthPatch +type CatalogAuthPatchGetDremioArgType = DremioAuthPatch +type CatalogAuthPatchGetDremioRetType = DremioAuthPatch + +func getCatalogAuthPatchGetDremioAttributeTypeOk(arg CatalogAuthPatchGetDremioAttributeType) (ret CatalogAuthPatchGetDremioRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCatalogAuthPatchGetDremioAttributeType(arg *CatalogAuthPatchGetDremioAttributeType, val CatalogAuthPatchGetDremioRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isEnumRef +type CatalogAuthPatchGetTypeAttributeType = *CatalogAuthType +type CatalogAuthPatchGetTypeArgType = CatalogAuthType +type CatalogAuthPatchGetTypeRetType = CatalogAuthType + +func getCatalogAuthPatchGetTypeAttributeTypeOk(arg CatalogAuthPatchGetTypeAttributeType) (ret CatalogAuthPatchGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCatalogAuthPatchGetTypeAttributeType(arg *CatalogAuthPatchGetTypeAttributeType, val CatalogAuthPatchGetTypeRetType) { + *arg = &val +} + +// CatalogAuthPatch Configures authentication for the Iceberg catalog +type CatalogAuthPatch struct { + Dremio CatalogAuthPatchGetDremioAttributeType `json:"dremio,omitempty"` + Type CatalogAuthPatchGetTypeAttributeType `json:"type,omitempty"` +} + +// NewCatalogAuthPatch instantiates a new CatalogAuthPatch 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 NewCatalogAuthPatch() *CatalogAuthPatch { + this := CatalogAuthPatch{} + return &this +} + +// NewCatalogAuthPatchWithDefaults instantiates a new CatalogAuthPatch 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 NewCatalogAuthPatchWithDefaults() *CatalogAuthPatch { + this := CatalogAuthPatch{} + return &this +} + +// GetDremio returns the Dremio field value if set, zero value otherwise. +func (o *CatalogAuthPatch) GetDremio() (res CatalogAuthPatchGetDremioRetType) { + res, _ = o.GetDremioOk() + return +} + +// GetDremioOk returns a tuple with the Dremio field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogAuthPatch) GetDremioOk() (ret CatalogAuthPatchGetDremioRetType, ok bool) { + return getCatalogAuthPatchGetDremioAttributeTypeOk(o.Dremio) +} + +// HasDremio returns a boolean if a field has been set. +func (o *CatalogAuthPatch) HasDremio() bool { + _, ok := o.GetDremioOk() + return ok +} + +// SetDremio gets a reference to the given DremioAuthPatch and assigns it to the Dremio field. +func (o *CatalogAuthPatch) SetDremio(v CatalogAuthPatchGetDremioRetType) { + setCatalogAuthPatchGetDremioAttributeType(&o.Dremio, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CatalogAuthPatch) GetType() (res CatalogAuthPatchGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CatalogAuthPatch) GetTypeOk() (ret CatalogAuthPatchGetTypeRetType, ok bool) { + return getCatalogAuthPatchGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *CatalogAuthPatch) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given CatalogAuthType and assigns it to the Type field. +func (o *CatalogAuthPatch) SetType(v CatalogAuthPatchGetTypeRetType) { + setCatalogAuthPatchGetTypeAttributeType(&o.Type, v) +} + +func (o CatalogAuthPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCatalogAuthPatchGetDremioAttributeTypeOk(o.Dremio); ok { + toSerialize["Dremio"] = val + } + if val, ok := getCatalogAuthPatchGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableCatalogAuthPatch struct { + value *CatalogAuthPatch + isSet bool +} + +func (v NullableCatalogAuthPatch) Get() *CatalogAuthPatch { + return v.value +} + +func (v *NullableCatalogAuthPatch) Set(val *CatalogAuthPatch) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogAuthPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogAuthPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogAuthPatch(val *CatalogAuthPatch) *NullableCatalogAuthPatch { + return &NullableCatalogAuthPatch{value: val, isSet: true} +} + +func (v NullableCatalogAuthPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogAuthPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_catalog_auth_patch_test.go b/pkg/intakebeta/model_catalog_auth_patch_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_catalog_auth_patch_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_catalog_auth_test.go b/pkg/intakebeta/model_catalog_auth_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_catalog_auth_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_catalog_auth_type.go b/pkg/intakebeta/model_catalog_auth_type.go new file mode 100644 index 00000000..b183dfe8 --- /dev/null +++ b/pkg/intakebeta/model_catalog_auth_type.go @@ -0,0 +1,115 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" + "fmt" +) + +// CatalogAuthType Means of authentication for catalog requests +type CatalogAuthType string + +// List of catalogAuthType +const ( + CATALOGAUTHTYPE_NONE CatalogAuthType = "none" + CATALOGAUTHTYPE_DREMIO CatalogAuthType = "dremio" +) + +// All allowed values of CatalogAuthType enum +var AllowedCatalogAuthTypeEnumValues = []CatalogAuthType{ + "none", + "dremio", +} + +func (v *CatalogAuthType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := CatalogAuthType(value) + for _, existing := range AllowedCatalogAuthTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CatalogAuthType", value) +} + +// NewCatalogAuthTypeFromValue returns a pointer to a valid CatalogAuthType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCatalogAuthTypeFromValue(v string) (*CatalogAuthType, error) { + ev := CatalogAuthType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CatalogAuthType: valid values are %v", v, AllowedCatalogAuthTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CatalogAuthType) IsValid() bool { + for _, existing := range AllowedCatalogAuthTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to catalogAuthType value +func (v CatalogAuthType) Ptr() *CatalogAuthType { + return &v +} + +type NullableCatalogAuthType struct { + value *CatalogAuthType + isSet bool +} + +func (v NullableCatalogAuthType) Get() *CatalogAuthType { + return v.value +} + +func (v *NullableCatalogAuthType) Set(val *CatalogAuthType) { + v.value = val + v.isSet = true +} + +func (v NullableCatalogAuthType) IsSet() bool { + return v.isSet +} + +func (v *NullableCatalogAuthType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCatalogAuthType(val *CatalogAuthType) *NullableCatalogAuthType { + return &NullableCatalogAuthType{value: val, isSet: true} +} + +func (v NullableCatalogAuthType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCatalogAuthType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_catalog_auth_type_test.go b/pkg/intakebeta/model_catalog_auth_type_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_catalog_auth_type_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_client_config.go b/pkg/intakebeta/model_client_config.go new file mode 100644 index 00000000..11ad2c93 --- /dev/null +++ b/pkg/intakebeta/model_client_config.go @@ -0,0 +1,172 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the ClientConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ClientConfig{} + +/* + types and functions for java +*/ + +// isNotNullableString +type ClientConfigGetJavaAttributeType = *string + +func getClientConfigGetJavaAttributeTypeOk(arg ClientConfigGetJavaAttributeType) (ret ClientConfigGetJavaRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setClientConfigGetJavaAttributeType(arg *ClientConfigGetJavaAttributeType, val ClientConfigGetJavaRetType) { + *arg = &val +} + +type ClientConfigGetJavaArgType = string +type ClientConfigGetJavaRetType = string + +/* + types and functions for librdkafka +*/ + +// isNotNullableString +type ClientConfigGetLibrdkafkaAttributeType = *string + +func getClientConfigGetLibrdkafkaAttributeTypeOk(arg ClientConfigGetLibrdkafkaAttributeType) (ret ClientConfigGetLibrdkafkaRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setClientConfigGetLibrdkafkaAttributeType(arg *ClientConfigGetLibrdkafkaAttributeType, val ClientConfigGetLibrdkafkaRetType) { + *arg = &val +} + +type ClientConfigGetLibrdkafkaArgType = string +type ClientConfigGetLibrdkafkaRetType = string + +// ClientConfig Configuration properties for supported clients. +type ClientConfig struct { + // Configuration for Java Kafka clients. + // REQUIRED + Java ClientConfigGetJavaAttributeType `json:"java" required:"true"` + // Configuration for Kafka clients using librdkafka + // REQUIRED + Librdkafka ClientConfigGetLibrdkafkaAttributeType `json:"librdkafka" required:"true"` +} + +type _ClientConfig ClientConfig + +// NewClientConfig instantiates a new ClientConfig 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 NewClientConfig(java ClientConfigGetJavaArgType, librdkafka ClientConfigGetLibrdkafkaArgType) *ClientConfig { + this := ClientConfig{} + setClientConfigGetJavaAttributeType(&this.Java, java) + setClientConfigGetLibrdkafkaAttributeType(&this.Librdkafka, librdkafka) + return &this +} + +// NewClientConfigWithDefaults instantiates a new ClientConfig 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 NewClientConfigWithDefaults() *ClientConfig { + this := ClientConfig{} + return &this +} + +// GetJava returns the Java field value +func (o *ClientConfig) GetJava() (ret ClientConfigGetJavaRetType) { + ret, _ = o.GetJavaOk() + return ret +} + +// GetJavaOk returns a tuple with the Java field value +// and a boolean to check if the value has been set. +func (o *ClientConfig) GetJavaOk() (ret ClientConfigGetJavaRetType, ok bool) { + return getClientConfigGetJavaAttributeTypeOk(o.Java) +} + +// SetJava sets field value +func (o *ClientConfig) SetJava(v ClientConfigGetJavaRetType) { + setClientConfigGetJavaAttributeType(&o.Java, v) +} + +// GetLibrdkafka returns the Librdkafka field value +func (o *ClientConfig) GetLibrdkafka() (ret ClientConfigGetLibrdkafkaRetType) { + ret, _ = o.GetLibrdkafkaOk() + return ret +} + +// GetLibrdkafkaOk returns a tuple with the Librdkafka field value +// and a boolean to check if the value has been set. +func (o *ClientConfig) GetLibrdkafkaOk() (ret ClientConfigGetLibrdkafkaRetType, ok bool) { + return getClientConfigGetLibrdkafkaAttributeTypeOk(o.Librdkafka) +} + +// SetLibrdkafka sets field value +func (o *ClientConfig) SetLibrdkafka(v ClientConfigGetLibrdkafkaRetType) { + setClientConfigGetLibrdkafkaAttributeType(&o.Librdkafka, v) +} + +func (o ClientConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getClientConfigGetJavaAttributeTypeOk(o.Java); ok { + toSerialize["Java"] = val + } + if val, ok := getClientConfigGetLibrdkafkaAttributeTypeOk(o.Librdkafka); ok { + toSerialize["Librdkafka"] = val + } + return toSerialize, nil +} + +type NullableClientConfig struct { + value *ClientConfig + isSet bool +} + +func (v NullableClientConfig) Get() *ClientConfig { + return v.value +} + +func (v *NullableClientConfig) Set(val *ClientConfig) { + v.value = val + v.isSet = true +} + +func (v NullableClientConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableClientConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClientConfig(val *ClientConfig) *NullableClientConfig { + return &NullableClientConfig{value: val, isSet: true} +} + +func (v NullableClientConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClientConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_client_config_test.go b/pkg/intakebeta/model_client_config_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_client_config_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_create_intake_payload.go b/pkg/intakebeta/model_create_intake_payload.go new file mode 100644 index 00000000..853b50ac --- /dev/null +++ b/pkg/intakebeta/model_create_intake_payload.go @@ -0,0 +1,313 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the CreateIntakePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateIntakePayload{} + +/* + types and functions for catalog +*/ + +// isModel +type CreateIntakePayloadGetCatalogAttributeType = *IntakeCatalog +type CreateIntakePayloadGetCatalogArgType = IntakeCatalog +type CreateIntakePayloadGetCatalogRetType = IntakeCatalog + +func getCreateIntakePayloadGetCatalogAttributeTypeOk(arg CreateIntakePayloadGetCatalogAttributeType) (ret CreateIntakePayloadGetCatalogRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakePayloadGetCatalogAttributeType(arg *CreateIntakePayloadGetCatalogAttributeType, val CreateIntakePayloadGetCatalogRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateIntakePayloadGetDescriptionAttributeType = *string + +func getCreateIntakePayloadGetDescriptionAttributeTypeOk(arg CreateIntakePayloadGetDescriptionAttributeType) (ret CreateIntakePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakePayloadGetDescriptionAttributeType(arg *CreateIntakePayloadGetDescriptionAttributeType, val CreateIntakePayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateIntakePayloadGetDescriptionArgType = string +type CreateIntakePayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateIntakePayloadGetDisplayNameAttributeType = *string + +func getCreateIntakePayloadGetDisplayNameAttributeTypeOk(arg CreateIntakePayloadGetDisplayNameAttributeType) (ret CreateIntakePayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakePayloadGetDisplayNameAttributeType(arg *CreateIntakePayloadGetDisplayNameAttributeType, val CreateIntakePayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateIntakePayloadGetDisplayNameArgType = string +type CreateIntakePayloadGetDisplayNameRetType = string + +/* + types and functions for intakeRunnerId +*/ + +// isNotNullableString +type CreateIntakePayloadGetIntakeRunnerIdAttributeType = *string + +func getCreateIntakePayloadGetIntakeRunnerIdAttributeTypeOk(arg CreateIntakePayloadGetIntakeRunnerIdAttributeType) (ret CreateIntakePayloadGetIntakeRunnerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakePayloadGetIntakeRunnerIdAttributeType(arg *CreateIntakePayloadGetIntakeRunnerIdAttributeType, val CreateIntakePayloadGetIntakeRunnerIdRetType) { + *arg = &val +} + +type CreateIntakePayloadGetIntakeRunnerIdArgType = string +type CreateIntakePayloadGetIntakeRunnerIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type CreateIntakePayloadGetLabelsAttributeType = *map[string]string +type CreateIntakePayloadGetLabelsArgType = *map[string]string +type CreateIntakePayloadGetLabelsRetType = *map[string]string + +func getCreateIntakePayloadGetLabelsAttributeTypeOk(arg CreateIntakePayloadGetLabelsAttributeType) (ret CreateIntakePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setCreateIntakePayloadGetLabelsAttributeType(arg *CreateIntakePayloadGetLabelsAttributeType, val CreateIntakePayloadGetLabelsRetType) { + *arg = val +} + +// CreateIntakePayload struct for CreateIntakePayload +type CreateIntakePayload struct { + // REQUIRED + Catalog CreateIntakePayloadGetCatalogAttributeType `json:"catalog" required:"true"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description CreateIntakePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + // REQUIRED + DisplayName CreateIntakePayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + // The unique id of the intake runner this intake should run on. + // REQUIRED + IntakeRunnerId CreateIntakePayloadGetIntakeRunnerIdAttributeType `json:"intakeRunnerId" required:"true"` + // Labels are a set of key-value pairs assigned to resources. + Labels CreateIntakePayloadGetLabelsAttributeType `json:"labels,omitempty"` +} + +type _CreateIntakePayload CreateIntakePayload + +// NewCreateIntakePayload instantiates a new CreateIntakePayload 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 NewCreateIntakePayload(catalog CreateIntakePayloadGetCatalogArgType, displayName CreateIntakePayloadGetDisplayNameArgType, intakeRunnerId CreateIntakePayloadGetIntakeRunnerIdArgType) *CreateIntakePayload { + this := CreateIntakePayload{} + setCreateIntakePayloadGetCatalogAttributeType(&this.Catalog, catalog) + setCreateIntakePayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + setCreateIntakePayloadGetIntakeRunnerIdAttributeType(&this.IntakeRunnerId, intakeRunnerId) + return &this +} + +// NewCreateIntakePayloadWithDefaults instantiates a new CreateIntakePayload 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 NewCreateIntakePayloadWithDefaults() *CreateIntakePayload { + this := CreateIntakePayload{} + return &this +} + +// GetCatalog returns the Catalog field value +func (o *CreateIntakePayload) GetCatalog() (ret CreateIntakePayloadGetCatalogRetType) { + ret, _ = o.GetCatalogOk() + return ret +} + +// GetCatalogOk returns a tuple with the Catalog field value +// and a boolean to check if the value has been set. +func (o *CreateIntakePayload) GetCatalogOk() (ret CreateIntakePayloadGetCatalogRetType, ok bool) { + return getCreateIntakePayloadGetCatalogAttributeTypeOk(o.Catalog) +} + +// SetCatalog sets field value +func (o *CreateIntakePayload) SetCatalog(v CreateIntakePayloadGetCatalogRetType) { + setCreateIntakePayloadGetCatalogAttributeType(&o.Catalog, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateIntakePayload) GetDescription() (res CreateIntakePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIntakePayload) GetDescriptionOk() (ret CreateIntakePayloadGetDescriptionRetType, ok bool) { + return getCreateIntakePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateIntakePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateIntakePayload) SetDescription(v CreateIntakePayloadGetDescriptionRetType) { + setCreateIntakePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateIntakePayload) GetDisplayName() (ret CreateIntakePayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateIntakePayload) GetDisplayNameOk() (ret CreateIntakePayloadGetDisplayNameRetType, ok bool) { + return getCreateIntakePayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateIntakePayload) SetDisplayName(v CreateIntakePayloadGetDisplayNameRetType) { + setCreateIntakePayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetIntakeRunnerId returns the IntakeRunnerId field value +func (o *CreateIntakePayload) GetIntakeRunnerId() (ret CreateIntakePayloadGetIntakeRunnerIdRetType) { + ret, _ = o.GetIntakeRunnerIdOk() + return ret +} + +// GetIntakeRunnerIdOk returns a tuple with the IntakeRunnerId field value +// and a boolean to check if the value has been set. +func (o *CreateIntakePayload) GetIntakeRunnerIdOk() (ret CreateIntakePayloadGetIntakeRunnerIdRetType, ok bool) { + return getCreateIntakePayloadGetIntakeRunnerIdAttributeTypeOk(o.IntakeRunnerId) +} + +// SetIntakeRunnerId sets field value +func (o *CreateIntakePayload) SetIntakeRunnerId(v CreateIntakePayloadGetIntakeRunnerIdRetType) { + setCreateIntakePayloadGetIntakeRunnerIdAttributeType(&o.IntakeRunnerId, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateIntakePayload) GetLabels() (res CreateIntakePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// 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 *CreateIntakePayload) GetLabelsOk() (ret CreateIntakePayloadGetLabelsRetType, ok bool) { + return getCreateIntakePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateIntakePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateIntakePayload) SetLabels(v CreateIntakePayloadGetLabelsRetType) { + setCreateIntakePayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o CreateIntakePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateIntakePayloadGetCatalogAttributeTypeOk(o.Catalog); ok { + toSerialize["Catalog"] = val + } + if val, ok := getCreateIntakePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateIntakePayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateIntakePayloadGetIntakeRunnerIdAttributeTypeOk(o.IntakeRunnerId); ok { + toSerialize["IntakeRunnerId"] = val + } + if val, ok := getCreateIntakePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableCreateIntakePayload struct { + value *CreateIntakePayload + isSet bool +} + +func (v NullableCreateIntakePayload) Get() *CreateIntakePayload { + return v.value +} + +func (v *NullableCreateIntakePayload) Set(val *CreateIntakePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateIntakePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateIntakePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateIntakePayload(val *CreateIntakePayload) *NullableCreateIntakePayload { + return &NullableCreateIntakePayload{value: val, isSet: true} +} + +func (v NullableCreateIntakePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateIntakePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_create_intake_payload_test.go b/pkg/intakebeta/model_create_intake_payload_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_create_intake_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_create_intake_runner_payload.go b/pkg/intakebeta/model_create_intake_runner_payload.go new file mode 100644 index 00000000..93a3e433 --- /dev/null +++ b/pkg/intakebeta/model_create_intake_runner_payload.go @@ -0,0 +1,313 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the CreateIntakeRunnerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateIntakeRunnerPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateIntakeRunnerPayloadGetDescriptionAttributeType = *string + +func getCreateIntakeRunnerPayloadGetDescriptionAttributeTypeOk(arg CreateIntakeRunnerPayloadGetDescriptionAttributeType) (ret CreateIntakeRunnerPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakeRunnerPayloadGetDescriptionAttributeType(arg *CreateIntakeRunnerPayloadGetDescriptionAttributeType, val CreateIntakeRunnerPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateIntakeRunnerPayloadGetDescriptionArgType = string +type CreateIntakeRunnerPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateIntakeRunnerPayloadGetDisplayNameAttributeType = *string + +func getCreateIntakeRunnerPayloadGetDisplayNameAttributeTypeOk(arg CreateIntakeRunnerPayloadGetDisplayNameAttributeType) (ret CreateIntakeRunnerPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakeRunnerPayloadGetDisplayNameAttributeType(arg *CreateIntakeRunnerPayloadGetDisplayNameAttributeType, val CreateIntakeRunnerPayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateIntakeRunnerPayloadGetDisplayNameArgType = string +type CreateIntakeRunnerPayloadGetDisplayNameRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type CreateIntakeRunnerPayloadGetLabelsAttributeType = *map[string]string +type CreateIntakeRunnerPayloadGetLabelsArgType = *map[string]string +type CreateIntakeRunnerPayloadGetLabelsRetType = *map[string]string + +func getCreateIntakeRunnerPayloadGetLabelsAttributeTypeOk(arg CreateIntakeRunnerPayloadGetLabelsAttributeType) (ret CreateIntakeRunnerPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setCreateIntakeRunnerPayloadGetLabelsAttributeType(arg *CreateIntakeRunnerPayloadGetLabelsAttributeType, val CreateIntakeRunnerPayloadGetLabelsRetType) { + *arg = val +} + +/* + types and functions for maxMessageSizeKiB +*/ + +// isInteger +type CreateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType = *int64 +type CreateIntakeRunnerPayloadGetMaxMessageSizeKiBArgType = int64 +type CreateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType = int64 + +func getCreateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeTypeOk(arg CreateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType) (ret CreateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType(arg *CreateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType, val CreateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType) { + *arg = &val +} + +/* + types and functions for maxMessagesPerHour +*/ + +// isInteger +type CreateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType = *int64 +type CreateIntakeRunnerPayloadGetMaxMessagesPerHourArgType = int64 +type CreateIntakeRunnerPayloadGetMaxMessagesPerHourRetType = int64 + +func getCreateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeTypeOk(arg CreateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType) (ret CreateIntakeRunnerPayloadGetMaxMessagesPerHourRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType(arg *CreateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType, val CreateIntakeRunnerPayloadGetMaxMessagesPerHourRetType) { + *arg = &val +} + +// CreateIntakeRunnerPayload struct for CreateIntakeRunnerPayload +type CreateIntakeRunnerPayload struct { + // The description is a longer text chosen by the user to provide more context for the resource. + Description CreateIntakeRunnerPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + // REQUIRED + DisplayName CreateIntakeRunnerPayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + // Labels are a set of key-value pairs assigned to resources. + Labels CreateIntakeRunnerPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The maximum size of a message in kibibytes (1 KiB = 1024 bytes). + // REQUIRED + MaxMessageSizeKiB CreateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType `json:"maxMessageSizeKiB" required:"true"` + // The maximum number of messages per hour. + // REQUIRED + MaxMessagesPerHour CreateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType `json:"maxMessagesPerHour" required:"true"` +} + +type _CreateIntakeRunnerPayload CreateIntakeRunnerPayload + +// NewCreateIntakeRunnerPayload instantiates a new CreateIntakeRunnerPayload 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 NewCreateIntakeRunnerPayload(displayName CreateIntakeRunnerPayloadGetDisplayNameArgType, maxMessageSizeKiB CreateIntakeRunnerPayloadGetMaxMessageSizeKiBArgType, maxMessagesPerHour CreateIntakeRunnerPayloadGetMaxMessagesPerHourArgType) *CreateIntakeRunnerPayload { + this := CreateIntakeRunnerPayload{} + setCreateIntakeRunnerPayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + setCreateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType(&this.MaxMessageSizeKiB, maxMessageSizeKiB) + setCreateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType(&this.MaxMessagesPerHour, maxMessagesPerHour) + return &this +} + +// NewCreateIntakeRunnerPayloadWithDefaults instantiates a new CreateIntakeRunnerPayload 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 NewCreateIntakeRunnerPayloadWithDefaults() *CreateIntakeRunnerPayload { + this := CreateIntakeRunnerPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateIntakeRunnerPayload) GetDescription() (res CreateIntakeRunnerPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIntakeRunnerPayload) GetDescriptionOk() (ret CreateIntakeRunnerPayloadGetDescriptionRetType, ok bool) { + return getCreateIntakeRunnerPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateIntakeRunnerPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateIntakeRunnerPayload) SetDescription(v CreateIntakeRunnerPayloadGetDescriptionRetType) { + setCreateIntakeRunnerPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateIntakeRunnerPayload) GetDisplayName() (ret CreateIntakeRunnerPayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateIntakeRunnerPayload) GetDisplayNameOk() (ret CreateIntakeRunnerPayloadGetDisplayNameRetType, ok bool) { + return getCreateIntakeRunnerPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateIntakeRunnerPayload) SetDisplayName(v CreateIntakeRunnerPayloadGetDisplayNameRetType) { + setCreateIntakeRunnerPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateIntakeRunnerPayload) GetLabels() (res CreateIntakeRunnerPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// 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 *CreateIntakeRunnerPayload) GetLabelsOk() (ret CreateIntakeRunnerPayloadGetLabelsRetType, ok bool) { + return getCreateIntakeRunnerPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateIntakeRunnerPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateIntakeRunnerPayload) SetLabels(v CreateIntakeRunnerPayloadGetLabelsRetType) { + setCreateIntakeRunnerPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetMaxMessageSizeKiB returns the MaxMessageSizeKiB field value +func (o *CreateIntakeRunnerPayload) GetMaxMessageSizeKiB() (ret CreateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType) { + ret, _ = o.GetMaxMessageSizeKiBOk() + return ret +} + +// GetMaxMessageSizeKiBOk returns a tuple with the MaxMessageSizeKiB field value +// and a boolean to check if the value has been set. +func (o *CreateIntakeRunnerPayload) GetMaxMessageSizeKiBOk() (ret CreateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType, ok bool) { + return getCreateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeTypeOk(o.MaxMessageSizeKiB) +} + +// SetMaxMessageSizeKiB sets field value +func (o *CreateIntakeRunnerPayload) SetMaxMessageSizeKiB(v CreateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType) { + setCreateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType(&o.MaxMessageSizeKiB, v) +} + +// GetMaxMessagesPerHour returns the MaxMessagesPerHour field value +func (o *CreateIntakeRunnerPayload) GetMaxMessagesPerHour() (ret CreateIntakeRunnerPayloadGetMaxMessagesPerHourRetType) { + ret, _ = o.GetMaxMessagesPerHourOk() + return ret +} + +// GetMaxMessagesPerHourOk returns a tuple with the MaxMessagesPerHour field value +// and a boolean to check if the value has been set. +func (o *CreateIntakeRunnerPayload) GetMaxMessagesPerHourOk() (ret CreateIntakeRunnerPayloadGetMaxMessagesPerHourRetType, ok bool) { + return getCreateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeTypeOk(o.MaxMessagesPerHour) +} + +// SetMaxMessagesPerHour sets field value +func (o *CreateIntakeRunnerPayload) SetMaxMessagesPerHour(v CreateIntakeRunnerPayloadGetMaxMessagesPerHourRetType) { + setCreateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType(&o.MaxMessagesPerHour, v) +} + +func (o CreateIntakeRunnerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateIntakeRunnerPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateIntakeRunnerPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateIntakeRunnerPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeTypeOk(o.MaxMessageSizeKiB); ok { + toSerialize["MaxMessageSizeKiB"] = val + } + if val, ok := getCreateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeTypeOk(o.MaxMessagesPerHour); ok { + toSerialize["MaxMessagesPerHour"] = val + } + return toSerialize, nil +} + +type NullableCreateIntakeRunnerPayload struct { + value *CreateIntakeRunnerPayload + isSet bool +} + +func (v NullableCreateIntakeRunnerPayload) Get() *CreateIntakeRunnerPayload { + return v.value +} + +func (v *NullableCreateIntakeRunnerPayload) Set(val *CreateIntakeRunnerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateIntakeRunnerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateIntakeRunnerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateIntakeRunnerPayload(val *CreateIntakeRunnerPayload) *NullableCreateIntakeRunnerPayload { + return &NullableCreateIntakeRunnerPayload{value: val, isSet: true} +} + +func (v NullableCreateIntakeRunnerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateIntakeRunnerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_create_intake_runner_payload_test.go b/pkg/intakebeta/model_create_intake_runner_payload_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_create_intake_runner_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_create_intake_user_payload.go b/pkg/intakebeta/model_create_intake_user_payload.go new file mode 100644 index 00000000..81c23d85 --- /dev/null +++ b/pkg/intakebeta/model_create_intake_user_payload.go @@ -0,0 +1,319 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the CreateIntakeUserPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateIntakeUserPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateIntakeUserPayloadGetDescriptionAttributeType = *string + +func getCreateIntakeUserPayloadGetDescriptionAttributeTypeOk(arg CreateIntakeUserPayloadGetDescriptionAttributeType) (ret CreateIntakeUserPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakeUserPayloadGetDescriptionAttributeType(arg *CreateIntakeUserPayloadGetDescriptionAttributeType, val CreateIntakeUserPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateIntakeUserPayloadGetDescriptionArgType = string +type CreateIntakeUserPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateIntakeUserPayloadGetDisplayNameAttributeType = *string + +func getCreateIntakeUserPayloadGetDisplayNameAttributeTypeOk(arg CreateIntakeUserPayloadGetDisplayNameAttributeType) (ret CreateIntakeUserPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakeUserPayloadGetDisplayNameAttributeType(arg *CreateIntakeUserPayloadGetDisplayNameAttributeType, val CreateIntakeUserPayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateIntakeUserPayloadGetDisplayNameArgType = string +type CreateIntakeUserPayloadGetDisplayNameRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type CreateIntakeUserPayloadGetLabelsAttributeType = *map[string]string +type CreateIntakeUserPayloadGetLabelsArgType = *map[string]string +type CreateIntakeUserPayloadGetLabelsRetType = *map[string]string + +func getCreateIntakeUserPayloadGetLabelsAttributeTypeOk(arg CreateIntakeUserPayloadGetLabelsAttributeType) (ret CreateIntakeUserPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setCreateIntakeUserPayloadGetLabelsAttributeType(arg *CreateIntakeUserPayloadGetLabelsAttributeType, val CreateIntakeUserPayloadGetLabelsRetType) { + *arg = val +} + +/* + types and functions for password +*/ + +// isNotNullableString +type CreateIntakeUserPayloadGetPasswordAttributeType = *string + +func getCreateIntakeUserPayloadGetPasswordAttributeTypeOk(arg CreateIntakeUserPayloadGetPasswordAttributeType) (ret CreateIntakeUserPayloadGetPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakeUserPayloadGetPasswordAttributeType(arg *CreateIntakeUserPayloadGetPasswordAttributeType, val CreateIntakeUserPayloadGetPasswordRetType) { + *arg = &val +} + +type CreateIntakeUserPayloadGetPasswordArgType = string +type CreateIntakeUserPayloadGetPasswordRetType = string + +/* + types and functions for type +*/ + +// isEnumRef +type CreateIntakeUserPayloadGetTypeAttributeType = *UserType +type CreateIntakeUserPayloadGetTypeArgType = UserType +type CreateIntakeUserPayloadGetTypeRetType = UserType + +func getCreateIntakeUserPayloadGetTypeAttributeTypeOk(arg CreateIntakeUserPayloadGetTypeAttributeType) (ret CreateIntakeUserPayloadGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateIntakeUserPayloadGetTypeAttributeType(arg *CreateIntakeUserPayloadGetTypeAttributeType, val CreateIntakeUserPayloadGetTypeRetType) { + *arg = &val +} + +// CreateIntakeUserPayload struct for CreateIntakeUserPayload +type CreateIntakeUserPayload struct { + // The description is a longer text chosen by the user to provide more context for the resource. + Description CreateIntakeUserPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + // REQUIRED + DisplayName CreateIntakeUserPayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + // Labels are key-value pairs associated with the resource. + Labels CreateIntakeUserPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // A password chosen by the user. The password must consist of at least of each of these categories: * lower case letter * upper case letter * number * other character + // REQUIRED + Password CreateIntakeUserPayloadGetPasswordAttributeType `json:"password" required:"true"` + Type CreateIntakeUserPayloadGetTypeAttributeType `json:"type,omitempty"` +} + +type _CreateIntakeUserPayload CreateIntakeUserPayload + +// NewCreateIntakeUserPayload instantiates a new CreateIntakeUserPayload 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 NewCreateIntakeUserPayload(displayName CreateIntakeUserPayloadGetDisplayNameArgType, password CreateIntakeUserPayloadGetPasswordArgType) *CreateIntakeUserPayload { + this := CreateIntakeUserPayload{} + setCreateIntakeUserPayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + setCreateIntakeUserPayloadGetPasswordAttributeType(&this.Password, password) + return &this +} + +// NewCreateIntakeUserPayloadWithDefaults instantiates a new CreateIntakeUserPayload 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 NewCreateIntakeUserPayloadWithDefaults() *CreateIntakeUserPayload { + this := CreateIntakeUserPayload{} + var types UserType = USERTYPE_INTAKE + this.Type = &types + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateIntakeUserPayload) GetDescription() (res CreateIntakeUserPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIntakeUserPayload) GetDescriptionOk() (ret CreateIntakeUserPayloadGetDescriptionRetType, ok bool) { + return getCreateIntakeUserPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateIntakeUserPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateIntakeUserPayload) SetDescription(v CreateIntakeUserPayloadGetDescriptionRetType) { + setCreateIntakeUserPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateIntakeUserPayload) GetDisplayName() (ret CreateIntakeUserPayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateIntakeUserPayload) GetDisplayNameOk() (ret CreateIntakeUserPayloadGetDisplayNameRetType, ok bool) { + return getCreateIntakeUserPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateIntakeUserPayload) SetDisplayName(v CreateIntakeUserPayloadGetDisplayNameRetType) { + setCreateIntakeUserPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateIntakeUserPayload) GetLabels() (res CreateIntakeUserPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// 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 *CreateIntakeUserPayload) GetLabelsOk() (ret CreateIntakeUserPayloadGetLabelsRetType, ok bool) { + return getCreateIntakeUserPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateIntakeUserPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateIntakeUserPayload) SetLabels(v CreateIntakeUserPayloadGetLabelsRetType) { + setCreateIntakeUserPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetPassword returns the Password field value +func (o *CreateIntakeUserPayload) GetPassword() (ret CreateIntakeUserPayloadGetPasswordRetType) { + ret, _ = o.GetPasswordOk() + return ret +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *CreateIntakeUserPayload) GetPasswordOk() (ret CreateIntakeUserPayloadGetPasswordRetType, ok bool) { + return getCreateIntakeUserPayloadGetPasswordAttributeTypeOk(o.Password) +} + +// SetPassword sets field value +func (o *CreateIntakeUserPayload) SetPassword(v CreateIntakeUserPayloadGetPasswordRetType) { + setCreateIntakeUserPayloadGetPasswordAttributeType(&o.Password, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CreateIntakeUserPayload) GetType() (res CreateIntakeUserPayloadGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateIntakeUserPayload) GetTypeOk() (ret CreateIntakeUserPayloadGetTypeRetType, ok bool) { + return getCreateIntakeUserPayloadGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *CreateIntakeUserPayload) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given UserType and assigns it to the Type field. +func (o *CreateIntakeUserPayload) SetType(v CreateIntakeUserPayloadGetTypeRetType) { + setCreateIntakeUserPayloadGetTypeAttributeType(&o.Type, v) +} + +func (o CreateIntakeUserPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateIntakeUserPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateIntakeUserPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateIntakeUserPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateIntakeUserPayloadGetPasswordAttributeTypeOk(o.Password); ok { + toSerialize["Password"] = val + } + if val, ok := getCreateIntakeUserPayloadGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableCreateIntakeUserPayload struct { + value *CreateIntakeUserPayload + isSet bool +} + +func (v NullableCreateIntakeUserPayload) Get() *CreateIntakeUserPayload { + return v.value +} + +func (v *NullableCreateIntakeUserPayload) Set(val *CreateIntakeUserPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateIntakeUserPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateIntakeUserPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateIntakeUserPayload(val *CreateIntakeUserPayload) *NullableCreateIntakeUserPayload { + return &NullableCreateIntakeUserPayload{value: val, isSet: true} +} + +func (v NullableCreateIntakeUserPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateIntakeUserPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_create_intake_user_payload_test.go b/pkg/intakebeta/model_create_intake_user_payload_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_create_intake_user_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_dremio_auth.go b/pkg/intakebeta/model_dremio_auth.go new file mode 100644 index 00000000..e481b871 --- /dev/null +++ b/pkg/intakebeta/model_dremio_auth.go @@ -0,0 +1,172 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the DremioAuth type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DremioAuth{} + +/* + types and functions for personalAccessToken +*/ + +// isNotNullableString +type DremioAuthGetPersonalAccessTokenAttributeType = *string + +func getDremioAuthGetPersonalAccessTokenAttributeTypeOk(arg DremioAuthGetPersonalAccessTokenAttributeType) (ret DremioAuthGetPersonalAccessTokenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDremioAuthGetPersonalAccessTokenAttributeType(arg *DremioAuthGetPersonalAccessTokenAttributeType, val DremioAuthGetPersonalAccessTokenRetType) { + *arg = &val +} + +type DremioAuthGetPersonalAccessTokenArgType = string +type DremioAuthGetPersonalAccessTokenRetType = string + +/* + types and functions for tokenEndpoint +*/ + +// isNotNullableString +type DremioAuthGetTokenEndpointAttributeType = *string + +func getDremioAuthGetTokenEndpointAttributeTypeOk(arg DremioAuthGetTokenEndpointAttributeType) (ret DremioAuthGetTokenEndpointRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDremioAuthGetTokenEndpointAttributeType(arg *DremioAuthGetTokenEndpointAttributeType, val DremioAuthGetTokenEndpointRetType) { + *arg = &val +} + +type DremioAuthGetTokenEndpointArgType = string +type DremioAuthGetTokenEndpointRetType = string + +// DremioAuth struct for DremioAuth +type DremioAuth struct { + // A Dremio personal access token for authentication + // REQUIRED + PersonalAccessToken DremioAuthGetPersonalAccessTokenAttributeType `json:"personalAccessToken" required:"true"` + // The URL to the Dremio instance's OAuth 2.0 token endpoint + // REQUIRED + TokenEndpoint DremioAuthGetTokenEndpointAttributeType `json:"tokenEndpoint" required:"true"` +} + +type _DremioAuth DremioAuth + +// NewDremioAuth instantiates a new DremioAuth 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 NewDremioAuth(personalAccessToken DremioAuthGetPersonalAccessTokenArgType, tokenEndpoint DremioAuthGetTokenEndpointArgType) *DremioAuth { + this := DremioAuth{} + setDremioAuthGetPersonalAccessTokenAttributeType(&this.PersonalAccessToken, personalAccessToken) + setDremioAuthGetTokenEndpointAttributeType(&this.TokenEndpoint, tokenEndpoint) + return &this +} + +// NewDremioAuthWithDefaults instantiates a new DremioAuth 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 NewDremioAuthWithDefaults() *DremioAuth { + this := DremioAuth{} + return &this +} + +// GetPersonalAccessToken returns the PersonalAccessToken field value +func (o *DremioAuth) GetPersonalAccessToken() (ret DremioAuthGetPersonalAccessTokenRetType) { + ret, _ = o.GetPersonalAccessTokenOk() + return ret +} + +// GetPersonalAccessTokenOk returns a tuple with the PersonalAccessToken field value +// and a boolean to check if the value has been set. +func (o *DremioAuth) GetPersonalAccessTokenOk() (ret DremioAuthGetPersonalAccessTokenRetType, ok bool) { + return getDremioAuthGetPersonalAccessTokenAttributeTypeOk(o.PersonalAccessToken) +} + +// SetPersonalAccessToken sets field value +func (o *DremioAuth) SetPersonalAccessToken(v DremioAuthGetPersonalAccessTokenRetType) { + setDremioAuthGetPersonalAccessTokenAttributeType(&o.PersonalAccessToken, v) +} + +// GetTokenEndpoint returns the TokenEndpoint field value +func (o *DremioAuth) GetTokenEndpoint() (ret DremioAuthGetTokenEndpointRetType) { + ret, _ = o.GetTokenEndpointOk() + return ret +} + +// GetTokenEndpointOk returns a tuple with the TokenEndpoint field value +// and a boolean to check if the value has been set. +func (o *DremioAuth) GetTokenEndpointOk() (ret DremioAuthGetTokenEndpointRetType, ok bool) { + return getDremioAuthGetTokenEndpointAttributeTypeOk(o.TokenEndpoint) +} + +// SetTokenEndpoint sets field value +func (o *DremioAuth) SetTokenEndpoint(v DremioAuthGetTokenEndpointRetType) { + setDremioAuthGetTokenEndpointAttributeType(&o.TokenEndpoint, v) +} + +func (o DremioAuth) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDremioAuthGetPersonalAccessTokenAttributeTypeOk(o.PersonalAccessToken); ok { + toSerialize["PersonalAccessToken"] = val + } + if val, ok := getDremioAuthGetTokenEndpointAttributeTypeOk(o.TokenEndpoint); ok { + toSerialize["TokenEndpoint"] = val + } + return toSerialize, nil +} + +type NullableDremioAuth struct { + value *DremioAuth + isSet bool +} + +func (v NullableDremioAuth) Get() *DremioAuth { + return v.value +} + +func (v *NullableDremioAuth) Set(val *DremioAuth) { + v.value = val + v.isSet = true +} + +func (v NullableDremioAuth) IsSet() bool { + return v.isSet +} + +func (v *NullableDremioAuth) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDremioAuth(val *DremioAuth) *NullableDremioAuth { + return &NullableDremioAuth{value: val, isSet: true} +} + +func (v NullableDremioAuth) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDremioAuth) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_dremio_auth_patch.go b/pkg/intakebeta/model_dremio_auth_patch.go new file mode 100644 index 00000000..e40ec5c2 --- /dev/null +++ b/pkg/intakebeta/model_dremio_auth_patch.go @@ -0,0 +1,178 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the DremioAuthPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DremioAuthPatch{} + +/* + types and functions for personalAccessToken +*/ + +// isNotNullableString +type DremioAuthPatchGetPersonalAccessTokenAttributeType = *string + +func getDremioAuthPatchGetPersonalAccessTokenAttributeTypeOk(arg DremioAuthPatchGetPersonalAccessTokenAttributeType) (ret DremioAuthPatchGetPersonalAccessTokenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDremioAuthPatchGetPersonalAccessTokenAttributeType(arg *DremioAuthPatchGetPersonalAccessTokenAttributeType, val DremioAuthPatchGetPersonalAccessTokenRetType) { + *arg = &val +} + +type DremioAuthPatchGetPersonalAccessTokenArgType = string +type DremioAuthPatchGetPersonalAccessTokenRetType = string + +/* + types and functions for tokenEndpoint +*/ + +// isNotNullableString +type DremioAuthPatchGetTokenEndpointAttributeType = *string + +func getDremioAuthPatchGetTokenEndpointAttributeTypeOk(arg DremioAuthPatchGetTokenEndpointAttributeType) (ret DremioAuthPatchGetTokenEndpointRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDremioAuthPatchGetTokenEndpointAttributeType(arg *DremioAuthPatchGetTokenEndpointAttributeType, val DremioAuthPatchGetTokenEndpointRetType) { + *arg = &val +} + +type DremioAuthPatchGetTokenEndpointArgType = string +type DremioAuthPatchGetTokenEndpointRetType = string + +// DremioAuthPatch struct for DremioAuthPatch +type DremioAuthPatch struct { + // A Dremio personal access token for authentication + PersonalAccessToken DremioAuthPatchGetPersonalAccessTokenAttributeType `json:"personalAccessToken,omitempty"` + // The URL to the Dremio instance's OAuth 2.0 token endpoint + TokenEndpoint DremioAuthPatchGetTokenEndpointAttributeType `json:"tokenEndpoint,omitempty"` +} + +// NewDremioAuthPatch instantiates a new DremioAuthPatch 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 NewDremioAuthPatch() *DremioAuthPatch { + this := DremioAuthPatch{} + return &this +} + +// NewDremioAuthPatchWithDefaults instantiates a new DremioAuthPatch 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 NewDremioAuthPatchWithDefaults() *DremioAuthPatch { + this := DremioAuthPatch{} + return &this +} + +// GetPersonalAccessToken returns the PersonalAccessToken field value if set, zero value otherwise. +func (o *DremioAuthPatch) GetPersonalAccessToken() (res DremioAuthPatchGetPersonalAccessTokenRetType) { + res, _ = o.GetPersonalAccessTokenOk() + return +} + +// GetPersonalAccessTokenOk returns a tuple with the PersonalAccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DremioAuthPatch) GetPersonalAccessTokenOk() (ret DremioAuthPatchGetPersonalAccessTokenRetType, ok bool) { + return getDremioAuthPatchGetPersonalAccessTokenAttributeTypeOk(o.PersonalAccessToken) +} + +// HasPersonalAccessToken returns a boolean if a field has been set. +func (o *DremioAuthPatch) HasPersonalAccessToken() bool { + _, ok := o.GetPersonalAccessTokenOk() + return ok +} + +// SetPersonalAccessToken gets a reference to the given string and assigns it to the PersonalAccessToken field. +func (o *DremioAuthPatch) SetPersonalAccessToken(v DremioAuthPatchGetPersonalAccessTokenRetType) { + setDremioAuthPatchGetPersonalAccessTokenAttributeType(&o.PersonalAccessToken, v) +} + +// GetTokenEndpoint returns the TokenEndpoint field value if set, zero value otherwise. +func (o *DremioAuthPatch) GetTokenEndpoint() (res DremioAuthPatchGetTokenEndpointRetType) { + res, _ = o.GetTokenEndpointOk() + return +} + +// GetTokenEndpointOk returns a tuple with the TokenEndpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DremioAuthPatch) GetTokenEndpointOk() (ret DremioAuthPatchGetTokenEndpointRetType, ok bool) { + return getDremioAuthPatchGetTokenEndpointAttributeTypeOk(o.TokenEndpoint) +} + +// HasTokenEndpoint returns a boolean if a field has been set. +func (o *DremioAuthPatch) HasTokenEndpoint() bool { + _, ok := o.GetTokenEndpointOk() + return ok +} + +// SetTokenEndpoint gets a reference to the given string and assigns it to the TokenEndpoint field. +func (o *DremioAuthPatch) SetTokenEndpoint(v DremioAuthPatchGetTokenEndpointRetType) { + setDremioAuthPatchGetTokenEndpointAttributeType(&o.TokenEndpoint, v) +} + +func (o DremioAuthPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDremioAuthPatchGetPersonalAccessTokenAttributeTypeOk(o.PersonalAccessToken); ok { + toSerialize["PersonalAccessToken"] = val + } + if val, ok := getDremioAuthPatchGetTokenEndpointAttributeTypeOk(o.TokenEndpoint); ok { + toSerialize["TokenEndpoint"] = val + } + return toSerialize, nil +} + +type NullableDremioAuthPatch struct { + value *DremioAuthPatch + isSet bool +} + +func (v NullableDremioAuthPatch) Get() *DremioAuthPatch { + return v.value +} + +func (v *NullableDremioAuthPatch) Set(val *DremioAuthPatch) { + v.value = val + v.isSet = true +} + +func (v NullableDremioAuthPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableDremioAuthPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDremioAuthPatch(val *DremioAuthPatch) *NullableDremioAuthPatch { + return &NullableDremioAuthPatch{value: val, isSet: true} +} + +func (v NullableDremioAuthPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDremioAuthPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_dremio_auth_patch_test.go b/pkg/intakebeta/model_dremio_auth_patch_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_dremio_auth_patch_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_dremio_auth_test.go b/pkg/intakebeta/model_dremio_auth_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_dremio_auth_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_intake_catalog.go b/pkg/intakebeta/model_intake_catalog.go new file mode 100644 index 00000000..6e86787f --- /dev/null +++ b/pkg/intakebeta/model_intake_catalog.go @@ -0,0 +1,417 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the IntakeCatalog type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IntakeCatalog{} + +/* + types and functions for auth +*/ + +// isModel +type IntakeCatalogGetAuthAttributeType = *CatalogAuth +type IntakeCatalogGetAuthArgType = CatalogAuth +type IntakeCatalogGetAuthRetType = CatalogAuth + +func getIntakeCatalogGetAuthAttributeTypeOk(arg IntakeCatalogGetAuthAttributeType) (ret IntakeCatalogGetAuthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogGetAuthAttributeType(arg *IntakeCatalogGetAuthAttributeType, val IntakeCatalogGetAuthRetType) { + *arg = &val +} + +/* + types and functions for namespace +*/ + +// isNotNullableString +type IntakeCatalogGetNamespaceAttributeType = *string + +func getIntakeCatalogGetNamespaceAttributeTypeOk(arg IntakeCatalogGetNamespaceAttributeType) (ret IntakeCatalogGetNamespaceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogGetNamespaceAttributeType(arg *IntakeCatalogGetNamespaceAttributeType, val IntakeCatalogGetNamespaceRetType) { + *arg = &val +} + +type IntakeCatalogGetNamespaceArgType = string +type IntakeCatalogGetNamespaceRetType = string + +/* + types and functions for partitionBy +*/ + +// isArray +type IntakeCatalogGetPartitionByAttributeType = *[]string +type IntakeCatalogGetPartitionByArgType = *[]string +type IntakeCatalogGetPartitionByRetType = *[]string + +func getIntakeCatalogGetPartitionByAttributeTypeOk(arg IntakeCatalogGetPartitionByAttributeType) (ret IntakeCatalogGetPartitionByRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setIntakeCatalogGetPartitionByAttributeType(arg *IntakeCatalogGetPartitionByAttributeType, val IntakeCatalogGetPartitionByRetType) { + *arg = val +} + +/* + types and functions for partitioning +*/ + +// isEnumRef +type IntakeCatalogGetPartitioningAttributeType = *PartitioningType +type IntakeCatalogGetPartitioningArgType = PartitioningType +type IntakeCatalogGetPartitioningRetType = PartitioningType + +func getIntakeCatalogGetPartitioningAttributeTypeOk(arg IntakeCatalogGetPartitioningAttributeType) (ret IntakeCatalogGetPartitioningRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogGetPartitioningAttributeType(arg *IntakeCatalogGetPartitioningAttributeType, val IntakeCatalogGetPartitioningRetType) { + *arg = &val +} + +/* + types and functions for tableName +*/ + +// isNotNullableString +type IntakeCatalogGetTableNameAttributeType = *string + +func getIntakeCatalogGetTableNameAttributeTypeOk(arg IntakeCatalogGetTableNameAttributeType) (ret IntakeCatalogGetTableNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogGetTableNameAttributeType(arg *IntakeCatalogGetTableNameAttributeType, val IntakeCatalogGetTableNameRetType) { + *arg = &val +} + +type IntakeCatalogGetTableNameArgType = string +type IntakeCatalogGetTableNameRetType = string + +/* + types and functions for uri +*/ + +// isNotNullableString +type IntakeCatalogGetUriAttributeType = *string + +func getIntakeCatalogGetUriAttributeTypeOk(arg IntakeCatalogGetUriAttributeType) (ret IntakeCatalogGetUriRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogGetUriAttributeType(arg *IntakeCatalogGetUriAttributeType, val IntakeCatalogGetUriRetType) { + *arg = &val +} + +type IntakeCatalogGetUriArgType = string +type IntakeCatalogGetUriRetType = string + +/* + types and functions for warehouse +*/ + +// isNotNullableString +type IntakeCatalogGetWarehouseAttributeType = *string + +func getIntakeCatalogGetWarehouseAttributeTypeOk(arg IntakeCatalogGetWarehouseAttributeType) (ret IntakeCatalogGetWarehouseRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogGetWarehouseAttributeType(arg *IntakeCatalogGetWarehouseAttributeType, val IntakeCatalogGetWarehouseRetType) { + *arg = &val +} + +type IntakeCatalogGetWarehouseArgType = string +type IntakeCatalogGetWarehouseRetType = string + +// IntakeCatalog The Iceberg catalog configuration +type IntakeCatalog struct { + Auth IntakeCatalogGetAuthAttributeType `json:"auth,omitempty"` + // The namespace to which data shall be written. It will be automatically created, if it does not exist. + Namespace IntakeCatalogGetNamespaceAttributeType `json:"namespace,omitempty"` + // List of Iceberg partitioning expressions to use when creating the target table. This setting can only be used when `partitioning` is set to `manual`. Partitioning configuration of an Intake can be changed after creation, but will only take effect once the table has been changed as well. In case of not updating the table to a new one, the old partitioning configuration will remain. See the [Apache Iceberg spec](https://iceberg.apache.org/spec/#partitioning) for more details. + PartitionBy IntakeCatalogGetPartitionByAttributeType `json:"partitionBy,omitempty"` + Partitioning IntakeCatalogGetPartitioningAttributeType `json:"partitioning,omitempty"` + // The table name is a short name chosen by the user to identify the table in Iceberg. + TableName IntakeCatalogGetTableNameAttributeType `json:"tableName,omitempty"` + // The URI to the Iceberg catalog endpoint + // REQUIRED + Uri IntakeCatalogGetUriAttributeType `json:"uri" required:"true"` + // The Iceberg warehouse to connect to, required when the catalog has no default warehouse configured. + // REQUIRED + Warehouse IntakeCatalogGetWarehouseAttributeType `json:"warehouse" required:"true"` +} + +type _IntakeCatalog IntakeCatalog + +// NewIntakeCatalog instantiates a new IntakeCatalog 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 NewIntakeCatalog(uri IntakeCatalogGetUriArgType, warehouse IntakeCatalogGetWarehouseArgType) *IntakeCatalog { + this := IntakeCatalog{} + setIntakeCatalogGetUriAttributeType(&this.Uri, uri) + setIntakeCatalogGetWarehouseAttributeType(&this.Warehouse, warehouse) + return &this +} + +// NewIntakeCatalogWithDefaults instantiates a new IntakeCatalog 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 NewIntakeCatalogWithDefaults() *IntakeCatalog { + this := IntakeCatalog{} + var namespace string = "intake" + this.Namespace = &namespace + var partitioning PartitioningType = PARTITIONINGTYPE_NONE + this.Partitioning = &partitioning + return &this +} + +// GetAuth returns the Auth field value if set, zero value otherwise. +func (o *IntakeCatalog) GetAuth() (res IntakeCatalogGetAuthRetType) { + res, _ = o.GetAuthOk() + return +} + +// GetAuthOk returns a tuple with the Auth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeCatalog) GetAuthOk() (ret IntakeCatalogGetAuthRetType, ok bool) { + return getIntakeCatalogGetAuthAttributeTypeOk(o.Auth) +} + +// HasAuth returns a boolean if a field has been set. +func (o *IntakeCatalog) HasAuth() bool { + _, ok := o.GetAuthOk() + return ok +} + +// SetAuth gets a reference to the given CatalogAuth and assigns it to the Auth field. +func (o *IntakeCatalog) SetAuth(v IntakeCatalogGetAuthRetType) { + setIntakeCatalogGetAuthAttributeType(&o.Auth, v) +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *IntakeCatalog) GetNamespace() (res IntakeCatalogGetNamespaceRetType) { + res, _ = o.GetNamespaceOk() + return +} + +// GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeCatalog) GetNamespaceOk() (ret IntakeCatalogGetNamespaceRetType, ok bool) { + return getIntakeCatalogGetNamespaceAttributeTypeOk(o.Namespace) +} + +// HasNamespace returns a boolean if a field has been set. +func (o *IntakeCatalog) HasNamespace() bool { + _, ok := o.GetNamespaceOk() + return ok +} + +// SetNamespace gets a reference to the given string and assigns it to the Namespace field. +func (o *IntakeCatalog) SetNamespace(v IntakeCatalogGetNamespaceRetType) { + setIntakeCatalogGetNamespaceAttributeType(&o.Namespace, v) +} + +// GetPartitionBy returns the PartitionBy field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IntakeCatalog) GetPartitionBy() (res IntakeCatalogGetPartitionByRetType) { + res, _ = o.GetPartitionByOk() + return +} + +// GetPartitionByOk returns a tuple with the PartitionBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IntakeCatalog) GetPartitionByOk() (ret IntakeCatalogGetPartitionByRetType, ok bool) { + return getIntakeCatalogGetPartitionByAttributeTypeOk(o.PartitionBy) +} + +// HasPartitionBy returns a boolean if a field has been set. +func (o *IntakeCatalog) HasPartitionBy() bool { + _, ok := o.GetPartitionByOk() + return ok +} + +// SetPartitionBy gets a reference to the given []string and assigns it to the PartitionBy field. +func (o *IntakeCatalog) SetPartitionBy(v IntakeCatalogGetPartitionByRetType) { + setIntakeCatalogGetPartitionByAttributeType(&o.PartitionBy, v) +} + +// GetPartitioning returns the Partitioning field value if set, zero value otherwise. +func (o *IntakeCatalog) GetPartitioning() (res IntakeCatalogGetPartitioningRetType) { + res, _ = o.GetPartitioningOk() + return +} + +// GetPartitioningOk returns a tuple with the Partitioning field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeCatalog) GetPartitioningOk() (ret IntakeCatalogGetPartitioningRetType, ok bool) { + return getIntakeCatalogGetPartitioningAttributeTypeOk(o.Partitioning) +} + +// HasPartitioning returns a boolean if a field has been set. +func (o *IntakeCatalog) HasPartitioning() bool { + _, ok := o.GetPartitioningOk() + return ok +} + +// SetPartitioning gets a reference to the given PartitioningType and assigns it to the Partitioning field. +func (o *IntakeCatalog) SetPartitioning(v IntakeCatalogGetPartitioningRetType) { + setIntakeCatalogGetPartitioningAttributeType(&o.Partitioning, v) +} + +// GetTableName returns the TableName field value if set, zero value otherwise. +func (o *IntakeCatalog) GetTableName() (res IntakeCatalogGetTableNameRetType) { + res, _ = o.GetTableNameOk() + return +} + +// GetTableNameOk returns a tuple with the TableName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeCatalog) GetTableNameOk() (ret IntakeCatalogGetTableNameRetType, ok bool) { + return getIntakeCatalogGetTableNameAttributeTypeOk(o.TableName) +} + +// HasTableName returns a boolean if a field has been set. +func (o *IntakeCatalog) HasTableName() bool { + _, ok := o.GetTableNameOk() + return ok +} + +// SetTableName gets a reference to the given string and assigns it to the TableName field. +func (o *IntakeCatalog) SetTableName(v IntakeCatalogGetTableNameRetType) { + setIntakeCatalogGetTableNameAttributeType(&o.TableName, v) +} + +// GetUri returns the Uri field value +func (o *IntakeCatalog) GetUri() (ret IntakeCatalogGetUriRetType) { + ret, _ = o.GetUriOk() + return ret +} + +// GetUriOk returns a tuple with the Uri field value +// and a boolean to check if the value has been set. +func (o *IntakeCatalog) GetUriOk() (ret IntakeCatalogGetUriRetType, ok bool) { + return getIntakeCatalogGetUriAttributeTypeOk(o.Uri) +} + +// SetUri sets field value +func (o *IntakeCatalog) SetUri(v IntakeCatalogGetUriRetType) { + setIntakeCatalogGetUriAttributeType(&o.Uri, v) +} + +// GetWarehouse returns the Warehouse field value +func (o *IntakeCatalog) GetWarehouse() (ret IntakeCatalogGetWarehouseRetType) { + ret, _ = o.GetWarehouseOk() + return ret +} + +// GetWarehouseOk returns a tuple with the Warehouse field value +// and a boolean to check if the value has been set. +func (o *IntakeCatalog) GetWarehouseOk() (ret IntakeCatalogGetWarehouseRetType, ok bool) { + return getIntakeCatalogGetWarehouseAttributeTypeOk(o.Warehouse) +} + +// SetWarehouse sets field value +func (o *IntakeCatalog) SetWarehouse(v IntakeCatalogGetWarehouseRetType) { + setIntakeCatalogGetWarehouseAttributeType(&o.Warehouse, v) +} + +func (o IntakeCatalog) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getIntakeCatalogGetAuthAttributeTypeOk(o.Auth); ok { + toSerialize["Auth"] = val + } + if val, ok := getIntakeCatalogGetNamespaceAttributeTypeOk(o.Namespace); ok { + toSerialize["Namespace"] = val + } + if val, ok := getIntakeCatalogGetPartitionByAttributeTypeOk(o.PartitionBy); ok { + toSerialize["PartitionBy"] = val + } + if val, ok := getIntakeCatalogGetPartitioningAttributeTypeOk(o.Partitioning); ok { + toSerialize["Partitioning"] = val + } + if val, ok := getIntakeCatalogGetTableNameAttributeTypeOk(o.TableName); ok { + toSerialize["TableName"] = val + } + if val, ok := getIntakeCatalogGetUriAttributeTypeOk(o.Uri); ok { + toSerialize["Uri"] = val + } + if val, ok := getIntakeCatalogGetWarehouseAttributeTypeOk(o.Warehouse); ok { + toSerialize["Warehouse"] = val + } + return toSerialize, nil +} + +type NullableIntakeCatalog struct { + value *IntakeCatalog + isSet bool +} + +func (v NullableIntakeCatalog) Get() *IntakeCatalog { + return v.value +} + +func (v *NullableIntakeCatalog) Set(val *IntakeCatalog) { + v.value = val + v.isSet = true +} + +func (v NullableIntakeCatalog) IsSet() bool { + return v.isSet +} + +func (v *NullableIntakeCatalog) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntakeCatalog(val *IntakeCatalog) *NullableIntakeCatalog { + return &NullableIntakeCatalog{value: val, isSet: true} +} + +func (v NullableIntakeCatalog) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntakeCatalog) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_intake_catalog_patch.go b/pkg/intakebeta/model_intake_catalog_patch.go new file mode 100644 index 00000000..d5c7a700 --- /dev/null +++ b/pkg/intakebeta/model_intake_catalog_patch.go @@ -0,0 +1,421 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the IntakeCatalogPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IntakeCatalogPatch{} + +/* + types and functions for auth +*/ + +// isModel +type IntakeCatalogPatchGetAuthAttributeType = *CatalogAuthPatch +type IntakeCatalogPatchGetAuthArgType = CatalogAuthPatch +type IntakeCatalogPatchGetAuthRetType = CatalogAuthPatch + +func getIntakeCatalogPatchGetAuthAttributeTypeOk(arg IntakeCatalogPatchGetAuthAttributeType) (ret IntakeCatalogPatchGetAuthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogPatchGetAuthAttributeType(arg *IntakeCatalogPatchGetAuthAttributeType, val IntakeCatalogPatchGetAuthRetType) { + *arg = &val +} + +/* + types and functions for namespace +*/ + +// isNotNullableString +type IntakeCatalogPatchGetNamespaceAttributeType = *string + +func getIntakeCatalogPatchGetNamespaceAttributeTypeOk(arg IntakeCatalogPatchGetNamespaceAttributeType) (ret IntakeCatalogPatchGetNamespaceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogPatchGetNamespaceAttributeType(arg *IntakeCatalogPatchGetNamespaceAttributeType, val IntakeCatalogPatchGetNamespaceRetType) { + *arg = &val +} + +type IntakeCatalogPatchGetNamespaceArgType = string +type IntakeCatalogPatchGetNamespaceRetType = string + +/* + types and functions for partitionBy +*/ + +// isArray +type IntakeCatalogPatchGetPartitionByAttributeType = *[]string +type IntakeCatalogPatchGetPartitionByArgType = *[]string +type IntakeCatalogPatchGetPartitionByRetType = *[]string + +func getIntakeCatalogPatchGetPartitionByAttributeTypeOk(arg IntakeCatalogPatchGetPartitionByAttributeType) (ret IntakeCatalogPatchGetPartitionByRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setIntakeCatalogPatchGetPartitionByAttributeType(arg *IntakeCatalogPatchGetPartitionByAttributeType, val IntakeCatalogPatchGetPartitionByRetType) { + *arg = val +} + +/* + types and functions for partitioning +*/ + +// isEnumRef +type IntakeCatalogPatchGetPartitioningAttributeType = *PartitioningUpdateType +type IntakeCatalogPatchGetPartitioningArgType = PartitioningUpdateType +type IntakeCatalogPatchGetPartitioningRetType = PartitioningUpdateType + +func getIntakeCatalogPatchGetPartitioningAttributeTypeOk(arg IntakeCatalogPatchGetPartitioningAttributeType) (ret IntakeCatalogPatchGetPartitioningRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogPatchGetPartitioningAttributeType(arg *IntakeCatalogPatchGetPartitioningAttributeType, val IntakeCatalogPatchGetPartitioningRetType) { + *arg = &val +} + +/* + types and functions for tableName +*/ + +// isNotNullableString +type IntakeCatalogPatchGetTableNameAttributeType = *string + +func getIntakeCatalogPatchGetTableNameAttributeTypeOk(arg IntakeCatalogPatchGetTableNameAttributeType) (ret IntakeCatalogPatchGetTableNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogPatchGetTableNameAttributeType(arg *IntakeCatalogPatchGetTableNameAttributeType, val IntakeCatalogPatchGetTableNameRetType) { + *arg = &val +} + +type IntakeCatalogPatchGetTableNameArgType = string +type IntakeCatalogPatchGetTableNameRetType = string + +/* + types and functions for uri +*/ + +// isNotNullableString +type IntakeCatalogPatchGetUriAttributeType = *string + +func getIntakeCatalogPatchGetUriAttributeTypeOk(arg IntakeCatalogPatchGetUriAttributeType) (ret IntakeCatalogPatchGetUriRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogPatchGetUriAttributeType(arg *IntakeCatalogPatchGetUriAttributeType, val IntakeCatalogPatchGetUriRetType) { + *arg = &val +} + +type IntakeCatalogPatchGetUriArgType = string +type IntakeCatalogPatchGetUriRetType = string + +/* + types and functions for warehouse +*/ + +// isNotNullableString +type IntakeCatalogPatchGetWarehouseAttributeType = *string + +func getIntakeCatalogPatchGetWarehouseAttributeTypeOk(arg IntakeCatalogPatchGetWarehouseAttributeType) (ret IntakeCatalogPatchGetWarehouseRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeCatalogPatchGetWarehouseAttributeType(arg *IntakeCatalogPatchGetWarehouseAttributeType, val IntakeCatalogPatchGetWarehouseRetType) { + *arg = &val +} + +type IntakeCatalogPatchGetWarehouseArgType = string +type IntakeCatalogPatchGetWarehouseRetType = string + +// IntakeCatalogPatch The Iceberg catalog configuration +type IntakeCatalogPatch struct { + Auth IntakeCatalogPatchGetAuthAttributeType `json:"auth,omitempty"` + // The namespace to which data shall be written. It will be automatically created, if it does not exist. + Namespace IntakeCatalogPatchGetNamespaceAttributeType `json:"namespace,omitempty"` + // List of Iceberg partitioning expressions to use when creating the target table. This setting can only be used when `partitioning` is set to `manual`. See the [Apache Iceberg spec](https://iceberg.apache.org/spec/#partitioning) for more details. + PartitionBy IntakeCatalogPatchGetPartitionByAttributeType `json:"partitionBy,omitempty"` + Partitioning IntakeCatalogPatchGetPartitioningAttributeType `json:"partitioning,omitempty"` + // The table name is a short name chosen by the user to identify the table in Iceberg. + TableName IntakeCatalogPatchGetTableNameAttributeType `json:"tableName,omitempty"` + // The URI to the Iceberg catalog endpoint + Uri IntakeCatalogPatchGetUriAttributeType `json:"uri,omitempty"` + // The Iceberg warehouse to connect to, required when the catalog has no default warehouse configured. + Warehouse IntakeCatalogPatchGetWarehouseAttributeType `json:"warehouse,omitempty"` +} + +// NewIntakeCatalogPatch instantiates a new IntakeCatalogPatch 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 NewIntakeCatalogPatch() *IntakeCatalogPatch { + this := IntakeCatalogPatch{} + return &this +} + +// NewIntakeCatalogPatchWithDefaults instantiates a new IntakeCatalogPatch 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 NewIntakeCatalogPatchWithDefaults() *IntakeCatalogPatch { + this := IntakeCatalogPatch{} + var namespace string = "intake" + this.Namespace = &namespace + return &this +} + +// GetAuth returns the Auth field value if set, zero value otherwise. +func (o *IntakeCatalogPatch) GetAuth() (res IntakeCatalogPatchGetAuthRetType) { + res, _ = o.GetAuthOk() + return +} + +// GetAuthOk returns a tuple with the Auth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeCatalogPatch) GetAuthOk() (ret IntakeCatalogPatchGetAuthRetType, ok bool) { + return getIntakeCatalogPatchGetAuthAttributeTypeOk(o.Auth) +} + +// HasAuth returns a boolean if a field has been set. +func (o *IntakeCatalogPatch) HasAuth() bool { + _, ok := o.GetAuthOk() + return ok +} + +// SetAuth gets a reference to the given CatalogAuthPatch and assigns it to the Auth field. +func (o *IntakeCatalogPatch) SetAuth(v IntakeCatalogPatchGetAuthRetType) { + setIntakeCatalogPatchGetAuthAttributeType(&o.Auth, v) +} + +// GetNamespace returns the Namespace field value if set, zero value otherwise. +func (o *IntakeCatalogPatch) GetNamespace() (res IntakeCatalogPatchGetNamespaceRetType) { + res, _ = o.GetNamespaceOk() + return +} + +// GetNamespaceOk returns a tuple with the Namespace field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeCatalogPatch) GetNamespaceOk() (ret IntakeCatalogPatchGetNamespaceRetType, ok bool) { + return getIntakeCatalogPatchGetNamespaceAttributeTypeOk(o.Namespace) +} + +// HasNamespace returns a boolean if a field has been set. +func (o *IntakeCatalogPatch) HasNamespace() bool { + _, ok := o.GetNamespaceOk() + return ok +} + +// SetNamespace gets a reference to the given string and assigns it to the Namespace field. +func (o *IntakeCatalogPatch) SetNamespace(v IntakeCatalogPatchGetNamespaceRetType) { + setIntakeCatalogPatchGetNamespaceAttributeType(&o.Namespace, v) +} + +// GetPartitionBy returns the PartitionBy field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IntakeCatalogPatch) GetPartitionBy() (res IntakeCatalogPatchGetPartitionByRetType) { + res, _ = o.GetPartitionByOk() + return +} + +// GetPartitionByOk returns a tuple with the PartitionBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *IntakeCatalogPatch) GetPartitionByOk() (ret IntakeCatalogPatchGetPartitionByRetType, ok bool) { + return getIntakeCatalogPatchGetPartitionByAttributeTypeOk(o.PartitionBy) +} + +// HasPartitionBy returns a boolean if a field has been set. +func (o *IntakeCatalogPatch) HasPartitionBy() bool { + _, ok := o.GetPartitionByOk() + return ok +} + +// SetPartitionBy gets a reference to the given []string and assigns it to the PartitionBy field. +func (o *IntakeCatalogPatch) SetPartitionBy(v IntakeCatalogPatchGetPartitionByRetType) { + setIntakeCatalogPatchGetPartitionByAttributeType(&o.PartitionBy, v) +} + +// GetPartitioning returns the Partitioning field value if set, zero value otherwise. +func (o *IntakeCatalogPatch) GetPartitioning() (res IntakeCatalogPatchGetPartitioningRetType) { + res, _ = o.GetPartitioningOk() + return +} + +// GetPartitioningOk returns a tuple with the Partitioning field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeCatalogPatch) GetPartitioningOk() (ret IntakeCatalogPatchGetPartitioningRetType, ok bool) { + return getIntakeCatalogPatchGetPartitioningAttributeTypeOk(o.Partitioning) +} + +// HasPartitioning returns a boolean if a field has been set. +func (o *IntakeCatalogPatch) HasPartitioning() bool { + _, ok := o.GetPartitioningOk() + return ok +} + +// SetPartitioning gets a reference to the given PartitioningUpdateType and assigns it to the Partitioning field. +func (o *IntakeCatalogPatch) SetPartitioning(v IntakeCatalogPatchGetPartitioningRetType) { + setIntakeCatalogPatchGetPartitioningAttributeType(&o.Partitioning, v) +} + +// GetTableName returns the TableName field value if set, zero value otherwise. +func (o *IntakeCatalogPatch) GetTableName() (res IntakeCatalogPatchGetTableNameRetType) { + res, _ = o.GetTableNameOk() + return +} + +// GetTableNameOk returns a tuple with the TableName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeCatalogPatch) GetTableNameOk() (ret IntakeCatalogPatchGetTableNameRetType, ok bool) { + return getIntakeCatalogPatchGetTableNameAttributeTypeOk(o.TableName) +} + +// HasTableName returns a boolean if a field has been set. +func (o *IntakeCatalogPatch) HasTableName() bool { + _, ok := o.GetTableNameOk() + return ok +} + +// SetTableName gets a reference to the given string and assigns it to the TableName field. +func (o *IntakeCatalogPatch) SetTableName(v IntakeCatalogPatchGetTableNameRetType) { + setIntakeCatalogPatchGetTableNameAttributeType(&o.TableName, v) +} + +// GetUri returns the Uri field value if set, zero value otherwise. +func (o *IntakeCatalogPatch) GetUri() (res IntakeCatalogPatchGetUriRetType) { + res, _ = o.GetUriOk() + return +} + +// GetUriOk returns a tuple with the Uri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeCatalogPatch) GetUriOk() (ret IntakeCatalogPatchGetUriRetType, ok bool) { + return getIntakeCatalogPatchGetUriAttributeTypeOk(o.Uri) +} + +// HasUri returns a boolean if a field has been set. +func (o *IntakeCatalogPatch) HasUri() bool { + _, ok := o.GetUriOk() + return ok +} + +// SetUri gets a reference to the given string and assigns it to the Uri field. +func (o *IntakeCatalogPatch) SetUri(v IntakeCatalogPatchGetUriRetType) { + setIntakeCatalogPatchGetUriAttributeType(&o.Uri, v) +} + +// GetWarehouse returns the Warehouse field value if set, zero value otherwise. +func (o *IntakeCatalogPatch) GetWarehouse() (res IntakeCatalogPatchGetWarehouseRetType) { + res, _ = o.GetWarehouseOk() + return +} + +// GetWarehouseOk returns a tuple with the Warehouse field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeCatalogPatch) GetWarehouseOk() (ret IntakeCatalogPatchGetWarehouseRetType, ok bool) { + return getIntakeCatalogPatchGetWarehouseAttributeTypeOk(o.Warehouse) +} + +// HasWarehouse returns a boolean if a field has been set. +func (o *IntakeCatalogPatch) HasWarehouse() bool { + _, ok := o.GetWarehouseOk() + return ok +} + +// SetWarehouse gets a reference to the given string and assigns it to the Warehouse field. +func (o *IntakeCatalogPatch) SetWarehouse(v IntakeCatalogPatchGetWarehouseRetType) { + setIntakeCatalogPatchGetWarehouseAttributeType(&o.Warehouse, v) +} + +func (o IntakeCatalogPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getIntakeCatalogPatchGetAuthAttributeTypeOk(o.Auth); ok { + toSerialize["Auth"] = val + } + if val, ok := getIntakeCatalogPatchGetNamespaceAttributeTypeOk(o.Namespace); ok { + toSerialize["Namespace"] = val + } + if val, ok := getIntakeCatalogPatchGetPartitionByAttributeTypeOk(o.PartitionBy); ok { + toSerialize["PartitionBy"] = val + } + if val, ok := getIntakeCatalogPatchGetPartitioningAttributeTypeOk(o.Partitioning); ok { + toSerialize["Partitioning"] = val + } + if val, ok := getIntakeCatalogPatchGetTableNameAttributeTypeOk(o.TableName); ok { + toSerialize["TableName"] = val + } + if val, ok := getIntakeCatalogPatchGetUriAttributeTypeOk(o.Uri); ok { + toSerialize["Uri"] = val + } + if val, ok := getIntakeCatalogPatchGetWarehouseAttributeTypeOk(o.Warehouse); ok { + toSerialize["Warehouse"] = val + } + return toSerialize, nil +} + +type NullableIntakeCatalogPatch struct { + value *IntakeCatalogPatch + isSet bool +} + +func (v NullableIntakeCatalogPatch) Get() *IntakeCatalogPatch { + return v.value +} + +func (v *NullableIntakeCatalogPatch) Set(val *IntakeCatalogPatch) { + v.value = val + v.isSet = true +} + +func (v NullableIntakeCatalogPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableIntakeCatalogPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntakeCatalogPatch(val *IntakeCatalogPatch) *NullableIntakeCatalogPatch { + return &NullableIntakeCatalogPatch{value: val, isSet: true} +} + +func (v NullableIntakeCatalogPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntakeCatalogPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_intake_catalog_patch_test.go b/pkg/intakebeta/model_intake_catalog_patch_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_intake_catalog_patch_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_intake_catalog_test.go b/pkg/intakebeta/model_intake_catalog_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_intake_catalog_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_intake_response.go b/pkg/intakebeta/model_intake_response.go new file mode 100644 index 00000000..a4968e0e --- /dev/null +++ b/pkg/intakebeta/model_intake_response.go @@ -0,0 +1,788 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the IntakeResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IntakeResponse{} + +/* + types and functions for catalog +*/ + +// isModel +type IntakeResponseGetCatalogAttributeType = *IntakeCatalog +type IntakeResponseGetCatalogArgType = IntakeCatalog +type IntakeResponseGetCatalogRetType = IntakeCatalog + +func getIntakeResponseGetCatalogAttributeTypeOk(arg IntakeResponseGetCatalogAttributeType) (ret IntakeResponseGetCatalogRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetCatalogAttributeType(arg *IntakeResponseGetCatalogAttributeType, val IntakeResponseGetCatalogRetType) { + *arg = &val +} + +/* + types and functions for create_time +*/ + +// isDateTime +type IntakeResponseGetCreateTimeAttributeType = *time.Time +type IntakeResponseGetCreateTimeArgType = time.Time +type IntakeResponseGetCreateTimeRetType = time.Time + +func getIntakeResponseGetCreateTimeAttributeTypeOk(arg IntakeResponseGetCreateTimeAttributeType) (ret IntakeResponseGetCreateTimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetCreateTimeAttributeType(arg *IntakeResponseGetCreateTimeAttributeType, val IntakeResponseGetCreateTimeRetType) { + *arg = &val +} + +/* + types and functions for deadLetterTopic +*/ + +// isNotNullableString +type IntakeResponseGetDeadLetterTopicAttributeType = *string + +func getIntakeResponseGetDeadLetterTopicAttributeTypeOk(arg IntakeResponseGetDeadLetterTopicAttributeType) (ret IntakeResponseGetDeadLetterTopicRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetDeadLetterTopicAttributeType(arg *IntakeResponseGetDeadLetterTopicAttributeType, val IntakeResponseGetDeadLetterTopicRetType) { + *arg = &val +} + +type IntakeResponseGetDeadLetterTopicArgType = string +type IntakeResponseGetDeadLetterTopicRetType = string + +/* + types and functions for description +*/ + +// isNotNullableString +type IntakeResponseGetDescriptionAttributeType = *string + +func getIntakeResponseGetDescriptionAttributeTypeOk(arg IntakeResponseGetDescriptionAttributeType) (ret IntakeResponseGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetDescriptionAttributeType(arg *IntakeResponseGetDescriptionAttributeType, val IntakeResponseGetDescriptionRetType) { + *arg = &val +} + +type IntakeResponseGetDescriptionArgType = string +type IntakeResponseGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type IntakeResponseGetDisplayNameAttributeType = *string + +func getIntakeResponseGetDisplayNameAttributeTypeOk(arg IntakeResponseGetDisplayNameAttributeType) (ret IntakeResponseGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetDisplayNameAttributeType(arg *IntakeResponseGetDisplayNameAttributeType, val IntakeResponseGetDisplayNameRetType) { + *arg = &val +} + +type IntakeResponseGetDisplayNameArgType = string +type IntakeResponseGetDisplayNameRetType = string + +/* + types and functions for failure_message +*/ + +// isNotNullableString +type IntakeResponseGetFailureMessageAttributeType = *string + +func getIntakeResponseGetFailureMessageAttributeTypeOk(arg IntakeResponseGetFailureMessageAttributeType) (ret IntakeResponseGetFailureMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetFailureMessageAttributeType(arg *IntakeResponseGetFailureMessageAttributeType, val IntakeResponseGetFailureMessageRetType) { + *arg = &val +} + +type IntakeResponseGetFailureMessageArgType = string +type IntakeResponseGetFailureMessageRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type IntakeResponseGetIdAttributeType = *string + +func getIntakeResponseGetIdAttributeTypeOk(arg IntakeResponseGetIdAttributeType) (ret IntakeResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetIdAttributeType(arg *IntakeResponseGetIdAttributeType, val IntakeResponseGetIdRetType) { + *arg = &val +} + +type IntakeResponseGetIdArgType = string +type IntakeResponseGetIdRetType = string + +/* + types and functions for intakeRunnerId +*/ + +// isNotNullableString +type IntakeResponseGetIntakeRunnerIdAttributeType = *string + +func getIntakeResponseGetIntakeRunnerIdAttributeTypeOk(arg IntakeResponseGetIntakeRunnerIdAttributeType) (ret IntakeResponseGetIntakeRunnerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetIntakeRunnerIdAttributeType(arg *IntakeResponseGetIntakeRunnerIdAttributeType, val IntakeResponseGetIntakeRunnerIdRetType) { + *arg = &val +} + +type IntakeResponseGetIntakeRunnerIdArgType = string +type IntakeResponseGetIntakeRunnerIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type IntakeResponseGetLabelsAttributeType = *map[string]string +type IntakeResponseGetLabelsArgType = *map[string]string +type IntakeResponseGetLabelsRetType = *map[string]string + +func getIntakeResponseGetLabelsAttributeTypeOk(arg IntakeResponseGetLabelsAttributeType) (ret IntakeResponseGetLabelsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setIntakeResponseGetLabelsAttributeType(arg *IntakeResponseGetLabelsAttributeType, val IntakeResponseGetLabelsRetType) { + *arg = val +} + +/* + types and functions for state +*/ + +// isEnum + +// IntakeResponseState The current state of the resource. +// value type for enums +type IntakeResponseState string + +// List of State +const ( + INTAKERESPONSESTATE_RECONCILING IntakeResponseState = "reconciling" + INTAKERESPONSESTATE_ACTIVE IntakeResponseState = "active" + INTAKERESPONSESTATE_DELETING IntakeResponseState = "deleting" + INTAKERESPONSESTATE_FAILED IntakeResponseState = "failed" +) + +// All allowed values of IntakeResponse enum +var AllowedIntakeResponseStateEnumValues = []IntakeResponseState{ + "reconciling", + "active", + "deleting", + "failed", +} + +func (v *IntakeResponseState) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson IntakeResponseState + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := IntakeResponseState(value) + for _, existing := range AllowedIntakeResponseStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid IntakeResponse", value) +} + +// NewIntakeResponseStateFromValue returns a pointer to a valid IntakeResponseState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewIntakeResponseStateFromValue(v IntakeResponseState) (*IntakeResponseState, error) { + ev := IntakeResponseState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for IntakeResponseState: valid values are %v", v, AllowedIntakeResponseStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v IntakeResponseState) IsValid() bool { + for _, existing := range AllowedIntakeResponseStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v IntakeResponseState) Ptr() *IntakeResponseState { + return &v +} + +type NullableIntakeResponseState struct { + value *IntakeResponseState + isSet bool +} + +func (v NullableIntakeResponseState) Get() *IntakeResponseState { + return v.value +} + +func (v *NullableIntakeResponseState) Set(val *IntakeResponseState) { + v.value = val + v.isSet = true +} + +func (v NullableIntakeResponseState) IsSet() bool { + return v.isSet +} + +func (v *NullableIntakeResponseState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntakeResponseState(val *IntakeResponseState) *NullableIntakeResponseState { + return &NullableIntakeResponseState{value: val, isSet: true} +} + +func (v NullableIntakeResponseState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntakeResponseState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type IntakeResponseGetStateAttributeType = *IntakeResponseState +type IntakeResponseGetStateArgType = IntakeResponseState +type IntakeResponseGetStateRetType = IntakeResponseState + +func getIntakeResponseGetStateAttributeTypeOk(arg IntakeResponseGetStateAttributeType) (ret IntakeResponseGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetStateAttributeType(arg *IntakeResponseGetStateAttributeType, val IntakeResponseGetStateRetType) { + *arg = &val +} + +/* + types and functions for topic +*/ + +// isNotNullableString +type IntakeResponseGetTopicAttributeType = *string + +func getIntakeResponseGetTopicAttributeTypeOk(arg IntakeResponseGetTopicAttributeType) (ret IntakeResponseGetTopicRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetTopicAttributeType(arg *IntakeResponseGetTopicAttributeType, val IntakeResponseGetTopicRetType) { + *arg = &val +} + +type IntakeResponseGetTopicArgType = string +type IntakeResponseGetTopicRetType = string + +/* + types and functions for undeliveredMessageCount +*/ + +// isLong +type IntakeResponseGetUndeliveredMessageCountAttributeType = *int64 +type IntakeResponseGetUndeliveredMessageCountArgType = int64 +type IntakeResponseGetUndeliveredMessageCountRetType = int64 + +func getIntakeResponseGetUndeliveredMessageCountAttributeTypeOk(arg IntakeResponseGetUndeliveredMessageCountAttributeType) (ret IntakeResponseGetUndeliveredMessageCountRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetUndeliveredMessageCountAttributeType(arg *IntakeResponseGetUndeliveredMessageCountAttributeType, val IntakeResponseGetUndeliveredMessageCountRetType) { + *arg = &val +} + +/* + types and functions for uri +*/ + +// isNotNullableString +type IntakeResponseGetUriAttributeType = *string + +func getIntakeResponseGetUriAttributeTypeOk(arg IntakeResponseGetUriAttributeType) (ret IntakeResponseGetUriRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeResponseGetUriAttributeType(arg *IntakeResponseGetUriAttributeType, val IntakeResponseGetUriRetType) { + *arg = &val +} + +type IntakeResponseGetUriArgType = string +type IntakeResponseGetUriRetType = string + +// IntakeResponse struct for IntakeResponse +type IntakeResponse struct { + // REQUIRED + Catalog IntakeResponseGetCatalogAttributeType `json:"catalog" required:"true"` + // The point in time the resource was created. + // REQUIRED + CreateTime IntakeResponseGetCreateTimeAttributeType `json:"create_time" required:"true"` + // The topic where undelivered messages are published (Dead Letter Queue). + // REQUIRED + DeadLetterTopic IntakeResponseGetDeadLetterTopicAttributeType `json:"deadLetterTopic" required:"true"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description IntakeResponseGetDescriptionAttributeType `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + // REQUIRED + DisplayName IntakeResponseGetDisplayNameAttributeType `json:"displayName" required:"true"` + // A human-readable description of the error, if the state is 'failed'. + FailureMessage IntakeResponseGetFailureMessageAttributeType `json:"failure_message,omitempty"` + // A auto generated unique id which identifies the resource. + // REQUIRED + Id IntakeResponseGetIdAttributeType `json:"id" required:"true"` + // The unique id of the intake runner this intake is running on. + // REQUIRED + IntakeRunnerId IntakeResponseGetIntakeRunnerIdAttributeType `json:"intakeRunnerId" required:"true"` + // Labels are a set of key-value pairs assigned to resources. + Labels IntakeResponseGetLabelsAttributeType `json:"labels,omitempty"` + // The current state of the resource. + // REQUIRED + State IntakeResponseGetStateAttributeType `json:"state" required:"true"` + // The topic to publish data to. + // REQUIRED + Topic IntakeResponseGetTopicAttributeType `json:"topic" required:"true"` + // Number of messages that failed delivery and were sent to the Dead Letter Queue. + UndeliveredMessageCount IntakeResponseGetUndeliveredMessageCountAttributeType `json:"undeliveredMessageCount,omitempty"` + // The URI for reaching the resource. + // REQUIRED + Uri IntakeResponseGetUriAttributeType `json:"uri" required:"true"` +} + +type _IntakeResponse IntakeResponse + +// NewIntakeResponse instantiates a new IntakeResponse 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 NewIntakeResponse(catalog IntakeResponseGetCatalogArgType, createTime IntakeResponseGetCreateTimeArgType, deadLetterTopic IntakeResponseGetDeadLetterTopicArgType, displayName IntakeResponseGetDisplayNameArgType, id IntakeResponseGetIdArgType, intakeRunnerId IntakeResponseGetIntakeRunnerIdArgType, state IntakeResponseGetStateArgType, topic IntakeResponseGetTopicArgType, uri IntakeResponseGetUriArgType) *IntakeResponse { + this := IntakeResponse{} + setIntakeResponseGetCatalogAttributeType(&this.Catalog, catalog) + setIntakeResponseGetCreateTimeAttributeType(&this.CreateTime, createTime) + setIntakeResponseGetDeadLetterTopicAttributeType(&this.DeadLetterTopic, deadLetterTopic) + setIntakeResponseGetDisplayNameAttributeType(&this.DisplayName, displayName) + setIntakeResponseGetIdAttributeType(&this.Id, id) + setIntakeResponseGetIntakeRunnerIdAttributeType(&this.IntakeRunnerId, intakeRunnerId) + setIntakeResponseGetStateAttributeType(&this.State, state) + setIntakeResponseGetTopicAttributeType(&this.Topic, topic) + setIntakeResponseGetUriAttributeType(&this.Uri, uri) + return &this +} + +// NewIntakeResponseWithDefaults instantiates a new IntakeResponse 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 NewIntakeResponseWithDefaults() *IntakeResponse { + this := IntakeResponse{} + return &this +} + +// GetCatalog returns the Catalog field value +func (o *IntakeResponse) GetCatalog() (ret IntakeResponseGetCatalogRetType) { + ret, _ = o.GetCatalogOk() + return ret +} + +// GetCatalogOk returns a tuple with the Catalog field value +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetCatalogOk() (ret IntakeResponseGetCatalogRetType, ok bool) { + return getIntakeResponseGetCatalogAttributeTypeOk(o.Catalog) +} + +// SetCatalog sets field value +func (o *IntakeResponse) SetCatalog(v IntakeResponseGetCatalogRetType) { + setIntakeResponseGetCatalogAttributeType(&o.Catalog, v) +} + +// GetCreateTime returns the CreateTime field value +func (o *IntakeResponse) GetCreateTime() (ret IntakeResponseGetCreateTimeRetType) { + ret, _ = o.GetCreateTimeOk() + return ret +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetCreateTimeOk() (ret IntakeResponseGetCreateTimeRetType, ok bool) { + return getIntakeResponseGetCreateTimeAttributeTypeOk(o.CreateTime) +} + +// SetCreateTime sets field value +func (o *IntakeResponse) SetCreateTime(v IntakeResponseGetCreateTimeRetType) { + setIntakeResponseGetCreateTimeAttributeType(&o.CreateTime, v) +} + +// GetDeadLetterTopic returns the DeadLetterTopic field value +func (o *IntakeResponse) GetDeadLetterTopic() (ret IntakeResponseGetDeadLetterTopicRetType) { + ret, _ = o.GetDeadLetterTopicOk() + return ret +} + +// GetDeadLetterTopicOk returns a tuple with the DeadLetterTopic field value +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetDeadLetterTopicOk() (ret IntakeResponseGetDeadLetterTopicRetType, ok bool) { + return getIntakeResponseGetDeadLetterTopicAttributeTypeOk(o.DeadLetterTopic) +} + +// SetDeadLetterTopic sets field value +func (o *IntakeResponse) SetDeadLetterTopic(v IntakeResponseGetDeadLetterTopicRetType) { + setIntakeResponseGetDeadLetterTopicAttributeType(&o.DeadLetterTopic, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *IntakeResponse) GetDescription() (res IntakeResponseGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetDescriptionOk() (ret IntakeResponseGetDescriptionRetType, ok bool) { + return getIntakeResponseGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *IntakeResponse) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *IntakeResponse) SetDescription(v IntakeResponseGetDescriptionRetType) { + setIntakeResponseGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *IntakeResponse) GetDisplayName() (ret IntakeResponseGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetDisplayNameOk() (ret IntakeResponseGetDisplayNameRetType, ok bool) { + return getIntakeResponseGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *IntakeResponse) SetDisplayName(v IntakeResponseGetDisplayNameRetType) { + setIntakeResponseGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetFailureMessage returns the FailureMessage field value if set, zero value otherwise. +func (o *IntakeResponse) GetFailureMessage() (res IntakeResponseGetFailureMessageRetType) { + res, _ = o.GetFailureMessageOk() + return +} + +// GetFailureMessageOk returns a tuple with the FailureMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetFailureMessageOk() (ret IntakeResponseGetFailureMessageRetType, ok bool) { + return getIntakeResponseGetFailureMessageAttributeTypeOk(o.FailureMessage) +} + +// HasFailureMessage returns a boolean if a field has been set. +func (o *IntakeResponse) HasFailureMessage() bool { + _, ok := o.GetFailureMessageOk() + return ok +} + +// SetFailureMessage gets a reference to the given string and assigns it to the FailureMessage field. +func (o *IntakeResponse) SetFailureMessage(v IntakeResponseGetFailureMessageRetType) { + setIntakeResponseGetFailureMessageAttributeType(&o.FailureMessage, v) +} + +// GetId returns the Id field value +func (o *IntakeResponse) GetId() (ret IntakeResponseGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetIdOk() (ret IntakeResponseGetIdRetType, ok bool) { + return getIntakeResponseGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *IntakeResponse) SetId(v IntakeResponseGetIdRetType) { + setIntakeResponseGetIdAttributeType(&o.Id, v) +} + +// GetIntakeRunnerId returns the IntakeRunnerId field value +func (o *IntakeResponse) GetIntakeRunnerId() (ret IntakeResponseGetIntakeRunnerIdRetType) { + ret, _ = o.GetIntakeRunnerIdOk() + return ret +} + +// GetIntakeRunnerIdOk returns a tuple with the IntakeRunnerId field value +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetIntakeRunnerIdOk() (ret IntakeResponseGetIntakeRunnerIdRetType, ok bool) { + return getIntakeResponseGetIntakeRunnerIdAttributeTypeOk(o.IntakeRunnerId) +} + +// SetIntakeRunnerId sets field value +func (o *IntakeResponse) SetIntakeRunnerId(v IntakeResponseGetIntakeRunnerIdRetType) { + setIntakeResponseGetIntakeRunnerIdAttributeType(&o.IntakeRunnerId, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IntakeResponse) GetLabels() (res IntakeResponseGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// 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 *IntakeResponse) GetLabelsOk() (ret IntakeResponseGetLabelsRetType, ok bool) { + return getIntakeResponseGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *IntakeResponse) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *IntakeResponse) SetLabels(v IntakeResponseGetLabelsRetType) { + setIntakeResponseGetLabelsAttributeType(&o.Labels, v) +} + +// GetState returns the State field value +func (o *IntakeResponse) GetState() (ret IntakeResponseGetStateRetType) { + ret, _ = o.GetStateOk() + return ret +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetStateOk() (ret IntakeResponseGetStateRetType, ok bool) { + return getIntakeResponseGetStateAttributeTypeOk(o.State) +} + +// SetState sets field value +func (o *IntakeResponse) SetState(v IntakeResponseGetStateRetType) { + setIntakeResponseGetStateAttributeType(&o.State, v) +} + +// GetTopic returns the Topic field value +func (o *IntakeResponse) GetTopic() (ret IntakeResponseGetTopicRetType) { + ret, _ = o.GetTopicOk() + return ret +} + +// GetTopicOk returns a tuple with the Topic field value +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetTopicOk() (ret IntakeResponseGetTopicRetType, ok bool) { + return getIntakeResponseGetTopicAttributeTypeOk(o.Topic) +} + +// SetTopic sets field value +func (o *IntakeResponse) SetTopic(v IntakeResponseGetTopicRetType) { + setIntakeResponseGetTopicAttributeType(&o.Topic, v) +} + +// GetUndeliveredMessageCount returns the UndeliveredMessageCount field value if set, zero value otherwise. +func (o *IntakeResponse) GetUndeliveredMessageCount() (res IntakeResponseGetUndeliveredMessageCountRetType) { + res, _ = o.GetUndeliveredMessageCountOk() + return +} + +// GetUndeliveredMessageCountOk returns a tuple with the UndeliveredMessageCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetUndeliveredMessageCountOk() (ret IntakeResponseGetUndeliveredMessageCountRetType, ok bool) { + return getIntakeResponseGetUndeliveredMessageCountAttributeTypeOk(o.UndeliveredMessageCount) +} + +// HasUndeliveredMessageCount returns a boolean if a field has been set. +func (o *IntakeResponse) HasUndeliveredMessageCount() bool { + _, ok := o.GetUndeliveredMessageCountOk() + return ok +} + +// SetUndeliveredMessageCount gets a reference to the given int64 and assigns it to the UndeliveredMessageCount field. +func (o *IntakeResponse) SetUndeliveredMessageCount(v IntakeResponseGetUndeliveredMessageCountRetType) { + setIntakeResponseGetUndeliveredMessageCountAttributeType(&o.UndeliveredMessageCount, v) +} + +// GetUri returns the Uri field value +func (o *IntakeResponse) GetUri() (ret IntakeResponseGetUriRetType) { + ret, _ = o.GetUriOk() + return ret +} + +// GetUriOk returns a tuple with the Uri field value +// and a boolean to check if the value has been set. +func (o *IntakeResponse) GetUriOk() (ret IntakeResponseGetUriRetType, ok bool) { + return getIntakeResponseGetUriAttributeTypeOk(o.Uri) +} + +// SetUri sets field value +func (o *IntakeResponse) SetUri(v IntakeResponseGetUriRetType) { + setIntakeResponseGetUriAttributeType(&o.Uri, v) +} + +func (o IntakeResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getIntakeResponseGetCatalogAttributeTypeOk(o.Catalog); ok { + toSerialize["Catalog"] = val + } + if val, ok := getIntakeResponseGetCreateTimeAttributeTypeOk(o.CreateTime); ok { + toSerialize["CreateTime"] = val + } + if val, ok := getIntakeResponseGetDeadLetterTopicAttributeTypeOk(o.DeadLetterTopic); ok { + toSerialize["DeadLetterTopic"] = val + } + if val, ok := getIntakeResponseGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getIntakeResponseGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getIntakeResponseGetFailureMessageAttributeTypeOk(o.FailureMessage); ok { + toSerialize["FailureMessage"] = val + } + if val, ok := getIntakeResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getIntakeResponseGetIntakeRunnerIdAttributeTypeOk(o.IntakeRunnerId); ok { + toSerialize["IntakeRunnerId"] = val + } + if val, ok := getIntakeResponseGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getIntakeResponseGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + if val, ok := getIntakeResponseGetTopicAttributeTypeOk(o.Topic); ok { + toSerialize["Topic"] = val + } + if val, ok := getIntakeResponseGetUndeliveredMessageCountAttributeTypeOk(o.UndeliveredMessageCount); ok { + toSerialize["UndeliveredMessageCount"] = val + } + if val, ok := getIntakeResponseGetUriAttributeTypeOk(o.Uri); ok { + toSerialize["Uri"] = val + } + return toSerialize, nil +} + +type NullableIntakeResponse struct { + value *IntakeResponse + isSet bool +} + +func (v NullableIntakeResponse) Get() *IntakeResponse { + return v.value +} + +func (v *NullableIntakeResponse) Set(val *IntakeResponse) { + v.value = val + v.isSet = true +} + +func (v NullableIntakeResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableIntakeResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntakeResponse(val *IntakeResponse) *NullableIntakeResponse { + return &NullableIntakeResponse{value: val, isSet: true} +} + +func (v NullableIntakeResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntakeResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_intake_response_test.go b/pkg/intakebeta/model_intake_response_test.go new file mode 100644 index 00000000..9cc0800a --- /dev/null +++ b/pkg/intakebeta/model_intake_response_test.go @@ -0,0 +1,72 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "testing" +) + +// isEnum + +func TestIntakeResponseState_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"reconciling"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"deleting"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"failed"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := IntakeResponseState("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/intakebeta/model_intake_runner_response.go b/pkg/intakebeta/model_intake_runner_response.go new file mode 100644 index 00000000..5281ecff --- /dev/null +++ b/pkg/intakebeta/model_intake_runner_response.go @@ -0,0 +1,599 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the IntakeRunnerResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IntakeRunnerResponse{} + +/* + types and functions for create_time +*/ + +// isDateTime +type IntakeRunnerResponseGetCreateTimeAttributeType = *time.Time +type IntakeRunnerResponseGetCreateTimeArgType = time.Time +type IntakeRunnerResponseGetCreateTimeRetType = time.Time + +func getIntakeRunnerResponseGetCreateTimeAttributeTypeOk(arg IntakeRunnerResponseGetCreateTimeAttributeType) (ret IntakeRunnerResponseGetCreateTimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeRunnerResponseGetCreateTimeAttributeType(arg *IntakeRunnerResponseGetCreateTimeAttributeType, val IntakeRunnerResponseGetCreateTimeRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type IntakeRunnerResponseGetDescriptionAttributeType = *string + +func getIntakeRunnerResponseGetDescriptionAttributeTypeOk(arg IntakeRunnerResponseGetDescriptionAttributeType) (ret IntakeRunnerResponseGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeRunnerResponseGetDescriptionAttributeType(arg *IntakeRunnerResponseGetDescriptionAttributeType, val IntakeRunnerResponseGetDescriptionRetType) { + *arg = &val +} + +type IntakeRunnerResponseGetDescriptionArgType = string +type IntakeRunnerResponseGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type IntakeRunnerResponseGetDisplayNameAttributeType = *string + +func getIntakeRunnerResponseGetDisplayNameAttributeTypeOk(arg IntakeRunnerResponseGetDisplayNameAttributeType) (ret IntakeRunnerResponseGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeRunnerResponseGetDisplayNameAttributeType(arg *IntakeRunnerResponseGetDisplayNameAttributeType, val IntakeRunnerResponseGetDisplayNameRetType) { + *arg = &val +} + +type IntakeRunnerResponseGetDisplayNameArgType = string +type IntakeRunnerResponseGetDisplayNameRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type IntakeRunnerResponseGetIdAttributeType = *string + +func getIntakeRunnerResponseGetIdAttributeTypeOk(arg IntakeRunnerResponseGetIdAttributeType) (ret IntakeRunnerResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeRunnerResponseGetIdAttributeType(arg *IntakeRunnerResponseGetIdAttributeType, val IntakeRunnerResponseGetIdRetType) { + *arg = &val +} + +type IntakeRunnerResponseGetIdArgType = string +type IntakeRunnerResponseGetIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type IntakeRunnerResponseGetLabelsAttributeType = *map[string]string +type IntakeRunnerResponseGetLabelsArgType = *map[string]string +type IntakeRunnerResponseGetLabelsRetType = *map[string]string + +func getIntakeRunnerResponseGetLabelsAttributeTypeOk(arg IntakeRunnerResponseGetLabelsAttributeType) (ret IntakeRunnerResponseGetLabelsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setIntakeRunnerResponseGetLabelsAttributeType(arg *IntakeRunnerResponseGetLabelsAttributeType, val IntakeRunnerResponseGetLabelsRetType) { + *arg = val +} + +/* + types and functions for maxMessageSizeKiB +*/ + +// isInteger +type IntakeRunnerResponseGetMaxMessageSizeKiBAttributeType = *int64 +type IntakeRunnerResponseGetMaxMessageSizeKiBArgType = int64 +type IntakeRunnerResponseGetMaxMessageSizeKiBRetType = int64 + +func getIntakeRunnerResponseGetMaxMessageSizeKiBAttributeTypeOk(arg IntakeRunnerResponseGetMaxMessageSizeKiBAttributeType) (ret IntakeRunnerResponseGetMaxMessageSizeKiBRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeRunnerResponseGetMaxMessageSizeKiBAttributeType(arg *IntakeRunnerResponseGetMaxMessageSizeKiBAttributeType, val IntakeRunnerResponseGetMaxMessageSizeKiBRetType) { + *arg = &val +} + +/* + types and functions for maxMessagesPerHour +*/ + +// isInteger +type IntakeRunnerResponseGetMaxMessagesPerHourAttributeType = *int64 +type IntakeRunnerResponseGetMaxMessagesPerHourArgType = int64 +type IntakeRunnerResponseGetMaxMessagesPerHourRetType = int64 + +func getIntakeRunnerResponseGetMaxMessagesPerHourAttributeTypeOk(arg IntakeRunnerResponseGetMaxMessagesPerHourAttributeType) (ret IntakeRunnerResponseGetMaxMessagesPerHourRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeRunnerResponseGetMaxMessagesPerHourAttributeType(arg *IntakeRunnerResponseGetMaxMessagesPerHourAttributeType, val IntakeRunnerResponseGetMaxMessagesPerHourRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isEnum + +// IntakeRunnerResponseState The current state of the resource. +// value type for enums +type IntakeRunnerResponseState string + +// List of State +const ( + INTAKERUNNERRESPONSESTATE_RECONCILING IntakeRunnerResponseState = "reconciling" + INTAKERUNNERRESPONSESTATE_ACTIVE IntakeRunnerResponseState = "active" + INTAKERUNNERRESPONSESTATE_DELETING IntakeRunnerResponseState = "deleting" +) + +// All allowed values of IntakeRunnerResponse enum +var AllowedIntakeRunnerResponseStateEnumValues = []IntakeRunnerResponseState{ + "reconciling", + "active", + "deleting", +} + +func (v *IntakeRunnerResponseState) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson IntakeRunnerResponseState + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := IntakeRunnerResponseState(value) + for _, existing := range AllowedIntakeRunnerResponseStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid IntakeRunnerResponse", value) +} + +// NewIntakeRunnerResponseStateFromValue returns a pointer to a valid IntakeRunnerResponseState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewIntakeRunnerResponseStateFromValue(v IntakeRunnerResponseState) (*IntakeRunnerResponseState, error) { + ev := IntakeRunnerResponseState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for IntakeRunnerResponseState: valid values are %v", v, AllowedIntakeRunnerResponseStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v IntakeRunnerResponseState) IsValid() bool { + for _, existing := range AllowedIntakeRunnerResponseStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v IntakeRunnerResponseState) Ptr() *IntakeRunnerResponseState { + return &v +} + +type NullableIntakeRunnerResponseState struct { + value *IntakeRunnerResponseState + isSet bool +} + +func (v NullableIntakeRunnerResponseState) Get() *IntakeRunnerResponseState { + return v.value +} + +func (v *NullableIntakeRunnerResponseState) Set(val *IntakeRunnerResponseState) { + v.value = val + v.isSet = true +} + +func (v NullableIntakeRunnerResponseState) IsSet() bool { + return v.isSet +} + +func (v *NullableIntakeRunnerResponseState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntakeRunnerResponseState(val *IntakeRunnerResponseState) *NullableIntakeRunnerResponseState { + return &NullableIntakeRunnerResponseState{value: val, isSet: true} +} + +func (v NullableIntakeRunnerResponseState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntakeRunnerResponseState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type IntakeRunnerResponseGetStateAttributeType = *IntakeRunnerResponseState +type IntakeRunnerResponseGetStateArgType = IntakeRunnerResponseState +type IntakeRunnerResponseGetStateRetType = IntakeRunnerResponseState + +func getIntakeRunnerResponseGetStateAttributeTypeOk(arg IntakeRunnerResponseGetStateAttributeType) (ret IntakeRunnerResponseGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeRunnerResponseGetStateAttributeType(arg *IntakeRunnerResponseGetStateAttributeType, val IntakeRunnerResponseGetStateRetType) { + *arg = &val +} + +/* + types and functions for uri +*/ + +// isNotNullableString +type IntakeRunnerResponseGetUriAttributeType = *string + +func getIntakeRunnerResponseGetUriAttributeTypeOk(arg IntakeRunnerResponseGetUriAttributeType) (ret IntakeRunnerResponseGetUriRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeRunnerResponseGetUriAttributeType(arg *IntakeRunnerResponseGetUriAttributeType, val IntakeRunnerResponseGetUriRetType) { + *arg = &val +} + +type IntakeRunnerResponseGetUriArgType = string +type IntakeRunnerResponseGetUriRetType = string + +// IntakeRunnerResponse struct for IntakeRunnerResponse +type IntakeRunnerResponse struct { + // The point in time the resource was created. + // REQUIRED + CreateTime IntakeRunnerResponseGetCreateTimeAttributeType `json:"create_time" required:"true"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description IntakeRunnerResponseGetDescriptionAttributeType `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + // REQUIRED + DisplayName IntakeRunnerResponseGetDisplayNameAttributeType `json:"displayName" required:"true"` + // A auto generated unique id which identifies the resource. + // REQUIRED + Id IntakeRunnerResponseGetIdAttributeType `json:"id" required:"true"` + // Labels are a set of key-value pairs assigned to resources. + Labels IntakeRunnerResponseGetLabelsAttributeType `json:"labels,omitempty"` + // The maximum size of a message in kibibytes (1 KiB = 1024 bytes). + // REQUIRED + MaxMessageSizeKiB IntakeRunnerResponseGetMaxMessageSizeKiBAttributeType `json:"maxMessageSizeKiB" required:"true"` + // The maximum number of messages per hour. + // REQUIRED + MaxMessagesPerHour IntakeRunnerResponseGetMaxMessagesPerHourAttributeType `json:"maxMessagesPerHour" required:"true"` + // The current state of the resource. + // REQUIRED + State IntakeRunnerResponseGetStateAttributeType `json:"state" required:"true"` + // The URI for reaching the resource. + // REQUIRED + Uri IntakeRunnerResponseGetUriAttributeType `json:"uri" required:"true"` +} + +type _IntakeRunnerResponse IntakeRunnerResponse + +// NewIntakeRunnerResponse instantiates a new IntakeRunnerResponse 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 NewIntakeRunnerResponse(createTime IntakeRunnerResponseGetCreateTimeArgType, displayName IntakeRunnerResponseGetDisplayNameArgType, id IntakeRunnerResponseGetIdArgType, maxMessageSizeKiB IntakeRunnerResponseGetMaxMessageSizeKiBArgType, maxMessagesPerHour IntakeRunnerResponseGetMaxMessagesPerHourArgType, state IntakeRunnerResponseGetStateArgType, uri IntakeRunnerResponseGetUriArgType) *IntakeRunnerResponse { + this := IntakeRunnerResponse{} + setIntakeRunnerResponseGetCreateTimeAttributeType(&this.CreateTime, createTime) + setIntakeRunnerResponseGetDisplayNameAttributeType(&this.DisplayName, displayName) + setIntakeRunnerResponseGetIdAttributeType(&this.Id, id) + setIntakeRunnerResponseGetMaxMessageSizeKiBAttributeType(&this.MaxMessageSizeKiB, maxMessageSizeKiB) + setIntakeRunnerResponseGetMaxMessagesPerHourAttributeType(&this.MaxMessagesPerHour, maxMessagesPerHour) + setIntakeRunnerResponseGetStateAttributeType(&this.State, state) + setIntakeRunnerResponseGetUriAttributeType(&this.Uri, uri) + return &this +} + +// NewIntakeRunnerResponseWithDefaults instantiates a new IntakeRunnerResponse 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 NewIntakeRunnerResponseWithDefaults() *IntakeRunnerResponse { + this := IntakeRunnerResponse{} + return &this +} + +// GetCreateTime returns the CreateTime field value +func (o *IntakeRunnerResponse) GetCreateTime() (ret IntakeRunnerResponseGetCreateTimeRetType) { + ret, _ = o.GetCreateTimeOk() + return ret +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *IntakeRunnerResponse) GetCreateTimeOk() (ret IntakeRunnerResponseGetCreateTimeRetType, ok bool) { + return getIntakeRunnerResponseGetCreateTimeAttributeTypeOk(o.CreateTime) +} + +// SetCreateTime sets field value +func (o *IntakeRunnerResponse) SetCreateTime(v IntakeRunnerResponseGetCreateTimeRetType) { + setIntakeRunnerResponseGetCreateTimeAttributeType(&o.CreateTime, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *IntakeRunnerResponse) GetDescription() (res IntakeRunnerResponseGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeRunnerResponse) GetDescriptionOk() (ret IntakeRunnerResponseGetDescriptionRetType, ok bool) { + return getIntakeRunnerResponseGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *IntakeRunnerResponse) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *IntakeRunnerResponse) SetDescription(v IntakeRunnerResponseGetDescriptionRetType) { + setIntakeRunnerResponseGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *IntakeRunnerResponse) GetDisplayName() (ret IntakeRunnerResponseGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *IntakeRunnerResponse) GetDisplayNameOk() (ret IntakeRunnerResponseGetDisplayNameRetType, ok bool) { + return getIntakeRunnerResponseGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *IntakeRunnerResponse) SetDisplayName(v IntakeRunnerResponseGetDisplayNameRetType) { + setIntakeRunnerResponseGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetId returns the Id field value +func (o *IntakeRunnerResponse) GetId() (ret IntakeRunnerResponseGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *IntakeRunnerResponse) GetIdOk() (ret IntakeRunnerResponseGetIdRetType, ok bool) { + return getIntakeRunnerResponseGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *IntakeRunnerResponse) SetId(v IntakeRunnerResponseGetIdRetType) { + setIntakeRunnerResponseGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IntakeRunnerResponse) GetLabels() (res IntakeRunnerResponseGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// 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 *IntakeRunnerResponse) GetLabelsOk() (ret IntakeRunnerResponseGetLabelsRetType, ok bool) { + return getIntakeRunnerResponseGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *IntakeRunnerResponse) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *IntakeRunnerResponse) SetLabels(v IntakeRunnerResponseGetLabelsRetType) { + setIntakeRunnerResponseGetLabelsAttributeType(&o.Labels, v) +} + +// GetMaxMessageSizeKiB returns the MaxMessageSizeKiB field value +func (o *IntakeRunnerResponse) GetMaxMessageSizeKiB() (ret IntakeRunnerResponseGetMaxMessageSizeKiBRetType) { + ret, _ = o.GetMaxMessageSizeKiBOk() + return ret +} + +// GetMaxMessageSizeKiBOk returns a tuple with the MaxMessageSizeKiB field value +// and a boolean to check if the value has been set. +func (o *IntakeRunnerResponse) GetMaxMessageSizeKiBOk() (ret IntakeRunnerResponseGetMaxMessageSizeKiBRetType, ok bool) { + return getIntakeRunnerResponseGetMaxMessageSizeKiBAttributeTypeOk(o.MaxMessageSizeKiB) +} + +// SetMaxMessageSizeKiB sets field value +func (o *IntakeRunnerResponse) SetMaxMessageSizeKiB(v IntakeRunnerResponseGetMaxMessageSizeKiBRetType) { + setIntakeRunnerResponseGetMaxMessageSizeKiBAttributeType(&o.MaxMessageSizeKiB, v) +} + +// GetMaxMessagesPerHour returns the MaxMessagesPerHour field value +func (o *IntakeRunnerResponse) GetMaxMessagesPerHour() (ret IntakeRunnerResponseGetMaxMessagesPerHourRetType) { + ret, _ = o.GetMaxMessagesPerHourOk() + return ret +} + +// GetMaxMessagesPerHourOk returns a tuple with the MaxMessagesPerHour field value +// and a boolean to check if the value has been set. +func (o *IntakeRunnerResponse) GetMaxMessagesPerHourOk() (ret IntakeRunnerResponseGetMaxMessagesPerHourRetType, ok bool) { + return getIntakeRunnerResponseGetMaxMessagesPerHourAttributeTypeOk(o.MaxMessagesPerHour) +} + +// SetMaxMessagesPerHour sets field value +func (o *IntakeRunnerResponse) SetMaxMessagesPerHour(v IntakeRunnerResponseGetMaxMessagesPerHourRetType) { + setIntakeRunnerResponseGetMaxMessagesPerHourAttributeType(&o.MaxMessagesPerHour, v) +} + +// GetState returns the State field value +func (o *IntakeRunnerResponse) GetState() (ret IntakeRunnerResponseGetStateRetType) { + ret, _ = o.GetStateOk() + return ret +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *IntakeRunnerResponse) GetStateOk() (ret IntakeRunnerResponseGetStateRetType, ok bool) { + return getIntakeRunnerResponseGetStateAttributeTypeOk(o.State) +} + +// SetState sets field value +func (o *IntakeRunnerResponse) SetState(v IntakeRunnerResponseGetStateRetType) { + setIntakeRunnerResponseGetStateAttributeType(&o.State, v) +} + +// GetUri returns the Uri field value +func (o *IntakeRunnerResponse) GetUri() (ret IntakeRunnerResponseGetUriRetType) { + ret, _ = o.GetUriOk() + return ret +} + +// GetUriOk returns a tuple with the Uri field value +// and a boolean to check if the value has been set. +func (o *IntakeRunnerResponse) GetUriOk() (ret IntakeRunnerResponseGetUriRetType, ok bool) { + return getIntakeRunnerResponseGetUriAttributeTypeOk(o.Uri) +} + +// SetUri sets field value +func (o *IntakeRunnerResponse) SetUri(v IntakeRunnerResponseGetUriRetType) { + setIntakeRunnerResponseGetUriAttributeType(&o.Uri, v) +} + +func (o IntakeRunnerResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getIntakeRunnerResponseGetCreateTimeAttributeTypeOk(o.CreateTime); ok { + toSerialize["CreateTime"] = val + } + if val, ok := getIntakeRunnerResponseGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getIntakeRunnerResponseGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getIntakeRunnerResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getIntakeRunnerResponseGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getIntakeRunnerResponseGetMaxMessageSizeKiBAttributeTypeOk(o.MaxMessageSizeKiB); ok { + toSerialize["MaxMessageSizeKiB"] = val + } + if val, ok := getIntakeRunnerResponseGetMaxMessagesPerHourAttributeTypeOk(o.MaxMessagesPerHour); ok { + toSerialize["MaxMessagesPerHour"] = val + } + if val, ok := getIntakeRunnerResponseGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + if val, ok := getIntakeRunnerResponseGetUriAttributeTypeOk(o.Uri); ok { + toSerialize["Uri"] = val + } + return toSerialize, nil +} + +type NullableIntakeRunnerResponse struct { + value *IntakeRunnerResponse + isSet bool +} + +func (v NullableIntakeRunnerResponse) Get() *IntakeRunnerResponse { + return v.value +} + +func (v *NullableIntakeRunnerResponse) Set(val *IntakeRunnerResponse) { + v.value = val + v.isSet = true +} + +func (v NullableIntakeRunnerResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableIntakeRunnerResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntakeRunnerResponse(val *IntakeRunnerResponse) *NullableIntakeRunnerResponse { + return &NullableIntakeRunnerResponse{value: val, isSet: true} +} + +func (v NullableIntakeRunnerResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntakeRunnerResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_intake_runner_response_test.go b/pkg/intakebeta/model_intake_runner_response_test.go new file mode 100644 index 00000000..b32b31a0 --- /dev/null +++ b/pkg/intakebeta/model_intake_runner_response_test.go @@ -0,0 +1,65 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "testing" +) + +// isEnum + +func TestIntakeRunnerResponseState_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"reconciling"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"deleting"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := IntakeRunnerResponseState("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/intakebeta/model_intake_user_response.go b/pkg/intakebeta/model_intake_user_response.go new file mode 100644 index 00000000..ec5a92f1 --- /dev/null +++ b/pkg/intakebeta/model_intake_user_response.go @@ -0,0 +1,603 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the IntakeUserResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IntakeUserResponse{} + +/* + types and functions for clientConfig +*/ + +// isModel +type IntakeUserResponseGetClientConfigAttributeType = *ClientConfig +type IntakeUserResponseGetClientConfigArgType = ClientConfig +type IntakeUserResponseGetClientConfigRetType = ClientConfig + +func getIntakeUserResponseGetClientConfigAttributeTypeOk(arg IntakeUserResponseGetClientConfigAttributeType) (ret IntakeUserResponseGetClientConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeUserResponseGetClientConfigAttributeType(arg *IntakeUserResponseGetClientConfigAttributeType, val IntakeUserResponseGetClientConfigRetType) { + *arg = &val +} + +/* + types and functions for create_time +*/ + +// isDateTime +type IntakeUserResponseGetCreateTimeAttributeType = *time.Time +type IntakeUserResponseGetCreateTimeArgType = time.Time +type IntakeUserResponseGetCreateTimeRetType = time.Time + +func getIntakeUserResponseGetCreateTimeAttributeTypeOk(arg IntakeUserResponseGetCreateTimeAttributeType) (ret IntakeUserResponseGetCreateTimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeUserResponseGetCreateTimeAttributeType(arg *IntakeUserResponseGetCreateTimeAttributeType, val IntakeUserResponseGetCreateTimeRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type IntakeUserResponseGetDescriptionAttributeType = *string + +func getIntakeUserResponseGetDescriptionAttributeTypeOk(arg IntakeUserResponseGetDescriptionAttributeType) (ret IntakeUserResponseGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeUserResponseGetDescriptionAttributeType(arg *IntakeUserResponseGetDescriptionAttributeType, val IntakeUserResponseGetDescriptionRetType) { + *arg = &val +} + +type IntakeUserResponseGetDescriptionArgType = string +type IntakeUserResponseGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type IntakeUserResponseGetDisplayNameAttributeType = *string + +func getIntakeUserResponseGetDisplayNameAttributeTypeOk(arg IntakeUserResponseGetDisplayNameAttributeType) (ret IntakeUserResponseGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeUserResponseGetDisplayNameAttributeType(arg *IntakeUserResponseGetDisplayNameAttributeType, val IntakeUserResponseGetDisplayNameRetType) { + *arg = &val +} + +type IntakeUserResponseGetDisplayNameArgType = string +type IntakeUserResponseGetDisplayNameRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type IntakeUserResponseGetIdAttributeType = *string + +func getIntakeUserResponseGetIdAttributeTypeOk(arg IntakeUserResponseGetIdAttributeType) (ret IntakeUserResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeUserResponseGetIdAttributeType(arg *IntakeUserResponseGetIdAttributeType, val IntakeUserResponseGetIdRetType) { + *arg = &val +} + +type IntakeUserResponseGetIdArgType = string +type IntakeUserResponseGetIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type IntakeUserResponseGetLabelsAttributeType = *map[string]string +type IntakeUserResponseGetLabelsArgType = *map[string]string +type IntakeUserResponseGetLabelsRetType = *map[string]string + +func getIntakeUserResponseGetLabelsAttributeTypeOk(arg IntakeUserResponseGetLabelsAttributeType) (ret IntakeUserResponseGetLabelsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setIntakeUserResponseGetLabelsAttributeType(arg *IntakeUserResponseGetLabelsAttributeType, val IntakeUserResponseGetLabelsRetType) { + *arg = val +} + +/* + types and functions for state +*/ + +// isEnum + +// IntakeUserResponseState The current state of the resource. +// value type for enums +type IntakeUserResponseState string + +// List of State +const ( + INTAKEUSERRESPONSESTATE_RECONCILING IntakeUserResponseState = "reconciling" + INTAKEUSERRESPONSESTATE_ACTIVE IntakeUserResponseState = "active" + INTAKEUSERRESPONSESTATE_DELETING IntakeUserResponseState = "deleting" +) + +// All allowed values of IntakeUserResponse enum +var AllowedIntakeUserResponseStateEnumValues = []IntakeUserResponseState{ + "reconciling", + "active", + "deleting", +} + +func (v *IntakeUserResponseState) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson IntakeUserResponseState + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := IntakeUserResponseState(value) + for _, existing := range AllowedIntakeUserResponseStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid IntakeUserResponse", value) +} + +// NewIntakeUserResponseStateFromValue returns a pointer to a valid IntakeUserResponseState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewIntakeUserResponseStateFromValue(v IntakeUserResponseState) (*IntakeUserResponseState, error) { + ev := IntakeUserResponseState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for IntakeUserResponseState: valid values are %v", v, AllowedIntakeUserResponseStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v IntakeUserResponseState) IsValid() bool { + for _, existing := range AllowedIntakeUserResponseStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v IntakeUserResponseState) Ptr() *IntakeUserResponseState { + return &v +} + +type NullableIntakeUserResponseState struct { + value *IntakeUserResponseState + isSet bool +} + +func (v NullableIntakeUserResponseState) Get() *IntakeUserResponseState { + return v.value +} + +func (v *NullableIntakeUserResponseState) Set(val *IntakeUserResponseState) { + v.value = val + v.isSet = true +} + +func (v NullableIntakeUserResponseState) IsSet() bool { + return v.isSet +} + +func (v *NullableIntakeUserResponseState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntakeUserResponseState(val *IntakeUserResponseState) *NullableIntakeUserResponseState { + return &NullableIntakeUserResponseState{value: val, isSet: true} +} + +func (v NullableIntakeUserResponseState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntakeUserResponseState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type IntakeUserResponseGetStateAttributeType = *IntakeUserResponseState +type IntakeUserResponseGetStateArgType = IntakeUserResponseState +type IntakeUserResponseGetStateRetType = IntakeUserResponseState + +func getIntakeUserResponseGetStateAttributeTypeOk(arg IntakeUserResponseGetStateAttributeType) (ret IntakeUserResponseGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeUserResponseGetStateAttributeType(arg *IntakeUserResponseGetStateAttributeType, val IntakeUserResponseGetStateRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isEnumRef +type IntakeUserResponseGetTypeAttributeType = *UserType +type IntakeUserResponseGetTypeArgType = UserType +type IntakeUserResponseGetTypeRetType = UserType + +func getIntakeUserResponseGetTypeAttributeTypeOk(arg IntakeUserResponseGetTypeAttributeType) (ret IntakeUserResponseGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeUserResponseGetTypeAttributeType(arg *IntakeUserResponseGetTypeAttributeType, val IntakeUserResponseGetTypeRetType) { + *arg = &val +} + +/* + types and functions for user +*/ + +// isNotNullableString +type IntakeUserResponseGetUserAttributeType = *string + +func getIntakeUserResponseGetUserAttributeTypeOk(arg IntakeUserResponseGetUserAttributeType) (ret IntakeUserResponseGetUserRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setIntakeUserResponseGetUserAttributeType(arg *IntakeUserResponseGetUserAttributeType, val IntakeUserResponseGetUserRetType) { + *arg = &val +} + +type IntakeUserResponseGetUserArgType = string +type IntakeUserResponseGetUserRetType = string + +// IntakeUserResponse struct for IntakeUserResponse +type IntakeUserResponse struct { + ClientConfig IntakeUserResponseGetClientConfigAttributeType `json:"clientConfig,omitempty"` + // The point in time the resource was created. + // REQUIRED + CreateTime IntakeUserResponseGetCreateTimeAttributeType `json:"create_time" required:"true"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description IntakeUserResponseGetDescriptionAttributeType `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + // REQUIRED + DisplayName IntakeUserResponseGetDisplayNameAttributeType `json:"displayName" required:"true"` + // A auto generated unique id which identifies the resource. + // REQUIRED + Id IntakeUserResponseGetIdAttributeType `json:"id" required:"true"` + // Labels are a set of key-value pairs assigned to resources. + Labels IntakeUserResponseGetLabelsAttributeType `json:"labels,omitempty"` + // The current state of the resource. + // REQUIRED + State IntakeUserResponseGetStateAttributeType `json:"state" required:"true"` + // REQUIRED + Type IntakeUserResponseGetTypeAttributeType `json:"type" required:"true"` + // The user to connect to the intake. + // REQUIRED + User IntakeUserResponseGetUserAttributeType `json:"user" required:"true"` +} + +type _IntakeUserResponse IntakeUserResponse + +// NewIntakeUserResponse instantiates a new IntakeUserResponse 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 NewIntakeUserResponse(createTime IntakeUserResponseGetCreateTimeArgType, displayName IntakeUserResponseGetDisplayNameArgType, id IntakeUserResponseGetIdArgType, state IntakeUserResponseGetStateArgType, types IntakeUserResponseGetTypeArgType, user IntakeUserResponseGetUserArgType) *IntakeUserResponse { + this := IntakeUserResponse{} + setIntakeUserResponseGetCreateTimeAttributeType(&this.CreateTime, createTime) + setIntakeUserResponseGetDisplayNameAttributeType(&this.DisplayName, displayName) + setIntakeUserResponseGetIdAttributeType(&this.Id, id) + setIntakeUserResponseGetStateAttributeType(&this.State, state) + setIntakeUserResponseGetTypeAttributeType(&this.Type, types) + setIntakeUserResponseGetUserAttributeType(&this.User, user) + return &this +} + +// NewIntakeUserResponseWithDefaults instantiates a new IntakeUserResponse 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 NewIntakeUserResponseWithDefaults() *IntakeUserResponse { + this := IntakeUserResponse{} + var types UserType = USERTYPE_INTAKE + this.Type = &types + return &this +} + +// GetClientConfig returns the ClientConfig field value if set, zero value otherwise. +func (o *IntakeUserResponse) GetClientConfig() (res IntakeUserResponseGetClientConfigRetType) { + res, _ = o.GetClientConfigOk() + return +} + +// GetClientConfigOk returns a tuple with the ClientConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeUserResponse) GetClientConfigOk() (ret IntakeUserResponseGetClientConfigRetType, ok bool) { + return getIntakeUserResponseGetClientConfigAttributeTypeOk(o.ClientConfig) +} + +// HasClientConfig returns a boolean if a field has been set. +func (o *IntakeUserResponse) HasClientConfig() bool { + _, ok := o.GetClientConfigOk() + return ok +} + +// SetClientConfig gets a reference to the given ClientConfig and assigns it to the ClientConfig field. +func (o *IntakeUserResponse) SetClientConfig(v IntakeUserResponseGetClientConfigRetType) { + setIntakeUserResponseGetClientConfigAttributeType(&o.ClientConfig, v) +} + +// GetCreateTime returns the CreateTime field value +func (o *IntakeUserResponse) GetCreateTime() (ret IntakeUserResponseGetCreateTimeRetType) { + ret, _ = o.GetCreateTimeOk() + return ret +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value +// and a boolean to check if the value has been set. +func (o *IntakeUserResponse) GetCreateTimeOk() (ret IntakeUserResponseGetCreateTimeRetType, ok bool) { + return getIntakeUserResponseGetCreateTimeAttributeTypeOk(o.CreateTime) +} + +// SetCreateTime sets field value +func (o *IntakeUserResponse) SetCreateTime(v IntakeUserResponseGetCreateTimeRetType) { + setIntakeUserResponseGetCreateTimeAttributeType(&o.CreateTime, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *IntakeUserResponse) GetDescription() (res IntakeUserResponseGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntakeUserResponse) GetDescriptionOk() (ret IntakeUserResponseGetDescriptionRetType, ok bool) { + return getIntakeUserResponseGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *IntakeUserResponse) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *IntakeUserResponse) SetDescription(v IntakeUserResponseGetDescriptionRetType) { + setIntakeUserResponseGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *IntakeUserResponse) GetDisplayName() (ret IntakeUserResponseGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *IntakeUserResponse) GetDisplayNameOk() (ret IntakeUserResponseGetDisplayNameRetType, ok bool) { + return getIntakeUserResponseGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *IntakeUserResponse) SetDisplayName(v IntakeUserResponseGetDisplayNameRetType) { + setIntakeUserResponseGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetId returns the Id field value +func (o *IntakeUserResponse) GetId() (ret IntakeUserResponseGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *IntakeUserResponse) GetIdOk() (ret IntakeUserResponseGetIdRetType, ok bool) { + return getIntakeUserResponseGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *IntakeUserResponse) SetId(v IntakeUserResponseGetIdRetType) { + setIntakeUserResponseGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IntakeUserResponse) GetLabels() (res IntakeUserResponseGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// 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 *IntakeUserResponse) GetLabelsOk() (ret IntakeUserResponseGetLabelsRetType, ok bool) { + return getIntakeUserResponseGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *IntakeUserResponse) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *IntakeUserResponse) SetLabels(v IntakeUserResponseGetLabelsRetType) { + setIntakeUserResponseGetLabelsAttributeType(&o.Labels, v) +} + +// GetState returns the State field value +func (o *IntakeUserResponse) GetState() (ret IntakeUserResponseGetStateRetType) { + ret, _ = o.GetStateOk() + return ret +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *IntakeUserResponse) GetStateOk() (ret IntakeUserResponseGetStateRetType, ok bool) { + return getIntakeUserResponseGetStateAttributeTypeOk(o.State) +} + +// SetState sets field value +func (o *IntakeUserResponse) SetState(v IntakeUserResponseGetStateRetType) { + setIntakeUserResponseGetStateAttributeType(&o.State, v) +} + +// GetType returns the Type field value +func (o *IntakeUserResponse) GetType() (ret IntakeUserResponseGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *IntakeUserResponse) GetTypeOk() (ret IntakeUserResponseGetTypeRetType, ok bool) { + return getIntakeUserResponseGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *IntakeUserResponse) SetType(v IntakeUserResponseGetTypeRetType) { + setIntakeUserResponseGetTypeAttributeType(&o.Type, v) +} + +// GetUser returns the User field value +func (o *IntakeUserResponse) GetUser() (ret IntakeUserResponseGetUserRetType) { + ret, _ = o.GetUserOk() + return ret +} + +// GetUserOk returns a tuple with the User field value +// and a boolean to check if the value has been set. +func (o *IntakeUserResponse) GetUserOk() (ret IntakeUserResponseGetUserRetType, ok bool) { + return getIntakeUserResponseGetUserAttributeTypeOk(o.User) +} + +// SetUser sets field value +func (o *IntakeUserResponse) SetUser(v IntakeUserResponseGetUserRetType) { + setIntakeUserResponseGetUserAttributeType(&o.User, v) +} + +func (o IntakeUserResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getIntakeUserResponseGetClientConfigAttributeTypeOk(o.ClientConfig); ok { + toSerialize["ClientConfig"] = val + } + if val, ok := getIntakeUserResponseGetCreateTimeAttributeTypeOk(o.CreateTime); ok { + toSerialize["CreateTime"] = val + } + if val, ok := getIntakeUserResponseGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getIntakeUserResponseGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getIntakeUserResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getIntakeUserResponseGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getIntakeUserResponseGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + if val, ok := getIntakeUserResponseGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getIntakeUserResponseGetUserAttributeTypeOk(o.User); ok { + toSerialize["User"] = val + } + return toSerialize, nil +} + +type NullableIntakeUserResponse struct { + value *IntakeUserResponse + isSet bool +} + +func (v NullableIntakeUserResponse) Get() *IntakeUserResponse { + return v.value +} + +func (v *NullableIntakeUserResponse) Set(val *IntakeUserResponse) { + v.value = val + v.isSet = true +} + +func (v NullableIntakeUserResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableIntakeUserResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntakeUserResponse(val *IntakeUserResponse) *NullableIntakeUserResponse { + return &NullableIntakeUserResponse{value: val, isSet: true} +} + +func (v NullableIntakeUserResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntakeUserResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_intake_user_response_test.go b/pkg/intakebeta/model_intake_user_response_test.go new file mode 100644 index 00000000..9ed68c65 --- /dev/null +++ b/pkg/intakebeta/model_intake_user_response_test.go @@ -0,0 +1,65 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "testing" +) + +// isEnum + +func TestIntakeUserResponseState_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"reconciling"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"deleting"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := IntakeUserResponseState("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/intakebeta/model_list_intake_runners_response.go b/pkg/intakebeta/model_list_intake_runners_response.go new file mode 100644 index 00000000..5c25a09a --- /dev/null +++ b/pkg/intakebeta/model_list_intake_runners_response.go @@ -0,0 +1,174 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the ListIntakeRunnersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListIntakeRunnersResponse{} + +/* + types and functions for intakeRunners +*/ + +// isArray +type ListIntakeRunnersResponseGetIntakeRunnersAttributeType = *[]IntakeRunnerResponse +type ListIntakeRunnersResponseGetIntakeRunnersArgType = []IntakeRunnerResponse +type ListIntakeRunnersResponseGetIntakeRunnersRetType = []IntakeRunnerResponse + +func getListIntakeRunnersResponseGetIntakeRunnersAttributeTypeOk(arg ListIntakeRunnersResponseGetIntakeRunnersAttributeType) (ret ListIntakeRunnersResponseGetIntakeRunnersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListIntakeRunnersResponseGetIntakeRunnersAttributeType(arg *ListIntakeRunnersResponseGetIntakeRunnersAttributeType, val ListIntakeRunnersResponseGetIntakeRunnersRetType) { + *arg = &val +} + +/* + types and functions for nextPageToken +*/ + +// isNotNullableString +type ListIntakeRunnersResponseGetNextPageTokenAttributeType = *string + +func getListIntakeRunnersResponseGetNextPageTokenAttributeTypeOk(arg ListIntakeRunnersResponseGetNextPageTokenAttributeType) (ret ListIntakeRunnersResponseGetNextPageTokenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListIntakeRunnersResponseGetNextPageTokenAttributeType(arg *ListIntakeRunnersResponseGetNextPageTokenAttributeType, val ListIntakeRunnersResponseGetNextPageTokenRetType) { + *arg = &val +} + +type ListIntakeRunnersResponseGetNextPageTokenArgType = string +type ListIntakeRunnersResponseGetNextPageTokenRetType = string + +// ListIntakeRunnersResponse struct for ListIntakeRunnersResponse +type ListIntakeRunnersResponse struct { + // REQUIRED + IntakeRunners ListIntakeRunnersResponseGetIntakeRunnersAttributeType `json:"intakeRunners" required:"true"` + // A token to retrieve the next page of results. + NextPageToken ListIntakeRunnersResponseGetNextPageTokenAttributeType `json:"nextPageToken,omitempty"` +} + +type _ListIntakeRunnersResponse ListIntakeRunnersResponse + +// NewListIntakeRunnersResponse instantiates a new ListIntakeRunnersResponse 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 NewListIntakeRunnersResponse(intakeRunners ListIntakeRunnersResponseGetIntakeRunnersArgType) *ListIntakeRunnersResponse { + this := ListIntakeRunnersResponse{} + setListIntakeRunnersResponseGetIntakeRunnersAttributeType(&this.IntakeRunners, intakeRunners) + return &this +} + +// NewListIntakeRunnersResponseWithDefaults instantiates a new ListIntakeRunnersResponse 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 NewListIntakeRunnersResponseWithDefaults() *ListIntakeRunnersResponse { + this := ListIntakeRunnersResponse{} + return &this +} + +// GetIntakeRunners returns the IntakeRunners field value +func (o *ListIntakeRunnersResponse) GetIntakeRunners() (ret ListIntakeRunnersResponseGetIntakeRunnersRetType) { + ret, _ = o.GetIntakeRunnersOk() + return ret +} + +// GetIntakeRunnersOk returns a tuple with the IntakeRunners field value +// and a boolean to check if the value has been set. +func (o *ListIntakeRunnersResponse) GetIntakeRunnersOk() (ret ListIntakeRunnersResponseGetIntakeRunnersRetType, ok bool) { + return getListIntakeRunnersResponseGetIntakeRunnersAttributeTypeOk(o.IntakeRunners) +} + +// SetIntakeRunners sets field value +func (o *ListIntakeRunnersResponse) SetIntakeRunners(v ListIntakeRunnersResponseGetIntakeRunnersRetType) { + setListIntakeRunnersResponseGetIntakeRunnersAttributeType(&o.IntakeRunners, v) +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListIntakeRunnersResponse) GetNextPageToken() (res ListIntakeRunnersResponseGetNextPageTokenRetType) { + res, _ = o.GetNextPageTokenOk() + return +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListIntakeRunnersResponse) GetNextPageTokenOk() (ret ListIntakeRunnersResponseGetNextPageTokenRetType, ok bool) { + return getListIntakeRunnersResponseGetNextPageTokenAttributeTypeOk(o.NextPageToken) +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ListIntakeRunnersResponse) HasNextPageToken() bool { + _, ok := o.GetNextPageTokenOk() + return ok +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ListIntakeRunnersResponse) SetNextPageToken(v ListIntakeRunnersResponseGetNextPageTokenRetType) { + setListIntakeRunnersResponseGetNextPageTokenAttributeType(&o.NextPageToken, v) +} + +func (o ListIntakeRunnersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListIntakeRunnersResponseGetIntakeRunnersAttributeTypeOk(o.IntakeRunners); ok { + toSerialize["IntakeRunners"] = val + } + if val, ok := getListIntakeRunnersResponseGetNextPageTokenAttributeTypeOk(o.NextPageToken); ok { + toSerialize["NextPageToken"] = val + } + return toSerialize, nil +} + +type NullableListIntakeRunnersResponse struct { + value *ListIntakeRunnersResponse + isSet bool +} + +func (v NullableListIntakeRunnersResponse) Get() *ListIntakeRunnersResponse { + return v.value +} + +func (v *NullableListIntakeRunnersResponse) Set(val *ListIntakeRunnersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListIntakeRunnersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListIntakeRunnersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListIntakeRunnersResponse(val *ListIntakeRunnersResponse) *NullableListIntakeRunnersResponse { + return &NullableListIntakeRunnersResponse{value: val, isSet: true} +} + +func (v NullableListIntakeRunnersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListIntakeRunnersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_list_intake_runners_response_test.go b/pkg/intakebeta/model_list_intake_runners_response_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_list_intake_runners_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_list_intake_users_response.go b/pkg/intakebeta/model_list_intake_users_response.go new file mode 100644 index 00000000..ef4baa1e --- /dev/null +++ b/pkg/intakebeta/model_list_intake_users_response.go @@ -0,0 +1,174 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the ListIntakeUsersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListIntakeUsersResponse{} + +/* + types and functions for intakeUsers +*/ + +// isArray +type ListIntakeUsersResponseGetIntakeUsersAttributeType = *[]IntakeUserResponse +type ListIntakeUsersResponseGetIntakeUsersArgType = []IntakeUserResponse +type ListIntakeUsersResponseGetIntakeUsersRetType = []IntakeUserResponse + +func getListIntakeUsersResponseGetIntakeUsersAttributeTypeOk(arg ListIntakeUsersResponseGetIntakeUsersAttributeType) (ret ListIntakeUsersResponseGetIntakeUsersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListIntakeUsersResponseGetIntakeUsersAttributeType(arg *ListIntakeUsersResponseGetIntakeUsersAttributeType, val ListIntakeUsersResponseGetIntakeUsersRetType) { + *arg = &val +} + +/* + types and functions for nextPageToken +*/ + +// isNotNullableString +type ListIntakeUsersResponseGetNextPageTokenAttributeType = *string + +func getListIntakeUsersResponseGetNextPageTokenAttributeTypeOk(arg ListIntakeUsersResponseGetNextPageTokenAttributeType) (ret ListIntakeUsersResponseGetNextPageTokenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListIntakeUsersResponseGetNextPageTokenAttributeType(arg *ListIntakeUsersResponseGetNextPageTokenAttributeType, val ListIntakeUsersResponseGetNextPageTokenRetType) { + *arg = &val +} + +type ListIntakeUsersResponseGetNextPageTokenArgType = string +type ListIntakeUsersResponseGetNextPageTokenRetType = string + +// ListIntakeUsersResponse struct for ListIntakeUsersResponse +type ListIntakeUsersResponse struct { + // REQUIRED + IntakeUsers ListIntakeUsersResponseGetIntakeUsersAttributeType `json:"intakeUsers" required:"true"` + // A token to retrieve the next page of results. + NextPageToken ListIntakeUsersResponseGetNextPageTokenAttributeType `json:"nextPageToken,omitempty"` +} + +type _ListIntakeUsersResponse ListIntakeUsersResponse + +// NewListIntakeUsersResponse instantiates a new ListIntakeUsersResponse 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 NewListIntakeUsersResponse(intakeUsers ListIntakeUsersResponseGetIntakeUsersArgType) *ListIntakeUsersResponse { + this := ListIntakeUsersResponse{} + setListIntakeUsersResponseGetIntakeUsersAttributeType(&this.IntakeUsers, intakeUsers) + return &this +} + +// NewListIntakeUsersResponseWithDefaults instantiates a new ListIntakeUsersResponse 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 NewListIntakeUsersResponseWithDefaults() *ListIntakeUsersResponse { + this := ListIntakeUsersResponse{} + return &this +} + +// GetIntakeUsers returns the IntakeUsers field value +func (o *ListIntakeUsersResponse) GetIntakeUsers() (ret ListIntakeUsersResponseGetIntakeUsersRetType) { + ret, _ = o.GetIntakeUsersOk() + return ret +} + +// GetIntakeUsersOk returns a tuple with the IntakeUsers field value +// and a boolean to check if the value has been set. +func (o *ListIntakeUsersResponse) GetIntakeUsersOk() (ret ListIntakeUsersResponseGetIntakeUsersRetType, ok bool) { + return getListIntakeUsersResponseGetIntakeUsersAttributeTypeOk(o.IntakeUsers) +} + +// SetIntakeUsers sets field value +func (o *ListIntakeUsersResponse) SetIntakeUsers(v ListIntakeUsersResponseGetIntakeUsersRetType) { + setListIntakeUsersResponseGetIntakeUsersAttributeType(&o.IntakeUsers, v) +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListIntakeUsersResponse) GetNextPageToken() (res ListIntakeUsersResponseGetNextPageTokenRetType) { + res, _ = o.GetNextPageTokenOk() + return +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListIntakeUsersResponse) GetNextPageTokenOk() (ret ListIntakeUsersResponseGetNextPageTokenRetType, ok bool) { + return getListIntakeUsersResponseGetNextPageTokenAttributeTypeOk(o.NextPageToken) +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ListIntakeUsersResponse) HasNextPageToken() bool { + _, ok := o.GetNextPageTokenOk() + return ok +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ListIntakeUsersResponse) SetNextPageToken(v ListIntakeUsersResponseGetNextPageTokenRetType) { + setListIntakeUsersResponseGetNextPageTokenAttributeType(&o.NextPageToken, v) +} + +func (o ListIntakeUsersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListIntakeUsersResponseGetIntakeUsersAttributeTypeOk(o.IntakeUsers); ok { + toSerialize["IntakeUsers"] = val + } + if val, ok := getListIntakeUsersResponseGetNextPageTokenAttributeTypeOk(o.NextPageToken); ok { + toSerialize["NextPageToken"] = val + } + return toSerialize, nil +} + +type NullableListIntakeUsersResponse struct { + value *ListIntakeUsersResponse + isSet bool +} + +func (v NullableListIntakeUsersResponse) Get() *ListIntakeUsersResponse { + return v.value +} + +func (v *NullableListIntakeUsersResponse) Set(val *ListIntakeUsersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListIntakeUsersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListIntakeUsersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListIntakeUsersResponse(val *ListIntakeUsersResponse) *NullableListIntakeUsersResponse { + return &NullableListIntakeUsersResponse{value: val, isSet: true} +} + +func (v NullableListIntakeUsersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListIntakeUsersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_list_intake_users_response_test.go b/pkg/intakebeta/model_list_intake_users_response_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_list_intake_users_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_list_intakes_response.go b/pkg/intakebeta/model_list_intakes_response.go new file mode 100644 index 00000000..cc9f3136 --- /dev/null +++ b/pkg/intakebeta/model_list_intakes_response.go @@ -0,0 +1,174 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the ListIntakesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListIntakesResponse{} + +/* + types and functions for intakes +*/ + +// isArray +type ListIntakesResponseGetIntakesAttributeType = *[]IntakeResponse +type ListIntakesResponseGetIntakesArgType = []IntakeResponse +type ListIntakesResponseGetIntakesRetType = []IntakeResponse + +func getListIntakesResponseGetIntakesAttributeTypeOk(arg ListIntakesResponseGetIntakesAttributeType) (ret ListIntakesResponseGetIntakesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListIntakesResponseGetIntakesAttributeType(arg *ListIntakesResponseGetIntakesAttributeType, val ListIntakesResponseGetIntakesRetType) { + *arg = &val +} + +/* + types and functions for nextPageToken +*/ + +// isNotNullableString +type ListIntakesResponseGetNextPageTokenAttributeType = *string + +func getListIntakesResponseGetNextPageTokenAttributeTypeOk(arg ListIntakesResponseGetNextPageTokenAttributeType) (ret ListIntakesResponseGetNextPageTokenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListIntakesResponseGetNextPageTokenAttributeType(arg *ListIntakesResponseGetNextPageTokenAttributeType, val ListIntakesResponseGetNextPageTokenRetType) { + *arg = &val +} + +type ListIntakesResponseGetNextPageTokenArgType = string +type ListIntakesResponseGetNextPageTokenRetType = string + +// ListIntakesResponse struct for ListIntakesResponse +type ListIntakesResponse struct { + // REQUIRED + Intakes ListIntakesResponseGetIntakesAttributeType `json:"intakes" required:"true"` + // A token to retrieve the next page of results. + NextPageToken ListIntakesResponseGetNextPageTokenAttributeType `json:"nextPageToken,omitempty"` +} + +type _ListIntakesResponse ListIntakesResponse + +// NewListIntakesResponse instantiates a new ListIntakesResponse 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 NewListIntakesResponse(intakes ListIntakesResponseGetIntakesArgType) *ListIntakesResponse { + this := ListIntakesResponse{} + setListIntakesResponseGetIntakesAttributeType(&this.Intakes, intakes) + return &this +} + +// NewListIntakesResponseWithDefaults instantiates a new ListIntakesResponse 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 NewListIntakesResponseWithDefaults() *ListIntakesResponse { + this := ListIntakesResponse{} + return &this +} + +// GetIntakes returns the Intakes field value +func (o *ListIntakesResponse) GetIntakes() (ret ListIntakesResponseGetIntakesRetType) { + ret, _ = o.GetIntakesOk() + return ret +} + +// GetIntakesOk returns a tuple with the Intakes field value +// and a boolean to check if the value has been set. +func (o *ListIntakesResponse) GetIntakesOk() (ret ListIntakesResponseGetIntakesRetType, ok bool) { + return getListIntakesResponseGetIntakesAttributeTypeOk(o.Intakes) +} + +// SetIntakes sets field value +func (o *ListIntakesResponse) SetIntakes(v ListIntakesResponseGetIntakesRetType) { + setListIntakesResponseGetIntakesAttributeType(&o.Intakes, v) +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *ListIntakesResponse) GetNextPageToken() (res ListIntakesResponseGetNextPageTokenRetType) { + res, _ = o.GetNextPageTokenOk() + return +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListIntakesResponse) GetNextPageTokenOk() (ret ListIntakesResponseGetNextPageTokenRetType, ok bool) { + return getListIntakesResponseGetNextPageTokenAttributeTypeOk(o.NextPageToken) +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *ListIntakesResponse) HasNextPageToken() bool { + _, ok := o.GetNextPageTokenOk() + return ok +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *ListIntakesResponse) SetNextPageToken(v ListIntakesResponseGetNextPageTokenRetType) { + setListIntakesResponseGetNextPageTokenAttributeType(&o.NextPageToken, v) +} + +func (o ListIntakesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListIntakesResponseGetIntakesAttributeTypeOk(o.Intakes); ok { + toSerialize["Intakes"] = val + } + if val, ok := getListIntakesResponseGetNextPageTokenAttributeTypeOk(o.NextPageToken); ok { + toSerialize["NextPageToken"] = val + } + return toSerialize, nil +} + +type NullableListIntakesResponse struct { + value *ListIntakesResponse + isSet bool +} + +func (v NullableListIntakesResponse) Get() *ListIntakesResponse { + return v.value +} + +func (v *NullableListIntakesResponse) Set(val *ListIntakesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListIntakesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListIntakesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListIntakesResponse(val *ListIntakesResponse) *NullableListIntakesResponse { + return &NullableListIntakesResponse{value: val, isSet: true} +} + +func (v NullableListIntakesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListIntakesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_list_intakes_response_test.go b/pkg/intakebeta/model_list_intakes_response_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_list_intakes_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_partitioning_type.go b/pkg/intakebeta/model_partitioning_type.go new file mode 100644 index 00000000..91ebaceb --- /dev/null +++ b/pkg/intakebeta/model_partitioning_type.go @@ -0,0 +1,117 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" + "fmt" +) + +// PartitioningType The target table's partitioning. * `none` disables partitioning, the default. * `intake-time` configures daily partitioning based on the automatically created ingestion time column `__intake_ts`. * `manual` allows arbitrary Iceberg partitioning expression to be set via `partitionBy`. +type PartitioningType string + +// List of partitioningType +const ( + PARTITIONINGTYPE_NONE PartitioningType = "none" + PARTITIONINGTYPE_INTAKE_TIME PartitioningType = "intake-time" + PARTITIONINGTYPE_MANUAL PartitioningType = "manual" +) + +// All allowed values of PartitioningType enum +var AllowedPartitioningTypeEnumValues = []PartitioningType{ + "none", + "intake-time", + "manual", +} + +func (v *PartitioningType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := PartitioningType(value) + for _, existing := range AllowedPartitioningTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PartitioningType", value) +} + +// NewPartitioningTypeFromValue returns a pointer to a valid PartitioningType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPartitioningTypeFromValue(v string) (*PartitioningType, error) { + ev := PartitioningType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PartitioningType: valid values are %v", v, AllowedPartitioningTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PartitioningType) IsValid() bool { + for _, existing := range AllowedPartitioningTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to partitioningType value +func (v PartitioningType) Ptr() *PartitioningType { + return &v +} + +type NullablePartitioningType struct { + value *PartitioningType + isSet bool +} + +func (v NullablePartitioningType) Get() *PartitioningType { + return v.value +} + +func (v *NullablePartitioningType) Set(val *PartitioningType) { + v.value = val + v.isSet = true +} + +func (v NullablePartitioningType) IsSet() bool { + return v.isSet +} + +func (v *NullablePartitioningType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartitioningType(val *PartitioningType) *NullablePartitioningType { + return &NullablePartitioningType{value: val, isSet: true} +} + +func (v NullablePartitioningType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartitioningType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_partitioning_type_test.go b/pkg/intakebeta/model_partitioning_type_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_partitioning_type_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_partitioning_update_type.go b/pkg/intakebeta/model_partitioning_update_type.go new file mode 100644 index 00000000..f5930c98 --- /dev/null +++ b/pkg/intakebeta/model_partitioning_update_type.go @@ -0,0 +1,117 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" + "fmt" +) + +// PartitioningUpdateType The target table's partitioning. * `none` disables partitioning. * `intake-time` configures daily partitioning based on the automatically created ingestion time column `__intake_ts`. * `manual` allows arbitrary Iceberg partitioning expression to be set via `partitionBy`. +type PartitioningUpdateType string + +// List of partitioningUpdateType +const ( + PARTITIONINGUPDATETYPE_NONE PartitioningUpdateType = "none" + PARTITIONINGUPDATETYPE_INTAKE_TIME PartitioningUpdateType = "intake-time" + PARTITIONINGUPDATETYPE_MANUAL PartitioningUpdateType = "manual" +) + +// All allowed values of PartitioningUpdateType enum +var AllowedPartitioningUpdateTypeEnumValues = []PartitioningUpdateType{ + "none", + "intake-time", + "manual", +} + +func (v *PartitioningUpdateType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := PartitioningUpdateType(value) + for _, existing := range AllowedPartitioningUpdateTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PartitioningUpdateType", value) +} + +// NewPartitioningUpdateTypeFromValue returns a pointer to a valid PartitioningUpdateType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPartitioningUpdateTypeFromValue(v string) (*PartitioningUpdateType, error) { + ev := PartitioningUpdateType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PartitioningUpdateType: valid values are %v", v, AllowedPartitioningUpdateTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PartitioningUpdateType) IsValid() bool { + for _, existing := range AllowedPartitioningUpdateTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to partitioningUpdateType value +func (v PartitioningUpdateType) Ptr() *PartitioningUpdateType { + return &v +} + +type NullablePartitioningUpdateType struct { + value *PartitioningUpdateType + isSet bool +} + +func (v NullablePartitioningUpdateType) Get() *PartitioningUpdateType { + return v.value +} + +func (v *NullablePartitioningUpdateType) Set(val *PartitioningUpdateType) { + v.value = val + v.isSet = true +} + +func (v NullablePartitioningUpdateType) IsSet() bool { + return v.isSet +} + +func (v *NullablePartitioningUpdateType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartitioningUpdateType(val *PartitioningUpdateType) *NullablePartitioningUpdateType { + return &NullablePartitioningUpdateType{value: val, isSet: true} +} + +func (v NullablePartitioningUpdateType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartitioningUpdateType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_partitioning_update_type_test.go b/pkg/intakebeta/model_partitioning_update_type_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_partitioning_update_type_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_update_intake_payload.go b/pkg/intakebeta/model_update_intake_payload.go new file mode 100644 index 00000000..5c647424 --- /dev/null +++ b/pkg/intakebeta/model_update_intake_payload.go @@ -0,0 +1,321 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the UpdateIntakePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateIntakePayload{} + +/* + types and functions for catalog +*/ + +// isModel +type UpdateIntakePayloadGetCatalogAttributeType = *IntakeCatalogPatch +type UpdateIntakePayloadGetCatalogArgType = IntakeCatalogPatch +type UpdateIntakePayloadGetCatalogRetType = IntakeCatalogPatch + +func getUpdateIntakePayloadGetCatalogAttributeTypeOk(arg UpdateIntakePayloadGetCatalogAttributeType) (ret UpdateIntakePayloadGetCatalogRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakePayloadGetCatalogAttributeType(arg *UpdateIntakePayloadGetCatalogAttributeType, val UpdateIntakePayloadGetCatalogRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateIntakePayloadGetDescriptionAttributeType = *string + +func getUpdateIntakePayloadGetDescriptionAttributeTypeOk(arg UpdateIntakePayloadGetDescriptionAttributeType) (ret UpdateIntakePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakePayloadGetDescriptionAttributeType(arg *UpdateIntakePayloadGetDescriptionAttributeType, val UpdateIntakePayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateIntakePayloadGetDescriptionArgType = string +type UpdateIntakePayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type UpdateIntakePayloadGetDisplayNameAttributeType = *string + +func getUpdateIntakePayloadGetDisplayNameAttributeTypeOk(arg UpdateIntakePayloadGetDisplayNameAttributeType) (ret UpdateIntakePayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakePayloadGetDisplayNameAttributeType(arg *UpdateIntakePayloadGetDisplayNameAttributeType, val UpdateIntakePayloadGetDisplayNameRetType) { + *arg = &val +} + +type UpdateIntakePayloadGetDisplayNameArgType = string +type UpdateIntakePayloadGetDisplayNameRetType = string + +/* + types and functions for intakeRunnerId +*/ + +// isNotNullableString +type UpdateIntakePayloadGetIntakeRunnerIdAttributeType = *string + +func getUpdateIntakePayloadGetIntakeRunnerIdAttributeTypeOk(arg UpdateIntakePayloadGetIntakeRunnerIdAttributeType) (ret UpdateIntakePayloadGetIntakeRunnerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakePayloadGetIntakeRunnerIdAttributeType(arg *UpdateIntakePayloadGetIntakeRunnerIdAttributeType, val UpdateIntakePayloadGetIntakeRunnerIdRetType) { + *arg = &val +} + +type UpdateIntakePayloadGetIntakeRunnerIdArgType = string +type UpdateIntakePayloadGetIntakeRunnerIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type UpdateIntakePayloadGetLabelsAttributeType = *map[string]string +type UpdateIntakePayloadGetLabelsArgType = *map[string]string +type UpdateIntakePayloadGetLabelsRetType = *map[string]string + +func getUpdateIntakePayloadGetLabelsAttributeTypeOk(arg UpdateIntakePayloadGetLabelsAttributeType) (ret UpdateIntakePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setUpdateIntakePayloadGetLabelsAttributeType(arg *UpdateIntakePayloadGetLabelsAttributeType, val UpdateIntakePayloadGetLabelsRetType) { + *arg = val +} + +// UpdateIntakePayload struct for UpdateIntakePayload +type UpdateIntakePayload struct { + Catalog UpdateIntakePayloadGetCatalogAttributeType `json:"catalog,omitempty"` + // The description is a longer text chosen by the user to provide more context for the resource. + Description UpdateIntakePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName UpdateIntakePayloadGetDisplayNameAttributeType `json:"displayName,omitempty"` + // The unique id of the intake runner this intake should run on. + // REQUIRED + IntakeRunnerId UpdateIntakePayloadGetIntakeRunnerIdAttributeType `json:"intakeRunnerId" required:"true"` + // Labels are key-value pairs associated with the resource. To update labels: - Provide a new set of key-value pairs to replace the existing labels. - Send empty object `{}` to remove all labels. - Omit this field to leave the labels unchanged. + Labels UpdateIntakePayloadGetLabelsAttributeType `json:"labels,omitempty"` +} + +type _UpdateIntakePayload UpdateIntakePayload + +// NewUpdateIntakePayload instantiates a new UpdateIntakePayload 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 NewUpdateIntakePayload(intakeRunnerId UpdateIntakePayloadGetIntakeRunnerIdArgType) *UpdateIntakePayload { + this := UpdateIntakePayload{} + setUpdateIntakePayloadGetIntakeRunnerIdAttributeType(&this.IntakeRunnerId, intakeRunnerId) + return &this +} + +// NewUpdateIntakePayloadWithDefaults instantiates a new UpdateIntakePayload 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 NewUpdateIntakePayloadWithDefaults() *UpdateIntakePayload { + this := UpdateIntakePayload{} + return &this +} + +// GetCatalog returns the Catalog field value if set, zero value otherwise. +func (o *UpdateIntakePayload) GetCatalog() (res UpdateIntakePayloadGetCatalogRetType) { + res, _ = o.GetCatalogOk() + return +} + +// GetCatalogOk returns a tuple with the Catalog field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakePayload) GetCatalogOk() (ret UpdateIntakePayloadGetCatalogRetType, ok bool) { + return getUpdateIntakePayloadGetCatalogAttributeTypeOk(o.Catalog) +} + +// HasCatalog returns a boolean if a field has been set. +func (o *UpdateIntakePayload) HasCatalog() bool { + _, ok := o.GetCatalogOk() + return ok +} + +// SetCatalog gets a reference to the given IntakeCatalogPatch and assigns it to the Catalog field. +func (o *UpdateIntakePayload) SetCatalog(v UpdateIntakePayloadGetCatalogRetType) { + setUpdateIntakePayloadGetCatalogAttributeType(&o.Catalog, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateIntakePayload) GetDescription() (res UpdateIntakePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakePayload) GetDescriptionOk() (ret UpdateIntakePayloadGetDescriptionRetType, ok bool) { + return getUpdateIntakePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateIntakePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateIntakePayload) SetDescription(v UpdateIntakePayloadGetDescriptionRetType) { + setUpdateIntakePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateIntakePayload) GetDisplayName() (res UpdateIntakePayloadGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakePayload) GetDisplayNameOk() (ret UpdateIntakePayloadGetDisplayNameRetType, ok bool) { + return getUpdateIntakePayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateIntakePayload) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateIntakePayload) SetDisplayName(v UpdateIntakePayloadGetDisplayNameRetType) { + setUpdateIntakePayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetIntakeRunnerId returns the IntakeRunnerId field value +func (o *UpdateIntakePayload) GetIntakeRunnerId() (ret UpdateIntakePayloadGetIntakeRunnerIdRetType) { + ret, _ = o.GetIntakeRunnerIdOk() + return ret +} + +// GetIntakeRunnerIdOk returns a tuple with the IntakeRunnerId field value +// and a boolean to check if the value has been set. +func (o *UpdateIntakePayload) GetIntakeRunnerIdOk() (ret UpdateIntakePayloadGetIntakeRunnerIdRetType, ok bool) { + return getUpdateIntakePayloadGetIntakeRunnerIdAttributeTypeOk(o.IntakeRunnerId) +} + +// SetIntakeRunnerId sets field value +func (o *UpdateIntakePayload) SetIntakeRunnerId(v UpdateIntakePayloadGetIntakeRunnerIdRetType) { + setUpdateIntakePayloadGetIntakeRunnerIdAttributeType(&o.IntakeRunnerId, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateIntakePayload) GetLabels() (res UpdateIntakePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// 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 *UpdateIntakePayload) GetLabelsOk() (ret UpdateIntakePayloadGetLabelsRetType, ok bool) { + return getUpdateIntakePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateIntakePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateIntakePayload) SetLabels(v UpdateIntakePayloadGetLabelsRetType) { + setUpdateIntakePayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o UpdateIntakePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateIntakePayloadGetCatalogAttributeTypeOk(o.Catalog); ok { + toSerialize["Catalog"] = val + } + if val, ok := getUpdateIntakePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateIntakePayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getUpdateIntakePayloadGetIntakeRunnerIdAttributeTypeOk(o.IntakeRunnerId); ok { + toSerialize["IntakeRunnerId"] = val + } + if val, ok := getUpdateIntakePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableUpdateIntakePayload struct { + value *UpdateIntakePayload + isSet bool +} + +func (v NullableUpdateIntakePayload) Get() *UpdateIntakePayload { + return v.value +} + +func (v *NullableUpdateIntakePayload) Set(val *UpdateIntakePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateIntakePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateIntakePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateIntakePayload(val *UpdateIntakePayload) *NullableUpdateIntakePayload { + return &NullableUpdateIntakePayload{value: val, isSet: true} +} + +func (v NullableUpdateIntakePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateIntakePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_update_intake_payload_test.go b/pkg/intakebeta/model_update_intake_payload_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_update_intake_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_update_intake_runner_payload.go b/pkg/intakebeta/model_update_intake_runner_payload.go new file mode 100644 index 00000000..271ea5ea --- /dev/null +++ b/pkg/intakebeta/model_update_intake_runner_payload.go @@ -0,0 +1,323 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the UpdateIntakeRunnerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateIntakeRunnerPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateIntakeRunnerPayloadGetDescriptionAttributeType = *string + +func getUpdateIntakeRunnerPayloadGetDescriptionAttributeTypeOk(arg UpdateIntakeRunnerPayloadGetDescriptionAttributeType) (ret UpdateIntakeRunnerPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakeRunnerPayloadGetDescriptionAttributeType(arg *UpdateIntakeRunnerPayloadGetDescriptionAttributeType, val UpdateIntakeRunnerPayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateIntakeRunnerPayloadGetDescriptionArgType = string +type UpdateIntakeRunnerPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type UpdateIntakeRunnerPayloadGetDisplayNameAttributeType = *string + +func getUpdateIntakeRunnerPayloadGetDisplayNameAttributeTypeOk(arg UpdateIntakeRunnerPayloadGetDisplayNameAttributeType) (ret UpdateIntakeRunnerPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakeRunnerPayloadGetDisplayNameAttributeType(arg *UpdateIntakeRunnerPayloadGetDisplayNameAttributeType, val UpdateIntakeRunnerPayloadGetDisplayNameRetType) { + *arg = &val +} + +type UpdateIntakeRunnerPayloadGetDisplayNameArgType = string +type UpdateIntakeRunnerPayloadGetDisplayNameRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type UpdateIntakeRunnerPayloadGetLabelsAttributeType = *map[string]string +type UpdateIntakeRunnerPayloadGetLabelsArgType = *map[string]string +type UpdateIntakeRunnerPayloadGetLabelsRetType = *map[string]string + +func getUpdateIntakeRunnerPayloadGetLabelsAttributeTypeOk(arg UpdateIntakeRunnerPayloadGetLabelsAttributeType) (ret UpdateIntakeRunnerPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setUpdateIntakeRunnerPayloadGetLabelsAttributeType(arg *UpdateIntakeRunnerPayloadGetLabelsAttributeType, val UpdateIntakeRunnerPayloadGetLabelsRetType) { + *arg = val +} + +/* + types and functions for maxMessageSizeKiB +*/ + +// isInteger +type UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType = *int64 +type UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBArgType = int64 +type UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType = int64 + +func getUpdateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeTypeOk(arg UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType) (ret UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType(arg *UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType, val UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType) { + *arg = &val +} + +/* + types and functions for maxMessagesPerHour +*/ + +// isInteger +type UpdateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType = *int64 +type UpdateIntakeRunnerPayloadGetMaxMessagesPerHourArgType = int64 +type UpdateIntakeRunnerPayloadGetMaxMessagesPerHourRetType = int64 + +func getUpdateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeTypeOk(arg UpdateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType) (ret UpdateIntakeRunnerPayloadGetMaxMessagesPerHourRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType(arg *UpdateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType, val UpdateIntakeRunnerPayloadGetMaxMessagesPerHourRetType) { + *arg = &val +} + +// UpdateIntakeRunnerPayload struct for UpdateIntakeRunnerPayload +type UpdateIntakeRunnerPayload struct { + // The description is a longer text chosen by the user to provide more context for the resource. + Description UpdateIntakeRunnerPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName UpdateIntakeRunnerPayloadGetDisplayNameAttributeType `json:"displayName,omitempty"` + // Labels are key-value pairs associated with the resource. To update labels: - Provide a new set of key-value pairs to replace the existing labels. - Send empty object `{}` to remove all labels. - Omit this field to leave the labels unchanged. + Labels UpdateIntakeRunnerPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The maximum size of a message in kibibytes (1 KiB = 1024 bytes). + MaxMessageSizeKiB UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType `json:"maxMessageSizeKiB,omitempty"` + // The maximum number of messages per hour. + MaxMessagesPerHour UpdateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType `json:"maxMessagesPerHour,omitempty"` +} + +// NewUpdateIntakeRunnerPayload instantiates a new UpdateIntakeRunnerPayload 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 NewUpdateIntakeRunnerPayload() *UpdateIntakeRunnerPayload { + this := UpdateIntakeRunnerPayload{} + return &this +} + +// NewUpdateIntakeRunnerPayloadWithDefaults instantiates a new UpdateIntakeRunnerPayload 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 NewUpdateIntakeRunnerPayloadWithDefaults() *UpdateIntakeRunnerPayload { + this := UpdateIntakeRunnerPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateIntakeRunnerPayload) GetDescription() (res UpdateIntakeRunnerPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakeRunnerPayload) GetDescriptionOk() (ret UpdateIntakeRunnerPayloadGetDescriptionRetType, ok bool) { + return getUpdateIntakeRunnerPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateIntakeRunnerPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateIntakeRunnerPayload) SetDescription(v UpdateIntakeRunnerPayloadGetDescriptionRetType) { + setUpdateIntakeRunnerPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateIntakeRunnerPayload) GetDisplayName() (res UpdateIntakeRunnerPayloadGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakeRunnerPayload) GetDisplayNameOk() (ret UpdateIntakeRunnerPayloadGetDisplayNameRetType, ok bool) { + return getUpdateIntakeRunnerPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateIntakeRunnerPayload) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateIntakeRunnerPayload) SetDisplayName(v UpdateIntakeRunnerPayloadGetDisplayNameRetType) { + setUpdateIntakeRunnerPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateIntakeRunnerPayload) GetLabels() (res UpdateIntakeRunnerPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// 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 *UpdateIntakeRunnerPayload) GetLabelsOk() (ret UpdateIntakeRunnerPayloadGetLabelsRetType, ok bool) { + return getUpdateIntakeRunnerPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateIntakeRunnerPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateIntakeRunnerPayload) SetLabels(v UpdateIntakeRunnerPayloadGetLabelsRetType) { + setUpdateIntakeRunnerPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetMaxMessageSizeKiB returns the MaxMessageSizeKiB field value if set, zero value otherwise. +func (o *UpdateIntakeRunnerPayload) GetMaxMessageSizeKiB() (res UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType) { + res, _ = o.GetMaxMessageSizeKiBOk() + return +} + +// GetMaxMessageSizeKiBOk returns a tuple with the MaxMessageSizeKiB field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakeRunnerPayload) GetMaxMessageSizeKiBOk() (ret UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType, ok bool) { + return getUpdateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeTypeOk(o.MaxMessageSizeKiB) +} + +// HasMaxMessageSizeKiB returns a boolean if a field has been set. +func (o *UpdateIntakeRunnerPayload) HasMaxMessageSizeKiB() bool { + _, ok := o.GetMaxMessageSizeKiBOk() + return ok +} + +// SetMaxMessageSizeKiB gets a reference to the given int64 and assigns it to the MaxMessageSizeKiB field. +func (o *UpdateIntakeRunnerPayload) SetMaxMessageSizeKiB(v UpdateIntakeRunnerPayloadGetMaxMessageSizeKiBRetType) { + setUpdateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeType(&o.MaxMessageSizeKiB, v) +} + +// GetMaxMessagesPerHour returns the MaxMessagesPerHour field value if set, zero value otherwise. +func (o *UpdateIntakeRunnerPayload) GetMaxMessagesPerHour() (res UpdateIntakeRunnerPayloadGetMaxMessagesPerHourRetType) { + res, _ = o.GetMaxMessagesPerHourOk() + return +} + +// GetMaxMessagesPerHourOk returns a tuple with the MaxMessagesPerHour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakeRunnerPayload) GetMaxMessagesPerHourOk() (ret UpdateIntakeRunnerPayloadGetMaxMessagesPerHourRetType, ok bool) { + return getUpdateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeTypeOk(o.MaxMessagesPerHour) +} + +// HasMaxMessagesPerHour returns a boolean if a field has been set. +func (o *UpdateIntakeRunnerPayload) HasMaxMessagesPerHour() bool { + _, ok := o.GetMaxMessagesPerHourOk() + return ok +} + +// SetMaxMessagesPerHour gets a reference to the given int64 and assigns it to the MaxMessagesPerHour field. +func (o *UpdateIntakeRunnerPayload) SetMaxMessagesPerHour(v UpdateIntakeRunnerPayloadGetMaxMessagesPerHourRetType) { + setUpdateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeType(&o.MaxMessagesPerHour, v) +} + +func (o UpdateIntakeRunnerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateIntakeRunnerPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateIntakeRunnerPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getUpdateIntakeRunnerPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateIntakeRunnerPayloadGetMaxMessageSizeKiBAttributeTypeOk(o.MaxMessageSizeKiB); ok { + toSerialize["MaxMessageSizeKiB"] = val + } + if val, ok := getUpdateIntakeRunnerPayloadGetMaxMessagesPerHourAttributeTypeOk(o.MaxMessagesPerHour); ok { + toSerialize["MaxMessagesPerHour"] = val + } + return toSerialize, nil +} + +type NullableUpdateIntakeRunnerPayload struct { + value *UpdateIntakeRunnerPayload + isSet bool +} + +func (v NullableUpdateIntakeRunnerPayload) Get() *UpdateIntakeRunnerPayload { + return v.value +} + +func (v *NullableUpdateIntakeRunnerPayload) Set(val *UpdateIntakeRunnerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateIntakeRunnerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateIntakeRunnerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateIntakeRunnerPayload(val *UpdateIntakeRunnerPayload) *NullableUpdateIntakeRunnerPayload { + return &NullableUpdateIntakeRunnerPayload{value: val, isSet: true} +} + +func (v NullableUpdateIntakeRunnerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateIntakeRunnerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_update_intake_runner_payload_test.go b/pkg/intakebeta/model_update_intake_runner_payload_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_update_intake_runner_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_update_intake_user_payload.go b/pkg/intakebeta/model_update_intake_user_payload.go new file mode 100644 index 00000000..0c4f1451 --- /dev/null +++ b/pkg/intakebeta/model_update_intake_user_payload.go @@ -0,0 +1,325 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" +) + +// checks if the UpdateIntakeUserPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateIntakeUserPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateIntakeUserPayloadGetDescriptionAttributeType = *string + +func getUpdateIntakeUserPayloadGetDescriptionAttributeTypeOk(arg UpdateIntakeUserPayloadGetDescriptionAttributeType) (ret UpdateIntakeUserPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakeUserPayloadGetDescriptionAttributeType(arg *UpdateIntakeUserPayloadGetDescriptionAttributeType, val UpdateIntakeUserPayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateIntakeUserPayloadGetDescriptionArgType = string +type UpdateIntakeUserPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type UpdateIntakeUserPayloadGetDisplayNameAttributeType = *string + +func getUpdateIntakeUserPayloadGetDisplayNameAttributeTypeOk(arg UpdateIntakeUserPayloadGetDisplayNameAttributeType) (ret UpdateIntakeUserPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakeUserPayloadGetDisplayNameAttributeType(arg *UpdateIntakeUserPayloadGetDisplayNameAttributeType, val UpdateIntakeUserPayloadGetDisplayNameRetType) { + *arg = &val +} + +type UpdateIntakeUserPayloadGetDisplayNameArgType = string +type UpdateIntakeUserPayloadGetDisplayNameRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type UpdateIntakeUserPayloadGetLabelsAttributeType = *map[string]string +type UpdateIntakeUserPayloadGetLabelsArgType = *map[string]string +type UpdateIntakeUserPayloadGetLabelsRetType = *map[string]string + +func getUpdateIntakeUserPayloadGetLabelsAttributeTypeOk(arg UpdateIntakeUserPayloadGetLabelsAttributeType) (ret UpdateIntakeUserPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setUpdateIntakeUserPayloadGetLabelsAttributeType(arg *UpdateIntakeUserPayloadGetLabelsAttributeType, val UpdateIntakeUserPayloadGetLabelsRetType) { + *arg = val +} + +/* + types and functions for password +*/ + +// isNotNullableString +type UpdateIntakeUserPayloadGetPasswordAttributeType = *string + +func getUpdateIntakeUserPayloadGetPasswordAttributeTypeOk(arg UpdateIntakeUserPayloadGetPasswordAttributeType) (ret UpdateIntakeUserPayloadGetPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakeUserPayloadGetPasswordAttributeType(arg *UpdateIntakeUserPayloadGetPasswordAttributeType, val UpdateIntakeUserPayloadGetPasswordRetType) { + *arg = &val +} + +type UpdateIntakeUserPayloadGetPasswordArgType = string +type UpdateIntakeUserPayloadGetPasswordRetType = string + +/* + types and functions for type +*/ + +// isEnumRef +type UpdateIntakeUserPayloadGetTypeAttributeType = *UserType +type UpdateIntakeUserPayloadGetTypeArgType = UserType +type UpdateIntakeUserPayloadGetTypeRetType = UserType + +func getUpdateIntakeUserPayloadGetTypeAttributeTypeOk(arg UpdateIntakeUserPayloadGetTypeAttributeType) (ret UpdateIntakeUserPayloadGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateIntakeUserPayloadGetTypeAttributeType(arg *UpdateIntakeUserPayloadGetTypeAttributeType, val UpdateIntakeUserPayloadGetTypeRetType) { + *arg = &val +} + +// UpdateIntakeUserPayload struct for UpdateIntakeUserPayload +type UpdateIntakeUserPayload struct { + // The description is a longer text chosen by the user to provide more context for the resource. + Description UpdateIntakeUserPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The display name is a short name chosen by the user to identify the resource. + DisplayName UpdateIntakeUserPayloadGetDisplayNameAttributeType `json:"displayName,omitempty"` + // Labels are key-value pairs associated with the resource. To update labels: - Provide a new set of key-value pairs to replace the existing labels. - Send empty object `{}` to remove all labels. - Omit this field to leave the labels unchanged. + Labels UpdateIntakeUserPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // A password chosen by the user. + Password UpdateIntakeUserPayloadGetPasswordAttributeType `json:"password,omitempty"` + Type UpdateIntakeUserPayloadGetTypeAttributeType `json:"type,omitempty"` +} + +// NewUpdateIntakeUserPayload instantiates a new UpdateIntakeUserPayload 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 NewUpdateIntakeUserPayload() *UpdateIntakeUserPayload { + this := UpdateIntakeUserPayload{} + return &this +} + +// NewUpdateIntakeUserPayloadWithDefaults instantiates a new UpdateIntakeUserPayload 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 NewUpdateIntakeUserPayloadWithDefaults() *UpdateIntakeUserPayload { + this := UpdateIntakeUserPayload{} + var types UserType = USERTYPE_INTAKE + this.Type = &types + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateIntakeUserPayload) GetDescription() (res UpdateIntakeUserPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakeUserPayload) GetDescriptionOk() (ret UpdateIntakeUserPayloadGetDescriptionRetType, ok bool) { + return getUpdateIntakeUserPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateIntakeUserPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateIntakeUserPayload) SetDescription(v UpdateIntakeUserPayloadGetDescriptionRetType) { + setUpdateIntakeUserPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateIntakeUserPayload) GetDisplayName() (res UpdateIntakeUserPayloadGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakeUserPayload) GetDisplayNameOk() (ret UpdateIntakeUserPayloadGetDisplayNameRetType, ok bool) { + return getUpdateIntakeUserPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateIntakeUserPayload) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateIntakeUserPayload) SetDisplayName(v UpdateIntakeUserPayloadGetDisplayNameRetType) { + setUpdateIntakeUserPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateIntakeUserPayload) GetLabels() (res UpdateIntakeUserPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// 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 *UpdateIntakeUserPayload) GetLabelsOk() (ret UpdateIntakeUserPayloadGetLabelsRetType, ok bool) { + return getUpdateIntakeUserPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateIntakeUserPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateIntakeUserPayload) SetLabels(v UpdateIntakeUserPayloadGetLabelsRetType) { + setUpdateIntakeUserPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *UpdateIntakeUserPayload) GetPassword() (res UpdateIntakeUserPayloadGetPasswordRetType) { + res, _ = o.GetPasswordOk() + return +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakeUserPayload) GetPasswordOk() (ret UpdateIntakeUserPayloadGetPasswordRetType, ok bool) { + return getUpdateIntakeUserPayloadGetPasswordAttributeTypeOk(o.Password) +} + +// HasPassword returns a boolean if a field has been set. +func (o *UpdateIntakeUserPayload) HasPassword() bool { + _, ok := o.GetPasswordOk() + return ok +} + +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *UpdateIntakeUserPayload) SetPassword(v UpdateIntakeUserPayloadGetPasswordRetType) { + setUpdateIntakeUserPayloadGetPasswordAttributeType(&o.Password, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *UpdateIntakeUserPayload) GetType() (res UpdateIntakeUserPayloadGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateIntakeUserPayload) GetTypeOk() (ret UpdateIntakeUserPayloadGetTypeRetType, ok bool) { + return getUpdateIntakeUserPayloadGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *UpdateIntakeUserPayload) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given UserType and assigns it to the Type field. +func (o *UpdateIntakeUserPayload) SetType(v UpdateIntakeUserPayloadGetTypeRetType) { + setUpdateIntakeUserPayloadGetTypeAttributeType(&o.Type, v) +} + +func (o UpdateIntakeUserPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateIntakeUserPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateIntakeUserPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getUpdateIntakeUserPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateIntakeUserPayloadGetPasswordAttributeTypeOk(o.Password); ok { + toSerialize["Password"] = val + } + if val, ok := getUpdateIntakeUserPayloadGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableUpdateIntakeUserPayload struct { + value *UpdateIntakeUserPayload + isSet bool +} + +func (v NullableUpdateIntakeUserPayload) Get() *UpdateIntakeUserPayload { + return v.value +} + +func (v *NullableUpdateIntakeUserPayload) Set(val *UpdateIntakeUserPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateIntakeUserPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateIntakeUserPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateIntakeUserPayload(val *UpdateIntakeUserPayload) *NullableUpdateIntakeUserPayload { + return &NullableUpdateIntakeUserPayload{value: val, isSet: true} +} + +func (v NullableUpdateIntakeUserPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateIntakeUserPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_update_intake_user_payload_test.go b/pkg/intakebeta/model_update_intake_user_payload_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_update_intake_user_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/model_user_type.go b/pkg/intakebeta/model_user_type.go new file mode 100644 index 00000000..cff00f04 --- /dev/null +++ b/pkg/intakebeta/model_user_type.go @@ -0,0 +1,115 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" + "fmt" +) + +// UserType Type of user, 'intake' allows writing to the Intake, 'dead-letter' allows reading from the dead-letter queue +type UserType string + +// List of userType +const ( + USERTYPE_INTAKE UserType = "intake" + USERTYPE_DEAD_LETTER UserType = "dead-letter" +) + +// All allowed values of UserType enum +var AllowedUserTypeEnumValues = []UserType{ + "intake", + "dead-letter", +} + +func (v *UserType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := UserType(value) + for _, existing := range AllowedUserTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid UserType", value) +} + +// NewUserTypeFromValue returns a pointer to a valid UserType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUserTypeFromValue(v string) (*UserType, error) { + ev := UserType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UserType: valid values are %v", v, AllowedUserTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UserType) IsValid() bool { + for _, existing := range AllowedUserTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to userType value +func (v UserType) Ptr() *UserType { + return &v +} + +type NullableUserType struct { + value *UserType + isSet bool +} + +func (v NullableUserType) Get() *UserType { + return v.value +} + +func (v *NullableUserType) Set(val *UserType) { + v.value = val + v.isSet = true +} + +func (v NullableUserType) IsSet() bool { + return v.isSet +} + +func (v *NullableUserType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserType(val *UserType) *NullableUserType { + return &NullableUserType{value: val, isSet: true} +} + +func (v NullableUserType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/intakebeta/model_user_type_test.go b/pkg/intakebeta/model_user_type_test.go new file mode 100644 index 00000000..8d1b661d --- /dev/null +++ b/pkg/intakebeta/model_user_type_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta diff --git a/pkg/intakebeta/utils.go b/pkg/intakebeta/utils.go new file mode 100644 index 00000000..5060a9f6 --- /dev/null +++ b/pkg/intakebeta/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT Intake API + +This API provides endpoints for managing Intakes. + +API version: 1beta.3.5 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package intakebeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/kmsbeta/.openapi-generator/VERSION b/pkg/kmsbeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/kmsbeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/kmsbeta/api_default.go b/pkg/kmsbeta/api_default.go new file mode 100644 index 00000000..9e8f6bbe --- /dev/null +++ b/pkg/kmsbeta/api_default.go @@ -0,0 +1,5390 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateKey Create key + Deprecated: Creates a new key for the given key ring. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiCreateKeyRequest + */ + CreateKey(ctx context.Context, projectId string, regionId string, keyRingId string) ApiCreateKeyRequest + /* + CreateKeyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return Key + + Deprecated: Creates a new key for the given key ring. + */ + CreateKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string) (*Key, error) + /* + CreateKeyRing Create key ring + Deprecated: Creates a new key ring within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @return ApiCreateKeyRingRequest + */ + CreateKeyRing(ctx context.Context, projectId string, regionId string) ApiCreateKeyRingRequest + /* + CreateKeyRingExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @return KeyRing + + Deprecated: Creates a new key ring within the project. + */ + CreateKeyRingExecute(ctx context.Context, projectId string, regionId string) (*KeyRing, error) + /* + CreateWrappingKey Create wrapping key + Deprecated: Creates a new wrapping key for the given key ring. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiCreateWrappingKeyRequest + */ + CreateWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string) ApiCreateWrappingKeyRequest + /* + CreateWrappingKeyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return WrappingKey + + Deprecated: Creates a new wrapping key for the given key ring. + */ + CreateWrappingKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string) (*WrappingKey, error) + /* + Decrypt Decrypt + Deprecated: Decrypts data using the given key version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiDecryptRequest + */ + Decrypt(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDecryptRequest + /* + DecryptExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return DecryptedData + + Deprecated: Decrypts data using the given key version. + */ + DecryptExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) (*DecryptedData, error) + /* + DeleteKey Delete key + Deprecated: Schedules the deletion of the given key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiDeleteKeyRequest + */ + DeleteKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiDeleteKeyRequest + /* + DeleteKeyExecute executes the request + + Deprecated: Schedules the deletion of the given key + */ + DeleteKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) error + /* + DeleteKeyRing Delete keyring + Deprecated: Deletes the given key ring if it is empty + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiDeleteKeyRingRequest + */ + DeleteKeyRing(ctx context.Context, projectId string, regionId string, keyRingId string) ApiDeleteKeyRingRequest + /* + DeleteKeyRingExecute executes the request + + Deprecated: Deletes the given key ring if it is empty + */ + DeleteKeyRingExecute(ctx context.Context, projectId string, regionId string, keyRingId string) error + /* + DeleteWrappingKey Delete wrapping key + Deprecated: Deletes the given wrapping key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param wrappingKeyId The wrapping key UUID. + @return ApiDeleteWrappingKeyRequest + */ + DeleteWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) ApiDeleteWrappingKeyRequest + /* + DeleteWrappingKeyExecute executes the request + + Deprecated: Deletes the given wrapping key + */ + DeleteWrappingKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) error + /* + DestroyVersion Destroy version + Deprecated: Removes the key material of a version permanently. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiDestroyVersionRequest + */ + DestroyVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDestroyVersionRequest + /* + DestroyVersionExecute executes the request + + Deprecated: Removes the key material of a version permanently. + */ + DestroyVersionExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) error + /* + DisableVersion Disable version + Deprecated: Disables the given version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiDisableVersionRequest + */ + DisableVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDisableVersionRequest + /* + DisableVersionExecute executes the request + + Deprecated: Disables the given version. + */ + DisableVersionExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) error + /* + EnableVersion Enable version + Deprecated: Enables the given version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiEnableVersionRequest + */ + EnableVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiEnableVersionRequest + /* + EnableVersionExecute executes the request + + Deprecated: Enables the given version. + */ + EnableVersionExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) error + /* + Encrypt Encrypt + Deprecated: Encrypts data using the given key version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiEncryptRequest + */ + Encrypt(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiEncryptRequest + /* + EncryptExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return EncryptedData + + Deprecated: Encrypts data using the given key version. + */ + EncryptExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) (*EncryptedData, error) + /* + GetKey Get key + Deprecated: Returns the details for the given key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiGetKeyRequest + */ + GetKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiGetKeyRequest + /* + GetKeyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return Key + + Deprecated: Returns the details for the given key. + */ + GetKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) (*Key, error) + /* + GetKeyRing Get key ring + Deprecated: Returns the details for the given key ring. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiGetKeyRingRequest + */ + GetKeyRing(ctx context.Context, projectId string, regionId string, keyRingId string) ApiGetKeyRingRequest + /* + GetKeyRingExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return KeyRing + + Deprecated: Returns the details for the given key ring. + */ + GetKeyRingExecute(ctx context.Context, projectId string, regionId string, keyRingId string) (*KeyRing, error) + /* + GetVersion Get version + Deprecated: Returns the details for the given version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiGetVersionRequest + */ + GetVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiGetVersionRequest + /* + GetVersionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return Version + + Deprecated: Returns the details for the given version. + */ + GetVersionExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) (*Version, error) + /* + GetWrappingKey Get wrapping key + Deprecated: Returns the details for the given wrapping key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param wrappingKeyId The wrapping key UUID. + @return ApiGetWrappingKeyRequest + */ + GetWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) ApiGetWrappingKeyRequest + /* + GetWrappingKeyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param wrappingKeyId The wrapping key UUID. + @return WrappingKey + + Deprecated: Returns the details for the given wrapping key. + */ + GetWrappingKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) (*WrappingKey, error) + /* + ImportKey Import key + Deprecated: Imports a new version to the given key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiImportKeyRequest + */ + ImportKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiImportKeyRequest + /* + ImportKeyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return Version + + Deprecated: Imports a new version to the given key. + */ + ImportKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) (*Version, error) + /* + ListKeyRings List key rings + Deprecated: Returns a list of all key rings within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @return ApiListKeyRingsRequest + */ + ListKeyRings(ctx context.Context, projectId string, regionId string) ApiListKeyRingsRequest + /* + ListKeyRingsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @return KeyRingList + + Deprecated: Returns a list of all key rings within the project. + */ + ListKeyRingsExecute(ctx context.Context, projectId string, regionId string) (*KeyRingList, error) + /* + ListKeys List keys + Deprecated: Returns the keys for the given key ring. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiListKeysRequest + */ + ListKeys(ctx context.Context, projectId string, regionId string, keyRingId string) ApiListKeysRequest + /* + ListKeysExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return KeyList + + Deprecated: Returns the keys for the given key ring. + */ + ListKeysExecute(ctx context.Context, projectId string, regionId string, keyRingId string) (*KeyList, error) + /* + ListVersions List versions + Deprecated: Returns a list of all versions of a given key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiListVersionsRequest + */ + ListVersions(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiListVersionsRequest + /* + ListVersionsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return VersionList + + Deprecated: Returns a list of all versions of a given key. + */ + ListVersionsExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) (*VersionList, error) + /* + ListWrappingKeys List wrapping keys + Deprecated: Returns the wrapping keys for the given key ring. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiListWrappingKeysRequest + */ + ListWrappingKeys(ctx context.Context, projectId string, regionId string, keyRingId string) ApiListWrappingKeysRequest + /* + ListWrappingKeysExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return WrappingKeyList + + Deprecated: Returns the wrapping keys for the given key ring. + */ + ListWrappingKeysExecute(ctx context.Context, projectId string, regionId string, keyRingId string) (*WrappingKeyList, error) + /* + RestoreKey Restore deleted key + Deprecated: Restores the given key from being deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiRestoreKeyRequest + */ + RestoreKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiRestoreKeyRequest + /* + RestoreKeyExecute executes the request + + Deprecated: Restores the given key from being deleted. + */ + RestoreKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) error + /* + RestoreVersion Restore version + Deprecated: Restores the given version from being destroyed + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiRestoreVersionRequest + */ + RestoreVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiRestoreVersionRequest + /* + RestoreVersionExecute executes the request + + Deprecated: Restores the given version from being destroyed + */ + RestoreVersionExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) error + /* + RotateKey Rotate key + Deprecated: Rotates the given key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiRotateKeyRequest + */ + RotateKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiRotateKeyRequest + /* + RotateKeyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return Version + + Deprecated: Rotates the given key. + */ + RotateKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) (*Version, error) + /* + Sign Sign + Deprecated: Sign data using the given key version as secret. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiSignRequest + */ + Sign(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiSignRequest + /* + SignExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return SignedData + + Deprecated: Sign data using the given key version as secret. + */ + SignExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) (*SignedData, error) + /* + Verify Verify + Deprecated: Verify data using the given key version as secret. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiVerifyRequest + */ + Verify(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiVerifyRequest + /* + VerifyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return VerifiedData + + Deprecated: Verify data using the given key version as secret. + */ + VerifyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) (*VerifiedData, error) +} + +type ApiCreateKeyRequest interface { + CreateKeyPayload(createKeyPayload CreateKeyPayload) ApiCreateKeyRequest + Execute() (*Key, error) +} + +type ApiCreateKeyRingRequest interface { + CreateKeyRingPayload(createKeyRingPayload CreateKeyRingPayload) ApiCreateKeyRingRequest + Execute() (*KeyRing, error) +} + +type ApiCreateWrappingKeyRequest interface { + CreateWrappingKeyPayload(createWrappingKeyPayload CreateWrappingKeyPayload) ApiCreateWrappingKeyRequest + Execute() (*WrappingKey, error) +} + +type ApiDecryptRequest interface { + DecryptPayload(decryptPayload DecryptPayload) ApiDecryptRequest + Execute() (*DecryptedData, error) +} + +type ApiDeleteKeyRequest interface { + Execute() error +} + +type ApiDeleteKeyRingRequest interface { + Execute() error +} + +type ApiDeleteWrappingKeyRequest interface { + Execute() error +} + +type ApiDestroyVersionRequest interface { + Execute() error +} + +type ApiDisableVersionRequest interface { + Execute() error +} + +type ApiEnableVersionRequest interface { + Execute() error +} + +type ApiEncryptRequest interface { + EncryptPayload(encryptPayload EncryptPayload) ApiEncryptRequest + Execute() (*EncryptedData, error) +} + +type ApiGetKeyRequest interface { + Execute() (*Key, error) +} + +type ApiGetKeyRingRequest interface { + Execute() (*KeyRing, error) +} + +type ApiGetVersionRequest interface { + Execute() (*Version, error) +} + +type ApiGetWrappingKeyRequest interface { + Execute() (*WrappingKey, error) +} + +type ApiImportKeyRequest interface { + ImportKeyPayload(importKeyPayload ImportKeyPayload) ApiImportKeyRequest + Execute() (*Version, error) +} + +type ApiListKeyRingsRequest interface { + Execute() (*KeyRingList, error) +} + +type ApiListKeysRequest interface { + Execute() (*KeyList, error) +} + +type ApiListVersionsRequest interface { + Execute() (*VersionList, error) +} + +type ApiListWrappingKeysRequest interface { + Execute() (*WrappingKeyList, error) +} + +type ApiRestoreKeyRequest interface { + Execute() error +} + +type ApiRestoreVersionRequest interface { + Execute() error +} + +type ApiRotateKeyRequest interface { + Execute() (*Version, error) +} + +type ApiSignRequest interface { + SignPayload(signPayload SignPayload) ApiSignRequest + Execute() (*SignedData, error) +} + +type ApiVerifyRequest interface { + VerifyPayload(verifyPayload VerifyPayload) ApiVerifyRequest + Execute() (*VerifiedData, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateKeyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + createKeyPayload *CreateKeyPayload +} + +func (r CreateKeyRequest) CreateKeyPayload(createKeyPayload CreateKeyPayload) ApiCreateKeyRequest { + r.createKeyPayload = &createKeyPayload + return r +} + +func (r CreateKeyRequest) Execute() (*Key, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Key + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateKey") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createKeyPayload == nil { + return localVarReturnValue, fmt.Errorf("createKeyPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createKeyPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateKey: Create key + +Deprecated: Creates a new key for the given key ring. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiCreateKeyRequest +*/ +func (a *APIClient) CreateKey(ctx context.Context, projectId string, regionId string, keyRingId string) ApiCreateKeyRequest { + return CreateKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } +} + +/* +Deprecated: Creates a new key for the given key ring. +*/ +func (a *APIClient) CreateKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string) (*Key, error) { + r := CreateKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } + return r.Execute() +} + +type CreateKeyRingRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + createKeyRingPayload *CreateKeyRingPayload +} + +func (r CreateKeyRingRequest) CreateKeyRingPayload(createKeyRingPayload CreateKeyRingPayload) ApiCreateKeyRingRequest { + r.createKeyRingPayload = &createKeyRingPayload + return r +} + +func (r CreateKeyRingRequest) Execute() (*KeyRing, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *KeyRing + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateKeyRing") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createKeyRingPayload == nil { + return localVarReturnValue, fmt.Errorf("createKeyRingPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createKeyRingPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateKeyRing: Create key ring + +Deprecated: Creates a new key ring within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @return ApiCreateKeyRingRequest +*/ +func (a *APIClient) CreateKeyRing(ctx context.Context, projectId string, regionId string) ApiCreateKeyRingRequest { + return CreateKeyRingRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +/* +Deprecated: Creates a new key ring within the project. +*/ +func (a *APIClient) CreateKeyRingExecute(ctx context.Context, projectId string, regionId string) (*KeyRing, error) { + r := CreateKeyRingRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type CreateWrappingKeyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + createWrappingKeyPayload *CreateWrappingKeyPayload +} + +func (r CreateWrappingKeyRequest) CreateWrappingKeyPayload(createWrappingKeyPayload CreateWrappingKeyPayload) ApiCreateWrappingKeyRequest { + r.createWrappingKeyPayload = &createWrappingKeyPayload + return r +} + +func (r CreateWrappingKeyRequest) Execute() (*WrappingKey, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *WrappingKey + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateWrappingKey") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createWrappingKeyPayload == nil { + return localVarReturnValue, fmt.Errorf("createWrappingKeyPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createWrappingKeyPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateWrappingKey: Create wrapping key + +Deprecated: Creates a new wrapping key for the given key ring. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiCreateWrappingKeyRequest +*/ +func (a *APIClient) CreateWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string) ApiCreateWrappingKeyRequest { + return CreateWrappingKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } +} + +/* +Deprecated: Creates a new wrapping key for the given key ring. +*/ +func (a *APIClient) CreateWrappingKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string) (*WrappingKey, error) { + r := CreateWrappingKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } + return r.Execute() +} + +type DecryptRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string + versionNumber int64 + decryptPayload *DecryptPayload +} + +func (r DecryptRequest) DecryptPayload(decryptPayload DecryptPayload) ApiDecryptRequest { + r.decryptPayload = &decryptPayload + return r +} + +func (r DecryptRequest) Execute() (*DecryptedData, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DecryptedData + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.Decrypt") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/decrypt" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(r.versionNumber, "versionNumber")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.decryptPayload == nil { + return localVarReturnValue, fmt.Errorf("decryptPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.decryptPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +Decrypt: Decrypt + +Deprecated: Decrypts data using the given key version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiDecryptRequest +*/ +func (a *APIClient) Decrypt(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDecryptRequest { + return DecryptRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } +} + +/* +Deprecated: Decrypts data using the given key version. +*/ +func (a *APIClient) DecryptExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) (*DecryptedData, error) { + r := DecryptRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } + return r.Execute() +} + +type DeleteKeyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string +} + +func (r DeleteKeyRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteKey") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteKey: Delete key + +Deprecated: Schedules the deletion of the given key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiDeleteKeyRequest +*/ +func (a *APIClient) DeleteKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiDeleteKeyRequest { + return DeleteKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } +} + +/* +Deprecated: Schedules the deletion of the given key +*/ +func (a *APIClient) DeleteKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) error { + r := DeleteKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } + return r.Execute() +} + +type DeleteKeyRingRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string +} + +func (r DeleteKeyRingRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteKeyRing") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteKeyRing: Delete keyring + +Deprecated: Deletes the given key ring if it is empty + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiDeleteKeyRingRequest +*/ +func (a *APIClient) DeleteKeyRing(ctx context.Context, projectId string, regionId string, keyRingId string) ApiDeleteKeyRingRequest { + return DeleteKeyRingRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } +} + +/* +Deprecated: Deletes the given key ring if it is empty +*/ +func (a *APIClient) DeleteKeyRingExecute(ctx context.Context, projectId string, regionId string, keyRingId string) error { + r := DeleteKeyRingRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } + return r.Execute() +} + +type DeleteWrappingKeyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + wrappingKeyId string +} + +func (r DeleteWrappingKeyRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteWrappingKey") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys/{wrappingKeyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"wrappingKeyId"+"}", url.PathEscape(ParameterValueToString(r.wrappingKeyId, "wrappingKeyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteWrappingKey: Delete wrapping key + +Deprecated: Deletes the given wrapping key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param wrappingKeyId The wrapping key UUID. + @return ApiDeleteWrappingKeyRequest +*/ +func (a *APIClient) DeleteWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) ApiDeleteWrappingKeyRequest { + return DeleteWrappingKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + wrappingKeyId: wrappingKeyId, + } +} + +/* +Deprecated: Deletes the given wrapping key +*/ +func (a *APIClient) DeleteWrappingKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) error { + r := DeleteWrappingKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + wrappingKeyId: wrappingKeyId, + } + return r.Execute() +} + +type DestroyVersionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string + versionNumber int64 +} + +func (r DestroyVersionRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DestroyVersion") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/destroy" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(r.versionNumber, "versionNumber")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DestroyVersion: Destroy version + +Deprecated: Removes the key material of a version permanently. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiDestroyVersionRequest +*/ +func (a *APIClient) DestroyVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDestroyVersionRequest { + return DestroyVersionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } +} + +/* +Deprecated: Removes the key material of a version permanently. +*/ +func (a *APIClient) DestroyVersionExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) error { + r := DestroyVersionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } + return r.Execute() +} + +type DisableVersionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string + versionNumber int64 +} + +func (r DisableVersionRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DisableVersion") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/disable" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(r.versionNumber, "versionNumber")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DisableVersion: Disable version + +Deprecated: Disables the given version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiDisableVersionRequest +*/ +func (a *APIClient) DisableVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDisableVersionRequest { + return DisableVersionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } +} + +/* +Deprecated: Disables the given version. +*/ +func (a *APIClient) DisableVersionExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) error { + r := DisableVersionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } + return r.Execute() +} + +type EnableVersionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string + versionNumber int64 +} + +func (r EnableVersionRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.EnableVersion") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/enable" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(r.versionNumber, "versionNumber")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +EnableVersion: Enable version + +Deprecated: Enables the given version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiEnableVersionRequest +*/ +func (a *APIClient) EnableVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiEnableVersionRequest { + return EnableVersionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } +} + +/* +Deprecated: Enables the given version. +*/ +func (a *APIClient) EnableVersionExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) error { + r := EnableVersionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } + return r.Execute() +} + +type EncryptRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string + versionNumber int64 + encryptPayload *EncryptPayload +} + +func (r EncryptRequest) EncryptPayload(encryptPayload EncryptPayload) ApiEncryptRequest { + r.encryptPayload = &encryptPayload + return r +} + +func (r EncryptRequest) Execute() (*EncryptedData, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EncryptedData + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.Encrypt") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/encrypt" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(r.versionNumber, "versionNumber")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.encryptPayload == nil { + return localVarReturnValue, fmt.Errorf("encryptPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.encryptPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +Encrypt: Encrypt + +Deprecated: Encrypts data using the given key version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiEncryptRequest +*/ +func (a *APIClient) Encrypt(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiEncryptRequest { + return EncryptRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } +} + +/* +Deprecated: Encrypts data using the given key version. +*/ +func (a *APIClient) EncryptExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) (*EncryptedData, error) { + r := EncryptRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } + return r.Execute() +} + +type GetKeyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string +} + +func (r GetKeyRequest) Execute() (*Key, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Key + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetKey") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetKey: Get key + +Deprecated: Returns the details for the given key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiGetKeyRequest +*/ +func (a *APIClient) GetKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiGetKeyRequest { + return GetKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } +} + +/* +Deprecated: Returns the details for the given key. +*/ +func (a *APIClient) GetKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) (*Key, error) { + r := GetKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } + return r.Execute() +} + +type GetKeyRingRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string +} + +func (r GetKeyRingRequest) Execute() (*KeyRing, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *KeyRing + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetKeyRing") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetKeyRing: Get key ring + +Deprecated: Returns the details for the given key ring. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiGetKeyRingRequest +*/ +func (a *APIClient) GetKeyRing(ctx context.Context, projectId string, regionId string, keyRingId string) ApiGetKeyRingRequest { + return GetKeyRingRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } +} + +/* +Deprecated: Returns the details for the given key ring. +*/ +func (a *APIClient) GetKeyRingExecute(ctx context.Context, projectId string, regionId string, keyRingId string) (*KeyRing, error) { + r := GetKeyRingRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } + return r.Execute() +} + +type GetVersionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string + versionNumber int64 +} + +func (r GetVersionRequest) Execute() (*Version, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Version + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVersion") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(r.versionNumber, "versionNumber")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetVersion: Get version + +Deprecated: Returns the details for the given version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiGetVersionRequest +*/ +func (a *APIClient) GetVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiGetVersionRequest { + return GetVersionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } +} + +/* +Deprecated: Returns the details for the given version. +*/ +func (a *APIClient) GetVersionExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) (*Version, error) { + r := GetVersionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } + return r.Execute() +} + +type GetWrappingKeyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + wrappingKeyId string +} + +func (r GetWrappingKeyRequest) Execute() (*WrappingKey, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *WrappingKey + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetWrappingKey") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys/{wrappingKeyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"wrappingKeyId"+"}", url.PathEscape(ParameterValueToString(r.wrappingKeyId, "wrappingKeyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetWrappingKey: Get wrapping key + +Deprecated: Returns the details for the given wrapping key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param wrappingKeyId The wrapping key UUID. + @return ApiGetWrappingKeyRequest +*/ +func (a *APIClient) GetWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) ApiGetWrappingKeyRequest { + return GetWrappingKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + wrappingKeyId: wrappingKeyId, + } +} + +/* +Deprecated: Returns the details for the given wrapping key. +*/ +func (a *APIClient) GetWrappingKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) (*WrappingKey, error) { + r := GetWrappingKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + wrappingKeyId: wrappingKeyId, + } + return r.Execute() +} + +type ImportKeyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string + importKeyPayload *ImportKeyPayload +} + +func (r ImportKeyRequest) ImportKeyPayload(importKeyPayload ImportKeyPayload) ApiImportKeyRequest { + r.importKeyPayload = &importKeyPayload + return r +} + +func (r ImportKeyRequest) Execute() (*Version, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Version + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ImportKey") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/import" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.importKeyPayload == nil { + return localVarReturnValue, fmt.Errorf("importKeyPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.importKeyPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ImportKey: Import key + +Deprecated: Imports a new version to the given key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiImportKeyRequest +*/ +func (a *APIClient) ImportKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiImportKeyRequest { + return ImportKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } +} + +/* +Deprecated: Imports a new version to the given key. +*/ +func (a *APIClient) ImportKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) (*Version, error) { + r := ImportKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } + return r.Execute() +} + +type ListKeyRingsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string +} + +func (r ListKeyRingsRequest) Execute() (*KeyRingList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *KeyRingList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListKeyRings") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListKeyRings: List key rings + +Deprecated: Returns a list of all key rings within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @return ApiListKeyRingsRequest +*/ +func (a *APIClient) ListKeyRings(ctx context.Context, projectId string, regionId string) ApiListKeyRingsRequest { + return ListKeyRingsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +/* +Deprecated: Returns a list of all key rings within the project. +*/ +func (a *APIClient) ListKeyRingsExecute(ctx context.Context, projectId string, regionId string) (*KeyRingList, error) { + r := ListKeyRingsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type ListKeysRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string +} + +func (r ListKeysRequest) Execute() (*KeyList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *KeyList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListKeys") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListKeys: List keys + +Deprecated: Returns the keys for the given key ring. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiListKeysRequest +*/ +func (a *APIClient) ListKeys(ctx context.Context, projectId string, regionId string, keyRingId string) ApiListKeysRequest { + return ListKeysRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } +} + +/* +Deprecated: Returns the keys for the given key ring. +*/ +func (a *APIClient) ListKeysExecute(ctx context.Context, projectId string, regionId string, keyRingId string) (*KeyList, error) { + r := ListKeysRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } + return r.Execute() +} + +type ListVersionsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string +} + +func (r ListVersionsRequest) Execute() (*VersionList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VersionList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVersions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListVersions: List versions + +Deprecated: Returns a list of all versions of a given key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiListVersionsRequest +*/ +func (a *APIClient) ListVersions(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiListVersionsRequest { + return ListVersionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } +} + +/* +Deprecated: Returns a list of all versions of a given key. +*/ +func (a *APIClient) ListVersionsExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) (*VersionList, error) { + r := ListVersionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } + return r.Execute() +} + +type ListWrappingKeysRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string +} + +func (r ListWrappingKeysRequest) Execute() (*WrappingKeyList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *WrappingKeyList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListWrappingKeys") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListWrappingKeys: List wrapping keys + +Deprecated: Returns the wrapping keys for the given key ring. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @return ApiListWrappingKeysRequest +*/ +func (a *APIClient) ListWrappingKeys(ctx context.Context, projectId string, regionId string, keyRingId string) ApiListWrappingKeysRequest { + return ListWrappingKeysRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } +} + +/* +Deprecated: Returns the wrapping keys for the given key ring. +*/ +func (a *APIClient) ListWrappingKeysExecute(ctx context.Context, projectId string, regionId string, keyRingId string) (*WrappingKeyList, error) { + r := ListWrappingKeysRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + } + return r.Execute() +} + +type RestoreKeyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string +} + +func (r RestoreKeyRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RestoreKey") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/restore" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RestoreKey: Restore deleted key + +Deprecated: Restores the given key from being deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiRestoreKeyRequest +*/ +func (a *APIClient) RestoreKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiRestoreKeyRequest { + return RestoreKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } +} + +/* +Deprecated: Restores the given key from being deleted. +*/ +func (a *APIClient) RestoreKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) error { + r := RestoreKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } + return r.Execute() +} + +type RestoreVersionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string + versionNumber int64 +} + +func (r RestoreVersionRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RestoreVersion") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/restore" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(r.versionNumber, "versionNumber")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RestoreVersion: Restore version + +Deprecated: Restores the given version from being destroyed + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiRestoreVersionRequest +*/ +func (a *APIClient) RestoreVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiRestoreVersionRequest { + return RestoreVersionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } +} + +/* +Deprecated: Restores the given version from being destroyed +*/ +func (a *APIClient) RestoreVersionExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) error { + r := RestoreVersionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } + return r.Execute() +} + +type RotateKeyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string +} + +func (r RotateKeyRequest) Execute() (*Version, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Version + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RotateKey") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/rotate" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +RotateKey: Rotate key + +Deprecated: Rotates the given key. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @return ApiRotateKeyRequest +*/ +func (a *APIClient) RotateKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiRotateKeyRequest { + return RotateKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } +} + +/* +Deprecated: Rotates the given key. +*/ +func (a *APIClient) RotateKeyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) (*Version, error) { + r := RotateKeyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + } + return r.Execute() +} + +type SignRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string + versionNumber int64 + signPayload *SignPayload +} + +func (r SignRequest) SignPayload(signPayload SignPayload) ApiSignRequest { + r.signPayload = &signPayload + return r +} + +func (r SignRequest) Execute() (*SignedData, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SignedData + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.Sign") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/sign" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(r.versionNumber, "versionNumber")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.signPayload == nil { + return localVarReturnValue, fmt.Errorf("signPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.signPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +Sign: Sign + +Deprecated: Sign data using the given key version as secret. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiSignRequest +*/ +func (a *APIClient) Sign(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiSignRequest { + return SignRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } +} + +/* +Deprecated: Sign data using the given key version as secret. +*/ +func (a *APIClient) SignExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) (*SignedData, error) { + r := SignRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } + return r.Execute() +} + +type VerifyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + keyRingId string + keyId string + versionNumber int64 + verifyPayload *VerifyPayload +} + +func (r VerifyRequest) VerifyPayload(verifyPayload VerifyPayload) ApiVerifyRequest { + r.verifyPayload = &verifyPayload + return r +} + +func (r VerifyRequest) Execute() (*VerifiedData, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VerifiedData + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.Verify") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/verify" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(r.keyRingId, "keyRingId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(r.versionNumber, "versionNumber")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.verifyPayload == nil { + return localVarReturnValue, fmt.Errorf("verifyPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.verifyPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v HttpError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +Verify: Verify + +Deprecated: Verify data using the given key version as secret. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the key ring is part of. + @param regionId The STACKIT region name the key ring is located in. + @param keyRingId The key ring UUID. + @param keyId The key UUID. + @param versionNumber The version number. + @return ApiVerifyRequest +*/ +func (a *APIClient) Verify(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiVerifyRequest { + return VerifyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } +} + +/* +Deprecated: Verify data using the given key version as secret. +*/ +func (a *APIClient) VerifyExecute(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) (*VerifiedData, error) { + r := VerifyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + keyRingId: keyRingId, + keyId: keyId, + versionNumber: versionNumber, + } + return r.Execute() +} diff --git a/pkg/kmsbeta/api_default_test.go b/pkg/kmsbeta/api_default_test.go new file mode 100644 index 00000000..2df61068 --- /dev/null +++ b/pkg/kmsbeta/api_default_test.go @@ -0,0 +1,1509 @@ +/* +STACKIT Key Management Service API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package kmsbeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_kmsbeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateKey", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Key{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + createKeyPayload := CreateKeyPayload{} + + resp, reqErr := apiClient.CreateKey(context.Background(), projectId, regionId, keyRingId).CreateKeyPayload(createKeyPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateKeyRing", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := KeyRing{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + createKeyRingPayload := CreateKeyRingPayload{} + + resp, reqErr := apiClient.CreateKeyRing(context.Background(), projectId, regionId).CreateKeyRingPayload(createKeyRingPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateWrappingKey", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := WrappingKey{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + createWrappingKeyPayload := CreateWrappingKeyPayload{} + + resp, reqErr := apiClient.CreateWrappingKey(context.Background(), projectId, regionId, keyRingId).CreateWrappingKeyPayload(createWrappingKeyPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService Decrypt", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/decrypt" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + versionNumberValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(versionNumberValue, "versionNumber")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := DecryptedData{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + versionNumber := versionNumberValue + decryptPayload := DecryptPayload{} + + resp, reqErr := apiClient.Decrypt(context.Background(), projectId, regionId, keyRingId, keyId, versionNumber).DecryptPayload(decryptPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteKey", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + + reqErr := apiClient.DeleteKey(context.Background(), projectId, regionId, keyRingId, keyId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteKeyRing", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + + reqErr := apiClient.DeleteKeyRing(context.Background(), projectId, regionId, keyRingId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteWrappingKey", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys/{wrappingKeyId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + wrappingKeyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"wrappingKeyId"+"}", url.PathEscape(ParameterValueToString(wrappingKeyIdValue, "wrappingKeyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + wrappingKeyId := wrappingKeyIdValue + + reqErr := apiClient.DeleteWrappingKey(context.Background(), projectId, regionId, keyRingId, wrappingKeyId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DestroyVersion", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/destroy" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + versionNumberValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(versionNumberValue, "versionNumber")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + versionNumber := versionNumberValue + + reqErr := apiClient.DestroyVersion(context.Background(), projectId, regionId, keyRingId, keyId, versionNumber).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DisableVersion", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/disable" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + versionNumberValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(versionNumberValue, "versionNumber")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + versionNumber := versionNumberValue + + reqErr := apiClient.DisableVersion(context.Background(), projectId, regionId, keyRingId, keyId, versionNumber).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService EnableVersion", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/enable" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + versionNumberValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(versionNumberValue, "versionNumber")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + versionNumber := versionNumberValue + + reqErr := apiClient.EnableVersion(context.Background(), projectId, regionId, keyRingId, keyId, versionNumber).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService Encrypt", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/encrypt" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + versionNumberValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(versionNumberValue, "versionNumber")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := EncryptedData{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + versionNumber := versionNumberValue + encryptPayload := EncryptPayload{} + + resp, reqErr := apiClient.Encrypt(context.Background(), projectId, regionId, keyRingId, keyId, versionNumber).EncryptPayload(encryptPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetKey", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Key{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + + resp, reqErr := apiClient.GetKey(context.Background(), projectId, regionId, keyRingId, keyId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetKeyRing", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := KeyRing{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + + resp, reqErr := apiClient.GetKeyRing(context.Background(), projectId, regionId, keyRingId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetVersion", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + versionNumberValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(versionNumberValue, "versionNumber")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Version{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + versionNumber := versionNumberValue + + resp, reqErr := apiClient.GetVersion(context.Background(), projectId, regionId, keyRingId, keyId, versionNumber).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetWrappingKey", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys/{wrappingKeyId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + wrappingKeyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"wrappingKeyId"+"}", url.PathEscape(ParameterValueToString(wrappingKeyIdValue, "wrappingKeyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := WrappingKey{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + wrappingKeyId := wrappingKeyIdValue + + resp, reqErr := apiClient.GetWrappingKey(context.Background(), projectId, regionId, keyRingId, wrappingKeyId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ImportKey", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/import" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Version{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + importKeyPayload := ImportKeyPayload{} + + resp, reqErr := apiClient.ImportKey(context.Background(), projectId, regionId, keyRingId, keyId).ImportKeyPayload(importKeyPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListKeyRings", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := KeyRingList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + + resp, reqErr := apiClient.ListKeyRings(context.Background(), projectId, regionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListKeys", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := KeyList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + + resp, reqErr := apiClient.ListKeys(context.Background(), projectId, regionId, keyRingId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListVersions", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := VersionList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + + resp, reqErr := apiClient.ListVersions(context.Background(), projectId, regionId, keyRingId, keyId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListWrappingKeys", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := WrappingKeyList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + + resp, reqErr := apiClient.ListWrappingKeys(context.Background(), projectId, regionId, keyRingId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService RestoreKey", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/restore" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + + reqErr := apiClient.RestoreKey(context.Background(), projectId, regionId, keyRingId, keyId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService RestoreVersion", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/restore" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + versionNumberValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(versionNumberValue, "versionNumber")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + versionNumber := versionNumberValue + + reqErr := apiClient.RestoreVersion(context.Background(), projectId, regionId, keyRingId, keyId, versionNumber).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService RotateKey", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/rotate" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Version{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + + resp, reqErr := apiClient.RotateKey(context.Background(), projectId, regionId, keyRingId, keyId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService Sign", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/sign" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + versionNumberValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(versionNumberValue, "versionNumber")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := SignedData{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + versionNumber := versionNumberValue + signPayload := SignPayload{} + + resp, reqErr := apiClient.Sign(context.Background(), projectId, regionId, keyRingId, keyId, versionNumber).SignPayload(signPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService Verify", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/verify" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + keyRingIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyRingId"+"}", url.PathEscape(ParameterValueToString(keyRingIdValue, "keyRingId")), -1) + keyIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(keyIdValue, "keyId")), -1) + versionNumberValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"versionNumber"+"}", url.PathEscape(ParameterValueToString(versionNumberValue, "versionNumber")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := VerifiedData{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for kmsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + keyRingId := keyRingIdValue + keyId := keyIdValue + versionNumber := versionNumberValue + verifyPayload := VerifyPayload{} + + resp, reqErr := apiClient.Verify(context.Background(), projectId, regionId, keyRingId, keyId, versionNumber).VerifyPayload(verifyPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/kmsbeta/client.go b/pkg/kmsbeta/client.go new file mode 100644 index 00000000..0d13c206 --- /dev/null +++ b/pkg/kmsbeta/client.go @@ -0,0 +1,628 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Key Management Service API API v1beta.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/kmsbeta/configuration.go b/pkg/kmsbeta/configuration.go new file mode 100644 index 00000000..fd086a8b --- /dev/null +++ b/pkg/kmsbeta/configuration.go @@ -0,0 +1,41 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/kmsbeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://kms.api.{region}stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "eu01.", + EnumValues: []string{ + "eu01.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/kmsbeta/model_access_scope.go b/pkg/kmsbeta/model_access_scope.go new file mode 100644 index 00000000..788acc3c --- /dev/null +++ b/pkg/kmsbeta/model_access_scope.go @@ -0,0 +1,115 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" +) + +// AccessScope The access scope of the key. +type AccessScope string + +// List of access_scope +const ( + ACCESSSCOPE_PUBLIC AccessScope = "PUBLIC" + ACCESSSCOPE_SNA AccessScope = "SNA" +) + +// All allowed values of AccessScope enum +var AllowedAccessScopeEnumValues = []AccessScope{ + "PUBLIC", + "SNA", +} + +func (v *AccessScope) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := AccessScope(value) + for _, existing := range AllowedAccessScopeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid AccessScope", value) +} + +// NewAccessScopeFromValue returns a pointer to a valid AccessScope +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAccessScopeFromValue(v string) (*AccessScope, error) { + ev := AccessScope(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AccessScope: valid values are %v", v, AllowedAccessScopeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v AccessScope) IsValid() bool { + for _, existing := range AllowedAccessScopeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to access_scope value +func (v AccessScope) Ptr() *AccessScope { + return &v +} + +type NullableAccessScope struct { + value *AccessScope + isSet bool +} + +func (v NullableAccessScope) Get() *AccessScope { + return v.value +} + +func (v *NullableAccessScope) Set(val *AccessScope) { + v.value = val + v.isSet = true +} + +func (v NullableAccessScope) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessScope) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessScope(val *AccessScope) *NullableAccessScope { + return &NullableAccessScope{value: val, isSet: true} +} + +func (v NullableAccessScope) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessScope) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_access_scope_test.go b/pkg/kmsbeta/model_access_scope_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_access_scope_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_algorithm.go b/pkg/kmsbeta/model_algorithm.go new file mode 100644 index 00000000..9ce6baa8 --- /dev/null +++ b/pkg/kmsbeta/model_algorithm.go @@ -0,0 +1,133 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" +) + +// Algorithm The algorithm the key material uses. +type Algorithm string + +// List of algorithm +const ( + ALGORITHM_AES_256_GCM Algorithm = "aes_256_gcm" + ALGORITHM_RSA_2048_OAEP_SHA256 Algorithm = "rsa_2048_oaep_sha256" + ALGORITHM_RSA_3072_OAEP_SHA256 Algorithm = "rsa_3072_oaep_sha256" + ALGORITHM_RSA_4096_OAEP_SHA256 Algorithm = "rsa_4096_oaep_sha256" + ALGORITHM_RSA_4096_OAEP_SHA512 Algorithm = "rsa_4096_oaep_sha512" + ALGORITHM_HMAC_SHA256 Algorithm = "hmac_sha256" + ALGORITHM_HMAC_SHA384 Algorithm = "hmac_sha384" + ALGORITHM_HMAC_SHA512 Algorithm = "hmac_sha512" + ALGORITHM_ECDSA_P256_SHA256 Algorithm = "ecdsa_p256_sha256" + ALGORITHM_ECDSA_P384_SHA384 Algorithm = "ecdsa_p384_sha384" + ALGORITHM_ECDSA_P521_SHA512 Algorithm = "ecdsa_p521_sha512" +) + +// All allowed values of Algorithm enum +var AllowedAlgorithmEnumValues = []Algorithm{ + "aes_256_gcm", + "rsa_2048_oaep_sha256", + "rsa_3072_oaep_sha256", + "rsa_4096_oaep_sha256", + "rsa_4096_oaep_sha512", + "hmac_sha256", + "hmac_sha384", + "hmac_sha512", + "ecdsa_p256_sha256", + "ecdsa_p384_sha384", + "ecdsa_p521_sha512", +} + +func (v *Algorithm) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := Algorithm(value) + for _, existing := range AllowedAlgorithmEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Algorithm", value) +} + +// NewAlgorithmFromValue returns a pointer to a valid Algorithm +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAlgorithmFromValue(v string) (*Algorithm, error) { + ev := Algorithm(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Algorithm: valid values are %v", v, AllowedAlgorithmEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Algorithm) IsValid() bool { + for _, existing := range AllowedAlgorithmEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to algorithm value +func (v Algorithm) Ptr() *Algorithm { + return &v +} + +type NullableAlgorithm struct { + value *Algorithm + isSet bool +} + +func (v NullableAlgorithm) Get() *Algorithm { + return v.value +} + +func (v *NullableAlgorithm) Set(val *Algorithm) { + v.value = val + v.isSet = true +} + +func (v NullableAlgorithm) IsSet() bool { + return v.isSet +} + +func (v *NullableAlgorithm) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAlgorithm(val *Algorithm) *NullableAlgorithm { + return &NullableAlgorithm{value: val, isSet: true} +} + +func (v NullableAlgorithm) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAlgorithm) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_algorithm_test.go b/pkg/kmsbeta/model_algorithm_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_algorithm_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_backend.go b/pkg/kmsbeta/model_backend.go new file mode 100644 index 00000000..4c8a32e8 --- /dev/null +++ b/pkg/kmsbeta/model_backend.go @@ -0,0 +1,113 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" +) + +// Backend The backend that is responsible for maintaining this key. Deprecated - use `protection`. +type Backend string + +// List of backend +const ( + BACKEND_SOFTWARE Backend = "software" +) + +// All allowed values of Backend enum +var AllowedBackendEnumValues = []Backend{ + "software", +} + +func (v *Backend) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := Backend(value) + for _, existing := range AllowedBackendEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Backend", value) +} + +// NewBackendFromValue returns a pointer to a valid Backend +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBackendFromValue(v string) (*Backend, error) { + ev := Backend(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Backend: valid values are %v", v, AllowedBackendEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Backend) IsValid() bool { + for _, existing := range AllowedBackendEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to backend value +func (v Backend) Ptr() *Backend { + return &v +} + +type NullableBackend struct { + value *Backend + isSet bool +} + +func (v NullableBackend) Get() *Backend { + return v.value +} + +func (v *NullableBackend) Set(val *Backend) { + v.value = val + v.isSet = true +} + +func (v NullableBackend) IsSet() bool { + return v.isSet +} + +func (v *NullableBackend) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackend(val *Backend) *NullableBackend { + return &NullableBackend{value: val, isSet: true} +} + +func (v NullableBackend) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackend) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_backend_test.go b/pkg/kmsbeta/model_backend_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_backend_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_create_key_payload.go b/pkg/kmsbeta/model_create_key_payload.go new file mode 100644 index 00000000..4e417cab --- /dev/null +++ b/pkg/kmsbeta/model_create_key_payload.go @@ -0,0 +1,455 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the CreateKeyPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateKeyPayload{} + +/* + types and functions for access_scope +*/ + +// isEnumRef +type CreateKeyPayloadGetAccessScopeAttributeType = *AccessScope +type CreateKeyPayloadGetAccessScopeArgType = AccessScope +type CreateKeyPayloadGetAccessScopeRetType = AccessScope + +func getCreateKeyPayloadGetAccessScopeAttributeTypeOk(arg CreateKeyPayloadGetAccessScopeAttributeType) (ret CreateKeyPayloadGetAccessScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPayloadGetAccessScopeAttributeType(arg *CreateKeyPayloadGetAccessScopeAttributeType, val CreateKeyPayloadGetAccessScopeRetType) { + *arg = &val +} + +/* + types and functions for algorithm +*/ + +// isEnumRef +type CreateKeyPayloadGetAlgorithmAttributeType = *Algorithm +type CreateKeyPayloadGetAlgorithmArgType = Algorithm +type CreateKeyPayloadGetAlgorithmRetType = Algorithm + +func getCreateKeyPayloadGetAlgorithmAttributeTypeOk(arg CreateKeyPayloadGetAlgorithmAttributeType) (ret CreateKeyPayloadGetAlgorithmRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPayloadGetAlgorithmAttributeType(arg *CreateKeyPayloadGetAlgorithmAttributeType, val CreateKeyPayloadGetAlgorithmRetType) { + *arg = &val +} + +/* + types and functions for backend +*/ + +// isEnumRef +type CreateKeyPayloadGetBackendAttributeType = *Backend +type CreateKeyPayloadGetBackendArgType = Backend +type CreateKeyPayloadGetBackendRetType = Backend + +func getCreateKeyPayloadGetBackendAttributeTypeOk(arg CreateKeyPayloadGetBackendAttributeType) (ret CreateKeyPayloadGetBackendRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPayloadGetBackendAttributeType(arg *CreateKeyPayloadGetBackendAttributeType, val CreateKeyPayloadGetBackendRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateKeyPayloadGetDescriptionAttributeType = *string + +func getCreateKeyPayloadGetDescriptionAttributeTypeOk(arg CreateKeyPayloadGetDescriptionAttributeType) (ret CreateKeyPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPayloadGetDescriptionAttributeType(arg *CreateKeyPayloadGetDescriptionAttributeType, val CreateKeyPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateKeyPayloadGetDescriptionArgType = string +type CreateKeyPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateKeyPayloadGetDisplayNameAttributeType = *string + +func getCreateKeyPayloadGetDisplayNameAttributeTypeOk(arg CreateKeyPayloadGetDisplayNameAttributeType) (ret CreateKeyPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPayloadGetDisplayNameAttributeType(arg *CreateKeyPayloadGetDisplayNameAttributeType, val CreateKeyPayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateKeyPayloadGetDisplayNameArgType = string +type CreateKeyPayloadGetDisplayNameRetType = string + +/* + types and functions for importOnly +*/ + +// isBoolean +type CreateKeyPayloadgetImportOnlyAttributeType = *bool +type CreateKeyPayloadgetImportOnlyArgType = bool +type CreateKeyPayloadgetImportOnlyRetType = bool + +func getCreateKeyPayloadgetImportOnlyAttributeTypeOk(arg CreateKeyPayloadgetImportOnlyAttributeType) (ret CreateKeyPayloadgetImportOnlyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPayloadgetImportOnlyAttributeType(arg *CreateKeyPayloadgetImportOnlyAttributeType, val CreateKeyPayloadgetImportOnlyRetType) { + *arg = &val +} + +/* + types and functions for protection +*/ + +// isEnumRef +type CreateKeyPayloadGetProtectionAttributeType = *Protection +type CreateKeyPayloadGetProtectionArgType = Protection +type CreateKeyPayloadGetProtectionRetType = Protection + +func getCreateKeyPayloadGetProtectionAttributeTypeOk(arg CreateKeyPayloadGetProtectionAttributeType) (ret CreateKeyPayloadGetProtectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPayloadGetProtectionAttributeType(arg *CreateKeyPayloadGetProtectionAttributeType, val CreateKeyPayloadGetProtectionRetType) { + *arg = &val +} + +/* + types and functions for purpose +*/ + +// isEnumRef +type CreateKeyPayloadGetPurposeAttributeType = *Purpose +type CreateKeyPayloadGetPurposeArgType = Purpose +type CreateKeyPayloadGetPurposeRetType = Purpose + +func getCreateKeyPayloadGetPurposeAttributeTypeOk(arg CreateKeyPayloadGetPurposeAttributeType) (ret CreateKeyPayloadGetPurposeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPayloadGetPurposeAttributeType(arg *CreateKeyPayloadGetPurposeAttributeType, val CreateKeyPayloadGetPurposeRetType) { + *arg = &val +} + +// CreateKeyPayload struct for CreateKeyPayload +type CreateKeyPayload struct { + AccessScope CreateKeyPayloadGetAccessScopeAttributeType `json:"access_scope,omitempty"` + // REQUIRED + Algorithm CreateKeyPayloadGetAlgorithmAttributeType `json:"algorithm" required:"true"` + // Deprecated: Check the GitHub changelog for alternatives + // REQUIRED + Backend CreateKeyPayloadGetBackendAttributeType `json:"backend" required:"true"` + // A user chosen description to distinguish multiple keys. + Description CreateKeyPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The display name to distinguish multiple keys. Valid characters: letters, digits, underscores and hyphens. + // REQUIRED + DisplayName CreateKeyPayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + // States whether versions can be created or only imported. + ImportOnly CreateKeyPayloadgetImportOnlyAttributeType `json:"importOnly,omitempty"` + Protection CreateKeyPayloadGetProtectionAttributeType `json:"protection,omitempty"` + // REQUIRED + Purpose CreateKeyPayloadGetPurposeAttributeType `json:"purpose" required:"true"` +} + +type _CreateKeyPayload CreateKeyPayload + +// NewCreateKeyPayload instantiates a new CreateKeyPayload 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 NewCreateKeyPayload(algorithm CreateKeyPayloadGetAlgorithmArgType, backend CreateKeyPayloadGetBackendArgType, displayName CreateKeyPayloadGetDisplayNameArgType, purpose CreateKeyPayloadGetPurposeArgType) *CreateKeyPayload { + this := CreateKeyPayload{} + setCreateKeyPayloadGetAlgorithmAttributeType(&this.Algorithm, algorithm) + setCreateKeyPayloadGetBackendAttributeType(&this.Backend, backend) + setCreateKeyPayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + setCreateKeyPayloadGetPurposeAttributeType(&this.Purpose, purpose) + return &this +} + +// NewCreateKeyPayloadWithDefaults instantiates a new CreateKeyPayload 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 NewCreateKeyPayloadWithDefaults() *CreateKeyPayload { + this := CreateKeyPayload{} + var accessScope AccessScope = ACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope + var importOnly bool = false + this.ImportOnly = &importOnly + return &this +} + +// GetAccessScope returns the AccessScope field value if set, zero value otherwise. +func (o *CreateKeyPayload) GetAccessScope() (res CreateKeyPayloadGetAccessScopeRetType) { + res, _ = o.GetAccessScopeOk() + return +} + +// GetAccessScopeOk returns a tuple with the AccessScope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPayload) GetAccessScopeOk() (ret CreateKeyPayloadGetAccessScopeRetType, ok bool) { + return getCreateKeyPayloadGetAccessScopeAttributeTypeOk(o.AccessScope) +} + +// HasAccessScope returns a boolean if a field has been set. +func (o *CreateKeyPayload) HasAccessScope() bool { + _, ok := o.GetAccessScopeOk() + return ok +} + +// SetAccessScope gets a reference to the given AccessScope and assigns it to the AccessScope field. +func (o *CreateKeyPayload) SetAccessScope(v CreateKeyPayloadGetAccessScopeRetType) { + setCreateKeyPayloadGetAccessScopeAttributeType(&o.AccessScope, v) +} + +// GetAlgorithm returns the Algorithm field value +func (o *CreateKeyPayload) GetAlgorithm() (ret CreateKeyPayloadGetAlgorithmRetType) { + ret, _ = o.GetAlgorithmOk() + return ret +} + +// GetAlgorithmOk returns a tuple with the Algorithm field value +// and a boolean to check if the value has been set. +func (o *CreateKeyPayload) GetAlgorithmOk() (ret CreateKeyPayloadGetAlgorithmRetType, ok bool) { + return getCreateKeyPayloadGetAlgorithmAttributeTypeOk(o.Algorithm) +} + +// SetAlgorithm sets field value +func (o *CreateKeyPayload) SetAlgorithm(v CreateKeyPayloadGetAlgorithmRetType) { + setCreateKeyPayloadGetAlgorithmAttributeType(&o.Algorithm, v) +} + +// GetBackend returns the Backend field value +// Deprecated +func (o *CreateKeyPayload) GetBackend() (ret CreateKeyPayloadGetBackendRetType) { + ret, _ = o.GetBackendOk() + return ret +} + +// GetBackendOk returns a tuple with the Backend field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *CreateKeyPayload) GetBackendOk() (ret CreateKeyPayloadGetBackendRetType, ok bool) { + return getCreateKeyPayloadGetBackendAttributeTypeOk(o.Backend) +} + +// SetBackend sets field value +// Deprecated +func (o *CreateKeyPayload) SetBackend(v CreateKeyPayloadGetBackendRetType) { + setCreateKeyPayloadGetBackendAttributeType(&o.Backend, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateKeyPayload) GetDescription() (res CreateKeyPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPayload) GetDescriptionOk() (ret CreateKeyPayloadGetDescriptionRetType, ok bool) { + return getCreateKeyPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateKeyPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateKeyPayload) SetDescription(v CreateKeyPayloadGetDescriptionRetType) { + setCreateKeyPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateKeyPayload) GetDisplayName() (ret CreateKeyPayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateKeyPayload) GetDisplayNameOk() (ret CreateKeyPayloadGetDisplayNameRetType, ok bool) { + return getCreateKeyPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateKeyPayload) SetDisplayName(v CreateKeyPayloadGetDisplayNameRetType) { + setCreateKeyPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetImportOnly returns the ImportOnly field value if set, zero value otherwise. +func (o *CreateKeyPayload) GetImportOnly() (res CreateKeyPayloadgetImportOnlyRetType) { + res, _ = o.GetImportOnlyOk() + return +} + +// GetImportOnlyOk returns a tuple with the ImportOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPayload) GetImportOnlyOk() (ret CreateKeyPayloadgetImportOnlyRetType, ok bool) { + return getCreateKeyPayloadgetImportOnlyAttributeTypeOk(o.ImportOnly) +} + +// HasImportOnly returns a boolean if a field has been set. +func (o *CreateKeyPayload) HasImportOnly() bool { + _, ok := o.GetImportOnlyOk() + return ok +} + +// SetImportOnly gets a reference to the given bool and assigns it to the ImportOnly field. +func (o *CreateKeyPayload) SetImportOnly(v CreateKeyPayloadgetImportOnlyRetType) { + setCreateKeyPayloadgetImportOnlyAttributeType(&o.ImportOnly, v) +} + +// GetProtection returns the Protection field value if set, zero value otherwise. +func (o *CreateKeyPayload) GetProtection() (res CreateKeyPayloadGetProtectionRetType) { + res, _ = o.GetProtectionOk() + return +} + +// GetProtectionOk returns a tuple with the Protection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPayload) GetProtectionOk() (ret CreateKeyPayloadGetProtectionRetType, ok bool) { + return getCreateKeyPayloadGetProtectionAttributeTypeOk(o.Protection) +} + +// HasProtection returns a boolean if a field has been set. +func (o *CreateKeyPayload) HasProtection() bool { + _, ok := o.GetProtectionOk() + return ok +} + +// SetProtection gets a reference to the given Protection and assigns it to the Protection field. +func (o *CreateKeyPayload) SetProtection(v CreateKeyPayloadGetProtectionRetType) { + setCreateKeyPayloadGetProtectionAttributeType(&o.Protection, v) +} + +// GetPurpose returns the Purpose field value +func (o *CreateKeyPayload) GetPurpose() (ret CreateKeyPayloadGetPurposeRetType) { + ret, _ = o.GetPurposeOk() + return ret +} + +// GetPurposeOk returns a tuple with the Purpose field value +// and a boolean to check if the value has been set. +func (o *CreateKeyPayload) GetPurposeOk() (ret CreateKeyPayloadGetPurposeRetType, ok bool) { + return getCreateKeyPayloadGetPurposeAttributeTypeOk(o.Purpose) +} + +// SetPurpose sets field value +func (o *CreateKeyPayload) SetPurpose(v CreateKeyPayloadGetPurposeRetType) { + setCreateKeyPayloadGetPurposeAttributeType(&o.Purpose, v) +} + +func (o CreateKeyPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateKeyPayloadGetAccessScopeAttributeTypeOk(o.AccessScope); ok { + toSerialize["AccessScope"] = val + } + if val, ok := getCreateKeyPayloadGetAlgorithmAttributeTypeOk(o.Algorithm); ok { + toSerialize["Algorithm"] = val + } + if val, ok := getCreateKeyPayloadGetBackendAttributeTypeOk(o.Backend); ok { + toSerialize["Backend"] = val + } + if val, ok := getCreateKeyPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateKeyPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateKeyPayloadgetImportOnlyAttributeTypeOk(o.ImportOnly); ok { + toSerialize["ImportOnly"] = val + } + if val, ok := getCreateKeyPayloadGetProtectionAttributeTypeOk(o.Protection); ok { + toSerialize["Protection"] = val + } + if val, ok := getCreateKeyPayloadGetPurposeAttributeTypeOk(o.Purpose); ok { + toSerialize["Purpose"] = val + } + return toSerialize, nil +} + +type NullableCreateKeyPayload struct { + value *CreateKeyPayload + isSet bool +} + +func (v NullableCreateKeyPayload) Get() *CreateKeyPayload { + return v.value +} + +func (v *NullableCreateKeyPayload) Set(val *CreateKeyPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateKeyPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateKeyPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateKeyPayload(val *CreateKeyPayload) *NullableCreateKeyPayload { + return &NullableCreateKeyPayload{value: val, isSet: true} +} + +func (v NullableCreateKeyPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateKeyPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_create_key_payload_test.go b/pkg/kmsbeta/model_create_key_payload_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_create_key_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_create_key_ring_payload.go b/pkg/kmsbeta/model_create_key_ring_payload.go new file mode 100644 index 00000000..06a8f370 --- /dev/null +++ b/pkg/kmsbeta/model_create_key_ring_payload.go @@ -0,0 +1,176 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the CreateKeyRingPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateKeyRingPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateKeyRingPayloadGetDescriptionAttributeType = *string + +func getCreateKeyRingPayloadGetDescriptionAttributeTypeOk(arg CreateKeyRingPayloadGetDescriptionAttributeType) (ret CreateKeyRingPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyRingPayloadGetDescriptionAttributeType(arg *CreateKeyRingPayloadGetDescriptionAttributeType, val CreateKeyRingPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateKeyRingPayloadGetDescriptionArgType = string +type CreateKeyRingPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateKeyRingPayloadGetDisplayNameAttributeType = *string + +func getCreateKeyRingPayloadGetDisplayNameAttributeTypeOk(arg CreateKeyRingPayloadGetDisplayNameAttributeType) (ret CreateKeyRingPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyRingPayloadGetDisplayNameAttributeType(arg *CreateKeyRingPayloadGetDisplayNameAttributeType, val CreateKeyRingPayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateKeyRingPayloadGetDisplayNameArgType = string +type CreateKeyRingPayloadGetDisplayNameRetType = string + +// CreateKeyRingPayload struct for CreateKeyRingPayload +type CreateKeyRingPayload struct { + // A user chosen description to distinguish multiple key rings. + Description CreateKeyRingPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The display name to distinguish multiple key rings. Valid characters: letters, digits, underscores and hyphens. + // REQUIRED + DisplayName CreateKeyRingPayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` +} + +type _CreateKeyRingPayload CreateKeyRingPayload + +// NewCreateKeyRingPayload instantiates a new CreateKeyRingPayload 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 NewCreateKeyRingPayload(displayName CreateKeyRingPayloadGetDisplayNameArgType) *CreateKeyRingPayload { + this := CreateKeyRingPayload{} + setCreateKeyRingPayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + return &this +} + +// NewCreateKeyRingPayloadWithDefaults instantiates a new CreateKeyRingPayload 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 NewCreateKeyRingPayloadWithDefaults() *CreateKeyRingPayload { + this := CreateKeyRingPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateKeyRingPayload) GetDescription() (res CreateKeyRingPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyRingPayload) GetDescriptionOk() (ret CreateKeyRingPayloadGetDescriptionRetType, ok bool) { + return getCreateKeyRingPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateKeyRingPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateKeyRingPayload) SetDescription(v CreateKeyRingPayloadGetDescriptionRetType) { + setCreateKeyRingPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateKeyRingPayload) GetDisplayName() (ret CreateKeyRingPayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateKeyRingPayload) GetDisplayNameOk() (ret CreateKeyRingPayloadGetDisplayNameRetType, ok bool) { + return getCreateKeyRingPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateKeyRingPayload) SetDisplayName(v CreateKeyRingPayloadGetDisplayNameRetType) { + setCreateKeyRingPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +func (o CreateKeyRingPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateKeyRingPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateKeyRingPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + return toSerialize, nil +} + +type NullableCreateKeyRingPayload struct { + value *CreateKeyRingPayload + isSet bool +} + +func (v NullableCreateKeyRingPayload) Get() *CreateKeyRingPayload { + return v.value +} + +func (v *NullableCreateKeyRingPayload) Set(val *CreateKeyRingPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateKeyRingPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateKeyRingPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateKeyRingPayload(val *CreateKeyRingPayload) *NullableCreateKeyRingPayload { + return &NullableCreateKeyRingPayload{value: val, isSet: true} +} + +func (v NullableCreateKeyRingPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateKeyRingPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_create_key_ring_payload_test.go b/pkg/kmsbeta/model_create_key_ring_payload_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_create_key_ring_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_create_wrapping_key_payload.go b/pkg/kmsbeta/model_create_wrapping_key_payload.go new file mode 100644 index 00000000..42947a6b --- /dev/null +++ b/pkg/kmsbeta/model_create_wrapping_key_payload.go @@ -0,0 +1,405 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the CreateWrappingKeyPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateWrappingKeyPayload{} + +/* + types and functions for access_scope +*/ + +// isEnumRef +type CreateWrappingKeyPayloadGetAccessScopeAttributeType = *AccessScope +type CreateWrappingKeyPayloadGetAccessScopeArgType = AccessScope +type CreateWrappingKeyPayloadGetAccessScopeRetType = AccessScope + +func getCreateWrappingKeyPayloadGetAccessScopeAttributeTypeOk(arg CreateWrappingKeyPayloadGetAccessScopeAttributeType) (ret CreateWrappingKeyPayloadGetAccessScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWrappingKeyPayloadGetAccessScopeAttributeType(arg *CreateWrappingKeyPayloadGetAccessScopeAttributeType, val CreateWrappingKeyPayloadGetAccessScopeRetType) { + *arg = &val +} + +/* + types and functions for algorithm +*/ + +// isEnumRef +type CreateWrappingKeyPayloadGetAlgorithmAttributeType = *WrappingAlgorithm +type CreateWrappingKeyPayloadGetAlgorithmArgType = WrappingAlgorithm +type CreateWrappingKeyPayloadGetAlgorithmRetType = WrappingAlgorithm + +func getCreateWrappingKeyPayloadGetAlgorithmAttributeTypeOk(arg CreateWrappingKeyPayloadGetAlgorithmAttributeType) (ret CreateWrappingKeyPayloadGetAlgorithmRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWrappingKeyPayloadGetAlgorithmAttributeType(arg *CreateWrappingKeyPayloadGetAlgorithmAttributeType, val CreateWrappingKeyPayloadGetAlgorithmRetType) { + *arg = &val +} + +/* + types and functions for backend +*/ + +// isEnumRef +type CreateWrappingKeyPayloadGetBackendAttributeType = *Backend +type CreateWrappingKeyPayloadGetBackendArgType = Backend +type CreateWrappingKeyPayloadGetBackendRetType = Backend + +func getCreateWrappingKeyPayloadGetBackendAttributeTypeOk(arg CreateWrappingKeyPayloadGetBackendAttributeType) (ret CreateWrappingKeyPayloadGetBackendRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWrappingKeyPayloadGetBackendAttributeType(arg *CreateWrappingKeyPayloadGetBackendAttributeType, val CreateWrappingKeyPayloadGetBackendRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateWrappingKeyPayloadGetDescriptionAttributeType = *string + +func getCreateWrappingKeyPayloadGetDescriptionAttributeTypeOk(arg CreateWrappingKeyPayloadGetDescriptionAttributeType) (ret CreateWrappingKeyPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWrappingKeyPayloadGetDescriptionAttributeType(arg *CreateWrappingKeyPayloadGetDescriptionAttributeType, val CreateWrappingKeyPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateWrappingKeyPayloadGetDescriptionArgType = string +type CreateWrappingKeyPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateWrappingKeyPayloadGetDisplayNameAttributeType = *string + +func getCreateWrappingKeyPayloadGetDisplayNameAttributeTypeOk(arg CreateWrappingKeyPayloadGetDisplayNameAttributeType) (ret CreateWrappingKeyPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWrappingKeyPayloadGetDisplayNameAttributeType(arg *CreateWrappingKeyPayloadGetDisplayNameAttributeType, val CreateWrappingKeyPayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateWrappingKeyPayloadGetDisplayNameArgType = string +type CreateWrappingKeyPayloadGetDisplayNameRetType = string + +/* + types and functions for protection +*/ + +// isEnumRef +type CreateWrappingKeyPayloadGetProtectionAttributeType = *Protection +type CreateWrappingKeyPayloadGetProtectionArgType = Protection +type CreateWrappingKeyPayloadGetProtectionRetType = Protection + +func getCreateWrappingKeyPayloadGetProtectionAttributeTypeOk(arg CreateWrappingKeyPayloadGetProtectionAttributeType) (ret CreateWrappingKeyPayloadGetProtectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWrappingKeyPayloadGetProtectionAttributeType(arg *CreateWrappingKeyPayloadGetProtectionAttributeType, val CreateWrappingKeyPayloadGetProtectionRetType) { + *arg = &val +} + +/* + types and functions for purpose +*/ + +// isEnumRef +type CreateWrappingKeyPayloadGetPurposeAttributeType = *WrappingPurpose +type CreateWrappingKeyPayloadGetPurposeArgType = WrappingPurpose +type CreateWrappingKeyPayloadGetPurposeRetType = WrappingPurpose + +func getCreateWrappingKeyPayloadGetPurposeAttributeTypeOk(arg CreateWrappingKeyPayloadGetPurposeAttributeType) (ret CreateWrappingKeyPayloadGetPurposeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateWrappingKeyPayloadGetPurposeAttributeType(arg *CreateWrappingKeyPayloadGetPurposeAttributeType, val CreateWrappingKeyPayloadGetPurposeRetType) { + *arg = &val +} + +// CreateWrappingKeyPayload struct for CreateWrappingKeyPayload +type CreateWrappingKeyPayload struct { + AccessScope CreateWrappingKeyPayloadGetAccessScopeAttributeType `json:"access_scope,omitempty"` + // REQUIRED + Algorithm CreateWrappingKeyPayloadGetAlgorithmAttributeType `json:"algorithm" required:"true"` + // Deprecated: Check the GitHub changelog for alternatives + // REQUIRED + Backend CreateWrappingKeyPayloadGetBackendAttributeType `json:"backend" required:"true"` + // A user chosen description to distinguish multiple wrapping keys. + Description CreateWrappingKeyPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The display name to distinguish multiple wrapping keys. Valid characters: letters, digits, underscores and hyphens. + // REQUIRED + DisplayName CreateWrappingKeyPayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + Protection CreateWrappingKeyPayloadGetProtectionAttributeType `json:"protection,omitempty"` + // REQUIRED + Purpose CreateWrappingKeyPayloadGetPurposeAttributeType `json:"purpose" required:"true"` +} + +type _CreateWrappingKeyPayload CreateWrappingKeyPayload + +// NewCreateWrappingKeyPayload instantiates a new CreateWrappingKeyPayload 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 NewCreateWrappingKeyPayload(algorithm CreateWrappingKeyPayloadGetAlgorithmArgType, backend CreateWrappingKeyPayloadGetBackendArgType, displayName CreateWrappingKeyPayloadGetDisplayNameArgType, purpose CreateWrappingKeyPayloadGetPurposeArgType) *CreateWrappingKeyPayload { + this := CreateWrappingKeyPayload{} + setCreateWrappingKeyPayloadGetAlgorithmAttributeType(&this.Algorithm, algorithm) + setCreateWrappingKeyPayloadGetBackendAttributeType(&this.Backend, backend) + setCreateWrappingKeyPayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + setCreateWrappingKeyPayloadGetPurposeAttributeType(&this.Purpose, purpose) + return &this +} + +// NewCreateWrappingKeyPayloadWithDefaults instantiates a new CreateWrappingKeyPayload 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 NewCreateWrappingKeyPayloadWithDefaults() *CreateWrappingKeyPayload { + this := CreateWrappingKeyPayload{} + var accessScope AccessScope = ACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope + return &this +} + +// GetAccessScope returns the AccessScope field value if set, zero value otherwise. +func (o *CreateWrappingKeyPayload) GetAccessScope() (res CreateWrappingKeyPayloadGetAccessScopeRetType) { + res, _ = o.GetAccessScopeOk() + return +} + +// GetAccessScopeOk returns a tuple with the AccessScope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWrappingKeyPayload) GetAccessScopeOk() (ret CreateWrappingKeyPayloadGetAccessScopeRetType, ok bool) { + return getCreateWrappingKeyPayloadGetAccessScopeAttributeTypeOk(o.AccessScope) +} + +// HasAccessScope returns a boolean if a field has been set. +func (o *CreateWrappingKeyPayload) HasAccessScope() bool { + _, ok := o.GetAccessScopeOk() + return ok +} + +// SetAccessScope gets a reference to the given AccessScope and assigns it to the AccessScope field. +func (o *CreateWrappingKeyPayload) SetAccessScope(v CreateWrappingKeyPayloadGetAccessScopeRetType) { + setCreateWrappingKeyPayloadGetAccessScopeAttributeType(&o.AccessScope, v) +} + +// GetAlgorithm returns the Algorithm field value +func (o *CreateWrappingKeyPayload) GetAlgorithm() (ret CreateWrappingKeyPayloadGetAlgorithmRetType) { + ret, _ = o.GetAlgorithmOk() + return ret +} + +// GetAlgorithmOk returns a tuple with the Algorithm field value +// and a boolean to check if the value has been set. +func (o *CreateWrappingKeyPayload) GetAlgorithmOk() (ret CreateWrappingKeyPayloadGetAlgorithmRetType, ok bool) { + return getCreateWrappingKeyPayloadGetAlgorithmAttributeTypeOk(o.Algorithm) +} + +// SetAlgorithm sets field value +func (o *CreateWrappingKeyPayload) SetAlgorithm(v CreateWrappingKeyPayloadGetAlgorithmRetType) { + setCreateWrappingKeyPayloadGetAlgorithmAttributeType(&o.Algorithm, v) +} + +// GetBackend returns the Backend field value +// Deprecated +func (o *CreateWrappingKeyPayload) GetBackend() (ret CreateWrappingKeyPayloadGetBackendRetType) { + ret, _ = o.GetBackendOk() + return ret +} + +// GetBackendOk returns a tuple with the Backend field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *CreateWrappingKeyPayload) GetBackendOk() (ret CreateWrappingKeyPayloadGetBackendRetType, ok bool) { + return getCreateWrappingKeyPayloadGetBackendAttributeTypeOk(o.Backend) +} + +// SetBackend sets field value +// Deprecated +func (o *CreateWrappingKeyPayload) SetBackend(v CreateWrappingKeyPayloadGetBackendRetType) { + setCreateWrappingKeyPayloadGetBackendAttributeType(&o.Backend, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateWrappingKeyPayload) GetDescription() (res CreateWrappingKeyPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWrappingKeyPayload) GetDescriptionOk() (ret CreateWrappingKeyPayloadGetDescriptionRetType, ok bool) { + return getCreateWrappingKeyPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateWrappingKeyPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateWrappingKeyPayload) SetDescription(v CreateWrappingKeyPayloadGetDescriptionRetType) { + setCreateWrappingKeyPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateWrappingKeyPayload) GetDisplayName() (ret CreateWrappingKeyPayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateWrappingKeyPayload) GetDisplayNameOk() (ret CreateWrappingKeyPayloadGetDisplayNameRetType, ok bool) { + return getCreateWrappingKeyPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateWrappingKeyPayload) SetDisplayName(v CreateWrappingKeyPayloadGetDisplayNameRetType) { + setCreateWrappingKeyPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetProtection returns the Protection field value if set, zero value otherwise. +func (o *CreateWrappingKeyPayload) GetProtection() (res CreateWrappingKeyPayloadGetProtectionRetType) { + res, _ = o.GetProtectionOk() + return +} + +// GetProtectionOk returns a tuple with the Protection field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWrappingKeyPayload) GetProtectionOk() (ret CreateWrappingKeyPayloadGetProtectionRetType, ok bool) { + return getCreateWrappingKeyPayloadGetProtectionAttributeTypeOk(o.Protection) +} + +// HasProtection returns a boolean if a field has been set. +func (o *CreateWrappingKeyPayload) HasProtection() bool { + _, ok := o.GetProtectionOk() + return ok +} + +// SetProtection gets a reference to the given Protection and assigns it to the Protection field. +func (o *CreateWrappingKeyPayload) SetProtection(v CreateWrappingKeyPayloadGetProtectionRetType) { + setCreateWrappingKeyPayloadGetProtectionAttributeType(&o.Protection, v) +} + +// GetPurpose returns the Purpose field value +func (o *CreateWrappingKeyPayload) GetPurpose() (ret CreateWrappingKeyPayloadGetPurposeRetType) { + ret, _ = o.GetPurposeOk() + return ret +} + +// GetPurposeOk returns a tuple with the Purpose field value +// and a boolean to check if the value has been set. +func (o *CreateWrappingKeyPayload) GetPurposeOk() (ret CreateWrappingKeyPayloadGetPurposeRetType, ok bool) { + return getCreateWrappingKeyPayloadGetPurposeAttributeTypeOk(o.Purpose) +} + +// SetPurpose sets field value +func (o *CreateWrappingKeyPayload) SetPurpose(v CreateWrappingKeyPayloadGetPurposeRetType) { + setCreateWrappingKeyPayloadGetPurposeAttributeType(&o.Purpose, v) +} + +func (o CreateWrappingKeyPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateWrappingKeyPayloadGetAccessScopeAttributeTypeOk(o.AccessScope); ok { + toSerialize["AccessScope"] = val + } + if val, ok := getCreateWrappingKeyPayloadGetAlgorithmAttributeTypeOk(o.Algorithm); ok { + toSerialize["Algorithm"] = val + } + if val, ok := getCreateWrappingKeyPayloadGetBackendAttributeTypeOk(o.Backend); ok { + toSerialize["Backend"] = val + } + if val, ok := getCreateWrappingKeyPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateWrappingKeyPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateWrappingKeyPayloadGetProtectionAttributeTypeOk(o.Protection); ok { + toSerialize["Protection"] = val + } + if val, ok := getCreateWrappingKeyPayloadGetPurposeAttributeTypeOk(o.Purpose); ok { + toSerialize["Purpose"] = val + } + return toSerialize, nil +} + +type NullableCreateWrappingKeyPayload struct { + value *CreateWrappingKeyPayload + isSet bool +} + +func (v NullableCreateWrappingKeyPayload) Get() *CreateWrappingKeyPayload { + return v.value +} + +func (v *NullableCreateWrappingKeyPayload) Set(val *CreateWrappingKeyPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateWrappingKeyPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateWrappingKeyPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateWrappingKeyPayload(val *CreateWrappingKeyPayload) *NullableCreateWrappingKeyPayload { + return &NullableCreateWrappingKeyPayload{value: val, isSet: true} +} + +func (v NullableCreateWrappingKeyPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateWrappingKeyPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_create_wrapping_key_payload_test.go b/pkg/kmsbeta/model_create_wrapping_key_payload_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_create_wrapping_key_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_decrypt_payload.go b/pkg/kmsbeta/model_decrypt_payload.go new file mode 100644 index 00000000..8ca920e8 --- /dev/null +++ b/pkg/kmsbeta/model_decrypt_payload.go @@ -0,0 +1,126 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the DecryptPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DecryptPayload{} + +/* + types and functions for data +*/ + +// isByteArray +type DecryptPayloadGetDataAttributeType = *[]byte +type DecryptPayloadGetDataArgType = []byte +type DecryptPayloadGetDataRetType = []byte + +func getDecryptPayloadGetDataAttributeTypeOk(arg DecryptPayloadGetDataAttributeType) (ret DecryptPayloadGetDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDecryptPayloadGetDataAttributeType(arg *DecryptPayloadGetDataAttributeType, val DecryptPayloadGetDataRetType) { + *arg = &val +} + +// DecryptPayload struct for DecryptPayload +type DecryptPayload struct { + // The data that has to be decrypted. Encoded in base64. + // REQUIRED + Data DecryptPayloadGetDataAttributeType `json:"data" required:"true"` +} + +type _DecryptPayload DecryptPayload + +// NewDecryptPayload instantiates a new DecryptPayload 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 NewDecryptPayload(data DecryptPayloadGetDataArgType) *DecryptPayload { + this := DecryptPayload{} + setDecryptPayloadGetDataAttributeType(&this.Data, data) + return &this +} + +// NewDecryptPayloadWithDefaults instantiates a new DecryptPayload 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 NewDecryptPayloadWithDefaults() *DecryptPayload { + this := DecryptPayload{} + return &this +} + +// GetData returns the Data field value +func (o *DecryptPayload) GetData() (ret DecryptPayloadGetDataRetType) { + ret, _ = o.GetDataOk() + return ret +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *DecryptPayload) GetDataOk() (ret DecryptPayloadGetDataRetType, ok bool) { + return getDecryptPayloadGetDataAttributeTypeOk(o.Data) +} + +// SetData sets field value +func (o *DecryptPayload) SetData(v DecryptPayloadGetDataRetType) { + setDecryptPayloadGetDataAttributeType(&o.Data, v) +} + +func (o DecryptPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDecryptPayloadGetDataAttributeTypeOk(o.Data); ok { + toSerialize["Data"] = val + } + return toSerialize, nil +} + +type NullableDecryptPayload struct { + value *DecryptPayload + isSet bool +} + +func (v NullableDecryptPayload) Get() *DecryptPayload { + return v.value +} + +func (v *NullableDecryptPayload) Set(val *DecryptPayload) { + v.value = val + v.isSet = true +} + +func (v NullableDecryptPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableDecryptPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDecryptPayload(val *DecryptPayload) *NullableDecryptPayload { + return &NullableDecryptPayload{value: val, isSet: true} +} + +func (v NullableDecryptPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDecryptPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_decrypt_payload_test.go b/pkg/kmsbeta/model_decrypt_payload_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_decrypt_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_decrypted_data.go b/pkg/kmsbeta/model_decrypted_data.go new file mode 100644 index 00000000..1192a1bf --- /dev/null +++ b/pkg/kmsbeta/model_decrypted_data.go @@ -0,0 +1,126 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the DecryptedData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DecryptedData{} + +/* + types and functions for data +*/ + +// isByteArray +type DecryptedDataGetDataAttributeType = *[]byte +type DecryptedDataGetDataArgType = []byte +type DecryptedDataGetDataRetType = []byte + +func getDecryptedDataGetDataAttributeTypeOk(arg DecryptedDataGetDataAttributeType) (ret DecryptedDataGetDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDecryptedDataGetDataAttributeType(arg *DecryptedDataGetDataAttributeType, val DecryptedDataGetDataRetType) { + *arg = &val +} + +// DecryptedData struct for DecryptedData +type DecryptedData struct { + // The decrypted data. Encoded in base64. + // REQUIRED + Data DecryptedDataGetDataAttributeType `json:"data" required:"true"` +} + +type _DecryptedData DecryptedData + +// NewDecryptedData instantiates a new DecryptedData 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 NewDecryptedData(data DecryptedDataGetDataArgType) *DecryptedData { + this := DecryptedData{} + setDecryptedDataGetDataAttributeType(&this.Data, data) + return &this +} + +// NewDecryptedDataWithDefaults instantiates a new DecryptedData 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 NewDecryptedDataWithDefaults() *DecryptedData { + this := DecryptedData{} + return &this +} + +// GetData returns the Data field value +func (o *DecryptedData) GetData() (ret DecryptedDataGetDataRetType) { + ret, _ = o.GetDataOk() + return ret +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *DecryptedData) GetDataOk() (ret DecryptedDataGetDataRetType, ok bool) { + return getDecryptedDataGetDataAttributeTypeOk(o.Data) +} + +// SetData sets field value +func (o *DecryptedData) SetData(v DecryptedDataGetDataRetType) { + setDecryptedDataGetDataAttributeType(&o.Data, v) +} + +func (o DecryptedData) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDecryptedDataGetDataAttributeTypeOk(o.Data); ok { + toSerialize["Data"] = val + } + return toSerialize, nil +} + +type NullableDecryptedData struct { + value *DecryptedData + isSet bool +} + +func (v NullableDecryptedData) Get() *DecryptedData { + return v.value +} + +func (v *NullableDecryptedData) Set(val *DecryptedData) { + v.value = val + v.isSet = true +} + +func (v NullableDecryptedData) IsSet() bool { + return v.isSet +} + +func (v *NullableDecryptedData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDecryptedData(val *DecryptedData) *NullableDecryptedData { + return &NullableDecryptedData{value: val, isSet: true} +} + +func (v NullableDecryptedData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDecryptedData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_decrypted_data_test.go b/pkg/kmsbeta/model_decrypted_data_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_decrypted_data_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_encrypt_payload.go b/pkg/kmsbeta/model_encrypt_payload.go new file mode 100644 index 00000000..c787e6b0 --- /dev/null +++ b/pkg/kmsbeta/model_encrypt_payload.go @@ -0,0 +1,126 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the EncryptPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EncryptPayload{} + +/* + types and functions for data +*/ + +// isByteArray +type EncryptPayloadGetDataAttributeType = *[]byte +type EncryptPayloadGetDataArgType = []byte +type EncryptPayloadGetDataRetType = []byte + +func getEncryptPayloadGetDataAttributeTypeOk(arg EncryptPayloadGetDataAttributeType) (ret EncryptPayloadGetDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setEncryptPayloadGetDataAttributeType(arg *EncryptPayloadGetDataAttributeType, val EncryptPayloadGetDataRetType) { + *arg = &val +} + +// EncryptPayload struct for EncryptPayload +type EncryptPayload struct { + // The data that has to be encrypted. Encoded in base64. + // REQUIRED + Data EncryptPayloadGetDataAttributeType `json:"data" required:"true"` +} + +type _EncryptPayload EncryptPayload + +// NewEncryptPayload instantiates a new EncryptPayload 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 NewEncryptPayload(data EncryptPayloadGetDataArgType) *EncryptPayload { + this := EncryptPayload{} + setEncryptPayloadGetDataAttributeType(&this.Data, data) + return &this +} + +// NewEncryptPayloadWithDefaults instantiates a new EncryptPayload 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 NewEncryptPayloadWithDefaults() *EncryptPayload { + this := EncryptPayload{} + return &this +} + +// GetData returns the Data field value +func (o *EncryptPayload) GetData() (ret EncryptPayloadGetDataRetType) { + ret, _ = o.GetDataOk() + return ret +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *EncryptPayload) GetDataOk() (ret EncryptPayloadGetDataRetType, ok bool) { + return getEncryptPayloadGetDataAttributeTypeOk(o.Data) +} + +// SetData sets field value +func (o *EncryptPayload) SetData(v EncryptPayloadGetDataRetType) { + setEncryptPayloadGetDataAttributeType(&o.Data, v) +} + +func (o EncryptPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getEncryptPayloadGetDataAttributeTypeOk(o.Data); ok { + toSerialize["Data"] = val + } + return toSerialize, nil +} + +type NullableEncryptPayload struct { + value *EncryptPayload + isSet bool +} + +func (v NullableEncryptPayload) Get() *EncryptPayload { + return v.value +} + +func (v *NullableEncryptPayload) Set(val *EncryptPayload) { + v.value = val + v.isSet = true +} + +func (v NullableEncryptPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableEncryptPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEncryptPayload(val *EncryptPayload) *NullableEncryptPayload { + return &NullableEncryptPayload{value: val, isSet: true} +} + +func (v NullableEncryptPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEncryptPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_encrypt_payload_test.go b/pkg/kmsbeta/model_encrypt_payload_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_encrypt_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_encrypted_data.go b/pkg/kmsbeta/model_encrypted_data.go new file mode 100644 index 00000000..46f203ad --- /dev/null +++ b/pkg/kmsbeta/model_encrypted_data.go @@ -0,0 +1,126 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the EncryptedData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EncryptedData{} + +/* + types and functions for data +*/ + +// isByteArray +type EncryptedDataGetDataAttributeType = *[]byte +type EncryptedDataGetDataArgType = []byte +type EncryptedDataGetDataRetType = []byte + +func getEncryptedDataGetDataAttributeTypeOk(arg EncryptedDataGetDataAttributeType) (ret EncryptedDataGetDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setEncryptedDataGetDataAttributeType(arg *EncryptedDataGetDataAttributeType, val EncryptedDataGetDataRetType) { + *arg = &val +} + +// EncryptedData struct for EncryptedData +type EncryptedData struct { + // The encrypted data. Encoded in base64. + // REQUIRED + Data EncryptedDataGetDataAttributeType `json:"data" required:"true"` +} + +type _EncryptedData EncryptedData + +// NewEncryptedData instantiates a new EncryptedData 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 NewEncryptedData(data EncryptedDataGetDataArgType) *EncryptedData { + this := EncryptedData{} + setEncryptedDataGetDataAttributeType(&this.Data, data) + return &this +} + +// NewEncryptedDataWithDefaults instantiates a new EncryptedData 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 NewEncryptedDataWithDefaults() *EncryptedData { + this := EncryptedData{} + return &this +} + +// GetData returns the Data field value +func (o *EncryptedData) GetData() (ret EncryptedDataGetDataRetType) { + ret, _ = o.GetDataOk() + return ret +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *EncryptedData) GetDataOk() (ret EncryptedDataGetDataRetType, ok bool) { + return getEncryptedDataGetDataAttributeTypeOk(o.Data) +} + +// SetData sets field value +func (o *EncryptedData) SetData(v EncryptedDataGetDataRetType) { + setEncryptedDataGetDataAttributeType(&o.Data, v) +} + +func (o EncryptedData) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getEncryptedDataGetDataAttributeTypeOk(o.Data); ok { + toSerialize["Data"] = val + } + return toSerialize, nil +} + +type NullableEncryptedData struct { + value *EncryptedData + isSet bool +} + +func (v NullableEncryptedData) Get() *EncryptedData { + return v.value +} + +func (v *NullableEncryptedData) Set(val *EncryptedData) { + v.value = val + v.isSet = true +} + +func (v NullableEncryptedData) IsSet() bool { + return v.isSet +} + +func (v *NullableEncryptedData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEncryptedData(val *EncryptedData) *NullableEncryptedData { + return &NullableEncryptedData{value: val, isSet: true} +} + +func (v NullableEncryptedData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEncryptedData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_encrypted_data_test.go b/pkg/kmsbeta/model_encrypted_data_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_encrypted_data_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_http_error.go b/pkg/kmsbeta/model_http_error.go new file mode 100644 index 00000000..69b2857d --- /dev/null +++ b/pkg/kmsbeta/model_http_error.go @@ -0,0 +1,127 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the HttpError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HttpError{} + +/* + types and functions for message +*/ + +// isNotNullableString +type HttpErrorGetMessageAttributeType = *string + +func getHttpErrorGetMessageAttributeTypeOk(arg HttpErrorGetMessageAttributeType) (ret HttpErrorGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setHttpErrorGetMessageAttributeType(arg *HttpErrorGetMessageAttributeType, val HttpErrorGetMessageRetType) { + *arg = &val +} + +type HttpErrorGetMessageArgType = string +type HttpErrorGetMessageRetType = string + +// HttpError struct for HttpError +type HttpError struct { + // A string that gives a short information about what went wrong. + // REQUIRED + Message HttpErrorGetMessageAttributeType `json:"message" required:"true"` +} + +type _HttpError HttpError + +// NewHttpError instantiates a new HttpError 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 NewHttpError(message HttpErrorGetMessageArgType) *HttpError { + this := HttpError{} + setHttpErrorGetMessageAttributeType(&this.Message, message) + return &this +} + +// NewHttpErrorWithDefaults instantiates a new HttpError 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 NewHttpErrorWithDefaults() *HttpError { + this := HttpError{} + return &this +} + +// GetMessage returns the Message field value +func (o *HttpError) GetMessage() (ret HttpErrorGetMessageRetType) { + ret, _ = o.GetMessageOk() + return ret +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *HttpError) GetMessageOk() (ret HttpErrorGetMessageRetType, ok bool) { + return getHttpErrorGetMessageAttributeTypeOk(o.Message) +} + +// SetMessage sets field value +func (o *HttpError) SetMessage(v HttpErrorGetMessageRetType) { + setHttpErrorGetMessageAttributeType(&o.Message, v) +} + +func (o HttpError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getHttpErrorGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableHttpError struct { + value *HttpError + isSet bool +} + +func (v NullableHttpError) Get() *HttpError { + return v.value +} + +func (v *NullableHttpError) Set(val *HttpError) { + v.value = val + v.isSet = true +} + +func (v NullableHttpError) IsSet() bool { + return v.isSet +} + +func (v *NullableHttpError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHttpError(val *HttpError) *NullableHttpError { + return &NullableHttpError{value: val, isSet: true} +} + +func (v NullableHttpError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHttpError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_http_error_test.go b/pkg/kmsbeta/model_http_error_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_http_error_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_import_key_payload.go b/pkg/kmsbeta/model_import_key_payload.go new file mode 100644 index 00000000..6da7c6aa --- /dev/null +++ b/pkg/kmsbeta/model_import_key_payload.go @@ -0,0 +1,172 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the ImportKeyPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImportKeyPayload{} + +/* + types and functions for wrappedKey +*/ + +// isNotNullableString +type ImportKeyPayloadGetWrappedKeyAttributeType = *string + +func getImportKeyPayloadGetWrappedKeyAttributeTypeOk(arg ImportKeyPayloadGetWrappedKeyAttributeType) (ret ImportKeyPayloadGetWrappedKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImportKeyPayloadGetWrappedKeyAttributeType(arg *ImportKeyPayloadGetWrappedKeyAttributeType, val ImportKeyPayloadGetWrappedKeyRetType) { + *arg = &val +} + +type ImportKeyPayloadGetWrappedKeyArgType = string +type ImportKeyPayloadGetWrappedKeyRetType = string + +/* + types and functions for wrappingKeyId +*/ + +// isNotNullableString +type ImportKeyPayloadGetWrappingKeyIdAttributeType = *string + +func getImportKeyPayloadGetWrappingKeyIdAttributeTypeOk(arg ImportKeyPayloadGetWrappingKeyIdAttributeType) (ret ImportKeyPayloadGetWrappingKeyIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImportKeyPayloadGetWrappingKeyIdAttributeType(arg *ImportKeyPayloadGetWrappingKeyIdAttributeType, val ImportKeyPayloadGetWrappingKeyIdRetType) { + *arg = &val +} + +type ImportKeyPayloadGetWrappingKeyIdArgType = string +type ImportKeyPayloadGetWrappingKeyIdRetType = string + +// ImportKeyPayload struct for ImportKeyPayload +type ImportKeyPayload struct { + // The wrapped key material that has to be imported. Encoded in base64. + // REQUIRED + WrappedKey ImportKeyPayloadGetWrappedKeyAttributeType `json:"wrappedKey" required:"true"` + // The unique id of the wrapping key the key material has been wrapped with. + // REQUIRED + WrappingKeyId ImportKeyPayloadGetWrappingKeyIdAttributeType `json:"wrappingKeyId" required:"true"` +} + +type _ImportKeyPayload ImportKeyPayload + +// NewImportKeyPayload instantiates a new ImportKeyPayload 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 NewImportKeyPayload(wrappedKey ImportKeyPayloadGetWrappedKeyArgType, wrappingKeyId ImportKeyPayloadGetWrappingKeyIdArgType) *ImportKeyPayload { + this := ImportKeyPayload{} + setImportKeyPayloadGetWrappedKeyAttributeType(&this.WrappedKey, wrappedKey) + setImportKeyPayloadGetWrappingKeyIdAttributeType(&this.WrappingKeyId, wrappingKeyId) + return &this +} + +// NewImportKeyPayloadWithDefaults instantiates a new ImportKeyPayload 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 NewImportKeyPayloadWithDefaults() *ImportKeyPayload { + this := ImportKeyPayload{} + return &this +} + +// GetWrappedKey returns the WrappedKey field value +func (o *ImportKeyPayload) GetWrappedKey() (ret ImportKeyPayloadGetWrappedKeyRetType) { + ret, _ = o.GetWrappedKeyOk() + return ret +} + +// GetWrappedKeyOk returns a tuple with the WrappedKey field value +// and a boolean to check if the value has been set. +func (o *ImportKeyPayload) GetWrappedKeyOk() (ret ImportKeyPayloadGetWrappedKeyRetType, ok bool) { + return getImportKeyPayloadGetWrappedKeyAttributeTypeOk(o.WrappedKey) +} + +// SetWrappedKey sets field value +func (o *ImportKeyPayload) SetWrappedKey(v ImportKeyPayloadGetWrappedKeyRetType) { + setImportKeyPayloadGetWrappedKeyAttributeType(&o.WrappedKey, v) +} + +// GetWrappingKeyId returns the WrappingKeyId field value +func (o *ImportKeyPayload) GetWrappingKeyId() (ret ImportKeyPayloadGetWrappingKeyIdRetType) { + ret, _ = o.GetWrappingKeyIdOk() + return ret +} + +// GetWrappingKeyIdOk returns a tuple with the WrappingKeyId field value +// and a boolean to check if the value has been set. +func (o *ImportKeyPayload) GetWrappingKeyIdOk() (ret ImportKeyPayloadGetWrappingKeyIdRetType, ok bool) { + return getImportKeyPayloadGetWrappingKeyIdAttributeTypeOk(o.WrappingKeyId) +} + +// SetWrappingKeyId sets field value +func (o *ImportKeyPayload) SetWrappingKeyId(v ImportKeyPayloadGetWrappingKeyIdRetType) { + setImportKeyPayloadGetWrappingKeyIdAttributeType(&o.WrappingKeyId, v) +} + +func (o ImportKeyPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImportKeyPayloadGetWrappedKeyAttributeTypeOk(o.WrappedKey); ok { + toSerialize["WrappedKey"] = val + } + if val, ok := getImportKeyPayloadGetWrappingKeyIdAttributeTypeOk(o.WrappingKeyId); ok { + toSerialize["WrappingKeyId"] = val + } + return toSerialize, nil +} + +type NullableImportKeyPayload struct { + value *ImportKeyPayload + isSet bool +} + +func (v NullableImportKeyPayload) Get() *ImportKeyPayload { + return v.value +} + +func (v *NullableImportKeyPayload) Set(val *ImportKeyPayload) { + v.value = val + v.isSet = true +} + +func (v NullableImportKeyPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableImportKeyPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImportKeyPayload(val *ImportKeyPayload) *NullableImportKeyPayload { + return &NullableImportKeyPayload{value: val, isSet: true} +} + +func (v NullableImportKeyPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImportKeyPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_import_key_payload_test.go b/pkg/kmsbeta/model_import_key_payload_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_import_key_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_key.go b/pkg/kmsbeta/model_key.go new file mode 100644 index 00000000..54afbcfa --- /dev/null +++ b/pkg/kmsbeta/model_key.go @@ -0,0 +1,783 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Key type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Key{} + +/* + types and functions for access_scope +*/ + +// isEnumRef +type KeyGetAccessScopeAttributeType = *AccessScope +type KeyGetAccessScopeArgType = AccessScope +type KeyGetAccessScopeRetType = AccessScope + +func getKeyGetAccessScopeAttributeTypeOk(arg KeyGetAccessScopeAttributeType) (ret KeyGetAccessScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetAccessScopeAttributeType(arg *KeyGetAccessScopeAttributeType, val KeyGetAccessScopeRetType) { + *arg = &val +} + +/* + types and functions for algorithm +*/ + +// isEnumRef +type KeyGetAlgorithmAttributeType = *Algorithm +type KeyGetAlgorithmArgType = Algorithm +type KeyGetAlgorithmRetType = Algorithm + +func getKeyGetAlgorithmAttributeTypeOk(arg KeyGetAlgorithmAttributeType) (ret KeyGetAlgorithmRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetAlgorithmAttributeType(arg *KeyGetAlgorithmAttributeType, val KeyGetAlgorithmRetType) { + *arg = &val +} + +/* + types and functions for backend +*/ + +// isEnumRef +type KeyGetBackendAttributeType = *Backend +type KeyGetBackendArgType = Backend +type KeyGetBackendRetType = Backend + +func getKeyGetBackendAttributeTypeOk(arg KeyGetBackendAttributeType) (ret KeyGetBackendRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetBackendAttributeType(arg *KeyGetBackendAttributeType, val KeyGetBackendRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type KeyGetCreatedAtAttributeType = *time.Time +type KeyGetCreatedAtArgType = time.Time +type KeyGetCreatedAtRetType = time.Time + +func getKeyGetCreatedAtAttributeTypeOk(arg KeyGetCreatedAtAttributeType) (ret KeyGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetCreatedAtAttributeType(arg *KeyGetCreatedAtAttributeType, val KeyGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for deletionDate +*/ + +// isDateTime +type KeyGetDeletionDateAttributeType = *time.Time +type KeyGetDeletionDateArgType = time.Time +type KeyGetDeletionDateRetType = time.Time + +func getKeyGetDeletionDateAttributeTypeOk(arg KeyGetDeletionDateAttributeType) (ret KeyGetDeletionDateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetDeletionDateAttributeType(arg *KeyGetDeletionDateAttributeType, val KeyGetDeletionDateRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type KeyGetDescriptionAttributeType = *string + +func getKeyGetDescriptionAttributeTypeOk(arg KeyGetDescriptionAttributeType) (ret KeyGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetDescriptionAttributeType(arg *KeyGetDescriptionAttributeType, val KeyGetDescriptionRetType) { + *arg = &val +} + +type KeyGetDescriptionArgType = string +type KeyGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type KeyGetDisplayNameAttributeType = *string + +func getKeyGetDisplayNameAttributeTypeOk(arg KeyGetDisplayNameAttributeType) (ret KeyGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetDisplayNameAttributeType(arg *KeyGetDisplayNameAttributeType, val KeyGetDisplayNameRetType) { + *arg = &val +} + +type KeyGetDisplayNameArgType = string +type KeyGetDisplayNameRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type KeyGetIdAttributeType = *string + +func getKeyGetIdAttributeTypeOk(arg KeyGetIdAttributeType) (ret KeyGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetIdAttributeType(arg *KeyGetIdAttributeType, val KeyGetIdRetType) { + *arg = &val +} + +type KeyGetIdArgType = string +type KeyGetIdRetType = string + +/* + types and functions for importOnly +*/ + +// isBoolean +type KeygetImportOnlyAttributeType = *bool +type KeygetImportOnlyArgType = bool +type KeygetImportOnlyRetType = bool + +func getKeygetImportOnlyAttributeTypeOk(arg KeygetImportOnlyAttributeType) (ret KeygetImportOnlyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeygetImportOnlyAttributeType(arg *KeygetImportOnlyAttributeType, val KeygetImportOnlyRetType) { + *arg = &val +} + +/* + types and functions for keyRingId +*/ + +// isNotNullableString +type KeyGetKeyRingIdAttributeType = *string + +func getKeyGetKeyRingIdAttributeTypeOk(arg KeyGetKeyRingIdAttributeType) (ret KeyGetKeyRingIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetKeyRingIdAttributeType(arg *KeyGetKeyRingIdAttributeType, val KeyGetKeyRingIdRetType) { + *arg = &val +} + +type KeyGetKeyRingIdArgType = string +type KeyGetKeyRingIdRetType = string + +/* + types and functions for protection +*/ + +// isEnumRef +type KeyGetProtectionAttributeType = *Protection +type KeyGetProtectionArgType = Protection +type KeyGetProtectionRetType = Protection + +func getKeyGetProtectionAttributeTypeOk(arg KeyGetProtectionAttributeType) (ret KeyGetProtectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetProtectionAttributeType(arg *KeyGetProtectionAttributeType, val KeyGetProtectionRetType) { + *arg = &val +} + +/* + types and functions for purpose +*/ + +// isEnumRef +type KeyGetPurposeAttributeType = *Purpose +type KeyGetPurposeArgType = Purpose +type KeyGetPurposeRetType = Purpose + +func getKeyGetPurposeAttributeTypeOk(arg KeyGetPurposeAttributeType) (ret KeyGetPurposeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetPurposeAttributeType(arg *KeyGetPurposeAttributeType, val KeyGetPurposeRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isEnum + +// KeyState The current state of the key. +// value type for enums +type KeyState string + +// List of State +const ( + KEYSTATE_ACTIVE KeyState = "active" + KEYSTATE_DELETED KeyState = "deleted" + KEYSTATE_NOT_AVAILABLE KeyState = "not_available" + KEYSTATE_ERRORS_EXIST KeyState = "errors_exist" + KEYSTATE_CREATING KeyState = "creating" + KEYSTATE_NO_VERSION KeyState = "no_version" +) + +// All allowed values of Key enum +var AllowedKeyStateEnumValues = []KeyState{ + "active", + "deleted", + "not_available", + "errors_exist", + "creating", + "no_version", +} + +func (v *KeyState) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson KeyState + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := KeyState(value) + for _, existing := range AllowedKeyStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Key", value) +} + +// NewKeyStateFromValue returns a pointer to a valid KeyState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewKeyStateFromValue(v KeyState) (*KeyState, error) { + ev := KeyState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for KeyState: valid values are %v", v, AllowedKeyStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v KeyState) IsValid() bool { + for _, existing := range AllowedKeyStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v KeyState) Ptr() *KeyState { + return &v +} + +type NullableKeyState struct { + value *KeyState + isSet bool +} + +func (v NullableKeyState) Get() *KeyState { + return v.value +} + +func (v *NullableKeyState) Set(val *KeyState) { + v.value = val + v.isSet = true +} + +func (v NullableKeyState) IsSet() bool { + return v.isSet +} + +func (v *NullableKeyState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeyState(val *KeyState) *NullableKeyState { + return &NullableKeyState{value: val, isSet: true} +} + +func (v NullableKeyState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeyState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type KeyGetStateAttributeType = *KeyState +type KeyGetStateArgType = KeyState +type KeyGetStateRetType = KeyState + +func getKeyGetStateAttributeTypeOk(arg KeyGetStateAttributeType) (ret KeyGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyGetStateAttributeType(arg *KeyGetStateAttributeType, val KeyGetStateRetType) { + *arg = &val +} + +// Key struct for Key +type Key struct { + // REQUIRED + AccessScope KeyGetAccessScopeAttributeType `json:"access_scope" required:"true"` + // REQUIRED + Algorithm KeyGetAlgorithmAttributeType `json:"algorithm" required:"true"` + // Deprecated: Check the GitHub changelog for alternatives + // REQUIRED + Backend KeyGetBackendAttributeType `json:"backend" required:"true"` + // The date and time the creation of the key was triggered. + // REQUIRED + CreatedAt KeyGetCreatedAtAttributeType `json:"createdAt" required:"true"` + // This date is set when a key is pending deletion and refers to the scheduled date of deletion + DeletionDate KeyGetDeletionDateAttributeType `json:"deletionDate,omitempty"` + // A user chosen description to distinguish multiple keys. + Description KeyGetDescriptionAttributeType `json:"description,omitempty"` + // The display name to distinguish multiple keys. + // REQUIRED + DisplayName KeyGetDisplayNameAttributeType `json:"displayName" required:"true"` + // A auto generated unique id which identifies the keys. + // REQUIRED + Id KeyGetIdAttributeType `json:"id" required:"true"` + // States whether versions can be created or only imported. + // REQUIRED + ImportOnly KeygetImportOnlyAttributeType `json:"importOnly" required:"true"` + // The unique id of the key ring this key is assigned to. + // REQUIRED + KeyRingId KeyGetKeyRingIdAttributeType `json:"keyRingId" required:"true"` + // REQUIRED + Protection KeyGetProtectionAttributeType `json:"protection" required:"true"` + // REQUIRED + Purpose KeyGetPurposeAttributeType `json:"purpose" required:"true"` + // The current state of the key. + // REQUIRED + State KeyGetStateAttributeType `json:"state" required:"true"` +} + +type _Key Key + +// NewKey instantiates a new Key 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 NewKey(accessScope KeyGetAccessScopeArgType, algorithm KeyGetAlgorithmArgType, backend KeyGetBackendArgType, createdAt KeyGetCreatedAtArgType, displayName KeyGetDisplayNameArgType, id KeyGetIdArgType, importOnly KeygetImportOnlyArgType, keyRingId KeyGetKeyRingIdArgType, protection KeyGetProtectionArgType, purpose KeyGetPurposeArgType, state KeyGetStateArgType) *Key { + this := Key{} + setKeyGetAccessScopeAttributeType(&this.AccessScope, accessScope) + setKeyGetAlgorithmAttributeType(&this.Algorithm, algorithm) + setKeyGetBackendAttributeType(&this.Backend, backend) + setKeyGetCreatedAtAttributeType(&this.CreatedAt, createdAt) + setKeyGetDisplayNameAttributeType(&this.DisplayName, displayName) + setKeyGetIdAttributeType(&this.Id, id) + setKeygetImportOnlyAttributeType(&this.ImportOnly, importOnly) + setKeyGetKeyRingIdAttributeType(&this.KeyRingId, keyRingId) + setKeyGetProtectionAttributeType(&this.Protection, protection) + setKeyGetPurposeAttributeType(&this.Purpose, purpose) + setKeyGetStateAttributeType(&this.State, state) + return &this +} + +// NewKeyWithDefaults instantiates a new Key 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 NewKeyWithDefaults() *Key { + this := Key{} + var accessScope AccessScope = ACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope + var importOnly bool = false + this.ImportOnly = &importOnly + return &this +} + +// GetAccessScope returns the AccessScope field value +func (o *Key) GetAccessScope() (ret KeyGetAccessScopeRetType) { + ret, _ = o.GetAccessScopeOk() + return ret +} + +// GetAccessScopeOk returns a tuple with the AccessScope field value +// and a boolean to check if the value has been set. +func (o *Key) GetAccessScopeOk() (ret KeyGetAccessScopeRetType, ok bool) { + return getKeyGetAccessScopeAttributeTypeOk(o.AccessScope) +} + +// SetAccessScope sets field value +func (o *Key) SetAccessScope(v KeyGetAccessScopeRetType) { + setKeyGetAccessScopeAttributeType(&o.AccessScope, v) +} + +// GetAlgorithm returns the Algorithm field value +func (o *Key) GetAlgorithm() (ret KeyGetAlgorithmRetType) { + ret, _ = o.GetAlgorithmOk() + return ret +} + +// GetAlgorithmOk returns a tuple with the Algorithm field value +// and a boolean to check if the value has been set. +func (o *Key) GetAlgorithmOk() (ret KeyGetAlgorithmRetType, ok bool) { + return getKeyGetAlgorithmAttributeTypeOk(o.Algorithm) +} + +// SetAlgorithm sets field value +func (o *Key) SetAlgorithm(v KeyGetAlgorithmRetType) { + setKeyGetAlgorithmAttributeType(&o.Algorithm, v) +} + +// GetBackend returns the Backend field value +// Deprecated +func (o *Key) GetBackend() (ret KeyGetBackendRetType) { + ret, _ = o.GetBackendOk() + return ret +} + +// GetBackendOk returns a tuple with the Backend field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *Key) GetBackendOk() (ret KeyGetBackendRetType, ok bool) { + return getKeyGetBackendAttributeTypeOk(o.Backend) +} + +// SetBackend sets field value +// Deprecated +func (o *Key) SetBackend(v KeyGetBackendRetType) { + setKeyGetBackendAttributeType(&o.Backend, v) +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Key) GetCreatedAt() (ret KeyGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() + return ret +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *Key) GetCreatedAtOk() (ret KeyGetCreatedAtRetType, ok bool) { + return getKeyGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// SetCreatedAt sets field value +func (o *Key) SetCreatedAt(v KeyGetCreatedAtRetType) { + setKeyGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDeletionDate returns the DeletionDate field value if set, zero value otherwise. +func (o *Key) GetDeletionDate() (res KeyGetDeletionDateRetType) { + res, _ = o.GetDeletionDateOk() + return +} + +// GetDeletionDateOk returns a tuple with the DeletionDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Key) GetDeletionDateOk() (ret KeyGetDeletionDateRetType, ok bool) { + return getKeyGetDeletionDateAttributeTypeOk(o.DeletionDate) +} + +// HasDeletionDate returns a boolean if a field has been set. +func (o *Key) HasDeletionDate() bool { + _, ok := o.GetDeletionDateOk() + return ok +} + +// SetDeletionDate gets a reference to the given time.Time and assigns it to the DeletionDate field. +func (o *Key) SetDeletionDate(v KeyGetDeletionDateRetType) { + setKeyGetDeletionDateAttributeType(&o.DeletionDate, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Key) GetDescription() (res KeyGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Key) GetDescriptionOk() (ret KeyGetDescriptionRetType, ok bool) { + return getKeyGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *Key) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Key) SetDescription(v KeyGetDescriptionRetType) { + setKeyGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *Key) GetDisplayName() (ret KeyGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *Key) GetDisplayNameOk() (ret KeyGetDisplayNameRetType, ok bool) { + return getKeyGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *Key) SetDisplayName(v KeyGetDisplayNameRetType) { + setKeyGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetId returns the Id field value +func (o *Key) GetId() (ret KeyGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Key) GetIdOk() (ret KeyGetIdRetType, ok bool) { + return getKeyGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Key) SetId(v KeyGetIdRetType) { + setKeyGetIdAttributeType(&o.Id, v) +} + +// GetImportOnly returns the ImportOnly field value +func (o *Key) GetImportOnly() (ret KeygetImportOnlyRetType) { + ret, _ = o.GetImportOnlyOk() + return ret +} + +// GetImportOnlyOk returns a tuple with the ImportOnly field value +// and a boolean to check if the value has been set. +func (o *Key) GetImportOnlyOk() (ret KeygetImportOnlyRetType, ok bool) { + return getKeygetImportOnlyAttributeTypeOk(o.ImportOnly) +} + +// SetImportOnly sets field value +func (o *Key) SetImportOnly(v KeygetImportOnlyRetType) { + setKeygetImportOnlyAttributeType(&o.ImportOnly, v) +} + +// GetKeyRingId returns the KeyRingId field value +func (o *Key) GetKeyRingId() (ret KeyGetKeyRingIdRetType) { + ret, _ = o.GetKeyRingIdOk() + return ret +} + +// GetKeyRingIdOk returns a tuple with the KeyRingId field value +// and a boolean to check if the value has been set. +func (o *Key) GetKeyRingIdOk() (ret KeyGetKeyRingIdRetType, ok bool) { + return getKeyGetKeyRingIdAttributeTypeOk(o.KeyRingId) +} + +// SetKeyRingId sets field value +func (o *Key) SetKeyRingId(v KeyGetKeyRingIdRetType) { + setKeyGetKeyRingIdAttributeType(&o.KeyRingId, v) +} + +// GetProtection returns the Protection field value +func (o *Key) GetProtection() (ret KeyGetProtectionRetType) { + ret, _ = o.GetProtectionOk() + return ret +} + +// GetProtectionOk returns a tuple with the Protection field value +// and a boolean to check if the value has been set. +func (o *Key) GetProtectionOk() (ret KeyGetProtectionRetType, ok bool) { + return getKeyGetProtectionAttributeTypeOk(o.Protection) +} + +// SetProtection sets field value +func (o *Key) SetProtection(v KeyGetProtectionRetType) { + setKeyGetProtectionAttributeType(&o.Protection, v) +} + +// GetPurpose returns the Purpose field value +func (o *Key) GetPurpose() (ret KeyGetPurposeRetType) { + ret, _ = o.GetPurposeOk() + return ret +} + +// GetPurposeOk returns a tuple with the Purpose field value +// and a boolean to check if the value has been set. +func (o *Key) GetPurposeOk() (ret KeyGetPurposeRetType, ok bool) { + return getKeyGetPurposeAttributeTypeOk(o.Purpose) +} + +// SetPurpose sets field value +func (o *Key) SetPurpose(v KeyGetPurposeRetType) { + setKeyGetPurposeAttributeType(&o.Purpose, v) +} + +// GetState returns the State field value +func (o *Key) GetState() (ret KeyGetStateRetType) { + ret, _ = o.GetStateOk() + return ret +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *Key) GetStateOk() (ret KeyGetStateRetType, ok bool) { + return getKeyGetStateAttributeTypeOk(o.State) +} + +// SetState sets field value +func (o *Key) SetState(v KeyGetStateRetType) { + setKeyGetStateAttributeType(&o.State, v) +} + +func (o Key) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKeyGetAccessScopeAttributeTypeOk(o.AccessScope); ok { + toSerialize["AccessScope"] = val + } + if val, ok := getKeyGetAlgorithmAttributeTypeOk(o.Algorithm); ok { + toSerialize["Algorithm"] = val + } + if val, ok := getKeyGetBackendAttributeTypeOk(o.Backend); ok { + toSerialize["Backend"] = val + } + if val, ok := getKeyGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getKeyGetDeletionDateAttributeTypeOk(o.DeletionDate); ok { + toSerialize["DeletionDate"] = val + } + if val, ok := getKeyGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getKeyGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getKeyGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getKeygetImportOnlyAttributeTypeOk(o.ImportOnly); ok { + toSerialize["ImportOnly"] = val + } + if val, ok := getKeyGetKeyRingIdAttributeTypeOk(o.KeyRingId); ok { + toSerialize["KeyRingId"] = val + } + if val, ok := getKeyGetProtectionAttributeTypeOk(o.Protection); ok { + toSerialize["Protection"] = val + } + if val, ok := getKeyGetPurposeAttributeTypeOk(o.Purpose); ok { + toSerialize["Purpose"] = val + } + if val, ok := getKeyGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableKey struct { + value *Key + isSet bool +} + +func (v NullableKey) Get() *Key { + return v.value +} + +func (v *NullableKey) Set(val *Key) { + v.value = val + v.isSet = true +} + +func (v NullableKey) IsSet() bool { + return v.isSet +} + +func (v *NullableKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKey(val *Key) *NullableKey { + return &NullableKey{value: val, isSet: true} +} + +func (v NullableKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_key_list.go b/pkg/kmsbeta/model_key_list.go new file mode 100644 index 00000000..6910952b --- /dev/null +++ b/pkg/kmsbeta/model_key_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the KeyList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KeyList{} + +/* + types and functions for keys +*/ + +// isArray +type KeyListGetKeysAttributeType = *[]Key +type KeyListGetKeysArgType = []Key +type KeyListGetKeysRetType = []Key + +func getKeyListGetKeysAttributeTypeOk(arg KeyListGetKeysAttributeType) (ret KeyListGetKeysRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyListGetKeysAttributeType(arg *KeyListGetKeysAttributeType, val KeyListGetKeysRetType) { + *arg = &val +} + +// KeyList struct for KeyList +type KeyList struct { + // REQUIRED + Keys KeyListGetKeysAttributeType `json:"keys" required:"true"` +} + +type _KeyList KeyList + +// NewKeyList instantiates a new KeyList 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 NewKeyList(keys KeyListGetKeysArgType) *KeyList { + this := KeyList{} + setKeyListGetKeysAttributeType(&this.Keys, keys) + return &this +} + +// NewKeyListWithDefaults instantiates a new KeyList 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 NewKeyListWithDefaults() *KeyList { + this := KeyList{} + return &this +} + +// GetKeys returns the Keys field value +func (o *KeyList) GetKeys() (ret KeyListGetKeysRetType) { + ret, _ = o.GetKeysOk() + return ret +} + +// GetKeysOk returns a tuple with the Keys field value +// and a boolean to check if the value has been set. +func (o *KeyList) GetKeysOk() (ret KeyListGetKeysRetType, ok bool) { + return getKeyListGetKeysAttributeTypeOk(o.Keys) +} + +// SetKeys sets field value +func (o *KeyList) SetKeys(v KeyListGetKeysRetType) { + setKeyListGetKeysAttributeType(&o.Keys, v) +} + +func (o KeyList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKeyListGetKeysAttributeTypeOk(o.Keys); ok { + toSerialize["Keys"] = val + } + return toSerialize, nil +} + +type NullableKeyList struct { + value *KeyList + isSet bool +} + +func (v NullableKeyList) Get() *KeyList { + return v.value +} + +func (v *NullableKeyList) Set(val *KeyList) { + v.value = val + v.isSet = true +} + +func (v NullableKeyList) IsSet() bool { + return v.isSet +} + +func (v *NullableKeyList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeyList(val *KeyList) *NullableKeyList { + return &NullableKeyList{value: val, isSet: true} +} + +func (v NullableKeyList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeyList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_key_list_test.go b/pkg/kmsbeta/model_key_list_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_key_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_key_ring.go b/pkg/kmsbeta/model_key_ring.go new file mode 100644 index 00000000..c5a460a6 --- /dev/null +++ b/pkg/kmsbeta/model_key_ring.go @@ -0,0 +1,417 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the KeyRing type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KeyRing{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type KeyRingGetCreatedAtAttributeType = *time.Time +type KeyRingGetCreatedAtArgType = time.Time +type KeyRingGetCreatedAtRetType = time.Time + +func getKeyRingGetCreatedAtAttributeTypeOk(arg KeyRingGetCreatedAtAttributeType) (ret KeyRingGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyRingGetCreatedAtAttributeType(arg *KeyRingGetCreatedAtAttributeType, val KeyRingGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type KeyRingGetDescriptionAttributeType = *string + +func getKeyRingGetDescriptionAttributeTypeOk(arg KeyRingGetDescriptionAttributeType) (ret KeyRingGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyRingGetDescriptionAttributeType(arg *KeyRingGetDescriptionAttributeType, val KeyRingGetDescriptionRetType) { + *arg = &val +} + +type KeyRingGetDescriptionArgType = string +type KeyRingGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type KeyRingGetDisplayNameAttributeType = *string + +func getKeyRingGetDisplayNameAttributeTypeOk(arg KeyRingGetDisplayNameAttributeType) (ret KeyRingGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyRingGetDisplayNameAttributeType(arg *KeyRingGetDisplayNameAttributeType, val KeyRingGetDisplayNameRetType) { + *arg = &val +} + +type KeyRingGetDisplayNameArgType = string +type KeyRingGetDisplayNameRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type KeyRingGetIdAttributeType = *string + +func getKeyRingGetIdAttributeTypeOk(arg KeyRingGetIdAttributeType) (ret KeyRingGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyRingGetIdAttributeType(arg *KeyRingGetIdAttributeType, val KeyRingGetIdRetType) { + *arg = &val +} + +type KeyRingGetIdArgType = string +type KeyRingGetIdRetType = string + +/* + types and functions for state +*/ + +// isEnum + +// KeyRingState The current state of the key ring. +// value type for enums +type KeyRingState string + +// List of State +const ( + KEYRINGSTATE_CREATING KeyRingState = "creating" + KEYRINGSTATE_ACTIVE KeyRingState = "active" + KEYRINGSTATE_DELETED KeyRingState = "deleted" +) + +// All allowed values of KeyRing enum +var AllowedKeyRingStateEnumValues = []KeyRingState{ + "creating", + "active", + "deleted", +} + +func (v *KeyRingState) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson KeyRingState + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := KeyRingState(value) + for _, existing := range AllowedKeyRingStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid KeyRing", value) +} + +// NewKeyRingStateFromValue returns a pointer to a valid KeyRingState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewKeyRingStateFromValue(v KeyRingState) (*KeyRingState, error) { + ev := KeyRingState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for KeyRingState: valid values are %v", v, AllowedKeyRingStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v KeyRingState) IsValid() bool { + for _, existing := range AllowedKeyRingStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v KeyRingState) Ptr() *KeyRingState { + return &v +} + +type NullableKeyRingState struct { + value *KeyRingState + isSet bool +} + +func (v NullableKeyRingState) Get() *KeyRingState { + return v.value +} + +func (v *NullableKeyRingState) Set(val *KeyRingState) { + v.value = val + v.isSet = true +} + +func (v NullableKeyRingState) IsSet() bool { + return v.isSet +} + +func (v *NullableKeyRingState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeyRingState(val *KeyRingState) *NullableKeyRingState { + return &NullableKeyRingState{value: val, isSet: true} +} + +func (v NullableKeyRingState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeyRingState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type KeyRingGetStateAttributeType = *KeyRingState +type KeyRingGetStateArgType = KeyRingState +type KeyRingGetStateRetType = KeyRingState + +func getKeyRingGetStateAttributeTypeOk(arg KeyRingGetStateAttributeType) (ret KeyRingGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyRingGetStateAttributeType(arg *KeyRingGetStateAttributeType, val KeyRingGetStateRetType) { + *arg = &val +} + +// KeyRing struct for KeyRing +type KeyRing struct { + // The date and time the creation of the key ring was triggered. + // REQUIRED + CreatedAt KeyRingGetCreatedAtAttributeType `json:"createdAt" required:"true"` + // A user chosen description to distinguish multiple key rings. + Description KeyRingGetDescriptionAttributeType `json:"description,omitempty"` + // The display name to distinguish multiple key rings. + // REQUIRED + DisplayName KeyRingGetDisplayNameAttributeType `json:"displayName" required:"true"` + // A auto generated unique id which identifies the key ring. + // REQUIRED + Id KeyRingGetIdAttributeType `json:"id" required:"true"` + // The current state of the key ring. + // REQUIRED + State KeyRingGetStateAttributeType `json:"state" required:"true"` +} + +type _KeyRing KeyRing + +// NewKeyRing instantiates a new KeyRing 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 NewKeyRing(createdAt KeyRingGetCreatedAtArgType, displayName KeyRingGetDisplayNameArgType, id KeyRingGetIdArgType, state KeyRingGetStateArgType) *KeyRing { + this := KeyRing{} + setKeyRingGetCreatedAtAttributeType(&this.CreatedAt, createdAt) + setKeyRingGetDisplayNameAttributeType(&this.DisplayName, displayName) + setKeyRingGetIdAttributeType(&this.Id, id) + setKeyRingGetStateAttributeType(&this.State, state) + return &this +} + +// NewKeyRingWithDefaults instantiates a new KeyRing 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 NewKeyRingWithDefaults() *KeyRing { + this := KeyRing{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value +func (o *KeyRing) GetCreatedAt() (ret KeyRingGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() + return ret +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *KeyRing) GetCreatedAtOk() (ret KeyRingGetCreatedAtRetType, ok bool) { + return getKeyRingGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// SetCreatedAt sets field value +func (o *KeyRing) SetCreatedAt(v KeyRingGetCreatedAtRetType) { + setKeyRingGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *KeyRing) GetDescription() (res KeyRingGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *KeyRing) GetDescriptionOk() (ret KeyRingGetDescriptionRetType, ok bool) { + return getKeyRingGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *KeyRing) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *KeyRing) SetDescription(v KeyRingGetDescriptionRetType) { + setKeyRingGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *KeyRing) GetDisplayName() (ret KeyRingGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *KeyRing) GetDisplayNameOk() (ret KeyRingGetDisplayNameRetType, ok bool) { + return getKeyRingGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *KeyRing) SetDisplayName(v KeyRingGetDisplayNameRetType) { + setKeyRingGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetId returns the Id field value +func (o *KeyRing) GetId() (ret KeyRingGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *KeyRing) GetIdOk() (ret KeyRingGetIdRetType, ok bool) { + return getKeyRingGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *KeyRing) SetId(v KeyRingGetIdRetType) { + setKeyRingGetIdAttributeType(&o.Id, v) +} + +// GetState returns the State field value +func (o *KeyRing) GetState() (ret KeyRingGetStateRetType) { + ret, _ = o.GetStateOk() + return ret +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *KeyRing) GetStateOk() (ret KeyRingGetStateRetType, ok bool) { + return getKeyRingGetStateAttributeTypeOk(o.State) +} + +// SetState sets field value +func (o *KeyRing) SetState(v KeyRingGetStateRetType) { + setKeyRingGetStateAttributeType(&o.State, v) +} + +func (o KeyRing) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKeyRingGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getKeyRingGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getKeyRingGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getKeyRingGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getKeyRingGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableKeyRing struct { + value *KeyRing + isSet bool +} + +func (v NullableKeyRing) Get() *KeyRing { + return v.value +} + +func (v *NullableKeyRing) Set(val *KeyRing) { + v.value = val + v.isSet = true +} + +func (v NullableKeyRing) IsSet() bool { + return v.isSet +} + +func (v *NullableKeyRing) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeyRing(val *KeyRing) *NullableKeyRing { + return &NullableKeyRing{value: val, isSet: true} +} + +func (v NullableKeyRing) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeyRing) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_key_ring_list.go b/pkg/kmsbeta/model_key_ring_list.go new file mode 100644 index 00000000..713d31ad --- /dev/null +++ b/pkg/kmsbeta/model_key_ring_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the KeyRingList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KeyRingList{} + +/* + types and functions for keyRings +*/ + +// isArray +type KeyRingListGetKeyRingsAttributeType = *[]KeyRing +type KeyRingListGetKeyRingsArgType = []KeyRing +type KeyRingListGetKeyRingsRetType = []KeyRing + +func getKeyRingListGetKeyRingsAttributeTypeOk(arg KeyRingListGetKeyRingsAttributeType) (ret KeyRingListGetKeyRingsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyRingListGetKeyRingsAttributeType(arg *KeyRingListGetKeyRingsAttributeType, val KeyRingListGetKeyRingsRetType) { + *arg = &val +} + +// KeyRingList struct for KeyRingList +type KeyRingList struct { + // REQUIRED + KeyRings KeyRingListGetKeyRingsAttributeType `json:"keyRings" required:"true"` +} + +type _KeyRingList KeyRingList + +// NewKeyRingList instantiates a new KeyRingList 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 NewKeyRingList(keyRings KeyRingListGetKeyRingsArgType) *KeyRingList { + this := KeyRingList{} + setKeyRingListGetKeyRingsAttributeType(&this.KeyRings, keyRings) + return &this +} + +// NewKeyRingListWithDefaults instantiates a new KeyRingList 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 NewKeyRingListWithDefaults() *KeyRingList { + this := KeyRingList{} + return &this +} + +// GetKeyRings returns the KeyRings field value +func (o *KeyRingList) GetKeyRings() (ret KeyRingListGetKeyRingsRetType) { + ret, _ = o.GetKeyRingsOk() + return ret +} + +// GetKeyRingsOk returns a tuple with the KeyRings field value +// and a boolean to check if the value has been set. +func (o *KeyRingList) GetKeyRingsOk() (ret KeyRingListGetKeyRingsRetType, ok bool) { + return getKeyRingListGetKeyRingsAttributeTypeOk(o.KeyRings) +} + +// SetKeyRings sets field value +func (o *KeyRingList) SetKeyRings(v KeyRingListGetKeyRingsRetType) { + setKeyRingListGetKeyRingsAttributeType(&o.KeyRings, v) +} + +func (o KeyRingList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKeyRingListGetKeyRingsAttributeTypeOk(o.KeyRings); ok { + toSerialize["KeyRings"] = val + } + return toSerialize, nil +} + +type NullableKeyRingList struct { + value *KeyRingList + isSet bool +} + +func (v NullableKeyRingList) Get() *KeyRingList { + return v.value +} + +func (v *NullableKeyRingList) Set(val *KeyRingList) { + v.value = val + v.isSet = true +} + +func (v NullableKeyRingList) IsSet() bool { + return v.isSet +} + +func (v *NullableKeyRingList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeyRingList(val *KeyRingList) *NullableKeyRingList { + return &NullableKeyRingList{value: val, isSet: true} +} + +func (v NullableKeyRingList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeyRingList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_key_ring_list_test.go b/pkg/kmsbeta/model_key_ring_list_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_key_ring_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_key_ring_test.go b/pkg/kmsbeta/model_key_ring_test.go new file mode 100644 index 00000000..a6a6b321 --- /dev/null +++ b/pkg/kmsbeta/model_key_ring_test.go @@ -0,0 +1,65 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "testing" +) + +// isEnum + +func TestKeyRingState_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"creating"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"deleted"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := KeyRingState("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/kmsbeta/model_key_test.go b/pkg/kmsbeta/model_key_test.go new file mode 100644 index 00000000..65bedd9f --- /dev/null +++ b/pkg/kmsbeta/model_key_test.go @@ -0,0 +1,86 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "testing" +) + +// isEnum + +func TestKeyState_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"deleted"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"not_available"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"errors_exist"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 5`, + args: args{ + src: []byte(`"creating"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 6`, + args: args{ + src: []byte(`"no_version"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := KeyState("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/kmsbeta/model_protection.go b/pkg/kmsbeta/model_protection.go new file mode 100644 index 00000000..f2b8f541 --- /dev/null +++ b/pkg/kmsbeta/model_protection.go @@ -0,0 +1,113 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" +) + +// Protection The underlying system that is responsible for protecting the key material. Overrides the deprecated 'backend' field. +type Protection string + +// List of protection +const ( + PROTECTION_SOFTWARE Protection = "software" +) + +// All allowed values of Protection enum +var AllowedProtectionEnumValues = []Protection{ + "software", +} + +func (v *Protection) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := Protection(value) + for _, existing := range AllowedProtectionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Protection", value) +} + +// NewProtectionFromValue returns a pointer to a valid Protection +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewProtectionFromValue(v string) (*Protection, error) { + ev := Protection(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Protection: valid values are %v", v, AllowedProtectionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Protection) IsValid() bool { + for _, existing := range AllowedProtectionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to protection value +func (v Protection) Ptr() *Protection { + return &v +} + +type NullableProtection struct { + value *Protection + isSet bool +} + +func (v NullableProtection) Get() *Protection { + return v.value +} + +func (v *NullableProtection) Set(val *Protection) { + v.value = val + v.isSet = true +} + +func (v NullableProtection) IsSet() bool { + return v.isSet +} + +func (v *NullableProtection) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtection(val *Protection) *NullableProtection { + return &NullableProtection{value: val, isSet: true} +} + +func (v NullableProtection) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtection) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_protection_test.go b/pkg/kmsbeta/model_protection_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_protection_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_purpose.go b/pkg/kmsbeta/model_purpose.go new file mode 100644 index 00000000..4979a578 --- /dev/null +++ b/pkg/kmsbeta/model_purpose.go @@ -0,0 +1,119 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" +) + +// Purpose The purpose of the key. +type Purpose string + +// List of purpose +const ( + PURPOSE_SYMMETRIC_ENCRYPT_DECRYPT Purpose = "symmetric_encrypt_decrypt" + PURPOSE_ASYMMETRIC_ENCRYPT_DECRYPT Purpose = "asymmetric_encrypt_decrypt" + PURPOSE_MESSAGE_AUTHENTICATION_CODE Purpose = "message_authentication_code" + PURPOSE_ASYMMETRIC_SIGN_VERIFY Purpose = "asymmetric_sign_verify" +) + +// All allowed values of Purpose enum +var AllowedPurposeEnumValues = []Purpose{ + "symmetric_encrypt_decrypt", + "asymmetric_encrypt_decrypt", + "message_authentication_code", + "asymmetric_sign_verify", +} + +func (v *Purpose) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := Purpose(value) + for _, existing := range AllowedPurposeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Purpose", value) +} + +// NewPurposeFromValue returns a pointer to a valid Purpose +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPurposeFromValue(v string) (*Purpose, error) { + ev := Purpose(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Purpose: valid values are %v", v, AllowedPurposeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Purpose) IsValid() bool { + for _, existing := range AllowedPurposeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to purpose value +func (v Purpose) Ptr() *Purpose { + return &v +} + +type NullablePurpose struct { + value *Purpose + isSet bool +} + +func (v NullablePurpose) Get() *Purpose { + return v.value +} + +func (v *NullablePurpose) Set(val *Purpose) { + v.value = val + v.isSet = true +} + +func (v NullablePurpose) IsSet() bool { + return v.isSet +} + +func (v *NullablePurpose) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePurpose(val *Purpose) *NullablePurpose { + return &NullablePurpose{value: val, isSet: true} +} + +func (v NullablePurpose) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePurpose) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_purpose_test.go b/pkg/kmsbeta/model_purpose_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_purpose_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_sign_payload.go b/pkg/kmsbeta/model_sign_payload.go new file mode 100644 index 00000000..461c373c --- /dev/null +++ b/pkg/kmsbeta/model_sign_payload.go @@ -0,0 +1,126 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the SignPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SignPayload{} + +/* + types and functions for data +*/ + +// isByteArray +type SignPayloadGetDataAttributeType = *[]byte +type SignPayloadGetDataArgType = []byte +type SignPayloadGetDataRetType = []byte + +func getSignPayloadGetDataAttributeTypeOk(arg SignPayloadGetDataAttributeType) (ret SignPayloadGetDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSignPayloadGetDataAttributeType(arg *SignPayloadGetDataAttributeType, val SignPayloadGetDataRetType) { + *arg = &val +} + +// SignPayload struct for SignPayload +type SignPayload struct { + // The data that has to be signed. Encoded in base64. + // REQUIRED + Data SignPayloadGetDataAttributeType `json:"data" required:"true"` +} + +type _SignPayload SignPayload + +// NewSignPayload instantiates a new SignPayload 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 NewSignPayload(data SignPayloadGetDataArgType) *SignPayload { + this := SignPayload{} + setSignPayloadGetDataAttributeType(&this.Data, data) + return &this +} + +// NewSignPayloadWithDefaults instantiates a new SignPayload 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 NewSignPayloadWithDefaults() *SignPayload { + this := SignPayload{} + return &this +} + +// GetData returns the Data field value +func (o *SignPayload) GetData() (ret SignPayloadGetDataRetType) { + ret, _ = o.GetDataOk() + return ret +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *SignPayload) GetDataOk() (ret SignPayloadGetDataRetType, ok bool) { + return getSignPayloadGetDataAttributeTypeOk(o.Data) +} + +// SetData sets field value +func (o *SignPayload) SetData(v SignPayloadGetDataRetType) { + setSignPayloadGetDataAttributeType(&o.Data, v) +} + +func (o SignPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSignPayloadGetDataAttributeTypeOk(o.Data); ok { + toSerialize["Data"] = val + } + return toSerialize, nil +} + +type NullableSignPayload struct { + value *SignPayload + isSet bool +} + +func (v NullableSignPayload) Get() *SignPayload { + return v.value +} + +func (v *NullableSignPayload) Set(val *SignPayload) { + v.value = val + v.isSet = true +} + +func (v NullableSignPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableSignPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSignPayload(val *SignPayload) *NullableSignPayload { + return &NullableSignPayload{value: val, isSet: true} +} + +func (v NullableSignPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSignPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_sign_payload_test.go b/pkg/kmsbeta/model_sign_payload_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_sign_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_signed_data.go b/pkg/kmsbeta/model_signed_data.go new file mode 100644 index 00000000..bb8d512a --- /dev/null +++ b/pkg/kmsbeta/model_signed_data.go @@ -0,0 +1,170 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the SignedData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SignedData{} + +/* + types and functions for data +*/ + +// isByteArray +type SignedDataGetDataAttributeType = *[]byte +type SignedDataGetDataArgType = []byte +type SignedDataGetDataRetType = []byte + +func getSignedDataGetDataAttributeTypeOk(arg SignedDataGetDataAttributeType) (ret SignedDataGetDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSignedDataGetDataAttributeType(arg *SignedDataGetDataAttributeType, val SignedDataGetDataRetType) { + *arg = &val +} + +/* + types and functions for signature +*/ + +// isByteArray +type SignedDataGetSignatureAttributeType = *[]byte +type SignedDataGetSignatureArgType = []byte +type SignedDataGetSignatureRetType = []byte + +func getSignedDataGetSignatureAttributeTypeOk(arg SignedDataGetSignatureAttributeType) (ret SignedDataGetSignatureRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSignedDataGetSignatureAttributeType(arg *SignedDataGetSignatureAttributeType, val SignedDataGetSignatureRetType) { + *arg = &val +} + +// SignedData struct for SignedData +type SignedData struct { + // The data that was signed. Encoded in base64. + // REQUIRED + Data SignedDataGetDataAttributeType `json:"data" required:"true"` + // The signature of the data. Encoded in base64. + // REQUIRED + Signature SignedDataGetSignatureAttributeType `json:"signature" required:"true"` +} + +type _SignedData SignedData + +// NewSignedData instantiates a new SignedData 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 NewSignedData(data SignedDataGetDataArgType, signature SignedDataGetSignatureArgType) *SignedData { + this := SignedData{} + setSignedDataGetDataAttributeType(&this.Data, data) + setSignedDataGetSignatureAttributeType(&this.Signature, signature) + return &this +} + +// NewSignedDataWithDefaults instantiates a new SignedData 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 NewSignedDataWithDefaults() *SignedData { + this := SignedData{} + return &this +} + +// GetData returns the Data field value +func (o *SignedData) GetData() (ret SignedDataGetDataRetType) { + ret, _ = o.GetDataOk() + return ret +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *SignedData) GetDataOk() (ret SignedDataGetDataRetType, ok bool) { + return getSignedDataGetDataAttributeTypeOk(o.Data) +} + +// SetData sets field value +func (o *SignedData) SetData(v SignedDataGetDataRetType) { + setSignedDataGetDataAttributeType(&o.Data, v) +} + +// GetSignature returns the Signature field value +func (o *SignedData) GetSignature() (ret SignedDataGetSignatureRetType) { + ret, _ = o.GetSignatureOk() + return ret +} + +// GetSignatureOk returns a tuple with the Signature field value +// and a boolean to check if the value has been set. +func (o *SignedData) GetSignatureOk() (ret SignedDataGetSignatureRetType, ok bool) { + return getSignedDataGetSignatureAttributeTypeOk(o.Signature) +} + +// SetSignature sets field value +func (o *SignedData) SetSignature(v SignedDataGetSignatureRetType) { + setSignedDataGetSignatureAttributeType(&o.Signature, v) +} + +func (o SignedData) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSignedDataGetDataAttributeTypeOk(o.Data); ok { + toSerialize["Data"] = val + } + if val, ok := getSignedDataGetSignatureAttributeTypeOk(o.Signature); ok { + toSerialize["Signature"] = val + } + return toSerialize, nil +} + +type NullableSignedData struct { + value *SignedData + isSet bool +} + +func (v NullableSignedData) Get() *SignedData { + return v.value +} + +func (v *NullableSignedData) Set(val *SignedData) { + v.value = val + v.isSet = true +} + +func (v NullableSignedData) IsSet() bool { + return v.isSet +} + +func (v *NullableSignedData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSignedData(val *SignedData) *NullableSignedData { + return &NullableSignedData{value: val, isSet: true} +} + +func (v NullableSignedData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSignedData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_signed_data_test.go b/pkg/kmsbeta/model_signed_data_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_signed_data_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_verified_data.go b/pkg/kmsbeta/model_verified_data.go new file mode 100644 index 00000000..ad2736c7 --- /dev/null +++ b/pkg/kmsbeta/model_verified_data.go @@ -0,0 +1,126 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the VerifiedData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VerifiedData{} + +/* + types and functions for valid +*/ + +// isBoolean +type VerifiedDatagetValidAttributeType = *bool +type VerifiedDatagetValidArgType = bool +type VerifiedDatagetValidRetType = bool + +func getVerifiedDatagetValidAttributeTypeOk(arg VerifiedDatagetValidAttributeType) (ret VerifiedDatagetValidRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVerifiedDatagetValidAttributeType(arg *VerifiedDatagetValidAttributeType, val VerifiedDatagetValidRetType) { + *arg = &val +} + +// VerifiedData struct for VerifiedData +type VerifiedData struct { + // Whether or not the data has a valid signature. + // REQUIRED + Valid VerifiedDatagetValidAttributeType `json:"valid" required:"true"` +} + +type _VerifiedData VerifiedData + +// NewVerifiedData instantiates a new VerifiedData 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 NewVerifiedData(valid VerifiedDatagetValidArgType) *VerifiedData { + this := VerifiedData{} + setVerifiedDatagetValidAttributeType(&this.Valid, valid) + return &this +} + +// NewVerifiedDataWithDefaults instantiates a new VerifiedData 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 NewVerifiedDataWithDefaults() *VerifiedData { + this := VerifiedData{} + return &this +} + +// GetValid returns the Valid field value +func (o *VerifiedData) GetValid() (ret VerifiedDatagetValidRetType) { + ret, _ = o.GetValidOk() + return ret +} + +// GetValidOk returns a tuple with the Valid field value +// and a boolean to check if the value has been set. +func (o *VerifiedData) GetValidOk() (ret VerifiedDatagetValidRetType, ok bool) { + return getVerifiedDatagetValidAttributeTypeOk(o.Valid) +} + +// SetValid sets field value +func (o *VerifiedData) SetValid(v VerifiedDatagetValidRetType) { + setVerifiedDatagetValidAttributeType(&o.Valid, v) +} + +func (o VerifiedData) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVerifiedDatagetValidAttributeTypeOk(o.Valid); ok { + toSerialize["Valid"] = val + } + return toSerialize, nil +} + +type NullableVerifiedData struct { + value *VerifiedData + isSet bool +} + +func (v NullableVerifiedData) Get() *VerifiedData { + return v.value +} + +func (v *NullableVerifiedData) Set(val *VerifiedData) { + v.value = val + v.isSet = true +} + +func (v NullableVerifiedData) IsSet() bool { + return v.isSet +} + +func (v *NullableVerifiedData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVerifiedData(val *VerifiedData) *NullableVerifiedData { + return &NullableVerifiedData{value: val, isSet: true} +} + +func (v NullableVerifiedData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVerifiedData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_verified_data_test.go b/pkg/kmsbeta/model_verified_data_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_verified_data_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_verify_payload.go b/pkg/kmsbeta/model_verify_payload.go new file mode 100644 index 00000000..1bc58579 --- /dev/null +++ b/pkg/kmsbeta/model_verify_payload.go @@ -0,0 +1,170 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the VerifyPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VerifyPayload{} + +/* + types and functions for data +*/ + +// isByteArray +type VerifyPayloadGetDataAttributeType = *[]byte +type VerifyPayloadGetDataArgType = []byte +type VerifyPayloadGetDataRetType = []byte + +func getVerifyPayloadGetDataAttributeTypeOk(arg VerifyPayloadGetDataAttributeType) (ret VerifyPayloadGetDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVerifyPayloadGetDataAttributeType(arg *VerifyPayloadGetDataAttributeType, val VerifyPayloadGetDataRetType) { + *arg = &val +} + +/* + types and functions for signature +*/ + +// isByteArray +type VerifyPayloadGetSignatureAttributeType = *[]byte +type VerifyPayloadGetSignatureArgType = []byte +type VerifyPayloadGetSignatureRetType = []byte + +func getVerifyPayloadGetSignatureAttributeTypeOk(arg VerifyPayloadGetSignatureAttributeType) (ret VerifyPayloadGetSignatureRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVerifyPayloadGetSignatureAttributeType(arg *VerifyPayloadGetSignatureAttributeType, val VerifyPayloadGetSignatureRetType) { + *arg = &val +} + +// VerifyPayload struct for VerifyPayload +type VerifyPayload struct { + // The data to be verified. Encoded in base64. + // REQUIRED + Data VerifyPayloadGetDataAttributeType `json:"data" required:"true"` + // The signature of the data. Encoded in base64. + // REQUIRED + Signature VerifyPayloadGetSignatureAttributeType `json:"signature" required:"true"` +} + +type _VerifyPayload VerifyPayload + +// NewVerifyPayload instantiates a new VerifyPayload 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 NewVerifyPayload(data VerifyPayloadGetDataArgType, signature VerifyPayloadGetSignatureArgType) *VerifyPayload { + this := VerifyPayload{} + setVerifyPayloadGetDataAttributeType(&this.Data, data) + setVerifyPayloadGetSignatureAttributeType(&this.Signature, signature) + return &this +} + +// NewVerifyPayloadWithDefaults instantiates a new VerifyPayload 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 NewVerifyPayloadWithDefaults() *VerifyPayload { + this := VerifyPayload{} + return &this +} + +// GetData returns the Data field value +func (o *VerifyPayload) GetData() (ret VerifyPayloadGetDataRetType) { + ret, _ = o.GetDataOk() + return ret +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *VerifyPayload) GetDataOk() (ret VerifyPayloadGetDataRetType, ok bool) { + return getVerifyPayloadGetDataAttributeTypeOk(o.Data) +} + +// SetData sets field value +func (o *VerifyPayload) SetData(v VerifyPayloadGetDataRetType) { + setVerifyPayloadGetDataAttributeType(&o.Data, v) +} + +// GetSignature returns the Signature field value +func (o *VerifyPayload) GetSignature() (ret VerifyPayloadGetSignatureRetType) { + ret, _ = o.GetSignatureOk() + return ret +} + +// GetSignatureOk returns a tuple with the Signature field value +// and a boolean to check if the value has been set. +func (o *VerifyPayload) GetSignatureOk() (ret VerifyPayloadGetSignatureRetType, ok bool) { + return getVerifyPayloadGetSignatureAttributeTypeOk(o.Signature) +} + +// SetSignature sets field value +func (o *VerifyPayload) SetSignature(v VerifyPayloadGetSignatureRetType) { + setVerifyPayloadGetSignatureAttributeType(&o.Signature, v) +} + +func (o VerifyPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVerifyPayloadGetDataAttributeTypeOk(o.Data); ok { + toSerialize["Data"] = val + } + if val, ok := getVerifyPayloadGetSignatureAttributeTypeOk(o.Signature); ok { + toSerialize["Signature"] = val + } + return toSerialize, nil +} + +type NullableVerifyPayload struct { + value *VerifyPayload + isSet bool +} + +func (v NullableVerifyPayload) Get() *VerifyPayload { + return v.value +} + +func (v *NullableVerifyPayload) Set(val *VerifyPayload) { + v.value = val + v.isSet = true +} + +func (v NullableVerifyPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableVerifyPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVerifyPayload(val *VerifyPayload) *NullableVerifyPayload { + return &NullableVerifyPayload{value: val, isSet: true} +} + +func (v NullableVerifyPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVerifyPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_verify_payload_test.go b/pkg/kmsbeta/model_verify_payload_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_verify_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_version.go b/pkg/kmsbeta/model_version.go new file mode 100644 index 00000000..feb226da --- /dev/null +++ b/pkg/kmsbeta/model_version.go @@ -0,0 +1,561 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Version type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Version{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type VersionGetCreatedAtAttributeType = *time.Time +type VersionGetCreatedAtArgType = time.Time +type VersionGetCreatedAtRetType = time.Time + +func getVersionGetCreatedAtAttributeTypeOk(arg VersionGetCreatedAtAttributeType) (ret VersionGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVersionGetCreatedAtAttributeType(arg *VersionGetCreatedAtAttributeType, val VersionGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for destroyDate +*/ + +// isDateTime +type VersionGetDestroyDateAttributeType = *time.Time +type VersionGetDestroyDateArgType = time.Time +type VersionGetDestroyDateRetType = time.Time + +func getVersionGetDestroyDateAttributeTypeOk(arg VersionGetDestroyDateAttributeType) (ret VersionGetDestroyDateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVersionGetDestroyDateAttributeType(arg *VersionGetDestroyDateAttributeType, val VersionGetDestroyDateRetType) { + *arg = &val +} + +/* + types and functions for disabled +*/ + +// isBoolean +type VersiongetDisabledAttributeType = *bool +type VersiongetDisabledArgType = bool +type VersiongetDisabledRetType = bool + +func getVersiongetDisabledAttributeTypeOk(arg VersiongetDisabledAttributeType) (ret VersiongetDisabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVersiongetDisabledAttributeType(arg *VersiongetDisabledAttributeType, val VersiongetDisabledRetType) { + *arg = &val +} + +/* + types and functions for keyId +*/ + +// isNotNullableString +type VersionGetKeyIdAttributeType = *string + +func getVersionGetKeyIdAttributeTypeOk(arg VersionGetKeyIdAttributeType) (ret VersionGetKeyIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVersionGetKeyIdAttributeType(arg *VersionGetKeyIdAttributeType, val VersionGetKeyIdRetType) { + *arg = &val +} + +type VersionGetKeyIdArgType = string +type VersionGetKeyIdRetType = string + +/* + types and functions for keyRingId +*/ + +// isNotNullableString +type VersionGetKeyRingIdAttributeType = *string + +func getVersionGetKeyRingIdAttributeTypeOk(arg VersionGetKeyRingIdAttributeType) (ret VersionGetKeyRingIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVersionGetKeyRingIdAttributeType(arg *VersionGetKeyRingIdAttributeType, val VersionGetKeyRingIdRetType) { + *arg = &val +} + +type VersionGetKeyRingIdArgType = string +type VersionGetKeyRingIdRetType = string + +/* + types and functions for number +*/ + +// isLong +type VersionGetNumberAttributeType = *int64 +type VersionGetNumberArgType = int64 +type VersionGetNumberRetType = int64 + +func getVersionGetNumberAttributeTypeOk(arg VersionGetNumberAttributeType) (ret VersionGetNumberRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVersionGetNumberAttributeType(arg *VersionGetNumberAttributeType, val VersionGetNumberRetType) { + *arg = &val +} + +/* + types and functions for publicKey +*/ + +// isNotNullableString +type VersionGetPublicKeyAttributeType = *string + +func getVersionGetPublicKeyAttributeTypeOk(arg VersionGetPublicKeyAttributeType) (ret VersionGetPublicKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVersionGetPublicKeyAttributeType(arg *VersionGetPublicKeyAttributeType, val VersionGetPublicKeyRetType) { + *arg = &val +} + +type VersionGetPublicKeyArgType = string +type VersionGetPublicKeyRetType = string + +/* + types and functions for state +*/ + +// isEnum + +// VersionState The current state of the key. +// value type for enums +type VersionState string + +// List of State +const ( + VERSIONSTATE_ACTIVE VersionState = "active" + VERSIONSTATE_CREATING VersionState = "creating" + VERSIONSTATE_KEY_MATERIAL_INVALID VersionState = "key_material_invalid" + VERSIONSTATE_KEY_MATERIAL_UNAVAILABLE VersionState = "key_material_unavailable" + VERSIONSTATE_DISABLED VersionState = "disabled" + VERSIONSTATE_DESTROYED VersionState = "destroyed" +) + +// All allowed values of Version enum +var AllowedVersionStateEnumValues = []VersionState{ + "active", + "creating", + "key_material_invalid", + "key_material_unavailable", + "disabled", + "destroyed", +} + +func (v *VersionState) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson VersionState + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := VersionState(value) + for _, existing := range AllowedVersionStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Version", value) +} + +// NewVersionStateFromValue returns a pointer to a valid VersionState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVersionStateFromValue(v VersionState) (*VersionState, error) { + ev := VersionState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VersionState: valid values are %v", v, AllowedVersionStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VersionState) IsValid() bool { + for _, existing := range AllowedVersionStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v VersionState) Ptr() *VersionState { + return &v +} + +type NullableVersionState struct { + value *VersionState + isSet bool +} + +func (v NullableVersionState) Get() *VersionState { + return v.value +} + +func (v *NullableVersionState) Set(val *VersionState) { + v.value = val + v.isSet = true +} + +func (v NullableVersionState) IsSet() bool { + return v.isSet +} + +func (v *NullableVersionState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVersionState(val *VersionState) *NullableVersionState { + return &NullableVersionState{value: val, isSet: true} +} + +func (v NullableVersionState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVersionState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type VersionGetStateAttributeType = *VersionState +type VersionGetStateArgType = VersionState +type VersionGetStateRetType = VersionState + +func getVersionGetStateAttributeTypeOk(arg VersionGetStateAttributeType) (ret VersionGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVersionGetStateAttributeType(arg *VersionGetStateAttributeType, val VersionGetStateRetType) { + *arg = &val +} + +// Version struct for Version +type Version struct { + // The date and time the creation of the key was triggered. + // REQUIRED + CreatedAt VersionGetCreatedAtAttributeType `json:"createdAt" required:"true"` + // The scheduled date when a version's key material will be erased completely from the backend + DestroyDate VersionGetDestroyDateAttributeType `json:"destroyDate,omitempty"` + // States whether versions is enabled or disabled. + // REQUIRED + Disabled VersiongetDisabledAttributeType `json:"disabled" required:"true"` + // The unique id of the key this version is assigned to. + // REQUIRED + KeyId VersionGetKeyIdAttributeType `json:"keyId" required:"true"` + // The unique id of the key ring the key of this version is assigned to. + // REQUIRED + KeyRingId VersionGetKeyRingIdAttributeType `json:"keyRingId" required:"true"` + // A sequential number which identifies the key versions. + // REQUIRED + Number VersionGetNumberAttributeType `json:"number" required:"true"` + // The public key of the key version. Only present in asymmetric keys. + PublicKey VersionGetPublicKeyAttributeType `json:"publicKey,omitempty"` + // The current state of the key. + // REQUIRED + State VersionGetStateAttributeType `json:"state" required:"true"` +} + +type _Version Version + +// NewVersion instantiates a new Version 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 NewVersion(createdAt VersionGetCreatedAtArgType, disabled VersiongetDisabledArgType, keyId VersionGetKeyIdArgType, keyRingId VersionGetKeyRingIdArgType, number VersionGetNumberArgType, state VersionGetStateArgType) *Version { + this := Version{} + setVersionGetCreatedAtAttributeType(&this.CreatedAt, createdAt) + setVersiongetDisabledAttributeType(&this.Disabled, disabled) + setVersionGetKeyIdAttributeType(&this.KeyId, keyId) + setVersionGetKeyRingIdAttributeType(&this.KeyRingId, keyRingId) + setVersionGetNumberAttributeType(&this.Number, number) + setVersionGetStateAttributeType(&this.State, state) + return &this +} + +// NewVersionWithDefaults instantiates a new Version 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 NewVersionWithDefaults() *Version { + this := Version{} + var disabled bool = false + this.Disabled = &disabled + return &this +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Version) GetCreatedAt() (ret VersionGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() + return ret +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *Version) GetCreatedAtOk() (ret VersionGetCreatedAtRetType, ok bool) { + return getVersionGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// SetCreatedAt sets field value +func (o *Version) SetCreatedAt(v VersionGetCreatedAtRetType) { + setVersionGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDestroyDate returns the DestroyDate field value if set, zero value otherwise. +func (o *Version) GetDestroyDate() (res VersionGetDestroyDateRetType) { + res, _ = o.GetDestroyDateOk() + return +} + +// GetDestroyDateOk returns a tuple with the DestroyDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Version) GetDestroyDateOk() (ret VersionGetDestroyDateRetType, ok bool) { + return getVersionGetDestroyDateAttributeTypeOk(o.DestroyDate) +} + +// HasDestroyDate returns a boolean if a field has been set. +func (o *Version) HasDestroyDate() bool { + _, ok := o.GetDestroyDateOk() + return ok +} + +// SetDestroyDate gets a reference to the given time.Time and assigns it to the DestroyDate field. +func (o *Version) SetDestroyDate(v VersionGetDestroyDateRetType) { + setVersionGetDestroyDateAttributeType(&o.DestroyDate, v) +} + +// GetDisabled returns the Disabled field value +func (o *Version) GetDisabled() (ret VersiongetDisabledRetType) { + ret, _ = o.GetDisabledOk() + return ret +} + +// GetDisabledOk returns a tuple with the Disabled field value +// and a boolean to check if the value has been set. +func (o *Version) GetDisabledOk() (ret VersiongetDisabledRetType, ok bool) { + return getVersiongetDisabledAttributeTypeOk(o.Disabled) +} + +// SetDisabled sets field value +func (o *Version) SetDisabled(v VersiongetDisabledRetType) { + setVersiongetDisabledAttributeType(&o.Disabled, v) +} + +// GetKeyId returns the KeyId field value +func (o *Version) GetKeyId() (ret VersionGetKeyIdRetType) { + ret, _ = o.GetKeyIdOk() + return ret +} + +// GetKeyIdOk returns a tuple with the KeyId field value +// and a boolean to check if the value has been set. +func (o *Version) GetKeyIdOk() (ret VersionGetKeyIdRetType, ok bool) { + return getVersionGetKeyIdAttributeTypeOk(o.KeyId) +} + +// SetKeyId sets field value +func (o *Version) SetKeyId(v VersionGetKeyIdRetType) { + setVersionGetKeyIdAttributeType(&o.KeyId, v) +} + +// GetKeyRingId returns the KeyRingId field value +func (o *Version) GetKeyRingId() (ret VersionGetKeyRingIdRetType) { + ret, _ = o.GetKeyRingIdOk() + return ret +} + +// GetKeyRingIdOk returns a tuple with the KeyRingId field value +// and a boolean to check if the value has been set. +func (o *Version) GetKeyRingIdOk() (ret VersionGetKeyRingIdRetType, ok bool) { + return getVersionGetKeyRingIdAttributeTypeOk(o.KeyRingId) +} + +// SetKeyRingId sets field value +func (o *Version) SetKeyRingId(v VersionGetKeyRingIdRetType) { + setVersionGetKeyRingIdAttributeType(&o.KeyRingId, v) +} + +// GetNumber returns the Number field value +func (o *Version) GetNumber() (ret VersionGetNumberRetType) { + ret, _ = o.GetNumberOk() + return ret +} + +// GetNumberOk returns a tuple with the Number field value +// and a boolean to check if the value has been set. +func (o *Version) GetNumberOk() (ret VersionGetNumberRetType, ok bool) { + return getVersionGetNumberAttributeTypeOk(o.Number) +} + +// SetNumber sets field value +func (o *Version) SetNumber(v VersionGetNumberRetType) { + setVersionGetNumberAttributeType(&o.Number, v) +} + +// GetPublicKey returns the PublicKey field value if set, zero value otherwise. +func (o *Version) GetPublicKey() (res VersionGetPublicKeyRetType) { + res, _ = o.GetPublicKeyOk() + return +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Version) GetPublicKeyOk() (ret VersionGetPublicKeyRetType, ok bool) { + return getVersionGetPublicKeyAttributeTypeOk(o.PublicKey) +} + +// HasPublicKey returns a boolean if a field has been set. +func (o *Version) HasPublicKey() bool { + _, ok := o.GetPublicKeyOk() + return ok +} + +// SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. +func (o *Version) SetPublicKey(v VersionGetPublicKeyRetType) { + setVersionGetPublicKeyAttributeType(&o.PublicKey, v) +} + +// GetState returns the State field value +func (o *Version) GetState() (ret VersionGetStateRetType) { + ret, _ = o.GetStateOk() + return ret +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *Version) GetStateOk() (ret VersionGetStateRetType, ok bool) { + return getVersionGetStateAttributeTypeOk(o.State) +} + +// SetState sets field value +func (o *Version) SetState(v VersionGetStateRetType) { + setVersionGetStateAttributeType(&o.State, v) +} + +func (o Version) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVersionGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getVersionGetDestroyDateAttributeTypeOk(o.DestroyDate); ok { + toSerialize["DestroyDate"] = val + } + if val, ok := getVersiongetDisabledAttributeTypeOk(o.Disabled); ok { + toSerialize["Disabled"] = val + } + if val, ok := getVersionGetKeyIdAttributeTypeOk(o.KeyId); ok { + toSerialize["KeyId"] = val + } + if val, ok := getVersionGetKeyRingIdAttributeTypeOk(o.KeyRingId); ok { + toSerialize["KeyRingId"] = val + } + if val, ok := getVersionGetNumberAttributeTypeOk(o.Number); ok { + toSerialize["Number"] = val + } + if val, ok := getVersionGetPublicKeyAttributeTypeOk(o.PublicKey); ok { + toSerialize["PublicKey"] = val + } + if val, ok := getVersionGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableVersion struct { + value *Version + isSet bool +} + +func (v NullableVersion) Get() *Version { + return v.value +} + +func (v *NullableVersion) Set(val *Version) { + v.value = val + v.isSet = true +} + +func (v NullableVersion) IsSet() bool { + return v.isSet +} + +func (v *NullableVersion) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVersion(val *Version) *NullableVersion { + return &NullableVersion{value: val, isSet: true} +} + +func (v NullableVersion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVersion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_version_list.go b/pkg/kmsbeta/model_version_list.go new file mode 100644 index 00000000..7fe0a677 --- /dev/null +++ b/pkg/kmsbeta/model_version_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the VersionList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VersionList{} + +/* + types and functions for versions +*/ + +// isArray +type VersionListGetVersionsAttributeType = *[]Version +type VersionListGetVersionsArgType = []Version +type VersionListGetVersionsRetType = []Version + +func getVersionListGetVersionsAttributeTypeOk(arg VersionListGetVersionsAttributeType) (ret VersionListGetVersionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVersionListGetVersionsAttributeType(arg *VersionListGetVersionsAttributeType, val VersionListGetVersionsRetType) { + *arg = &val +} + +// VersionList struct for VersionList +type VersionList struct { + // REQUIRED + Versions VersionListGetVersionsAttributeType `json:"versions" required:"true"` +} + +type _VersionList VersionList + +// NewVersionList instantiates a new VersionList 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 NewVersionList(versions VersionListGetVersionsArgType) *VersionList { + this := VersionList{} + setVersionListGetVersionsAttributeType(&this.Versions, versions) + return &this +} + +// NewVersionListWithDefaults instantiates a new VersionList 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 NewVersionListWithDefaults() *VersionList { + this := VersionList{} + return &this +} + +// GetVersions returns the Versions field value +func (o *VersionList) GetVersions() (ret VersionListGetVersionsRetType) { + ret, _ = o.GetVersionsOk() + return ret +} + +// GetVersionsOk returns a tuple with the Versions field value +// and a boolean to check if the value has been set. +func (o *VersionList) GetVersionsOk() (ret VersionListGetVersionsRetType, ok bool) { + return getVersionListGetVersionsAttributeTypeOk(o.Versions) +} + +// SetVersions sets field value +func (o *VersionList) SetVersions(v VersionListGetVersionsRetType) { + setVersionListGetVersionsAttributeType(&o.Versions, v) +} + +func (o VersionList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVersionListGetVersionsAttributeTypeOk(o.Versions); ok { + toSerialize["Versions"] = val + } + return toSerialize, nil +} + +type NullableVersionList struct { + value *VersionList + isSet bool +} + +func (v NullableVersionList) Get() *VersionList { + return v.value +} + +func (v *NullableVersionList) Set(val *VersionList) { + v.value = val + v.isSet = true +} + +func (v NullableVersionList) IsSet() bool { + return v.isSet +} + +func (v *NullableVersionList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVersionList(val *VersionList) *NullableVersionList { + return &NullableVersionList{value: val, isSet: true} +} + +func (v NullableVersionList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVersionList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_version_list_test.go b/pkg/kmsbeta/model_version_list_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_version_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_version_test.go b/pkg/kmsbeta/model_version_test.go new file mode 100644 index 00000000..3b703ae4 --- /dev/null +++ b/pkg/kmsbeta/model_version_test.go @@ -0,0 +1,86 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "testing" +) + +// isEnum + +func TestVersionState_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"creating"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"key_material_invalid"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"key_material_unavailable"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 5`, + args: args{ + src: []byte(`"disabled"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 6`, + args: args{ + src: []byte(`"destroyed"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := VersionState("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/kmsbeta/model_wrapping_algorithm.go b/pkg/kmsbeta/model_wrapping_algorithm.go new file mode 100644 index 00000000..a125c5b2 --- /dev/null +++ b/pkg/kmsbeta/model_wrapping_algorithm.go @@ -0,0 +1,127 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" +) + +// WrappingAlgorithm The wrapping algorithm used to wrap the key to import. +type WrappingAlgorithm string + +// List of wrappingAlgorithm +const ( + WRAPPINGALGORITHM__2048_OAEP_SHA256 WrappingAlgorithm = "rsa_2048_oaep_sha256" + WRAPPINGALGORITHM__3072_OAEP_SHA256 WrappingAlgorithm = "rsa_3072_oaep_sha256" + WRAPPINGALGORITHM__4096_OAEP_SHA256 WrappingAlgorithm = "rsa_4096_oaep_sha256" + WRAPPINGALGORITHM__4096_OAEP_SHA512 WrappingAlgorithm = "rsa_4096_oaep_sha512" + WRAPPINGALGORITHM__2048_OAEP_SHA256_AES_256_KEY_WRAP WrappingAlgorithm = "rsa_2048_oaep_sha256_aes_256_key_wrap" + WRAPPINGALGORITHM__3072_OAEP_SHA256_AES_256_KEY_WRAP WrappingAlgorithm = "rsa_3072_oaep_sha256_aes_256_key_wrap" + WRAPPINGALGORITHM__4096_OAEP_SHA256_AES_256_KEY_WRAP WrappingAlgorithm = "rsa_4096_oaep_sha256_aes_256_key_wrap" + WRAPPINGALGORITHM__4096_OAEP_SHA512_AES_256_KEY_WRAP WrappingAlgorithm = "rsa_4096_oaep_sha512_aes_256_key_wrap" +) + +// All allowed values of WrappingAlgorithm enum +var AllowedWrappingAlgorithmEnumValues = []WrappingAlgorithm{ + "rsa_2048_oaep_sha256", + "rsa_3072_oaep_sha256", + "rsa_4096_oaep_sha256", + "rsa_4096_oaep_sha512", + "rsa_2048_oaep_sha256_aes_256_key_wrap", + "rsa_3072_oaep_sha256_aes_256_key_wrap", + "rsa_4096_oaep_sha256_aes_256_key_wrap", + "rsa_4096_oaep_sha512_aes_256_key_wrap", +} + +func (v *WrappingAlgorithm) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := WrappingAlgorithm(value) + for _, existing := range AllowedWrappingAlgorithmEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid WrappingAlgorithm", value) +} + +// NewWrappingAlgorithmFromValue returns a pointer to a valid WrappingAlgorithm +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewWrappingAlgorithmFromValue(v string) (*WrappingAlgorithm, error) { + ev := WrappingAlgorithm(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for WrappingAlgorithm: valid values are %v", v, AllowedWrappingAlgorithmEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v WrappingAlgorithm) IsValid() bool { + for _, existing := range AllowedWrappingAlgorithmEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to wrappingAlgorithm value +func (v WrappingAlgorithm) Ptr() *WrappingAlgorithm { + return &v +} + +type NullableWrappingAlgorithm struct { + value *WrappingAlgorithm + isSet bool +} + +func (v NullableWrappingAlgorithm) Get() *WrappingAlgorithm { + return v.value +} + +func (v *NullableWrappingAlgorithm) Set(val *WrappingAlgorithm) { + v.value = val + v.isSet = true +} + +func (v NullableWrappingAlgorithm) IsSet() bool { + return v.isSet +} + +func (v *NullableWrappingAlgorithm) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWrappingAlgorithm(val *WrappingAlgorithm) *NullableWrappingAlgorithm { + return &NullableWrappingAlgorithm{value: val, isSet: true} +} + +func (v NullableWrappingAlgorithm) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWrappingAlgorithm) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_wrapping_algorithm_test.go b/pkg/kmsbeta/model_wrapping_algorithm_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_wrapping_algorithm_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_wrapping_key.go b/pkg/kmsbeta/model_wrapping_key.go new file mode 100644 index 00000000..3a568ae1 --- /dev/null +++ b/pkg/kmsbeta/model_wrapping_key.go @@ -0,0 +1,780 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the WrappingKey type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WrappingKey{} + +/* + types and functions for access_scope +*/ + +// isEnumRef +type WrappingKeyGetAccessScopeAttributeType = *AccessScope +type WrappingKeyGetAccessScopeArgType = AccessScope +type WrappingKeyGetAccessScopeRetType = AccessScope + +func getWrappingKeyGetAccessScopeAttributeTypeOk(arg WrappingKeyGetAccessScopeAttributeType) (ret WrappingKeyGetAccessScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetAccessScopeAttributeType(arg *WrappingKeyGetAccessScopeAttributeType, val WrappingKeyGetAccessScopeRetType) { + *arg = &val +} + +/* + types and functions for algorithm +*/ + +// isEnumRef +type WrappingKeyGetAlgorithmAttributeType = *WrappingAlgorithm +type WrappingKeyGetAlgorithmArgType = WrappingAlgorithm +type WrappingKeyGetAlgorithmRetType = WrappingAlgorithm + +func getWrappingKeyGetAlgorithmAttributeTypeOk(arg WrappingKeyGetAlgorithmAttributeType) (ret WrappingKeyGetAlgorithmRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetAlgorithmAttributeType(arg *WrappingKeyGetAlgorithmAttributeType, val WrappingKeyGetAlgorithmRetType) { + *arg = &val +} + +/* + types and functions for backend +*/ + +// isEnumRef +type WrappingKeyGetBackendAttributeType = *Backend +type WrappingKeyGetBackendArgType = Backend +type WrappingKeyGetBackendRetType = Backend + +func getWrappingKeyGetBackendAttributeTypeOk(arg WrappingKeyGetBackendAttributeType) (ret WrappingKeyGetBackendRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetBackendAttributeType(arg *WrappingKeyGetBackendAttributeType, val WrappingKeyGetBackendRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type WrappingKeyGetCreatedAtAttributeType = *time.Time +type WrappingKeyGetCreatedAtArgType = time.Time +type WrappingKeyGetCreatedAtRetType = time.Time + +func getWrappingKeyGetCreatedAtAttributeTypeOk(arg WrappingKeyGetCreatedAtAttributeType) (ret WrappingKeyGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetCreatedAtAttributeType(arg *WrappingKeyGetCreatedAtAttributeType, val WrappingKeyGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type WrappingKeyGetDescriptionAttributeType = *string + +func getWrappingKeyGetDescriptionAttributeTypeOk(arg WrappingKeyGetDescriptionAttributeType) (ret WrappingKeyGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetDescriptionAttributeType(arg *WrappingKeyGetDescriptionAttributeType, val WrappingKeyGetDescriptionRetType) { + *arg = &val +} + +type WrappingKeyGetDescriptionArgType = string +type WrappingKeyGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type WrappingKeyGetDisplayNameAttributeType = *string + +func getWrappingKeyGetDisplayNameAttributeTypeOk(arg WrappingKeyGetDisplayNameAttributeType) (ret WrappingKeyGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetDisplayNameAttributeType(arg *WrappingKeyGetDisplayNameAttributeType, val WrappingKeyGetDisplayNameRetType) { + *arg = &val +} + +type WrappingKeyGetDisplayNameArgType = string +type WrappingKeyGetDisplayNameRetType = string + +/* + types and functions for expiresAt +*/ + +// isDateTime +type WrappingKeyGetExpiresAtAttributeType = *time.Time +type WrappingKeyGetExpiresAtArgType = time.Time +type WrappingKeyGetExpiresAtRetType = time.Time + +func getWrappingKeyGetExpiresAtAttributeTypeOk(arg WrappingKeyGetExpiresAtAttributeType) (ret WrappingKeyGetExpiresAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetExpiresAtAttributeType(arg *WrappingKeyGetExpiresAtAttributeType, val WrappingKeyGetExpiresAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type WrappingKeyGetIdAttributeType = *string + +func getWrappingKeyGetIdAttributeTypeOk(arg WrappingKeyGetIdAttributeType) (ret WrappingKeyGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetIdAttributeType(arg *WrappingKeyGetIdAttributeType, val WrappingKeyGetIdRetType) { + *arg = &val +} + +type WrappingKeyGetIdArgType = string +type WrappingKeyGetIdRetType = string + +/* + types and functions for keyRingId +*/ + +// isNotNullableString +type WrappingKeyGetKeyRingIdAttributeType = *string + +func getWrappingKeyGetKeyRingIdAttributeTypeOk(arg WrappingKeyGetKeyRingIdAttributeType) (ret WrappingKeyGetKeyRingIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetKeyRingIdAttributeType(arg *WrappingKeyGetKeyRingIdAttributeType, val WrappingKeyGetKeyRingIdRetType) { + *arg = &val +} + +type WrappingKeyGetKeyRingIdArgType = string +type WrappingKeyGetKeyRingIdRetType = string + +/* + types and functions for protection +*/ + +// isEnumRef +type WrappingKeyGetProtectionAttributeType = *Protection +type WrappingKeyGetProtectionArgType = Protection +type WrappingKeyGetProtectionRetType = Protection + +func getWrappingKeyGetProtectionAttributeTypeOk(arg WrappingKeyGetProtectionAttributeType) (ret WrappingKeyGetProtectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetProtectionAttributeType(arg *WrappingKeyGetProtectionAttributeType, val WrappingKeyGetProtectionRetType) { + *arg = &val +} + +/* + types and functions for publicKey +*/ + +// isNotNullableString +type WrappingKeyGetPublicKeyAttributeType = *string + +func getWrappingKeyGetPublicKeyAttributeTypeOk(arg WrappingKeyGetPublicKeyAttributeType) (ret WrappingKeyGetPublicKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetPublicKeyAttributeType(arg *WrappingKeyGetPublicKeyAttributeType, val WrappingKeyGetPublicKeyRetType) { + *arg = &val +} + +type WrappingKeyGetPublicKeyArgType = string +type WrappingKeyGetPublicKeyRetType = string + +/* + types and functions for purpose +*/ + +// isEnumRef +type WrappingKeyGetPurposeAttributeType = *WrappingPurpose +type WrappingKeyGetPurposeArgType = WrappingPurpose +type WrappingKeyGetPurposeRetType = WrappingPurpose + +func getWrappingKeyGetPurposeAttributeTypeOk(arg WrappingKeyGetPurposeAttributeType) (ret WrappingKeyGetPurposeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetPurposeAttributeType(arg *WrappingKeyGetPurposeAttributeType, val WrappingKeyGetPurposeRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isEnum + +// WrappingKeyState The current state of the wrapping key. +// value type for enums +type WrappingKeyState string + +// List of State +const ( + WRAPPINGKEYSTATE_ACTIVE WrappingKeyState = "active" + WRAPPINGKEYSTATE_CREATING WrappingKeyState = "creating" + WRAPPINGKEYSTATE_EXPIRED WrappingKeyState = "expired" + WRAPPINGKEYSTATE_DELETED WrappingKeyState = "deleted" + WRAPPINGKEYSTATE_KEY_MATERIAL_UNAVAILABLE WrappingKeyState = "key_material_unavailable" +) + +// All allowed values of WrappingKey enum +var AllowedWrappingKeyStateEnumValues = []WrappingKeyState{ + "active", + "creating", + "expired", + "deleted", + "key_material_unavailable", +} + +func (v *WrappingKeyState) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson WrappingKeyState + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := WrappingKeyState(value) + for _, existing := range AllowedWrappingKeyStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid WrappingKey", value) +} + +// NewWrappingKeyStateFromValue returns a pointer to a valid WrappingKeyState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewWrappingKeyStateFromValue(v WrappingKeyState) (*WrappingKeyState, error) { + ev := WrappingKeyState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for WrappingKeyState: valid values are %v", v, AllowedWrappingKeyStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v WrappingKeyState) IsValid() bool { + for _, existing := range AllowedWrappingKeyStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StateState value +func (v WrappingKeyState) Ptr() *WrappingKeyState { + return &v +} + +type NullableWrappingKeyState struct { + value *WrappingKeyState + isSet bool +} + +func (v NullableWrappingKeyState) Get() *WrappingKeyState { + return v.value +} + +func (v *NullableWrappingKeyState) Set(val *WrappingKeyState) { + v.value = val + v.isSet = true +} + +func (v NullableWrappingKeyState) IsSet() bool { + return v.isSet +} + +func (v *NullableWrappingKeyState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWrappingKeyState(val *WrappingKeyState) *NullableWrappingKeyState { + return &NullableWrappingKeyState{value: val, isSet: true} +} + +func (v NullableWrappingKeyState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWrappingKeyState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type WrappingKeyGetStateAttributeType = *WrappingKeyState +type WrappingKeyGetStateArgType = WrappingKeyState +type WrappingKeyGetStateRetType = WrappingKeyState + +func getWrappingKeyGetStateAttributeTypeOk(arg WrappingKeyGetStateAttributeType) (ret WrappingKeyGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyGetStateAttributeType(arg *WrappingKeyGetStateAttributeType, val WrappingKeyGetStateRetType) { + *arg = &val +} + +// WrappingKey struct for WrappingKey +type WrappingKey struct { + // REQUIRED + AccessScope WrappingKeyGetAccessScopeAttributeType `json:"access_scope" required:"true"` + // REQUIRED + Algorithm WrappingKeyGetAlgorithmAttributeType `json:"algorithm" required:"true"` + // Deprecated: Check the GitHub changelog for alternatives + // REQUIRED + Backend WrappingKeyGetBackendAttributeType `json:"backend" required:"true"` + // The date and time the creation of the wrapping key was triggered. + // REQUIRED + CreatedAt WrappingKeyGetCreatedAtAttributeType `json:"createdAt" required:"true"` + // A user chosen description to distinguish multiple wrapping keys. + Description WrappingKeyGetDescriptionAttributeType `json:"description,omitempty"` + // The display name to distinguish multiple wrapping keys. + // REQUIRED + DisplayName WrappingKeyGetDisplayNameAttributeType `json:"displayName" required:"true"` + // The date and time the wrapping key will expire. + // REQUIRED + ExpiresAt WrappingKeyGetExpiresAtAttributeType `json:"expiresAt" required:"true"` + // A auto generated unique id which identifies the wrapping keys. + // REQUIRED + Id WrappingKeyGetIdAttributeType `json:"id" required:"true"` + // The unique id of the key ring this wrapping key is assigned to. + // REQUIRED + KeyRingId WrappingKeyGetKeyRingIdAttributeType `json:"keyRingId" required:"true"` + // REQUIRED + Protection WrappingKeyGetProtectionAttributeType `json:"protection" required:"true"` + // The public key of the wrapping key. + PublicKey WrappingKeyGetPublicKeyAttributeType `json:"publicKey,omitempty"` + // REQUIRED + Purpose WrappingKeyGetPurposeAttributeType `json:"purpose" required:"true"` + // The current state of the wrapping key. + // REQUIRED + State WrappingKeyGetStateAttributeType `json:"state" required:"true"` +} + +type _WrappingKey WrappingKey + +// NewWrappingKey instantiates a new WrappingKey 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 NewWrappingKey(accessScope WrappingKeyGetAccessScopeArgType, algorithm WrappingKeyGetAlgorithmArgType, backend WrappingKeyGetBackendArgType, createdAt WrappingKeyGetCreatedAtArgType, displayName WrappingKeyGetDisplayNameArgType, expiresAt WrappingKeyGetExpiresAtArgType, id WrappingKeyGetIdArgType, keyRingId WrappingKeyGetKeyRingIdArgType, protection WrappingKeyGetProtectionArgType, purpose WrappingKeyGetPurposeArgType, state WrappingKeyGetStateArgType) *WrappingKey { + this := WrappingKey{} + setWrappingKeyGetAccessScopeAttributeType(&this.AccessScope, accessScope) + setWrappingKeyGetAlgorithmAttributeType(&this.Algorithm, algorithm) + setWrappingKeyGetBackendAttributeType(&this.Backend, backend) + setWrappingKeyGetCreatedAtAttributeType(&this.CreatedAt, createdAt) + setWrappingKeyGetDisplayNameAttributeType(&this.DisplayName, displayName) + setWrappingKeyGetExpiresAtAttributeType(&this.ExpiresAt, expiresAt) + setWrappingKeyGetIdAttributeType(&this.Id, id) + setWrappingKeyGetKeyRingIdAttributeType(&this.KeyRingId, keyRingId) + setWrappingKeyGetProtectionAttributeType(&this.Protection, protection) + setWrappingKeyGetPurposeAttributeType(&this.Purpose, purpose) + setWrappingKeyGetStateAttributeType(&this.State, state) + return &this +} + +// NewWrappingKeyWithDefaults instantiates a new WrappingKey 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 NewWrappingKeyWithDefaults() *WrappingKey { + this := WrappingKey{} + var accessScope AccessScope = ACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope + return &this +} + +// GetAccessScope returns the AccessScope field value +func (o *WrappingKey) GetAccessScope() (ret WrappingKeyGetAccessScopeRetType) { + ret, _ = o.GetAccessScopeOk() + return ret +} + +// GetAccessScopeOk returns a tuple with the AccessScope field value +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetAccessScopeOk() (ret WrappingKeyGetAccessScopeRetType, ok bool) { + return getWrappingKeyGetAccessScopeAttributeTypeOk(o.AccessScope) +} + +// SetAccessScope sets field value +func (o *WrappingKey) SetAccessScope(v WrappingKeyGetAccessScopeRetType) { + setWrappingKeyGetAccessScopeAttributeType(&o.AccessScope, v) +} + +// GetAlgorithm returns the Algorithm field value +func (o *WrappingKey) GetAlgorithm() (ret WrappingKeyGetAlgorithmRetType) { + ret, _ = o.GetAlgorithmOk() + return ret +} + +// GetAlgorithmOk returns a tuple with the Algorithm field value +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetAlgorithmOk() (ret WrappingKeyGetAlgorithmRetType, ok bool) { + return getWrappingKeyGetAlgorithmAttributeTypeOk(o.Algorithm) +} + +// SetAlgorithm sets field value +func (o *WrappingKey) SetAlgorithm(v WrappingKeyGetAlgorithmRetType) { + setWrappingKeyGetAlgorithmAttributeType(&o.Algorithm, v) +} + +// GetBackend returns the Backend field value +// Deprecated +func (o *WrappingKey) GetBackend() (ret WrappingKeyGetBackendRetType) { + ret, _ = o.GetBackendOk() + return ret +} + +// GetBackendOk returns a tuple with the Backend field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *WrappingKey) GetBackendOk() (ret WrappingKeyGetBackendRetType, ok bool) { + return getWrappingKeyGetBackendAttributeTypeOk(o.Backend) +} + +// SetBackend sets field value +// Deprecated +func (o *WrappingKey) SetBackend(v WrappingKeyGetBackendRetType) { + setWrappingKeyGetBackendAttributeType(&o.Backend, v) +} + +// GetCreatedAt returns the CreatedAt field value +func (o *WrappingKey) GetCreatedAt() (ret WrappingKeyGetCreatedAtRetType) { + ret, _ = o.GetCreatedAtOk() + return ret +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetCreatedAtOk() (ret WrappingKeyGetCreatedAtRetType, ok bool) { + return getWrappingKeyGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// SetCreatedAt sets field value +func (o *WrappingKey) SetCreatedAt(v WrappingKeyGetCreatedAtRetType) { + setWrappingKeyGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *WrappingKey) GetDescription() (res WrappingKeyGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetDescriptionOk() (ret WrappingKeyGetDescriptionRetType, ok bool) { + return getWrappingKeyGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *WrappingKey) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *WrappingKey) SetDescription(v WrappingKeyGetDescriptionRetType) { + setWrappingKeyGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *WrappingKey) GetDisplayName() (ret WrappingKeyGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetDisplayNameOk() (ret WrappingKeyGetDisplayNameRetType, ok bool) { + return getWrappingKeyGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *WrappingKey) SetDisplayName(v WrappingKeyGetDisplayNameRetType) { + setWrappingKeyGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetExpiresAt returns the ExpiresAt field value +func (o *WrappingKey) GetExpiresAt() (ret WrappingKeyGetExpiresAtRetType) { + ret, _ = o.GetExpiresAtOk() + return ret +} + +// GetExpiresAtOk returns a tuple with the ExpiresAt field value +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetExpiresAtOk() (ret WrappingKeyGetExpiresAtRetType, ok bool) { + return getWrappingKeyGetExpiresAtAttributeTypeOk(o.ExpiresAt) +} + +// SetExpiresAt sets field value +func (o *WrappingKey) SetExpiresAt(v WrappingKeyGetExpiresAtRetType) { + setWrappingKeyGetExpiresAtAttributeType(&o.ExpiresAt, v) +} + +// GetId returns the Id field value +func (o *WrappingKey) GetId() (ret WrappingKeyGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetIdOk() (ret WrappingKeyGetIdRetType, ok bool) { + return getWrappingKeyGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *WrappingKey) SetId(v WrappingKeyGetIdRetType) { + setWrappingKeyGetIdAttributeType(&o.Id, v) +} + +// GetKeyRingId returns the KeyRingId field value +func (o *WrappingKey) GetKeyRingId() (ret WrappingKeyGetKeyRingIdRetType) { + ret, _ = o.GetKeyRingIdOk() + return ret +} + +// GetKeyRingIdOk returns a tuple with the KeyRingId field value +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetKeyRingIdOk() (ret WrappingKeyGetKeyRingIdRetType, ok bool) { + return getWrappingKeyGetKeyRingIdAttributeTypeOk(o.KeyRingId) +} + +// SetKeyRingId sets field value +func (o *WrappingKey) SetKeyRingId(v WrappingKeyGetKeyRingIdRetType) { + setWrappingKeyGetKeyRingIdAttributeType(&o.KeyRingId, v) +} + +// GetProtection returns the Protection field value +func (o *WrappingKey) GetProtection() (ret WrappingKeyGetProtectionRetType) { + ret, _ = o.GetProtectionOk() + return ret +} + +// GetProtectionOk returns a tuple with the Protection field value +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetProtectionOk() (ret WrappingKeyGetProtectionRetType, ok bool) { + return getWrappingKeyGetProtectionAttributeTypeOk(o.Protection) +} + +// SetProtection sets field value +func (o *WrappingKey) SetProtection(v WrappingKeyGetProtectionRetType) { + setWrappingKeyGetProtectionAttributeType(&o.Protection, v) +} + +// GetPublicKey returns the PublicKey field value if set, zero value otherwise. +func (o *WrappingKey) GetPublicKey() (res WrappingKeyGetPublicKeyRetType) { + res, _ = o.GetPublicKeyOk() + return +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetPublicKeyOk() (ret WrappingKeyGetPublicKeyRetType, ok bool) { + return getWrappingKeyGetPublicKeyAttributeTypeOk(o.PublicKey) +} + +// HasPublicKey returns a boolean if a field has been set. +func (o *WrappingKey) HasPublicKey() bool { + _, ok := o.GetPublicKeyOk() + return ok +} + +// SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. +func (o *WrappingKey) SetPublicKey(v WrappingKeyGetPublicKeyRetType) { + setWrappingKeyGetPublicKeyAttributeType(&o.PublicKey, v) +} + +// GetPurpose returns the Purpose field value +func (o *WrappingKey) GetPurpose() (ret WrappingKeyGetPurposeRetType) { + ret, _ = o.GetPurposeOk() + return ret +} + +// GetPurposeOk returns a tuple with the Purpose field value +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetPurposeOk() (ret WrappingKeyGetPurposeRetType, ok bool) { + return getWrappingKeyGetPurposeAttributeTypeOk(o.Purpose) +} + +// SetPurpose sets field value +func (o *WrappingKey) SetPurpose(v WrappingKeyGetPurposeRetType) { + setWrappingKeyGetPurposeAttributeType(&o.Purpose, v) +} + +// GetState returns the State field value +func (o *WrappingKey) GetState() (ret WrappingKeyGetStateRetType) { + ret, _ = o.GetStateOk() + return ret +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *WrappingKey) GetStateOk() (ret WrappingKeyGetStateRetType, ok bool) { + return getWrappingKeyGetStateAttributeTypeOk(o.State) +} + +// SetState sets field value +func (o *WrappingKey) SetState(v WrappingKeyGetStateRetType) { + setWrappingKeyGetStateAttributeType(&o.State, v) +} + +func (o WrappingKey) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getWrappingKeyGetAccessScopeAttributeTypeOk(o.AccessScope); ok { + toSerialize["AccessScope"] = val + } + if val, ok := getWrappingKeyGetAlgorithmAttributeTypeOk(o.Algorithm); ok { + toSerialize["Algorithm"] = val + } + if val, ok := getWrappingKeyGetBackendAttributeTypeOk(o.Backend); ok { + toSerialize["Backend"] = val + } + if val, ok := getWrappingKeyGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getWrappingKeyGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getWrappingKeyGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getWrappingKeyGetExpiresAtAttributeTypeOk(o.ExpiresAt); ok { + toSerialize["ExpiresAt"] = val + } + if val, ok := getWrappingKeyGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getWrappingKeyGetKeyRingIdAttributeTypeOk(o.KeyRingId); ok { + toSerialize["KeyRingId"] = val + } + if val, ok := getWrappingKeyGetProtectionAttributeTypeOk(o.Protection); ok { + toSerialize["Protection"] = val + } + if val, ok := getWrappingKeyGetPublicKeyAttributeTypeOk(o.PublicKey); ok { + toSerialize["PublicKey"] = val + } + if val, ok := getWrappingKeyGetPurposeAttributeTypeOk(o.Purpose); ok { + toSerialize["Purpose"] = val + } + if val, ok := getWrappingKeyGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableWrappingKey struct { + value *WrappingKey + isSet bool +} + +func (v NullableWrappingKey) Get() *WrappingKey { + return v.value +} + +func (v *NullableWrappingKey) Set(val *WrappingKey) { + v.value = val + v.isSet = true +} + +func (v NullableWrappingKey) IsSet() bool { + return v.isSet +} + +func (v *NullableWrappingKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWrappingKey(val *WrappingKey) *NullableWrappingKey { + return &NullableWrappingKey{value: val, isSet: true} +} + +func (v NullableWrappingKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWrappingKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_wrapping_key_list.go b/pkg/kmsbeta/model_wrapping_key_list.go new file mode 100644 index 00000000..ada3f035 --- /dev/null +++ b/pkg/kmsbeta/model_wrapping_key_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" +) + +// checks if the WrappingKeyList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WrappingKeyList{} + +/* + types and functions for wrappingKeys +*/ + +// isArray +type WrappingKeyListGetWrappingKeysAttributeType = *[]WrappingKey +type WrappingKeyListGetWrappingKeysArgType = []WrappingKey +type WrappingKeyListGetWrappingKeysRetType = []WrappingKey + +func getWrappingKeyListGetWrappingKeysAttributeTypeOk(arg WrappingKeyListGetWrappingKeysAttributeType) (ret WrappingKeyListGetWrappingKeysRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setWrappingKeyListGetWrappingKeysAttributeType(arg *WrappingKeyListGetWrappingKeysAttributeType, val WrappingKeyListGetWrappingKeysRetType) { + *arg = &val +} + +// WrappingKeyList struct for WrappingKeyList +type WrappingKeyList struct { + // REQUIRED + WrappingKeys WrappingKeyListGetWrappingKeysAttributeType `json:"wrappingKeys" required:"true"` +} + +type _WrappingKeyList WrappingKeyList + +// NewWrappingKeyList instantiates a new WrappingKeyList 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 NewWrappingKeyList(wrappingKeys WrappingKeyListGetWrappingKeysArgType) *WrappingKeyList { + this := WrappingKeyList{} + setWrappingKeyListGetWrappingKeysAttributeType(&this.WrappingKeys, wrappingKeys) + return &this +} + +// NewWrappingKeyListWithDefaults instantiates a new WrappingKeyList 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 NewWrappingKeyListWithDefaults() *WrappingKeyList { + this := WrappingKeyList{} + return &this +} + +// GetWrappingKeys returns the WrappingKeys field value +func (o *WrappingKeyList) GetWrappingKeys() (ret WrappingKeyListGetWrappingKeysRetType) { + ret, _ = o.GetWrappingKeysOk() + return ret +} + +// GetWrappingKeysOk returns a tuple with the WrappingKeys field value +// and a boolean to check if the value has been set. +func (o *WrappingKeyList) GetWrappingKeysOk() (ret WrappingKeyListGetWrappingKeysRetType, ok bool) { + return getWrappingKeyListGetWrappingKeysAttributeTypeOk(o.WrappingKeys) +} + +// SetWrappingKeys sets field value +func (o *WrappingKeyList) SetWrappingKeys(v WrappingKeyListGetWrappingKeysRetType) { + setWrappingKeyListGetWrappingKeysAttributeType(&o.WrappingKeys, v) +} + +func (o WrappingKeyList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getWrappingKeyListGetWrappingKeysAttributeTypeOk(o.WrappingKeys); ok { + toSerialize["WrappingKeys"] = val + } + return toSerialize, nil +} + +type NullableWrappingKeyList struct { + value *WrappingKeyList + isSet bool +} + +func (v NullableWrappingKeyList) Get() *WrappingKeyList { + return v.value +} + +func (v *NullableWrappingKeyList) Set(val *WrappingKeyList) { + v.value = val + v.isSet = true +} + +func (v NullableWrappingKeyList) IsSet() bool { + return v.isSet +} + +func (v *NullableWrappingKeyList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWrappingKeyList(val *WrappingKeyList) *NullableWrappingKeyList { + return &NullableWrappingKeyList{value: val, isSet: true} +} + +func (v NullableWrappingKeyList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWrappingKeyList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_wrapping_key_list_test.go b/pkg/kmsbeta/model_wrapping_key_list_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_wrapping_key_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/model_wrapping_key_test.go b/pkg/kmsbeta/model_wrapping_key_test.go new file mode 100644 index 00000000..4f270fca --- /dev/null +++ b/pkg/kmsbeta/model_wrapping_key_test.go @@ -0,0 +1,79 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "testing" +) + +// isEnum + +func TestWrappingKeyState_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"creating"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"expired"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"deleted"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 5`, + args: args{ + src: []byte(`"key_material_unavailable"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := WrappingKeyState("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/kmsbeta/model_wrapping_purpose.go b/pkg/kmsbeta/model_wrapping_purpose.go new file mode 100644 index 00000000..06cfd5c0 --- /dev/null +++ b/pkg/kmsbeta/model_wrapping_purpose.go @@ -0,0 +1,115 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "fmt" +) + +// WrappingPurpose The wrapping purpose for the wrapping key. +type WrappingPurpose string + +// List of wrappingPurpose +const ( + WRAPPINGPURPOSE_SYMMETRIC_KEY WrappingPurpose = "wrap_symmetric_key" + WRAPPINGPURPOSE_ASYMMETRIC_KEY WrappingPurpose = "wrap_asymmetric_key" +) + +// All allowed values of WrappingPurpose enum +var AllowedWrappingPurposeEnumValues = []WrappingPurpose{ + "wrap_symmetric_key", + "wrap_asymmetric_key", +} + +func (v *WrappingPurpose) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := WrappingPurpose(value) + for _, existing := range AllowedWrappingPurposeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid WrappingPurpose", value) +} + +// NewWrappingPurposeFromValue returns a pointer to a valid WrappingPurpose +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewWrappingPurposeFromValue(v string) (*WrappingPurpose, error) { + ev := WrappingPurpose(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for WrappingPurpose: valid values are %v", v, AllowedWrappingPurposeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v WrappingPurpose) IsValid() bool { + for _, existing := range AllowedWrappingPurposeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to wrappingPurpose value +func (v WrappingPurpose) Ptr() *WrappingPurpose { + return &v +} + +type NullableWrappingPurpose struct { + value *WrappingPurpose + isSet bool +} + +func (v NullableWrappingPurpose) Get() *WrappingPurpose { + return v.value +} + +func (v *NullableWrappingPurpose) Set(val *WrappingPurpose) { + v.value = val + v.isSet = true +} + +func (v NullableWrappingPurpose) IsSet() bool { + return v.isSet +} + +func (v *NullableWrappingPurpose) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWrappingPurpose(val *WrappingPurpose) *NullableWrappingPurpose { + return &NullableWrappingPurpose{value: val, isSet: true} +} + +func (v NullableWrappingPurpose) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWrappingPurpose) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/kmsbeta/model_wrapping_purpose_test.go b/pkg/kmsbeta/model_wrapping_purpose_test.go new file mode 100644 index 00000000..c3f0318b --- /dev/null +++ b/pkg/kmsbeta/model_wrapping_purpose_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta diff --git a/pkg/kmsbeta/utils.go b/pkg/kmsbeta/utils.go new file mode 100644 index 00000000..f04567a1 --- /dev/null +++ b/pkg/kmsbeta/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT Key Management Service API + +### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package kmsbeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/logsalpha/.openapi-generator/VERSION b/pkg/logsalpha/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/logsalpha/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/logsalpha/api_default.go b/pkg/logsalpha/api_default.go new file mode 100644 index 00000000..52e7a92f --- /dev/null +++ b/pkg/logsalpha/api_default.go @@ -0,0 +1,2048 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateAccessToken Create Access Token + Create a new Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiCreateAccessTokenRequest + */ + CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest + /* + CreateAccessTokenExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return AccessToken + + */ + CreateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessToken, error) + /* + CreateLogsInstance Create Logs instance + Creates a new Logs instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateLogsInstanceRequest + */ + CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest + /* + CreateLogsInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return LogsInstance + + */ + CreateLogsInstanceExecute(ctx context.Context, projectId string, regionId string) (*LogsInstance, error) + /* + DeleteAccessToken Delete Access Token + Deletes a Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiDeleteAccessTokenRequest + */ + DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest + /* + DeleteAccessTokenExecute executes the request + + */ + DeleteAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error + /* + DeleteAllAccessTokens Delete All Access Tokens + Deletes all access tokens available for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllAccessTokensRequest + */ + DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest + /* + DeleteAllAccessTokensExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return AccessTokenList + + */ + DeleteAllAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) + /* + DeleteAllExpiredAccessTokens Deletes all expired access tokens + Deletes all expired access tokens + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllExpiredAccessTokensRequest + */ + DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest + /* + DeleteAllExpiredAccessTokensExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return AccessTokenList + + */ + DeleteAllExpiredAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) + /* + DeleteLogsInstance Delete Logs instance + Deletes the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteLogsInstanceRequest + */ + DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest + /* + DeleteLogsInstanceExecute executes the request + + */ + DeleteLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) error + /* + GetAccessToken Get Access Token + Get the information of the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiGetAccessTokenRequest + */ + GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest + /* + GetAccessTokenExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return AccessToken + + */ + GetAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) (*AccessToken, error) + /* + GetLogsInstance Get Logs Instance + Returns the details for the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiGetLogsInstanceRequest + */ + GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest + /* + GetLogsInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return LogsInstance + + */ + GetLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) + /* + ListAccessTokens List Access Tokens + Returns a list of access tokens created for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiListAccessTokensRequest + */ + ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest + /* + ListAccessTokensExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return AccessTokenList + + */ + ListAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) + /* + ListLogsInstances List Logs instances + Returns a list of all Logs instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListLogsInstancesRequest + */ + ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest + /* + ListLogsInstancesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return LogsInstancesList + + */ + ListLogsInstancesExecute(ctx context.Context, projectId string, regionId string) (*LogsInstancesList, error) + /* + UpdateAccessToken Update Access Token + Updates the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiUpdateAccessTokenRequest + */ + UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest + /* + UpdateAccessTokenExecute executes the request + + */ + UpdateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error + /* + UpdateLogsInstance Update Logs instance + Updates the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiUpdateLogsInstanceRequest + */ + UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest + /* + UpdateLogsInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return LogsInstance + + */ + UpdateLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) +} + +type ApiCreateAccessTokenRequest interface { + CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest + Execute() (*AccessToken, error) +} + +type ApiCreateLogsInstanceRequest interface { + CreateLogsInstancePayload(createLogsInstancePayload CreateLogsInstancePayload) ApiCreateLogsInstanceRequest + Execute() (*LogsInstance, error) +} + +type ApiDeleteAccessTokenRequest interface { + Execute() error +} + +type ApiDeleteAllAccessTokensRequest interface { + Execute() (*AccessTokenList, error) +} + +type ApiDeleteAllExpiredAccessTokensRequest interface { + Execute() (*AccessTokenList, error) +} + +type ApiDeleteLogsInstanceRequest interface { + Execute() error +} + +type ApiGetAccessTokenRequest interface { + Execute() (*AccessToken, error) +} + +type ApiGetLogsInstanceRequest interface { + Execute() (*LogsInstance, error) +} + +type ApiListAccessTokensRequest interface { + Execute() (*AccessTokenList, error) +} + +type ApiListLogsInstancesRequest interface { + Execute() (*LogsInstancesList, error) +} + +type ApiUpdateAccessTokenRequest interface { + UpdateAccessTokenPayload(updateAccessTokenPayload UpdateAccessTokenPayload) ApiUpdateAccessTokenRequest + Execute() error +} + +type ApiUpdateLogsInstanceRequest interface { + UpdateLogsInstancePayload(updateLogsInstancePayload UpdateLogsInstancePayload) ApiUpdateLogsInstanceRequest + Execute() (*LogsInstance, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateAccessTokenRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + createAccessTokenPayload *CreateAccessTokenPayload +} + +func (r CreateAccessTokenRequest) CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest { + r.createAccessTokenPayload = &createAccessTokenPayload + return r +} + +func (r CreateAccessTokenRequest) Execute() (*AccessToken, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessToken + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateAccessToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createAccessTokenPayload == nil { + return localVarReturnValue, fmt.Errorf("createAccessTokenPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createAccessTokenPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateAccessToken: Create Access Token + +Create a new Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiCreateAccessTokenRequest +*/ +func (a *APIClient) CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest { + return CreateAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) CreateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessToken, error) { + r := CreateAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type CreateLogsInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + createLogsInstancePayload *CreateLogsInstancePayload +} + +func (r CreateLogsInstanceRequest) CreateLogsInstancePayload(createLogsInstancePayload CreateLogsInstancePayload) ApiCreateLogsInstanceRequest { + r.createLogsInstancePayload = &createLogsInstancePayload + return r +} + +func (r CreateLogsInstanceRequest) Execute() (*LogsInstance, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateLogsInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createLogsInstancePayload == nil { + return localVarReturnValue, fmt.Errorf("createLogsInstancePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createLogsInstancePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateLogsInstance: Create Logs instance + +Creates a new Logs instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateLogsInstanceRequest +*/ +func (a *APIClient) CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest { + return CreateLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +func (a *APIClient) CreateLogsInstanceExecute(ctx context.Context, projectId string, regionId string) (*LogsInstance, error) { + r := CreateLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type DeleteAccessTokenRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + tId string +} + +func (r DeleteAccessTokenRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAccessToken") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(r.tId, "tId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + return newErr + } + + return nil +} + +/* +DeleteAccessToken: Delete Access Token + +Deletes a Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiDeleteAccessTokenRequest +*/ +func (a *APIClient) DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest { + return DeleteAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +func (a *APIClient) DeleteAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error { + r := DeleteAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } + return r.Execute() +} + +type DeleteAllAccessTokensRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r DeleteAllAccessTokensRequest) Execute() (*AccessTokenList, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAllAccessTokens") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteAllAccessTokens: Delete All Access Tokens + +Deletes all access tokens available for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllAccessTokensRequest +*/ +func (a *APIClient) DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest { + return DeleteAllAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteAllAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) { + r := DeleteAllAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type DeleteAllExpiredAccessTokensRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r DeleteAllExpiredAccessTokensRequest) Execute() (*AccessTokenList, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAllExpiredAccessTokens") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/expired" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteAllExpiredAccessTokens: Deletes all expired access tokens + +Deletes all expired access tokens + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllExpiredAccessTokensRequest +*/ +func (a *APIClient) DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest { + return DeleteAllExpiredAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteAllExpiredAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) { + r := DeleteAllExpiredAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type DeleteLogsInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r DeleteLogsInstanceRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteLogsInstance") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + return newErr + } + + return nil +} + +/* +DeleteLogsInstance: Delete Logs instance + +Deletes the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteLogsInstanceRequest +*/ +func (a *APIClient) DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest { + return DeleteLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) error { + r := DeleteLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type GetAccessTokenRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + tId string +} + +func (r GetAccessTokenRequest) Execute() (*AccessToken, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessToken + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAccessToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(r.tId, "tId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetAccessToken: Get Access Token + +Get the information of the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiGetAccessTokenRequest +*/ +func (a *APIClient) GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest { + return GetAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +func (a *APIClient) GetAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) (*AccessToken, error) { + r := GetAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } + return r.Execute() +} + +type GetLogsInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r GetLogsInstanceRequest) Execute() (*LogsInstance, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetLogsInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetLogsInstance: Get Logs Instance + +Returns the details for the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiGetLogsInstanceRequest +*/ +func (a *APIClient) GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest { + return GetLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) GetLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) { + r := GetLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type ListAccessTokensRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r ListAccessTokensRequest) Execute() (*AccessTokenList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAccessTokens") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListAccessTokens: List Access Tokens + +Returns a list of access tokens created for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiListAccessTokensRequest +*/ +func (a *APIClient) ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest { + return ListAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) ListAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) { + r := ListAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type ListLogsInstancesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string +} + +func (r ListLogsInstancesRequest) Execute() (*LogsInstancesList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstancesList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListLogsInstances") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListLogsInstances: List Logs instances + +Returns a list of all Logs instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListLogsInstancesRequest +*/ +func (a *APIClient) ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest { + return ListLogsInstancesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +func (a *APIClient) ListLogsInstancesExecute(ctx context.Context, projectId string, regionId string) (*LogsInstancesList, error) { + r := ListLogsInstancesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type UpdateAccessTokenRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + tId string + updateAccessTokenPayload *UpdateAccessTokenPayload +} + +func (r UpdateAccessTokenRequest) UpdateAccessTokenPayload(updateAccessTokenPayload UpdateAccessTokenPayload) ApiUpdateAccessTokenRequest { + r.updateAccessTokenPayload = &updateAccessTokenPayload + return r +} + +func (r UpdateAccessTokenRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAccessToken") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(r.tId, "tId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateAccessTokenPayload == nil { + return fmt.Errorf("updateAccessTokenPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateAccessTokenPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + return newErr + } + + return nil +} + +/* +UpdateAccessToken: Update Access Token + +Updates the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiUpdateAccessTokenRequest +*/ +func (a *APIClient) UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest { + return UpdateAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +func (a *APIClient) UpdateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error { + r := UpdateAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } + return r.Execute() +} + +type UpdateLogsInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + updateLogsInstancePayload *UpdateLogsInstancePayload +} + +func (r UpdateLogsInstanceRequest) UpdateLogsInstancePayload(updateLogsInstancePayload UpdateLogsInstancePayload) ApiUpdateLogsInstanceRequest { + r.updateLogsInstancePayload = &updateLogsInstancePayload + return r +} + +func (r UpdateLogsInstanceRequest) Execute() (*LogsInstance, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateLogsInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateLogsInstancePayload == nil { + return localVarReturnValue, fmt.Errorf("updateLogsInstancePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateLogsInstancePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateLogsInstance: Update Logs instance + +Updates the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiUpdateLogsInstanceRequest +*/ +func (a *APIClient) UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest { + return UpdateLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) UpdateLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) { + r := UpdateLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} diff --git a/pkg/logsalpha/api_default_test.go b/pkg/logsalpha/api_default_test.go new file mode 100644 index 00000000..27ed5249 --- /dev/null +++ b/pkg/logsalpha/api_default_test.go @@ -0,0 +1,712 @@ +/* +STACKIT Logs API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package logsalpha + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_logsalpha_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateAccessToken", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AccessToken{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + createAccessTokenPayload := CreateAccessTokenPayload{} + + resp, reqErr := apiClient.CreateAccessToken(context.Background(), projectId, regionId, instanceId).CreateAccessTokenPayload(createAccessTokenPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateLogsInstance", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LogsInstance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + createLogsInstancePayload := CreateLogsInstancePayload{} + + resp, reqErr := apiClient.CreateLogsInstance(context.Background(), projectId, regionId).CreateLogsInstancePayload(createLogsInstancePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAccessToken", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + tIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(tIdValue, "tId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + tId := tIdValue + + reqErr := apiClient.DeleteAccessToken(context.Background(), projectId, regionId, instanceId, tId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteAllAccessTokens", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AccessTokenList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.DeleteAllAccessTokens(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAllExpiredAccessTokens", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/expired" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AccessTokenList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.DeleteAllExpiredAccessTokens(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteLogsInstance", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + reqErr := apiClient.DeleteLogsInstance(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetAccessToken", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + tIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(tIdValue, "tId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AccessToken{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + tId := tIdValue + + resp, reqErr := apiClient.GetAccessToken(context.Background(), projectId, regionId, instanceId, tId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetLogsInstance", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LogsInstance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.GetLogsInstance(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListAccessTokens", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AccessTokenList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.ListAccessTokens(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListLogsInstances", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LogsInstancesList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + + resp, reqErr := apiClient.ListLogsInstances(context.Background(), projectId, regionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateAccessToken", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + tIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(tIdValue, "tId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + tId := tIdValue + updateAccessTokenPayload := UpdateAccessTokenPayload{} + + reqErr := apiClient.UpdateAccessToken(context.Background(), projectId, regionId, instanceId, tId).UpdateAccessTokenPayload(updateAccessTokenPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService UpdateLogsInstance", func(t *testing.T) { + _apiUrlPath := "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LogsInstance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + updateLogsInstancePayload := UpdateLogsInstancePayload{} + + resp, reqErr := apiClient.UpdateLogsInstance(context.Background(), projectId, regionId, instanceId).UpdateLogsInstancePayload(updateLogsInstancePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/logsalpha/client.go b/pkg/logsalpha/client.go new file mode 100644 index 00000000..137e252b --- /dev/null +++ b/pkg/logsalpha/client.go @@ -0,0 +1,628 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Logs API API v1alpha.0.3 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/logsalpha/configuration.go b/pkg/logsalpha/configuration.go new file mode 100644 index 00000000..69abd399 --- /dev/null +++ b/pkg/logsalpha/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/logsalpha", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://logs.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/logsalpha/model_access_token.go b/pkg/logsalpha/model_access_token.go new file mode 100644 index 00000000..c1fadf1e --- /dev/null +++ b/pkg/logsalpha/model_access_token.go @@ -0,0 +1,600 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the AccessToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessToken{} + +/* + types and functions for accessToken +*/ + +// isNotNullableString +type AccessTokenGetAccessTokenAttributeType = *string + +func getAccessTokenGetAccessTokenAttributeTypeOk(arg AccessTokenGetAccessTokenAttributeType) (ret AccessTokenGetAccessTokenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetAccessTokenAttributeType(arg *AccessTokenGetAccessTokenAttributeType, val AccessTokenGetAccessTokenRetType) { + *arg = &val +} + +type AccessTokenGetAccessTokenArgType = string +type AccessTokenGetAccessTokenRetType = string + +/* + types and functions for creator +*/ + +// isNotNullableString +type AccessTokenGetCreatorAttributeType = *string + +func getAccessTokenGetCreatorAttributeTypeOk(arg AccessTokenGetCreatorAttributeType) (ret AccessTokenGetCreatorRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetCreatorAttributeType(arg *AccessTokenGetCreatorAttributeType, val AccessTokenGetCreatorRetType) { + *arg = &val +} + +type AccessTokenGetCreatorArgType = string +type AccessTokenGetCreatorRetType = string + +/* + types and functions for description +*/ + +// isNotNullableString +type AccessTokenGetDescriptionAttributeType = *string + +func getAccessTokenGetDescriptionAttributeTypeOk(arg AccessTokenGetDescriptionAttributeType) (ret AccessTokenGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetDescriptionAttributeType(arg *AccessTokenGetDescriptionAttributeType, val AccessTokenGetDescriptionRetType) { + *arg = &val +} + +type AccessTokenGetDescriptionArgType = string +type AccessTokenGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type AccessTokenGetDisplayNameAttributeType = *string + +func getAccessTokenGetDisplayNameAttributeTypeOk(arg AccessTokenGetDisplayNameAttributeType) (ret AccessTokenGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetDisplayNameAttributeType(arg *AccessTokenGetDisplayNameAttributeType, val AccessTokenGetDisplayNameRetType) { + *arg = &val +} + +type AccessTokenGetDisplayNameArgType = string +type AccessTokenGetDisplayNameRetType = string + +/* + types and functions for expires +*/ + +// isBoolean +type AccessTokengetExpiresAttributeType = *bool +type AccessTokengetExpiresArgType = bool +type AccessTokengetExpiresRetType = bool + +func getAccessTokengetExpiresAttributeTypeOk(arg AccessTokengetExpiresAttributeType) (ret AccessTokengetExpiresRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokengetExpiresAttributeType(arg *AccessTokengetExpiresAttributeType, val AccessTokengetExpiresRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type AccessTokenGetIdAttributeType = *string + +func getAccessTokenGetIdAttributeTypeOk(arg AccessTokenGetIdAttributeType) (ret AccessTokenGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetIdAttributeType(arg *AccessTokenGetIdAttributeType, val AccessTokenGetIdRetType) { + *arg = &val +} + +type AccessTokenGetIdArgType = string +type AccessTokenGetIdRetType = string + +/* + types and functions for permissions +*/ + +// isArray +type AccessTokenGetPermissionsAttributeType = *[]string +type AccessTokenGetPermissionsArgType = []string +type AccessTokenGetPermissionsRetType = []string + +func getAccessTokenGetPermissionsAttributeTypeOk(arg AccessTokenGetPermissionsAttributeType) (ret AccessTokenGetPermissionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetPermissionsAttributeType(arg *AccessTokenGetPermissionsAttributeType, val AccessTokenGetPermissionsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isEnum + +// AccessTokenStatus the model 'AccessToken' +// value type for enums +type AccessTokenStatus string + +// List of Status +const ( + ACCESSTOKENSTATUS_ACTIVE AccessTokenStatus = "active" + ACCESSTOKENSTATUS_EXPIRED AccessTokenStatus = "expired" +) + +// All allowed values of AccessToken enum +var AllowedAccessTokenStatusEnumValues = []AccessTokenStatus{ + "active", + "expired", +} + +func (v *AccessTokenStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson AccessTokenStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := AccessTokenStatus(value) + for _, existing := range AllowedAccessTokenStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid AccessToken", value) +} + +// NewAccessTokenStatusFromValue returns a pointer to a valid AccessTokenStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAccessTokenStatusFromValue(v AccessTokenStatus) (*AccessTokenStatus, error) { + ev := AccessTokenStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AccessTokenStatus: valid values are %v", v, AllowedAccessTokenStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v AccessTokenStatus) IsValid() bool { + for _, existing := range AllowedAccessTokenStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v AccessTokenStatus) Ptr() *AccessTokenStatus { + return &v +} + +type NullableAccessTokenStatus struct { + value *AccessTokenStatus + isSet bool +} + +func (v NullableAccessTokenStatus) Get() *AccessTokenStatus { + return v.value +} + +func (v *NullableAccessTokenStatus) Set(val *AccessTokenStatus) { + v.value = val + v.isSet = true +} + +func (v NullableAccessTokenStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessTokenStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessTokenStatus(val *AccessTokenStatus) *NullableAccessTokenStatus { + return &NullableAccessTokenStatus{value: val, isSet: true} +} + +func (v NullableAccessTokenStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessTokenStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type AccessTokenGetStatusAttributeType = *AccessTokenStatus +type AccessTokenGetStatusArgType = AccessTokenStatus +type AccessTokenGetStatusRetType = AccessTokenStatus + +func getAccessTokenGetStatusAttributeTypeOk(arg AccessTokenGetStatusAttributeType) (ret AccessTokenGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetStatusAttributeType(arg *AccessTokenGetStatusAttributeType, val AccessTokenGetStatusRetType) { + *arg = &val +} + +/* + types and functions for validUntil +*/ + +// isDateTime +type AccessTokenGetValidUntilAttributeType = *time.Time +type AccessTokenGetValidUntilArgType = time.Time +type AccessTokenGetValidUntilRetType = time.Time + +func getAccessTokenGetValidUntilAttributeTypeOk(arg AccessTokenGetValidUntilAttributeType) (ret AccessTokenGetValidUntilRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetValidUntilAttributeType(arg *AccessTokenGetValidUntilAttributeType, val AccessTokenGetValidUntilRetType) { + *arg = &val +} + +// AccessToken struct for AccessToken +type AccessToken struct { + // A generated access token. Only available on creation. + AccessToken AccessTokenGetAccessTokenAttributeType `json:"accessToken,omitempty"` + // The user who created the access token. + // REQUIRED + Creator AccessTokenGetCreatorAttributeType `json:"creator" required:"true"` + // The description of the access token. + Description AccessTokenGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name of the access token. + // REQUIRED + DisplayName AccessTokenGetDisplayNameAttributeType `json:"displayName" required:"true"` + // Indicates if the access token can expire. + // REQUIRED + Expires AccessTokengetExpiresAttributeType `json:"expires" required:"true"` + // An auto generated unique id which identifies the access token. + // REQUIRED + Id AccessTokenGetIdAttributeType `json:"id" required:"true"` + // The access permissions granted to the access token. + // REQUIRED + Permissions AccessTokenGetPermissionsAttributeType `json:"permissions" required:"true"` + // REQUIRED + Status AccessTokenGetStatusAttributeType `json:"status" required:"true"` + // The date and time util an access token is valid to (inclusively). + ValidUntil AccessTokenGetValidUntilAttributeType `json:"validUntil,omitempty"` +} + +type _AccessToken AccessToken + +// NewAccessToken instantiates a new AccessToken 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 NewAccessToken(creator AccessTokenGetCreatorArgType, displayName AccessTokenGetDisplayNameArgType, expires AccessTokengetExpiresArgType, id AccessTokenGetIdArgType, permissions AccessTokenGetPermissionsArgType, status AccessTokenGetStatusArgType) *AccessToken { + this := AccessToken{} + setAccessTokenGetCreatorAttributeType(&this.Creator, creator) + setAccessTokenGetDisplayNameAttributeType(&this.DisplayName, displayName) + setAccessTokengetExpiresAttributeType(&this.Expires, expires) + setAccessTokenGetIdAttributeType(&this.Id, id) + setAccessTokenGetPermissionsAttributeType(&this.Permissions, permissions) + setAccessTokenGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewAccessTokenWithDefaults instantiates a new AccessToken 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 NewAccessTokenWithDefaults() *AccessToken { + this := AccessToken{} + return &this +} + +// GetAccessToken returns the AccessToken field value if set, zero value otherwise. +func (o *AccessToken) GetAccessToken() (res AccessTokenGetAccessTokenRetType) { + res, _ = o.GetAccessTokenOk() + return +} + +// GetAccessTokenOk returns a tuple with the AccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetAccessTokenOk() (ret AccessTokenGetAccessTokenRetType, ok bool) { + return getAccessTokenGetAccessTokenAttributeTypeOk(o.AccessToken) +} + +// HasAccessToken returns a boolean if a field has been set. +func (o *AccessToken) HasAccessToken() bool { + _, ok := o.GetAccessTokenOk() + return ok +} + +// SetAccessToken gets a reference to the given string and assigns it to the AccessToken field. +func (o *AccessToken) SetAccessToken(v AccessTokenGetAccessTokenRetType) { + setAccessTokenGetAccessTokenAttributeType(&o.AccessToken, v) +} + +// GetCreator returns the Creator field value +func (o *AccessToken) GetCreator() (ret AccessTokenGetCreatorRetType) { + ret, _ = o.GetCreatorOk() + return ret +} + +// GetCreatorOk returns a tuple with the Creator field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetCreatorOk() (ret AccessTokenGetCreatorRetType, ok bool) { + return getAccessTokenGetCreatorAttributeTypeOk(o.Creator) +} + +// SetCreator sets field value +func (o *AccessToken) SetCreator(v AccessTokenGetCreatorRetType) { + setAccessTokenGetCreatorAttributeType(&o.Creator, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AccessToken) GetDescription() (res AccessTokenGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetDescriptionOk() (ret AccessTokenGetDescriptionRetType, ok bool) { + return getAccessTokenGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *AccessToken) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AccessToken) SetDescription(v AccessTokenGetDescriptionRetType) { + setAccessTokenGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *AccessToken) GetDisplayName() (ret AccessTokenGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetDisplayNameOk() (ret AccessTokenGetDisplayNameRetType, ok bool) { + return getAccessTokenGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *AccessToken) SetDisplayName(v AccessTokenGetDisplayNameRetType) { + setAccessTokenGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetExpires returns the Expires field value +func (o *AccessToken) GetExpires() (ret AccessTokengetExpiresRetType) { + ret, _ = o.GetExpiresOk() + return ret +} + +// GetExpiresOk returns a tuple with the Expires field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetExpiresOk() (ret AccessTokengetExpiresRetType, ok bool) { + return getAccessTokengetExpiresAttributeTypeOk(o.Expires) +} + +// SetExpires sets field value +func (o *AccessToken) SetExpires(v AccessTokengetExpiresRetType) { + setAccessTokengetExpiresAttributeType(&o.Expires, v) +} + +// GetId returns the Id field value +func (o *AccessToken) GetId() (ret AccessTokenGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetIdOk() (ret AccessTokenGetIdRetType, ok bool) { + return getAccessTokenGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *AccessToken) SetId(v AccessTokenGetIdRetType) { + setAccessTokenGetIdAttributeType(&o.Id, v) +} + +// GetPermissions returns the Permissions field value +func (o *AccessToken) GetPermissions() (ret AccessTokenGetPermissionsRetType) { + ret, _ = o.GetPermissionsOk() + return ret +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetPermissionsOk() (ret AccessTokenGetPermissionsRetType, ok bool) { + return getAccessTokenGetPermissionsAttributeTypeOk(o.Permissions) +} + +// SetPermissions sets field value +func (o *AccessToken) SetPermissions(v AccessTokenGetPermissionsRetType) { + setAccessTokenGetPermissionsAttributeType(&o.Permissions, v) +} + +// GetStatus returns the Status field value +func (o *AccessToken) GetStatus() (ret AccessTokenGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetStatusOk() (ret AccessTokenGetStatusRetType, ok bool) { + return getAccessTokenGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *AccessToken) SetStatus(v AccessTokenGetStatusRetType) { + setAccessTokenGetStatusAttributeType(&o.Status, v) +} + +// GetValidUntil returns the ValidUntil field value if set, zero value otherwise. +func (o *AccessToken) GetValidUntil() (res AccessTokenGetValidUntilRetType) { + res, _ = o.GetValidUntilOk() + return +} + +// GetValidUntilOk returns a tuple with the ValidUntil field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetValidUntilOk() (ret AccessTokenGetValidUntilRetType, ok bool) { + return getAccessTokenGetValidUntilAttributeTypeOk(o.ValidUntil) +} + +// HasValidUntil returns a boolean if a field has been set. +func (o *AccessToken) HasValidUntil() bool { + _, ok := o.GetValidUntilOk() + return ok +} + +// SetValidUntil gets a reference to the given time.Time and assigns it to the ValidUntil field. +func (o *AccessToken) SetValidUntil(v AccessTokenGetValidUntilRetType) { + setAccessTokenGetValidUntilAttributeType(&o.ValidUntil, v) +} + +func (o AccessToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAccessTokenGetAccessTokenAttributeTypeOk(o.AccessToken); ok { + toSerialize["AccessToken"] = val + } + if val, ok := getAccessTokenGetCreatorAttributeTypeOk(o.Creator); ok { + toSerialize["Creator"] = val + } + if val, ok := getAccessTokenGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getAccessTokenGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getAccessTokengetExpiresAttributeTypeOk(o.Expires); ok { + toSerialize["Expires"] = val + } + if val, ok := getAccessTokenGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getAccessTokenGetPermissionsAttributeTypeOk(o.Permissions); ok { + toSerialize["Permissions"] = val + } + if val, ok := getAccessTokenGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getAccessTokenGetValidUntilAttributeTypeOk(o.ValidUntil); ok { + toSerialize["ValidUntil"] = val + } + return toSerialize, nil +} + +type NullableAccessToken struct { + value *AccessToken + isSet bool +} + +func (v NullableAccessToken) Get() *AccessToken { + return v.value +} + +func (v *NullableAccessToken) Set(val *AccessToken) { + v.value = val + v.isSet = true +} + +func (v NullableAccessToken) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessToken(val *AccessToken) *NullableAccessToken { + return &NullableAccessToken{value: val, isSet: true} +} + +func (v NullableAccessToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsalpha/model_access_token_list.go b/pkg/logsalpha/model_access_token_list.go new file mode 100644 index 00000000..99e246a8 --- /dev/null +++ b/pkg/logsalpha/model_access_token_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "encoding/json" +) + +// checks if the AccessTokenList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessTokenList{} + +/* + types and functions for tokens +*/ + +// isArray +type AccessTokenListGetTokensAttributeType = *[]AccessToken +type AccessTokenListGetTokensArgType = []AccessToken +type AccessTokenListGetTokensRetType = []AccessToken + +func getAccessTokenListGetTokensAttributeTypeOk(arg AccessTokenListGetTokensAttributeType) (ret AccessTokenListGetTokensRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenListGetTokensAttributeType(arg *AccessTokenListGetTokensAttributeType, val AccessTokenListGetTokensRetType) { + *arg = &val +} + +// AccessTokenList struct for AccessTokenList +type AccessTokenList struct { + // REQUIRED + Tokens AccessTokenListGetTokensAttributeType `json:"tokens" required:"true"` +} + +type _AccessTokenList AccessTokenList + +// NewAccessTokenList instantiates a new AccessTokenList 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 NewAccessTokenList(tokens AccessTokenListGetTokensArgType) *AccessTokenList { + this := AccessTokenList{} + setAccessTokenListGetTokensAttributeType(&this.Tokens, tokens) + return &this +} + +// NewAccessTokenListWithDefaults instantiates a new AccessTokenList 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 NewAccessTokenListWithDefaults() *AccessTokenList { + this := AccessTokenList{} + return &this +} + +// GetTokens returns the Tokens field value +func (o *AccessTokenList) GetTokens() (ret AccessTokenListGetTokensRetType) { + ret, _ = o.GetTokensOk() + return ret +} + +// GetTokensOk returns a tuple with the Tokens field value +// and a boolean to check if the value has been set. +func (o *AccessTokenList) GetTokensOk() (ret AccessTokenListGetTokensRetType, ok bool) { + return getAccessTokenListGetTokensAttributeTypeOk(o.Tokens) +} + +// SetTokens sets field value +func (o *AccessTokenList) SetTokens(v AccessTokenListGetTokensRetType) { + setAccessTokenListGetTokensAttributeType(&o.Tokens, v) +} + +func (o AccessTokenList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAccessTokenListGetTokensAttributeTypeOk(o.Tokens); ok { + toSerialize["Tokens"] = val + } + return toSerialize, nil +} + +type NullableAccessTokenList struct { + value *AccessTokenList + isSet bool +} + +func (v NullableAccessTokenList) Get() *AccessTokenList { + return v.value +} + +func (v *NullableAccessTokenList) Set(val *AccessTokenList) { + v.value = val + v.isSet = true +} + +func (v NullableAccessTokenList) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessTokenList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessTokenList(val *AccessTokenList) *NullableAccessTokenList { + return &NullableAccessTokenList{value: val, isSet: true} +} + +func (v NullableAccessTokenList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessTokenList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsalpha/model_access_token_list_test.go b/pkg/logsalpha/model_access_token_list_test.go new file mode 100644 index 00000000..45d1c0b6 --- /dev/null +++ b/pkg/logsalpha/model_access_token_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha diff --git a/pkg/logsalpha/model_access_token_test.go b/pkg/logsalpha/model_access_token_test.go new file mode 100644 index 00000000..ef2bac46 --- /dev/null +++ b/pkg/logsalpha/model_access_token_test.go @@ -0,0 +1,58 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "testing" +) + +// isEnum + +func TestAccessTokenStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"expired"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := AccessTokenStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/logsalpha/model_create_access_token_payload.go b/pkg/logsalpha/model_create_access_token_payload.go new file mode 100644 index 00000000..2b6f0ae5 --- /dev/null +++ b/pkg/logsalpha/model_create_access_token_payload.go @@ -0,0 +1,269 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "encoding/json" +) + +// checks if the CreateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAccessTokenPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateAccessTokenPayloadGetDescriptionAttributeType = *string + +func getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(arg CreateAccessTokenPayloadGetDescriptionAttributeType) (ret CreateAccessTokenPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAccessTokenPayloadGetDescriptionAttributeType(arg *CreateAccessTokenPayloadGetDescriptionAttributeType, val CreateAccessTokenPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateAccessTokenPayloadGetDescriptionArgType = string +type CreateAccessTokenPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateAccessTokenPayloadGetDisplayNameAttributeType = *string + +func getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(arg CreateAccessTokenPayloadGetDisplayNameAttributeType) (ret CreateAccessTokenPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAccessTokenPayloadGetDisplayNameAttributeType(arg *CreateAccessTokenPayloadGetDisplayNameAttributeType, val CreateAccessTokenPayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateAccessTokenPayloadGetDisplayNameArgType = string +type CreateAccessTokenPayloadGetDisplayNameRetType = string + +/* + types and functions for lifetime +*/ + +// isInteger +type CreateAccessTokenPayloadGetLifetimeAttributeType = *int64 +type CreateAccessTokenPayloadGetLifetimeArgType = int64 +type CreateAccessTokenPayloadGetLifetimeRetType = int64 + +func getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(arg CreateAccessTokenPayloadGetLifetimeAttributeType) (ret CreateAccessTokenPayloadGetLifetimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAccessTokenPayloadGetLifetimeAttributeType(arg *CreateAccessTokenPayloadGetLifetimeAttributeType, val CreateAccessTokenPayloadGetLifetimeRetType) { + *arg = &val +} + +/* + types and functions for permissions +*/ + +// isArray +type CreateAccessTokenPayloadGetPermissionsAttributeType = *[]string +type CreateAccessTokenPayloadGetPermissionsArgType = []string +type CreateAccessTokenPayloadGetPermissionsRetType = []string + +func getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(arg CreateAccessTokenPayloadGetPermissionsAttributeType) (ret CreateAccessTokenPayloadGetPermissionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAccessTokenPayloadGetPermissionsAttributeType(arg *CreateAccessTokenPayloadGetPermissionsAttributeType, val CreateAccessTokenPayloadGetPermissionsRetType) { + *arg = &val +} + +// CreateAccessTokenPayload struct for CreateAccessTokenPayload +type CreateAccessTokenPayload struct { + // The description of the access token. + Description CreateAccessTokenPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name of the access token. + // REQUIRED + DisplayName CreateAccessTokenPayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + // A lifetime period for an access token in days. If unset the token will not expire. + // Can be cast to int32 without loss of precision. + Lifetime CreateAccessTokenPayloadGetLifetimeAttributeType `json:"lifetime,omitempty"` + // The access permissions granted to the access token. + // REQUIRED + Permissions CreateAccessTokenPayloadGetPermissionsAttributeType `json:"permissions" required:"true"` +} + +type _CreateAccessTokenPayload CreateAccessTokenPayload + +// NewCreateAccessTokenPayload instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayload(displayName CreateAccessTokenPayloadGetDisplayNameArgType, permissions CreateAccessTokenPayloadGetPermissionsArgType) *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + setCreateAccessTokenPayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + setCreateAccessTokenPayloadGetPermissionsAttributeType(&this.Permissions, permissions) + return &this +} + +// NewCreateAccessTokenPayloadWithDefaults instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayloadWithDefaults() *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) GetDescription() (res CreateAccessTokenPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDescriptionOk() (ret CreateAccessTokenPayloadGetDescriptionRetType, ok bool) { + return getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateAccessTokenPayload) SetDescription(v CreateAccessTokenPayloadGetDescriptionRetType) { + setCreateAccessTokenPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateAccessTokenPayload) GetDisplayName() (ret CreateAccessTokenPayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDisplayNameOk() (ret CreateAccessTokenPayloadGetDisplayNameRetType, ok bool) { + return getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateAccessTokenPayload) SetDisplayName(v CreateAccessTokenPayloadGetDisplayNameRetType) { + setCreateAccessTokenPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetLifetime returns the Lifetime field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) GetLifetime() (res CreateAccessTokenPayloadGetLifetimeRetType) { + res, _ = o.GetLifetimeOk() + return +} + +// GetLifetimeOk returns a tuple with the Lifetime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetLifetimeOk() (ret CreateAccessTokenPayloadGetLifetimeRetType, ok bool) { + return getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(o.Lifetime) +} + +// HasLifetime returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasLifetime() bool { + _, ok := o.GetLifetimeOk() + return ok +} + +// SetLifetime gets a reference to the given int64 and assigns it to the Lifetime field. +func (o *CreateAccessTokenPayload) SetLifetime(v CreateAccessTokenPayloadGetLifetimeRetType) { + setCreateAccessTokenPayloadGetLifetimeAttributeType(&o.Lifetime, v) +} + +// GetPermissions returns the Permissions field value +func (o *CreateAccessTokenPayload) GetPermissions() (ret CreateAccessTokenPayloadGetPermissionsRetType) { + ret, _ = o.GetPermissionsOk() + return ret +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetPermissionsOk() (ret CreateAccessTokenPayloadGetPermissionsRetType, ok bool) { + return getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(o.Permissions) +} + +// SetPermissions sets field value +func (o *CreateAccessTokenPayload) SetPermissions(v CreateAccessTokenPayloadGetPermissionsRetType) { + setCreateAccessTokenPayloadGetPermissionsAttributeType(&o.Permissions, v) +} + +func (o CreateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(o.Lifetime); ok { + toSerialize["Lifetime"] = val + } + if val, ok := getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(o.Permissions); ok { + toSerialize["Permissions"] = val + } + return toSerialize, nil +} + +type NullableCreateAccessTokenPayload struct { + value *CreateAccessTokenPayload + isSet bool +} + +func (v NullableCreateAccessTokenPayload) Get() *CreateAccessTokenPayload { + return v.value +} + +func (v *NullableCreateAccessTokenPayload) Set(val *CreateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAccessTokenPayload(val *CreateAccessTokenPayload) *NullableCreateAccessTokenPayload { + return &NullableCreateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableCreateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsalpha/model_create_access_token_payload_test.go b/pkg/logsalpha/model_create_access_token_payload_test.go new file mode 100644 index 00000000..45d1c0b6 --- /dev/null +++ b/pkg/logsalpha/model_create_access_token_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha diff --git a/pkg/logsalpha/model_create_logs_instance_payload.go b/pkg/logsalpha/model_create_logs_instance_payload.go new file mode 100644 index 00000000..45cca4c4 --- /dev/null +++ b/pkg/logsalpha/model_create_logs_instance_payload.go @@ -0,0 +1,269 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "encoding/json" +) + +// checks if the CreateLogsInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateLogsInstancePayload{} + +/* + types and functions for acl +*/ + +// isArray +type CreateLogsInstancePayloadGetAclAttributeType = *[]string +type CreateLogsInstancePayloadGetAclArgType = []string +type CreateLogsInstancePayloadGetAclRetType = []string + +func getCreateLogsInstancePayloadGetAclAttributeTypeOk(arg CreateLogsInstancePayloadGetAclAttributeType) (ret CreateLogsInstancePayloadGetAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLogsInstancePayloadGetAclAttributeType(arg *CreateLogsInstancePayloadGetAclAttributeType, val CreateLogsInstancePayloadGetAclRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateLogsInstancePayloadGetDescriptionAttributeType = *string + +func getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(arg CreateLogsInstancePayloadGetDescriptionAttributeType) (ret CreateLogsInstancePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLogsInstancePayloadGetDescriptionAttributeType(arg *CreateLogsInstancePayloadGetDescriptionAttributeType, val CreateLogsInstancePayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateLogsInstancePayloadGetDescriptionArgType = string +type CreateLogsInstancePayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateLogsInstancePayloadGetDisplayNameAttributeType = *string + +func getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(arg CreateLogsInstancePayloadGetDisplayNameAttributeType) (ret CreateLogsInstancePayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLogsInstancePayloadGetDisplayNameAttributeType(arg *CreateLogsInstancePayloadGetDisplayNameAttributeType, val CreateLogsInstancePayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateLogsInstancePayloadGetDisplayNameArgType = string +type CreateLogsInstancePayloadGetDisplayNameRetType = string + +/* + types and functions for retentionDays +*/ + +// isInteger +type CreateLogsInstancePayloadGetRetentionDaysAttributeType = *int64 +type CreateLogsInstancePayloadGetRetentionDaysArgType = int64 +type CreateLogsInstancePayloadGetRetentionDaysRetType = int64 + +func getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(arg CreateLogsInstancePayloadGetRetentionDaysAttributeType) (ret CreateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLogsInstancePayloadGetRetentionDaysAttributeType(arg *CreateLogsInstancePayloadGetRetentionDaysAttributeType, val CreateLogsInstancePayloadGetRetentionDaysRetType) { + *arg = &val +} + +// CreateLogsInstancePayload struct for CreateLogsInstancePayload +type CreateLogsInstancePayload struct { + // The access control list for the Logs instance. + Acl CreateLogsInstancePayloadGetAclAttributeType `json:"acl,omitempty"` + // The description of the access token. + Description CreateLogsInstancePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name to distinguish multiple Logs instances. + // REQUIRED + DisplayName CreateLogsInstancePayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + // The log retention time in days. + // Can be cast to int32 without loss of precision. + // REQUIRED + RetentionDays CreateLogsInstancePayloadGetRetentionDaysAttributeType `json:"retentionDays" required:"true"` +} + +type _CreateLogsInstancePayload CreateLogsInstancePayload + +// NewCreateLogsInstancePayload instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayload(displayName CreateLogsInstancePayloadGetDisplayNameArgType, retentionDays CreateLogsInstancePayloadGetRetentionDaysArgType) *CreateLogsInstancePayload { + this := CreateLogsInstancePayload{} + setCreateLogsInstancePayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + setCreateLogsInstancePayloadGetRetentionDaysAttributeType(&this.RetentionDays, retentionDays) + return &this +} + +// NewCreateLogsInstancePayloadWithDefaults instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayloadWithDefaults() *CreateLogsInstancePayload { + this := CreateLogsInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *CreateLogsInstancePayload) GetAcl() (res CreateLogsInstancePayloadGetAclRetType) { + res, _ = o.GetAclOk() + return +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetAclOk() (ret CreateLogsInstancePayloadGetAclRetType, ok bool) { + return getCreateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl) +} + +// HasAcl returns a boolean if a field has been set. +func (o *CreateLogsInstancePayload) HasAcl() bool { + _, ok := o.GetAclOk() + return ok +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *CreateLogsInstancePayload) SetAcl(v CreateLogsInstancePayloadGetAclRetType) { + setCreateLogsInstancePayloadGetAclAttributeType(&o.Acl, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateLogsInstancePayload) GetDescription() (res CreateLogsInstancePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetDescriptionOk() (ret CreateLogsInstancePayloadGetDescriptionRetType, ok bool) { + return getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateLogsInstancePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateLogsInstancePayload) SetDescription(v CreateLogsInstancePayloadGetDescriptionRetType) { + setCreateLogsInstancePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateLogsInstancePayload) GetDisplayName() (ret CreateLogsInstancePayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetDisplayNameOk() (ret CreateLogsInstancePayloadGetDisplayNameRetType, ok bool) { + return getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateLogsInstancePayload) SetDisplayName(v CreateLogsInstancePayloadGetDisplayNameRetType) { + setCreateLogsInstancePayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetRetentionDays returns the RetentionDays field value +func (o *CreateLogsInstancePayload) GetRetentionDays() (ret CreateLogsInstancePayloadGetRetentionDaysRetType) { + ret, _ = o.GetRetentionDaysOk() + return ret +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetRetentionDaysOk() (ret CreateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { + return getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays) +} + +// SetRetentionDays sets field value +func (o *CreateLogsInstancePayload) SetRetentionDays(v CreateLogsInstancePayloadGetRetentionDaysRetType) { + setCreateLogsInstancePayloadGetRetentionDaysAttributeType(&o.RetentionDays, v) +} + +func (o CreateLogsInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl); ok { + toSerialize["Acl"] = val + } + if val, ok := getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays); ok { + toSerialize["RetentionDays"] = val + } + return toSerialize, nil +} + +type NullableCreateLogsInstancePayload struct { + value *CreateLogsInstancePayload + isSet bool +} + +func (v NullableCreateLogsInstancePayload) Get() *CreateLogsInstancePayload { + return v.value +} + +func (v *NullableCreateLogsInstancePayload) Set(val *CreateLogsInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLogsInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLogsInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLogsInstancePayload(val *CreateLogsInstancePayload) *NullableCreateLogsInstancePayload { + return &NullableCreateLogsInstancePayload{value: val, isSet: true} +} + +func (v NullableCreateLogsInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLogsInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsalpha/model_create_logs_instance_payload_test.go b/pkg/logsalpha/model_create_logs_instance_payload_test.go new file mode 100644 index 00000000..45d1c0b6 --- /dev/null +++ b/pkg/logsalpha/model_create_logs_instance_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha diff --git a/pkg/logsalpha/model_logs_instance.go b/pkg/logsalpha/model_logs_instance.go new file mode 100644 index 00000000..7d5c8b5c --- /dev/null +++ b/pkg/logsalpha/model_logs_instance.go @@ -0,0 +1,755 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the LogsInstance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogsInstance{} + +/* + types and functions for acl +*/ + +// isArray +type LogsInstanceGetAclAttributeType = *[]string +type LogsInstanceGetAclArgType = []string +type LogsInstanceGetAclRetType = []string + +func getLogsInstanceGetAclAttributeTypeOk(arg LogsInstanceGetAclAttributeType) (ret LogsInstanceGetAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetAclAttributeType(arg *LogsInstanceGetAclAttributeType, val LogsInstanceGetAclRetType) { + *arg = &val +} + +/* + types and functions for created +*/ + +// isDateTime +type LogsInstanceGetCreatedAttributeType = *time.Time +type LogsInstanceGetCreatedArgType = time.Time +type LogsInstanceGetCreatedRetType = time.Time + +func getLogsInstanceGetCreatedAttributeTypeOk(arg LogsInstanceGetCreatedAttributeType) (ret LogsInstanceGetCreatedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetCreatedAttributeType(arg *LogsInstanceGetCreatedAttributeType, val LogsInstanceGetCreatedRetType) { + *arg = &val +} + +/* + types and functions for datasourceUrl +*/ + +// isNotNullableString +type LogsInstanceGetDatasourceUrlAttributeType = *string + +func getLogsInstanceGetDatasourceUrlAttributeTypeOk(arg LogsInstanceGetDatasourceUrlAttributeType) (ret LogsInstanceGetDatasourceUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetDatasourceUrlAttributeType(arg *LogsInstanceGetDatasourceUrlAttributeType, val LogsInstanceGetDatasourceUrlRetType) { + *arg = &val +} + +type LogsInstanceGetDatasourceUrlArgType = string +type LogsInstanceGetDatasourceUrlRetType = string + +/* + types and functions for description +*/ + +// isNotNullableString +type LogsInstanceGetDescriptionAttributeType = *string + +func getLogsInstanceGetDescriptionAttributeTypeOk(arg LogsInstanceGetDescriptionAttributeType) (ret LogsInstanceGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetDescriptionAttributeType(arg *LogsInstanceGetDescriptionAttributeType, val LogsInstanceGetDescriptionRetType) { + *arg = &val +} + +type LogsInstanceGetDescriptionArgType = string +type LogsInstanceGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type LogsInstanceGetDisplayNameAttributeType = *string + +func getLogsInstanceGetDisplayNameAttributeTypeOk(arg LogsInstanceGetDisplayNameAttributeType) (ret LogsInstanceGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetDisplayNameAttributeType(arg *LogsInstanceGetDisplayNameAttributeType, val LogsInstanceGetDisplayNameRetType) { + *arg = &val +} + +type LogsInstanceGetDisplayNameArgType = string +type LogsInstanceGetDisplayNameRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type LogsInstanceGetIdAttributeType = *string + +func getLogsInstanceGetIdAttributeTypeOk(arg LogsInstanceGetIdAttributeType) (ret LogsInstanceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetIdAttributeType(arg *LogsInstanceGetIdAttributeType, val LogsInstanceGetIdRetType) { + *arg = &val +} + +type LogsInstanceGetIdArgType = string +type LogsInstanceGetIdRetType = string + +/* + types and functions for ingestOtlpUrl +*/ + +// isNotNullableString +type LogsInstanceGetIngestOtlpUrlAttributeType = *string + +func getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(arg LogsInstanceGetIngestOtlpUrlAttributeType) (ret LogsInstanceGetIngestOtlpUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetIngestOtlpUrlAttributeType(arg *LogsInstanceGetIngestOtlpUrlAttributeType, val LogsInstanceGetIngestOtlpUrlRetType) { + *arg = &val +} + +type LogsInstanceGetIngestOtlpUrlArgType = string +type LogsInstanceGetIngestOtlpUrlRetType = string + +/* + types and functions for ingestUrl +*/ + +// isNotNullableString +type LogsInstanceGetIngestUrlAttributeType = *string + +func getLogsInstanceGetIngestUrlAttributeTypeOk(arg LogsInstanceGetIngestUrlAttributeType) (ret LogsInstanceGetIngestUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetIngestUrlAttributeType(arg *LogsInstanceGetIngestUrlAttributeType, val LogsInstanceGetIngestUrlRetType) { + *arg = &val +} + +type LogsInstanceGetIngestUrlArgType = string +type LogsInstanceGetIngestUrlRetType = string + +/* + types and functions for queryRangeUrl +*/ + +// isNotNullableString +type LogsInstanceGetQueryRangeUrlAttributeType = *string + +func getLogsInstanceGetQueryRangeUrlAttributeTypeOk(arg LogsInstanceGetQueryRangeUrlAttributeType) (ret LogsInstanceGetQueryRangeUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetQueryRangeUrlAttributeType(arg *LogsInstanceGetQueryRangeUrlAttributeType, val LogsInstanceGetQueryRangeUrlRetType) { + *arg = &val +} + +type LogsInstanceGetQueryRangeUrlArgType = string +type LogsInstanceGetQueryRangeUrlRetType = string + +/* + types and functions for queryUrl +*/ + +// isNotNullableString +type LogsInstanceGetQueryUrlAttributeType = *string + +func getLogsInstanceGetQueryUrlAttributeTypeOk(arg LogsInstanceGetQueryUrlAttributeType) (ret LogsInstanceGetQueryUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetQueryUrlAttributeType(arg *LogsInstanceGetQueryUrlAttributeType, val LogsInstanceGetQueryUrlRetType) { + *arg = &val +} + +type LogsInstanceGetQueryUrlArgType = string +type LogsInstanceGetQueryUrlRetType = string + +/* + types and functions for retentionDays +*/ + +// isInteger +type LogsInstanceGetRetentionDaysAttributeType = *int64 +type LogsInstanceGetRetentionDaysArgType = int64 +type LogsInstanceGetRetentionDaysRetType = int64 + +func getLogsInstanceGetRetentionDaysAttributeTypeOk(arg LogsInstanceGetRetentionDaysAttributeType) (ret LogsInstanceGetRetentionDaysRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetRetentionDaysAttributeType(arg *LogsInstanceGetRetentionDaysAttributeType, val LogsInstanceGetRetentionDaysRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isEnum + +// LogsInstanceStatus The current status of the Logs instance. +// value type for enums +type LogsInstanceStatus string + +// List of Status +const ( + LOGSINSTANCESTATUS_ACTIVE LogsInstanceStatus = "active" + LOGSINSTANCESTATUS_DELETING LogsInstanceStatus = "deleting" + LOGSINSTANCESTATUS_RECONCILING LogsInstanceStatus = "reconciling" +) + +// All allowed values of LogsInstance enum +var AllowedLogsInstanceStatusEnumValues = []LogsInstanceStatus{ + "active", + "deleting", + "reconciling", +} + +func (v *LogsInstanceStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson LogsInstanceStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := LogsInstanceStatus(value) + for _, existing := range AllowedLogsInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LogsInstance", value) +} + +// NewLogsInstanceStatusFromValue returns a pointer to a valid LogsInstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLogsInstanceStatusFromValue(v LogsInstanceStatus) (*LogsInstanceStatus, error) { + ev := LogsInstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LogsInstanceStatus: valid values are %v", v, AllowedLogsInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LogsInstanceStatus) IsValid() bool { + for _, existing := range AllowedLogsInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v LogsInstanceStatus) Ptr() *LogsInstanceStatus { + return &v +} + +type NullableLogsInstanceStatus struct { + value *LogsInstanceStatus + isSet bool +} + +func (v NullableLogsInstanceStatus) Get() *LogsInstanceStatus { + return v.value +} + +func (v *NullableLogsInstanceStatus) Set(val *LogsInstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstanceStatus(val *LogsInstanceStatus) *NullableLogsInstanceStatus { + return &NullableLogsInstanceStatus{value: val, isSet: true} +} + +func (v NullableLogsInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type LogsInstanceGetStatusAttributeType = *LogsInstanceStatus +type LogsInstanceGetStatusArgType = LogsInstanceStatus +type LogsInstanceGetStatusRetType = LogsInstanceStatus + +func getLogsInstanceGetStatusAttributeTypeOk(arg LogsInstanceGetStatusAttributeType) (ret LogsInstanceGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetStatusAttributeType(arg *LogsInstanceGetStatusAttributeType, val LogsInstanceGetStatusRetType) { + *arg = &val +} + +// LogsInstance struct for LogsInstance +type LogsInstance struct { + // The access control list for the Logs instance. + Acl LogsInstanceGetAclAttributeType `json:"acl,omitempty"` + // The date and time the creation of the Logs instance was triggered. + // REQUIRED + Created LogsInstanceGetCreatedAttributeType `json:"created" required:"true"` + // The Logs instance's datasource URL, can be used in Grafana as a datasource URL + DatasourceUrl LogsInstanceGetDatasourceUrlAttributeType `json:"datasourceUrl,omitempty"` + // The description of the Logs instance. + Description LogsInstanceGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name of the Logs instance. + // REQUIRED + DisplayName LogsInstanceGetDisplayNameAttributeType `json:"displayName" required:"true"` + // A auto generated unique id which identifies the Logs instance. + // REQUIRED + Id LogsInstanceGetIdAttributeType `json:"id" required:"true"` + // The Logs instance's ingest logs via OTLP URL + IngestOtlpUrl LogsInstanceGetIngestOtlpUrlAttributeType `json:"ingestOtlpUrl,omitempty"` + // The Logs instance's ingest logs URL + IngestUrl LogsInstanceGetIngestUrlAttributeType `json:"ingestUrl,omitempty"` + // The Logs instance's query range URL + QueryRangeUrl LogsInstanceGetQueryRangeUrlAttributeType `json:"queryRangeUrl,omitempty"` + // The Logs instance's query URL + QueryUrl LogsInstanceGetQueryUrlAttributeType `json:"queryUrl,omitempty"` + // The log retention time in days. + // Can be cast to int32 without loss of precision. + // REQUIRED + RetentionDays LogsInstanceGetRetentionDaysAttributeType `json:"retentionDays" required:"true"` + // The current status of the Logs instance. + // REQUIRED + Status LogsInstanceGetStatusAttributeType `json:"status" required:"true"` +} + +type _LogsInstance LogsInstance + +// NewLogsInstance instantiates a new LogsInstance 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 NewLogsInstance(created LogsInstanceGetCreatedArgType, displayName LogsInstanceGetDisplayNameArgType, id LogsInstanceGetIdArgType, retentionDays LogsInstanceGetRetentionDaysArgType, status LogsInstanceGetStatusArgType) *LogsInstance { + this := LogsInstance{} + setLogsInstanceGetCreatedAttributeType(&this.Created, created) + setLogsInstanceGetDisplayNameAttributeType(&this.DisplayName, displayName) + setLogsInstanceGetIdAttributeType(&this.Id, id) + setLogsInstanceGetRetentionDaysAttributeType(&this.RetentionDays, retentionDays) + setLogsInstanceGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewLogsInstanceWithDefaults instantiates a new LogsInstance 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 NewLogsInstanceWithDefaults() *LogsInstance { + this := LogsInstance{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *LogsInstance) GetAcl() (res LogsInstanceGetAclRetType) { + res, _ = o.GetAclOk() + return +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetAclOk() (ret LogsInstanceGetAclRetType, ok bool) { + return getLogsInstanceGetAclAttributeTypeOk(o.Acl) +} + +// HasAcl returns a boolean if a field has been set. +func (o *LogsInstance) HasAcl() bool { + _, ok := o.GetAclOk() + return ok +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *LogsInstance) SetAcl(v LogsInstanceGetAclRetType) { + setLogsInstanceGetAclAttributeType(&o.Acl, v) +} + +// GetCreated returns the Created field value +func (o *LogsInstance) GetCreated() (ret LogsInstanceGetCreatedRetType) { + ret, _ = o.GetCreatedOk() + return ret +} + +// GetCreatedOk returns a tuple with the Created field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetCreatedOk() (ret LogsInstanceGetCreatedRetType, ok bool) { + return getLogsInstanceGetCreatedAttributeTypeOk(o.Created) +} + +// SetCreated sets field value +func (o *LogsInstance) SetCreated(v LogsInstanceGetCreatedRetType) { + setLogsInstanceGetCreatedAttributeType(&o.Created, v) +} + +// GetDatasourceUrl returns the DatasourceUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetDatasourceUrl() (res LogsInstanceGetDatasourceUrlRetType) { + res, _ = o.GetDatasourceUrlOk() + return +} + +// GetDatasourceUrlOk returns a tuple with the DatasourceUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDatasourceUrlOk() (ret LogsInstanceGetDatasourceUrlRetType, ok bool) { + return getLogsInstanceGetDatasourceUrlAttributeTypeOk(o.DatasourceUrl) +} + +// HasDatasourceUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasDatasourceUrl() bool { + _, ok := o.GetDatasourceUrlOk() + return ok +} + +// SetDatasourceUrl gets a reference to the given string and assigns it to the DatasourceUrl field. +func (o *LogsInstance) SetDatasourceUrl(v LogsInstanceGetDatasourceUrlRetType) { + setLogsInstanceGetDatasourceUrlAttributeType(&o.DatasourceUrl, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *LogsInstance) GetDescription() (res LogsInstanceGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDescriptionOk() (ret LogsInstanceGetDescriptionRetType, ok bool) { + return getLogsInstanceGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *LogsInstance) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *LogsInstance) SetDescription(v LogsInstanceGetDescriptionRetType) { + setLogsInstanceGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *LogsInstance) GetDisplayName() (ret LogsInstanceGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDisplayNameOk() (ret LogsInstanceGetDisplayNameRetType, ok bool) { + return getLogsInstanceGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *LogsInstance) SetDisplayName(v LogsInstanceGetDisplayNameRetType) { + setLogsInstanceGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetId returns the Id field value +func (o *LogsInstance) GetId() (ret LogsInstanceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIdOk() (ret LogsInstanceGetIdRetType, ok bool) { + return getLogsInstanceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *LogsInstance) SetId(v LogsInstanceGetIdRetType) { + setLogsInstanceGetIdAttributeType(&o.Id, v) +} + +// GetIngestOtlpUrl returns the IngestOtlpUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetIngestOtlpUrl() (res LogsInstanceGetIngestOtlpUrlRetType) { + res, _ = o.GetIngestOtlpUrlOk() + return +} + +// GetIngestOtlpUrlOk returns a tuple with the IngestOtlpUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIngestOtlpUrlOk() (ret LogsInstanceGetIngestOtlpUrlRetType, ok bool) { + return getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(o.IngestOtlpUrl) +} + +// HasIngestOtlpUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasIngestOtlpUrl() bool { + _, ok := o.GetIngestOtlpUrlOk() + return ok +} + +// SetIngestOtlpUrl gets a reference to the given string and assigns it to the IngestOtlpUrl field. +func (o *LogsInstance) SetIngestOtlpUrl(v LogsInstanceGetIngestOtlpUrlRetType) { + setLogsInstanceGetIngestOtlpUrlAttributeType(&o.IngestOtlpUrl, v) +} + +// GetIngestUrl returns the IngestUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetIngestUrl() (res LogsInstanceGetIngestUrlRetType) { + res, _ = o.GetIngestUrlOk() + return +} + +// GetIngestUrlOk returns a tuple with the IngestUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIngestUrlOk() (ret LogsInstanceGetIngestUrlRetType, ok bool) { + return getLogsInstanceGetIngestUrlAttributeTypeOk(o.IngestUrl) +} + +// HasIngestUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasIngestUrl() bool { + _, ok := o.GetIngestUrlOk() + return ok +} + +// SetIngestUrl gets a reference to the given string and assigns it to the IngestUrl field. +func (o *LogsInstance) SetIngestUrl(v LogsInstanceGetIngestUrlRetType) { + setLogsInstanceGetIngestUrlAttributeType(&o.IngestUrl, v) +} + +// GetQueryRangeUrl returns the QueryRangeUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetQueryRangeUrl() (res LogsInstanceGetQueryRangeUrlRetType) { + res, _ = o.GetQueryRangeUrlOk() + return +} + +// GetQueryRangeUrlOk returns a tuple with the QueryRangeUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetQueryRangeUrlOk() (ret LogsInstanceGetQueryRangeUrlRetType, ok bool) { + return getLogsInstanceGetQueryRangeUrlAttributeTypeOk(o.QueryRangeUrl) +} + +// HasQueryRangeUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasQueryRangeUrl() bool { + _, ok := o.GetQueryRangeUrlOk() + return ok +} + +// SetQueryRangeUrl gets a reference to the given string and assigns it to the QueryRangeUrl field. +func (o *LogsInstance) SetQueryRangeUrl(v LogsInstanceGetQueryRangeUrlRetType) { + setLogsInstanceGetQueryRangeUrlAttributeType(&o.QueryRangeUrl, v) +} + +// GetQueryUrl returns the QueryUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetQueryUrl() (res LogsInstanceGetQueryUrlRetType) { + res, _ = o.GetQueryUrlOk() + return +} + +// GetQueryUrlOk returns a tuple with the QueryUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetQueryUrlOk() (ret LogsInstanceGetQueryUrlRetType, ok bool) { + return getLogsInstanceGetQueryUrlAttributeTypeOk(o.QueryUrl) +} + +// HasQueryUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasQueryUrl() bool { + _, ok := o.GetQueryUrlOk() + return ok +} + +// SetQueryUrl gets a reference to the given string and assigns it to the QueryUrl field. +func (o *LogsInstance) SetQueryUrl(v LogsInstanceGetQueryUrlRetType) { + setLogsInstanceGetQueryUrlAttributeType(&o.QueryUrl, v) +} + +// GetRetentionDays returns the RetentionDays field value +func (o *LogsInstance) GetRetentionDays() (ret LogsInstanceGetRetentionDaysRetType) { + ret, _ = o.GetRetentionDaysOk() + return ret +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetRetentionDaysOk() (ret LogsInstanceGetRetentionDaysRetType, ok bool) { + return getLogsInstanceGetRetentionDaysAttributeTypeOk(o.RetentionDays) +} + +// SetRetentionDays sets field value +func (o *LogsInstance) SetRetentionDays(v LogsInstanceGetRetentionDaysRetType) { + setLogsInstanceGetRetentionDaysAttributeType(&o.RetentionDays, v) +} + +// GetStatus returns the Status field value +func (o *LogsInstance) GetStatus() (ret LogsInstanceGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetStatusOk() (ret LogsInstanceGetStatusRetType, ok bool) { + return getLogsInstanceGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *LogsInstance) SetStatus(v LogsInstanceGetStatusRetType) { + setLogsInstanceGetStatusAttributeType(&o.Status, v) +} + +func (o LogsInstance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLogsInstanceGetAclAttributeTypeOk(o.Acl); ok { + toSerialize["Acl"] = val + } + if val, ok := getLogsInstanceGetCreatedAttributeTypeOk(o.Created); ok { + toSerialize["Created"] = val + } + if val, ok := getLogsInstanceGetDatasourceUrlAttributeTypeOk(o.DatasourceUrl); ok { + toSerialize["DatasourceUrl"] = val + } + if val, ok := getLogsInstanceGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getLogsInstanceGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getLogsInstanceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(o.IngestOtlpUrl); ok { + toSerialize["IngestOtlpUrl"] = val + } + if val, ok := getLogsInstanceGetIngestUrlAttributeTypeOk(o.IngestUrl); ok { + toSerialize["IngestUrl"] = val + } + if val, ok := getLogsInstanceGetQueryRangeUrlAttributeTypeOk(o.QueryRangeUrl); ok { + toSerialize["QueryRangeUrl"] = val + } + if val, ok := getLogsInstanceGetQueryUrlAttributeTypeOk(o.QueryUrl); ok { + toSerialize["QueryUrl"] = val + } + if val, ok := getLogsInstanceGetRetentionDaysAttributeTypeOk(o.RetentionDays); ok { + toSerialize["RetentionDays"] = val + } + if val, ok := getLogsInstanceGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableLogsInstance struct { + value *LogsInstance + isSet bool +} + +func (v NullableLogsInstance) Get() *LogsInstance { + return v.value +} + +func (v *NullableLogsInstance) Set(val *LogsInstance) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstance(val *LogsInstance) *NullableLogsInstance { + return &NullableLogsInstance{value: val, isSet: true} +} + +func (v NullableLogsInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsalpha/model_logs_instance_test.go b/pkg/logsalpha/model_logs_instance_test.go new file mode 100644 index 00000000..d06486e9 --- /dev/null +++ b/pkg/logsalpha/model_logs_instance_test.go @@ -0,0 +1,65 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "testing" +) + +// isEnum + +func TestLogsInstanceStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"deleting"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"reconciling"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := LogsInstanceStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/logsalpha/model_logs_instances_list.go b/pkg/logsalpha/model_logs_instances_list.go new file mode 100644 index 00000000..d5cd04fa --- /dev/null +++ b/pkg/logsalpha/model_logs_instances_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "encoding/json" +) + +// checks if the LogsInstancesList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogsInstancesList{} + +/* + types and functions for instances +*/ + +// isArray +type LogsInstancesListGetInstancesAttributeType = *[]LogsInstance +type LogsInstancesListGetInstancesArgType = []LogsInstance +type LogsInstancesListGetInstancesRetType = []LogsInstance + +func getLogsInstancesListGetInstancesAttributeTypeOk(arg LogsInstancesListGetInstancesAttributeType) (ret LogsInstancesListGetInstancesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstancesListGetInstancesAttributeType(arg *LogsInstancesListGetInstancesAttributeType, val LogsInstancesListGetInstancesRetType) { + *arg = &val +} + +// LogsInstancesList struct for LogsInstancesList +type LogsInstancesList struct { + // REQUIRED + Instances LogsInstancesListGetInstancesAttributeType `json:"instances" required:"true"` +} + +type _LogsInstancesList LogsInstancesList + +// NewLogsInstancesList instantiates a new LogsInstancesList 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 NewLogsInstancesList(instances LogsInstancesListGetInstancesArgType) *LogsInstancesList { + this := LogsInstancesList{} + setLogsInstancesListGetInstancesAttributeType(&this.Instances, instances) + return &this +} + +// NewLogsInstancesListWithDefaults instantiates a new LogsInstancesList 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 NewLogsInstancesListWithDefaults() *LogsInstancesList { + this := LogsInstancesList{} + return &this +} + +// GetInstances returns the Instances field value +func (o *LogsInstancesList) GetInstances() (ret LogsInstancesListGetInstancesRetType) { + ret, _ = o.GetInstancesOk() + return ret +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *LogsInstancesList) GetInstancesOk() (ret LogsInstancesListGetInstancesRetType, ok bool) { + return getLogsInstancesListGetInstancesAttributeTypeOk(o.Instances) +} + +// SetInstances sets field value +func (o *LogsInstancesList) SetInstances(v LogsInstancesListGetInstancesRetType) { + setLogsInstancesListGetInstancesAttributeType(&o.Instances, v) +} + +func (o LogsInstancesList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLogsInstancesListGetInstancesAttributeTypeOk(o.Instances); ok { + toSerialize["Instances"] = val + } + return toSerialize, nil +} + +type NullableLogsInstancesList struct { + value *LogsInstancesList + isSet bool +} + +func (v NullableLogsInstancesList) Get() *LogsInstancesList { + return v.value +} + +func (v *NullableLogsInstancesList) Set(val *LogsInstancesList) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstancesList) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstancesList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstancesList(val *LogsInstancesList) *NullableLogsInstancesList { + return &NullableLogsInstancesList{value: val, isSet: true} +} + +func (v NullableLogsInstancesList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstancesList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsalpha/model_logs_instances_list_test.go b/pkg/logsalpha/model_logs_instances_list_test.go new file mode 100644 index 00000000..45d1c0b6 --- /dev/null +++ b/pkg/logsalpha/model_logs_instances_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha diff --git a/pkg/logsalpha/model_update_access_token_payload.go b/pkg/logsalpha/model_update_access_token_payload.go new file mode 100644 index 00000000..98f606e0 --- /dev/null +++ b/pkg/logsalpha/model_update_access_token_payload.go @@ -0,0 +1,178 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "encoding/json" +) + +// checks if the UpdateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAccessTokenPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateAccessTokenPayloadGetDescriptionAttributeType = *string + +func getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(arg UpdateAccessTokenPayloadGetDescriptionAttributeType) (ret UpdateAccessTokenPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAccessTokenPayloadGetDescriptionAttributeType(arg *UpdateAccessTokenPayloadGetDescriptionAttributeType, val UpdateAccessTokenPayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateAccessTokenPayloadGetDescriptionArgType = string +type UpdateAccessTokenPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type UpdateAccessTokenPayloadGetDisplayNameAttributeType = *string + +func getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(arg UpdateAccessTokenPayloadGetDisplayNameAttributeType) (ret UpdateAccessTokenPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAccessTokenPayloadGetDisplayNameAttributeType(arg *UpdateAccessTokenPayloadGetDisplayNameAttributeType, val UpdateAccessTokenPayloadGetDisplayNameRetType) { + *arg = &val +} + +type UpdateAccessTokenPayloadGetDisplayNameArgType = string +type UpdateAccessTokenPayloadGetDisplayNameRetType = string + +// UpdateAccessTokenPayload struct for UpdateAccessTokenPayload +type UpdateAccessTokenPayload struct { + // The description of the access token. + Description UpdateAccessTokenPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName UpdateAccessTokenPayloadGetDisplayNameAttributeType `json:"displayName,omitempty"` +} + +// NewUpdateAccessTokenPayload instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayload() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// NewUpdateAccessTokenPayloadWithDefaults instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayloadWithDefaults() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateAccessTokenPayload) GetDescription() (res UpdateAccessTokenPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenPayload) GetDescriptionOk() (ret UpdateAccessTokenPayloadGetDescriptionRetType, ok bool) { + return getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateAccessTokenPayload) SetDescription(v UpdateAccessTokenPayloadGetDescriptionRetType) { + setUpdateAccessTokenPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateAccessTokenPayload) GetDisplayName() (res UpdateAccessTokenPayloadGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenPayload) GetDisplayNameOk() (ret UpdateAccessTokenPayloadGetDisplayNameRetType, ok bool) { + return getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateAccessTokenPayload) SetDisplayName(v UpdateAccessTokenPayloadGetDisplayNameRetType) { + setUpdateAccessTokenPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +func (o UpdateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + return toSerialize, nil +} + +type NullableUpdateAccessTokenPayload struct { + value *UpdateAccessTokenPayload + isSet bool +} + +func (v NullableUpdateAccessTokenPayload) Get() *UpdateAccessTokenPayload { + return v.value +} + +func (v *NullableUpdateAccessTokenPayload) Set(val *UpdateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAccessTokenPayload(val *UpdateAccessTokenPayload) *NullableUpdateAccessTokenPayload { + return &NullableUpdateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableUpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsalpha/model_update_access_token_payload_test.go b/pkg/logsalpha/model_update_access_token_payload_test.go new file mode 100644 index 00000000..45d1c0b6 --- /dev/null +++ b/pkg/logsalpha/model_update_access_token_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha diff --git a/pkg/logsalpha/model_update_logs_instance_payload.go b/pkg/logsalpha/model_update_logs_instance_payload.go new file mode 100644 index 00000000..15978088 --- /dev/null +++ b/pkg/logsalpha/model_update_logs_instance_payload.go @@ -0,0 +1,275 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "encoding/json" +) + +// checks if the UpdateLogsInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLogsInstancePayload{} + +/* + types and functions for acl +*/ + +// isArray +type UpdateLogsInstancePayloadGetAclAttributeType = *[]string +type UpdateLogsInstancePayloadGetAclArgType = []string +type UpdateLogsInstancePayloadGetAclRetType = []string + +func getUpdateLogsInstancePayloadGetAclAttributeTypeOk(arg UpdateLogsInstancePayloadGetAclAttributeType) (ret UpdateLogsInstancePayloadGetAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLogsInstancePayloadGetAclAttributeType(arg *UpdateLogsInstancePayloadGetAclAttributeType, val UpdateLogsInstancePayloadGetAclRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateLogsInstancePayloadGetDescriptionAttributeType = *string + +func getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(arg UpdateLogsInstancePayloadGetDescriptionAttributeType) (ret UpdateLogsInstancePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLogsInstancePayloadGetDescriptionAttributeType(arg *UpdateLogsInstancePayloadGetDescriptionAttributeType, val UpdateLogsInstancePayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateLogsInstancePayloadGetDescriptionArgType = string +type UpdateLogsInstancePayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type UpdateLogsInstancePayloadGetDisplayNameAttributeType = *string + +func getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(arg UpdateLogsInstancePayloadGetDisplayNameAttributeType) (ret UpdateLogsInstancePayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLogsInstancePayloadGetDisplayNameAttributeType(arg *UpdateLogsInstancePayloadGetDisplayNameAttributeType, val UpdateLogsInstancePayloadGetDisplayNameRetType) { + *arg = &val +} + +type UpdateLogsInstancePayloadGetDisplayNameArgType = string +type UpdateLogsInstancePayloadGetDisplayNameRetType = string + +/* + types and functions for retentionDays +*/ + +// isInteger +type UpdateLogsInstancePayloadGetRetentionDaysAttributeType = *int64 +type UpdateLogsInstancePayloadGetRetentionDaysArgType = int64 +type UpdateLogsInstancePayloadGetRetentionDaysRetType = int64 + +func getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(arg UpdateLogsInstancePayloadGetRetentionDaysAttributeType) (ret UpdateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLogsInstancePayloadGetRetentionDaysAttributeType(arg *UpdateLogsInstancePayloadGetRetentionDaysAttributeType, val UpdateLogsInstancePayloadGetRetentionDaysRetType) { + *arg = &val +} + +// UpdateLogsInstancePayload struct for UpdateLogsInstancePayload +type UpdateLogsInstancePayload struct { + // The access control list for the Logs instance. + Acl UpdateLogsInstancePayloadGetAclAttributeType `json:"acl,omitempty"` + // The description of the Logs instance. + Description UpdateLogsInstancePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name to distinguish multiple Logs instances. + DisplayName UpdateLogsInstancePayloadGetDisplayNameAttributeType `json:"displayName,omitempty"` + // The log retention time in days. + // Can be cast to int32 without loss of precision. + RetentionDays UpdateLogsInstancePayloadGetRetentionDaysAttributeType `json:"retentionDays,omitempty"` +} + +// NewUpdateLogsInstancePayload instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayload() *UpdateLogsInstancePayload { + this := UpdateLogsInstancePayload{} + return &this +} + +// NewUpdateLogsInstancePayloadWithDefaults instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayloadWithDefaults() *UpdateLogsInstancePayload { + this := UpdateLogsInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetAcl() (res UpdateLogsInstancePayloadGetAclRetType) { + res, _ = o.GetAclOk() + return +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetAclOk() (ret UpdateLogsInstancePayloadGetAclRetType, ok bool) { + return getUpdateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl) +} + +// HasAcl returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasAcl() bool { + _, ok := o.GetAclOk() + return ok +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *UpdateLogsInstancePayload) SetAcl(v UpdateLogsInstancePayloadGetAclRetType) { + setUpdateLogsInstancePayloadGetAclAttributeType(&o.Acl, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetDescription() (res UpdateLogsInstancePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetDescriptionOk() (ret UpdateLogsInstancePayloadGetDescriptionRetType, ok bool) { + return getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateLogsInstancePayload) SetDescription(v UpdateLogsInstancePayloadGetDescriptionRetType) { + setUpdateLogsInstancePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetDisplayName() (res UpdateLogsInstancePayloadGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetDisplayNameOk() (ret UpdateLogsInstancePayloadGetDisplayNameRetType, ok bool) { + return getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateLogsInstancePayload) SetDisplayName(v UpdateLogsInstancePayloadGetDisplayNameRetType) { + setUpdateLogsInstancePayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetRetentionDays returns the RetentionDays field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetRetentionDays() (res UpdateLogsInstancePayloadGetRetentionDaysRetType) { + res, _ = o.GetRetentionDaysOk() + return +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetRetentionDaysOk() (ret UpdateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { + return getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays) +} + +// HasRetentionDays returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasRetentionDays() bool { + _, ok := o.GetRetentionDaysOk() + return ok +} + +// SetRetentionDays gets a reference to the given int64 and assigns it to the RetentionDays field. +func (o *UpdateLogsInstancePayload) SetRetentionDays(v UpdateLogsInstancePayloadGetRetentionDaysRetType) { + setUpdateLogsInstancePayloadGetRetentionDaysAttributeType(&o.RetentionDays, v) +} + +func (o UpdateLogsInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl); ok { + toSerialize["Acl"] = val + } + if val, ok := getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays); ok { + toSerialize["RetentionDays"] = val + } + return toSerialize, nil +} + +type NullableUpdateLogsInstancePayload struct { + value *UpdateLogsInstancePayload + isSet bool +} + +func (v NullableUpdateLogsInstancePayload) Get() *UpdateLogsInstancePayload { + return v.value +} + +func (v *NullableUpdateLogsInstancePayload) Set(val *UpdateLogsInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateLogsInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateLogsInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateLogsInstancePayload(val *UpdateLogsInstancePayload) *NullableUpdateLogsInstancePayload { + return &NullableUpdateLogsInstancePayload{value: val, isSet: true} +} + +func (v NullableUpdateLogsInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateLogsInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsalpha/model_update_logs_instance_payload_test.go b/pkg/logsalpha/model_update_logs_instance_payload_test.go new file mode 100644 index 00000000..45d1c0b6 --- /dev/null +++ b/pkg/logsalpha/model_update_logs_instance_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha diff --git a/pkg/logsalpha/utils.go b/pkg/logsalpha/utils.go new file mode 100644 index 00000000..91a9fb97 --- /dev/null +++ b/pkg/logsalpha/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsalpha + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/logsbeta/.openapi-generator/VERSION b/pkg/logsbeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/logsbeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/logsbeta/api_default.go b/pkg/logsbeta/api_default.go new file mode 100644 index 00000000..19edb9f2 --- /dev/null +++ b/pkg/logsbeta/api_default.go @@ -0,0 +1,2048 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateAccessToken Create Access Token + Create a new Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiCreateAccessTokenRequest + */ + CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest + /* + CreateAccessTokenExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return AccessToken + + */ + CreateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessToken, error) + /* + CreateLogsInstance Create Logs instance + Creates a new Logs instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateLogsInstanceRequest + */ + CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest + /* + CreateLogsInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return LogsInstance + + */ + CreateLogsInstanceExecute(ctx context.Context, projectId string, regionId string) (*LogsInstance, error) + /* + DeleteAccessToken Delete Access Token + Deletes a Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiDeleteAccessTokenRequest + */ + DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest + /* + DeleteAccessTokenExecute executes the request + + */ + DeleteAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error + /* + DeleteAllAccessTokens Delete All Access Tokens + Deletes all access tokens available for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllAccessTokensRequest + */ + DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest + /* + DeleteAllAccessTokensExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return AccessTokenList + + */ + DeleteAllAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) + /* + DeleteAllExpiredAccessTokens Deletes all expired access tokens + Deletes all expired access tokens + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllExpiredAccessTokensRequest + */ + DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest + /* + DeleteAllExpiredAccessTokensExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return AccessTokenList + + */ + DeleteAllExpiredAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) + /* + DeleteLogsInstance Delete Logs instance + Deletes the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteLogsInstanceRequest + */ + DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest + /* + DeleteLogsInstanceExecute executes the request + + */ + DeleteLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) error + /* + GetAccessToken Get Access Token + Get the information of the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiGetAccessTokenRequest + */ + GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest + /* + GetAccessTokenExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return AccessToken + + */ + GetAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) (*AccessToken, error) + /* + GetLogsInstance Get Logs Instance + Returns the details for the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiGetLogsInstanceRequest + */ + GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest + /* + GetLogsInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return LogsInstance + + */ + GetLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) + /* + ListAccessTokens List Access Tokens + Returns a list of access tokens created for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiListAccessTokensRequest + */ + ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest + /* + ListAccessTokensExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return AccessTokenList + + */ + ListAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) + /* + ListLogsInstances List Logs instances + Returns a list of all Logs instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListLogsInstancesRequest + */ + ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest + /* + ListLogsInstancesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return LogsInstancesList + + */ + ListLogsInstancesExecute(ctx context.Context, projectId string, regionId string) (*LogsInstancesList, error) + /* + UpdateAccessToken Update Access Token + Updates the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiUpdateAccessTokenRequest + */ + UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest + /* + UpdateAccessTokenExecute executes the request + + */ + UpdateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error + /* + UpdateLogsInstance Update Logs instance + Updates the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiUpdateLogsInstanceRequest + */ + UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest + /* + UpdateLogsInstanceExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return LogsInstance + + */ + UpdateLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) +} + +type ApiCreateAccessTokenRequest interface { + CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest + Execute() (*AccessToken, error) +} + +type ApiCreateLogsInstanceRequest interface { + CreateLogsInstancePayload(createLogsInstancePayload CreateLogsInstancePayload) ApiCreateLogsInstanceRequest + Execute() (*LogsInstance, error) +} + +type ApiDeleteAccessTokenRequest interface { + Execute() error +} + +type ApiDeleteAllAccessTokensRequest interface { + Execute() (*AccessTokenList, error) +} + +type ApiDeleteAllExpiredAccessTokensRequest interface { + Execute() (*AccessTokenList, error) +} + +type ApiDeleteLogsInstanceRequest interface { + Execute() error +} + +type ApiGetAccessTokenRequest interface { + Execute() (*AccessToken, error) +} + +type ApiGetLogsInstanceRequest interface { + Execute() (*LogsInstance, error) +} + +type ApiListAccessTokensRequest interface { + Execute() (*AccessTokenList, error) +} + +type ApiListLogsInstancesRequest interface { + Execute() (*LogsInstancesList, error) +} + +type ApiUpdateAccessTokenRequest interface { + UpdateAccessTokenPayload(updateAccessTokenPayload UpdateAccessTokenPayload) ApiUpdateAccessTokenRequest + Execute() error +} + +type ApiUpdateLogsInstanceRequest interface { + UpdateLogsInstancePayload(updateLogsInstancePayload UpdateLogsInstancePayload) ApiUpdateLogsInstanceRequest + Execute() (*LogsInstance, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateAccessTokenRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + createAccessTokenPayload *CreateAccessTokenPayload +} + +func (r CreateAccessTokenRequest) CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest { + r.createAccessTokenPayload = &createAccessTokenPayload + return r +} + +func (r CreateAccessTokenRequest) Execute() (*AccessToken, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessToken + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateAccessToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createAccessTokenPayload == nil { + return localVarReturnValue, fmt.Errorf("createAccessTokenPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createAccessTokenPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateAccessToken: Create Access Token + +Create a new Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiCreateAccessTokenRequest +*/ +func (a *APIClient) CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest { + return CreateAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) CreateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessToken, error) { + r := CreateAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type CreateLogsInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + createLogsInstancePayload *CreateLogsInstancePayload +} + +func (r CreateLogsInstanceRequest) CreateLogsInstancePayload(createLogsInstancePayload CreateLogsInstancePayload) ApiCreateLogsInstanceRequest { + r.createLogsInstancePayload = &createLogsInstancePayload + return r +} + +func (r CreateLogsInstanceRequest) Execute() (*LogsInstance, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateLogsInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createLogsInstancePayload == nil { + return localVarReturnValue, fmt.Errorf("createLogsInstancePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createLogsInstancePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateLogsInstance: Create Logs instance + +Creates a new Logs instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateLogsInstanceRequest +*/ +func (a *APIClient) CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest { + return CreateLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +func (a *APIClient) CreateLogsInstanceExecute(ctx context.Context, projectId string, regionId string) (*LogsInstance, error) { + r := CreateLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type DeleteAccessTokenRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + tId string +} + +func (r DeleteAccessTokenRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAccessToken") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(r.tId, "tId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + return newErr + } + + return nil +} + +/* +DeleteAccessToken: Delete Access Token + +Deletes a Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiDeleteAccessTokenRequest +*/ +func (a *APIClient) DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest { + return DeleteAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +func (a *APIClient) DeleteAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error { + r := DeleteAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } + return r.Execute() +} + +type DeleteAllAccessTokensRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r DeleteAllAccessTokensRequest) Execute() (*AccessTokenList, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAllAccessTokens") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteAllAccessTokens: Delete All Access Tokens + +Deletes all access tokens available for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllAccessTokensRequest +*/ +func (a *APIClient) DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest { + return DeleteAllAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteAllAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) { + r := DeleteAllAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type DeleteAllExpiredAccessTokensRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r DeleteAllExpiredAccessTokensRequest) Execute() (*AccessTokenList, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAllExpiredAccessTokens") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/expired" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteAllExpiredAccessTokens: Deletes all expired access tokens + +Deletes all expired access tokens + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllExpiredAccessTokensRequest +*/ +func (a *APIClient) DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest { + return DeleteAllExpiredAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteAllExpiredAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) { + r := DeleteAllExpiredAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type DeleteLogsInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r DeleteLogsInstanceRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteLogsInstance") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + return newErr + } + + return nil +} + +/* +DeleteLogsInstance: Delete Logs instance + +Deletes the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteLogsInstanceRequest +*/ +func (a *APIClient) DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest { + return DeleteLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) DeleteLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) error { + r := DeleteLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type GetAccessTokenRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + tId string +} + +func (r GetAccessTokenRequest) Execute() (*AccessToken, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessToken + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAccessToken") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(r.tId, "tId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetAccessToken: Get Access Token + +Get the information of the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiGetAccessTokenRequest +*/ +func (a *APIClient) GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest { + return GetAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +func (a *APIClient) GetAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) (*AccessToken, error) { + r := GetAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } + return r.Execute() +} + +type GetLogsInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r GetLogsInstanceRequest) Execute() (*LogsInstance, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetLogsInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetLogsInstance: Get Logs Instance + +Returns the details for the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiGetLogsInstanceRequest +*/ +func (a *APIClient) GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest { + return GetLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) GetLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) { + r := GetLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type ListAccessTokensRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string +} + +func (r ListAccessTokensRequest) Execute() (*AccessTokenList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAccessTokens") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListAccessTokens: List Access Tokens + +Returns a list of access tokens created for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiListAccessTokensRequest +*/ +func (a *APIClient) ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest { + return ListAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) ListAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) { + r := ListAccessTokensRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} + +type ListLogsInstancesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string +} + +func (r ListLogsInstancesRequest) Execute() (*LogsInstancesList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstancesList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListLogsInstances") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListLogsInstances: List Logs instances + +Returns a list of all Logs instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListLogsInstancesRequest +*/ +func (a *APIClient) ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest { + return ListLogsInstancesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +func (a *APIClient) ListLogsInstancesExecute(ctx context.Context, projectId string, regionId string) (*LogsInstancesList, error) { + r := ListLogsInstancesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } + return r.Execute() +} + +type UpdateAccessTokenRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + tId string + updateAccessTokenPayload *UpdateAccessTokenPayload +} + +func (r UpdateAccessTokenRequest) UpdateAccessTokenPayload(updateAccessTokenPayload UpdateAccessTokenPayload) ApiUpdateAccessTokenRequest { + r.updateAccessTokenPayload = &updateAccessTokenPayload + return r +} + +func (r UpdateAccessTokenRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAccessToken") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(r.tId, "tId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateAccessTokenPayload == nil { + return fmt.Errorf("updateAccessTokenPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateAccessTokenPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + return newErr + } + + return nil +} + +/* +UpdateAccessToken: Update Access Token + +Updates the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiUpdateAccessTokenRequest +*/ +func (a *APIClient) UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest { + return UpdateAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +func (a *APIClient) UpdateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error { + r := UpdateAccessTokenRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } + return r.Execute() +} + +type UpdateLogsInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + regionId string + instanceId string + updateLogsInstancePayload *UpdateLogsInstancePayload +} + +func (r UpdateLogsInstanceRequest) UpdateLogsInstancePayload(updateLogsInstancePayload UpdateLogsInstancePayload) ApiUpdateLogsInstanceRequest { + r.updateLogsInstancePayload = &updateLogsInstancePayload + return r +} + +func (r UpdateLogsInstanceRequest) Execute() (*LogsInstance, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateLogsInstance") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateLogsInstancePayload == nil { + return localVarReturnValue, fmt.Errorf("updateLogsInstancePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateLogsInstancePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateLogsInstance: Update Logs instance + +Updates the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiUpdateLogsInstanceRequest +*/ +func (a *APIClient) UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest { + return UpdateLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +func (a *APIClient) UpdateLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) { + r := UpdateLogsInstanceRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } + return r.Execute() +} diff --git a/pkg/logsbeta/api_default_test.go b/pkg/logsbeta/api_default_test.go new file mode 100644 index 00000000..5bc4fa7e --- /dev/null +++ b/pkg/logsbeta/api_default_test.go @@ -0,0 +1,712 @@ +/* +STACKIT Logs API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package logsbeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_logsbeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateAccessToken", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AccessToken{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + createAccessTokenPayload := CreateAccessTokenPayload{} + + resp, reqErr := apiClient.CreateAccessToken(context.Background(), projectId, regionId, instanceId).CreateAccessTokenPayload(createAccessTokenPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateLogsInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LogsInstance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + createLogsInstancePayload := CreateLogsInstancePayload{} + + resp, reqErr := apiClient.CreateLogsInstance(context.Background(), projectId, regionId).CreateLogsInstancePayload(createLogsInstancePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAccessToken", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + tIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(tIdValue, "tId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + tId := tIdValue + + reqErr := apiClient.DeleteAccessToken(context.Background(), projectId, regionId, instanceId, tId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteAllAccessTokens", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AccessTokenList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.DeleteAllAccessTokens(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAllExpiredAccessTokens", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/expired" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AccessTokenList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.DeleteAllExpiredAccessTokens(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteLogsInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + reqErr := apiClient.DeleteLogsInstance(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetAccessToken", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + tIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(tIdValue, "tId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AccessToken{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + tId := tIdValue + + resp, reqErr := apiClient.GetAccessToken(context.Background(), projectId, regionId, instanceId, tId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetLogsInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LogsInstance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.GetLogsInstance(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListAccessTokens", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AccessTokenList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + + resp, reqErr := apiClient.ListAccessTokens(context.Background(), projectId, regionId, instanceId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListLogsInstances", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LogsInstancesList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + + resp, reqErr := apiClient.ListLogsInstances(context.Background(), projectId, regionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateAccessToken", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + tIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(tIdValue, "tId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + tId := tIdValue + updateAccessTokenPayload := UpdateAccessTokenPayload{} + + reqErr := apiClient.UpdateAccessToken(context.Background(), projectId, regionId, instanceId, tId).UpdateAccessTokenPayload(updateAccessTokenPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService UpdateLogsInstance", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionIdValue := "regionId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1) + instanceIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := LogsInstance{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for logsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + regionId := regionIdValue + instanceId := instanceIdValue + updateLogsInstancePayload := UpdateLogsInstancePayload{} + + resp, reqErr := apiClient.UpdateLogsInstance(context.Background(), projectId, regionId, instanceId).UpdateLogsInstancePayload(updateLogsInstancePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/logsbeta/client.go b/pkg/logsbeta/client.go new file mode 100644 index 00000000..05e2cbb6 --- /dev/null +++ b/pkg/logsbeta/client.go @@ -0,0 +1,628 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Logs API API v1beta.0.3 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/logsbeta/configuration.go b/pkg/logsbeta/configuration.go new file mode 100644 index 00000000..0f432f70 --- /dev/null +++ b/pkg/logsbeta/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/logsbeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://logs.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/logsbeta/model_access_token.go b/pkg/logsbeta/model_access_token.go new file mode 100644 index 00000000..9d8eca34 --- /dev/null +++ b/pkg/logsbeta/model_access_token.go @@ -0,0 +1,600 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the AccessToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessToken{} + +/* + types and functions for accessToken +*/ + +// isNotNullableString +type AccessTokenGetAccessTokenAttributeType = *string + +func getAccessTokenGetAccessTokenAttributeTypeOk(arg AccessTokenGetAccessTokenAttributeType) (ret AccessTokenGetAccessTokenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetAccessTokenAttributeType(arg *AccessTokenGetAccessTokenAttributeType, val AccessTokenGetAccessTokenRetType) { + *arg = &val +} + +type AccessTokenGetAccessTokenArgType = string +type AccessTokenGetAccessTokenRetType = string + +/* + types and functions for creator +*/ + +// isNotNullableString +type AccessTokenGetCreatorAttributeType = *string + +func getAccessTokenGetCreatorAttributeTypeOk(arg AccessTokenGetCreatorAttributeType) (ret AccessTokenGetCreatorRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetCreatorAttributeType(arg *AccessTokenGetCreatorAttributeType, val AccessTokenGetCreatorRetType) { + *arg = &val +} + +type AccessTokenGetCreatorArgType = string +type AccessTokenGetCreatorRetType = string + +/* + types and functions for description +*/ + +// isNotNullableString +type AccessTokenGetDescriptionAttributeType = *string + +func getAccessTokenGetDescriptionAttributeTypeOk(arg AccessTokenGetDescriptionAttributeType) (ret AccessTokenGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetDescriptionAttributeType(arg *AccessTokenGetDescriptionAttributeType, val AccessTokenGetDescriptionRetType) { + *arg = &val +} + +type AccessTokenGetDescriptionArgType = string +type AccessTokenGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type AccessTokenGetDisplayNameAttributeType = *string + +func getAccessTokenGetDisplayNameAttributeTypeOk(arg AccessTokenGetDisplayNameAttributeType) (ret AccessTokenGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetDisplayNameAttributeType(arg *AccessTokenGetDisplayNameAttributeType, val AccessTokenGetDisplayNameRetType) { + *arg = &val +} + +type AccessTokenGetDisplayNameArgType = string +type AccessTokenGetDisplayNameRetType = string + +/* + types and functions for expires +*/ + +// isBoolean +type AccessTokengetExpiresAttributeType = *bool +type AccessTokengetExpiresArgType = bool +type AccessTokengetExpiresRetType = bool + +func getAccessTokengetExpiresAttributeTypeOk(arg AccessTokengetExpiresAttributeType) (ret AccessTokengetExpiresRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokengetExpiresAttributeType(arg *AccessTokengetExpiresAttributeType, val AccessTokengetExpiresRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type AccessTokenGetIdAttributeType = *string + +func getAccessTokenGetIdAttributeTypeOk(arg AccessTokenGetIdAttributeType) (ret AccessTokenGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetIdAttributeType(arg *AccessTokenGetIdAttributeType, val AccessTokenGetIdRetType) { + *arg = &val +} + +type AccessTokenGetIdArgType = string +type AccessTokenGetIdRetType = string + +/* + types and functions for permissions +*/ + +// isArray +type AccessTokenGetPermissionsAttributeType = *[]string +type AccessTokenGetPermissionsArgType = []string +type AccessTokenGetPermissionsRetType = []string + +func getAccessTokenGetPermissionsAttributeTypeOk(arg AccessTokenGetPermissionsAttributeType) (ret AccessTokenGetPermissionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetPermissionsAttributeType(arg *AccessTokenGetPermissionsAttributeType, val AccessTokenGetPermissionsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isEnum + +// AccessTokenStatus the model 'AccessToken' +// value type for enums +type AccessTokenStatus string + +// List of Status +const ( + ACCESSTOKENSTATUS_ACTIVE AccessTokenStatus = "active" + ACCESSTOKENSTATUS_EXPIRED AccessTokenStatus = "expired" +) + +// All allowed values of AccessToken enum +var AllowedAccessTokenStatusEnumValues = []AccessTokenStatus{ + "active", + "expired", +} + +func (v *AccessTokenStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson AccessTokenStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := AccessTokenStatus(value) + for _, existing := range AllowedAccessTokenStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid AccessToken", value) +} + +// NewAccessTokenStatusFromValue returns a pointer to a valid AccessTokenStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAccessTokenStatusFromValue(v AccessTokenStatus) (*AccessTokenStatus, error) { + ev := AccessTokenStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AccessTokenStatus: valid values are %v", v, AllowedAccessTokenStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v AccessTokenStatus) IsValid() bool { + for _, existing := range AllowedAccessTokenStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v AccessTokenStatus) Ptr() *AccessTokenStatus { + return &v +} + +type NullableAccessTokenStatus struct { + value *AccessTokenStatus + isSet bool +} + +func (v NullableAccessTokenStatus) Get() *AccessTokenStatus { + return v.value +} + +func (v *NullableAccessTokenStatus) Set(val *AccessTokenStatus) { + v.value = val + v.isSet = true +} + +func (v NullableAccessTokenStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessTokenStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessTokenStatus(val *AccessTokenStatus) *NullableAccessTokenStatus { + return &NullableAccessTokenStatus{value: val, isSet: true} +} + +func (v NullableAccessTokenStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessTokenStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type AccessTokenGetStatusAttributeType = *AccessTokenStatus +type AccessTokenGetStatusArgType = AccessTokenStatus +type AccessTokenGetStatusRetType = AccessTokenStatus + +func getAccessTokenGetStatusAttributeTypeOk(arg AccessTokenGetStatusAttributeType) (ret AccessTokenGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetStatusAttributeType(arg *AccessTokenGetStatusAttributeType, val AccessTokenGetStatusRetType) { + *arg = &val +} + +/* + types and functions for validUntil +*/ + +// isDateTime +type AccessTokenGetValidUntilAttributeType = *time.Time +type AccessTokenGetValidUntilArgType = time.Time +type AccessTokenGetValidUntilRetType = time.Time + +func getAccessTokenGetValidUntilAttributeTypeOk(arg AccessTokenGetValidUntilAttributeType) (ret AccessTokenGetValidUntilRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenGetValidUntilAttributeType(arg *AccessTokenGetValidUntilAttributeType, val AccessTokenGetValidUntilRetType) { + *arg = &val +} + +// AccessToken struct for AccessToken +type AccessToken struct { + // A generated access token. Only available on creation. + AccessToken AccessTokenGetAccessTokenAttributeType `json:"accessToken,omitempty"` + // The user who created the access token. + // REQUIRED + Creator AccessTokenGetCreatorAttributeType `json:"creator" required:"true"` + // The description of the access token. + Description AccessTokenGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name of the access token. + // REQUIRED + DisplayName AccessTokenGetDisplayNameAttributeType `json:"displayName" required:"true"` + // Indicates if the access token can expire. + // REQUIRED + Expires AccessTokengetExpiresAttributeType `json:"expires" required:"true"` + // An auto generated unique id which identifies the access token. + // REQUIRED + Id AccessTokenGetIdAttributeType `json:"id" required:"true"` + // The access permissions granted to the access token. + // REQUIRED + Permissions AccessTokenGetPermissionsAttributeType `json:"permissions" required:"true"` + // REQUIRED + Status AccessTokenGetStatusAttributeType `json:"status" required:"true"` + // The date and time util an access token is valid to (inclusively). + ValidUntil AccessTokenGetValidUntilAttributeType `json:"validUntil,omitempty"` +} + +type _AccessToken AccessToken + +// NewAccessToken instantiates a new AccessToken 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 NewAccessToken(creator AccessTokenGetCreatorArgType, displayName AccessTokenGetDisplayNameArgType, expires AccessTokengetExpiresArgType, id AccessTokenGetIdArgType, permissions AccessTokenGetPermissionsArgType, status AccessTokenGetStatusArgType) *AccessToken { + this := AccessToken{} + setAccessTokenGetCreatorAttributeType(&this.Creator, creator) + setAccessTokenGetDisplayNameAttributeType(&this.DisplayName, displayName) + setAccessTokengetExpiresAttributeType(&this.Expires, expires) + setAccessTokenGetIdAttributeType(&this.Id, id) + setAccessTokenGetPermissionsAttributeType(&this.Permissions, permissions) + setAccessTokenGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewAccessTokenWithDefaults instantiates a new AccessToken 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 NewAccessTokenWithDefaults() *AccessToken { + this := AccessToken{} + return &this +} + +// GetAccessToken returns the AccessToken field value if set, zero value otherwise. +func (o *AccessToken) GetAccessToken() (res AccessTokenGetAccessTokenRetType) { + res, _ = o.GetAccessTokenOk() + return +} + +// GetAccessTokenOk returns a tuple with the AccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetAccessTokenOk() (ret AccessTokenGetAccessTokenRetType, ok bool) { + return getAccessTokenGetAccessTokenAttributeTypeOk(o.AccessToken) +} + +// HasAccessToken returns a boolean if a field has been set. +func (o *AccessToken) HasAccessToken() bool { + _, ok := o.GetAccessTokenOk() + return ok +} + +// SetAccessToken gets a reference to the given string and assigns it to the AccessToken field. +func (o *AccessToken) SetAccessToken(v AccessTokenGetAccessTokenRetType) { + setAccessTokenGetAccessTokenAttributeType(&o.AccessToken, v) +} + +// GetCreator returns the Creator field value +func (o *AccessToken) GetCreator() (ret AccessTokenGetCreatorRetType) { + ret, _ = o.GetCreatorOk() + return ret +} + +// GetCreatorOk returns a tuple with the Creator field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetCreatorOk() (ret AccessTokenGetCreatorRetType, ok bool) { + return getAccessTokenGetCreatorAttributeTypeOk(o.Creator) +} + +// SetCreator sets field value +func (o *AccessToken) SetCreator(v AccessTokenGetCreatorRetType) { + setAccessTokenGetCreatorAttributeType(&o.Creator, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AccessToken) GetDescription() (res AccessTokenGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetDescriptionOk() (ret AccessTokenGetDescriptionRetType, ok bool) { + return getAccessTokenGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *AccessToken) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AccessToken) SetDescription(v AccessTokenGetDescriptionRetType) { + setAccessTokenGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *AccessToken) GetDisplayName() (ret AccessTokenGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetDisplayNameOk() (ret AccessTokenGetDisplayNameRetType, ok bool) { + return getAccessTokenGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *AccessToken) SetDisplayName(v AccessTokenGetDisplayNameRetType) { + setAccessTokenGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetExpires returns the Expires field value +func (o *AccessToken) GetExpires() (ret AccessTokengetExpiresRetType) { + ret, _ = o.GetExpiresOk() + return ret +} + +// GetExpiresOk returns a tuple with the Expires field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetExpiresOk() (ret AccessTokengetExpiresRetType, ok bool) { + return getAccessTokengetExpiresAttributeTypeOk(o.Expires) +} + +// SetExpires sets field value +func (o *AccessToken) SetExpires(v AccessTokengetExpiresRetType) { + setAccessTokengetExpiresAttributeType(&o.Expires, v) +} + +// GetId returns the Id field value +func (o *AccessToken) GetId() (ret AccessTokenGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetIdOk() (ret AccessTokenGetIdRetType, ok bool) { + return getAccessTokenGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *AccessToken) SetId(v AccessTokenGetIdRetType) { + setAccessTokenGetIdAttributeType(&o.Id, v) +} + +// GetPermissions returns the Permissions field value +func (o *AccessToken) GetPermissions() (ret AccessTokenGetPermissionsRetType) { + ret, _ = o.GetPermissionsOk() + return ret +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetPermissionsOk() (ret AccessTokenGetPermissionsRetType, ok bool) { + return getAccessTokenGetPermissionsAttributeTypeOk(o.Permissions) +} + +// SetPermissions sets field value +func (o *AccessToken) SetPermissions(v AccessTokenGetPermissionsRetType) { + setAccessTokenGetPermissionsAttributeType(&o.Permissions, v) +} + +// GetStatus returns the Status field value +func (o *AccessToken) GetStatus() (ret AccessTokenGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetStatusOk() (ret AccessTokenGetStatusRetType, ok bool) { + return getAccessTokenGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *AccessToken) SetStatus(v AccessTokenGetStatusRetType) { + setAccessTokenGetStatusAttributeType(&o.Status, v) +} + +// GetValidUntil returns the ValidUntil field value if set, zero value otherwise. +func (o *AccessToken) GetValidUntil() (res AccessTokenGetValidUntilRetType) { + res, _ = o.GetValidUntilOk() + return +} + +// GetValidUntilOk returns a tuple with the ValidUntil field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetValidUntilOk() (ret AccessTokenGetValidUntilRetType, ok bool) { + return getAccessTokenGetValidUntilAttributeTypeOk(o.ValidUntil) +} + +// HasValidUntil returns a boolean if a field has been set. +func (o *AccessToken) HasValidUntil() bool { + _, ok := o.GetValidUntilOk() + return ok +} + +// SetValidUntil gets a reference to the given time.Time and assigns it to the ValidUntil field. +func (o *AccessToken) SetValidUntil(v AccessTokenGetValidUntilRetType) { + setAccessTokenGetValidUntilAttributeType(&o.ValidUntil, v) +} + +func (o AccessToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAccessTokenGetAccessTokenAttributeTypeOk(o.AccessToken); ok { + toSerialize["AccessToken"] = val + } + if val, ok := getAccessTokenGetCreatorAttributeTypeOk(o.Creator); ok { + toSerialize["Creator"] = val + } + if val, ok := getAccessTokenGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getAccessTokenGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getAccessTokengetExpiresAttributeTypeOk(o.Expires); ok { + toSerialize["Expires"] = val + } + if val, ok := getAccessTokenGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getAccessTokenGetPermissionsAttributeTypeOk(o.Permissions); ok { + toSerialize["Permissions"] = val + } + if val, ok := getAccessTokenGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getAccessTokenGetValidUntilAttributeTypeOk(o.ValidUntil); ok { + toSerialize["ValidUntil"] = val + } + return toSerialize, nil +} + +type NullableAccessToken struct { + value *AccessToken + isSet bool +} + +func (v NullableAccessToken) Get() *AccessToken { + return v.value +} + +func (v *NullableAccessToken) Set(val *AccessToken) { + v.value = val + v.isSet = true +} + +func (v NullableAccessToken) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessToken(val *AccessToken) *NullableAccessToken { + return &NullableAccessToken{value: val, isSet: true} +} + +func (v NullableAccessToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsbeta/model_access_token_list.go b/pkg/logsbeta/model_access_token_list.go new file mode 100644 index 00000000..0fd0a0a8 --- /dev/null +++ b/pkg/logsbeta/model_access_token_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "encoding/json" +) + +// checks if the AccessTokenList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessTokenList{} + +/* + types and functions for tokens +*/ + +// isArray +type AccessTokenListGetTokensAttributeType = *[]AccessToken +type AccessTokenListGetTokensArgType = []AccessToken +type AccessTokenListGetTokensRetType = []AccessToken + +func getAccessTokenListGetTokensAttributeTypeOk(arg AccessTokenListGetTokensAttributeType) (ret AccessTokenListGetTokensRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAccessTokenListGetTokensAttributeType(arg *AccessTokenListGetTokensAttributeType, val AccessTokenListGetTokensRetType) { + *arg = &val +} + +// AccessTokenList struct for AccessTokenList +type AccessTokenList struct { + // REQUIRED + Tokens AccessTokenListGetTokensAttributeType `json:"tokens" required:"true"` +} + +type _AccessTokenList AccessTokenList + +// NewAccessTokenList instantiates a new AccessTokenList 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 NewAccessTokenList(tokens AccessTokenListGetTokensArgType) *AccessTokenList { + this := AccessTokenList{} + setAccessTokenListGetTokensAttributeType(&this.Tokens, tokens) + return &this +} + +// NewAccessTokenListWithDefaults instantiates a new AccessTokenList 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 NewAccessTokenListWithDefaults() *AccessTokenList { + this := AccessTokenList{} + return &this +} + +// GetTokens returns the Tokens field value +func (o *AccessTokenList) GetTokens() (ret AccessTokenListGetTokensRetType) { + ret, _ = o.GetTokensOk() + return ret +} + +// GetTokensOk returns a tuple with the Tokens field value +// and a boolean to check if the value has been set. +func (o *AccessTokenList) GetTokensOk() (ret AccessTokenListGetTokensRetType, ok bool) { + return getAccessTokenListGetTokensAttributeTypeOk(o.Tokens) +} + +// SetTokens sets field value +func (o *AccessTokenList) SetTokens(v AccessTokenListGetTokensRetType) { + setAccessTokenListGetTokensAttributeType(&o.Tokens, v) +} + +func (o AccessTokenList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAccessTokenListGetTokensAttributeTypeOk(o.Tokens); ok { + toSerialize["Tokens"] = val + } + return toSerialize, nil +} + +type NullableAccessTokenList struct { + value *AccessTokenList + isSet bool +} + +func (v NullableAccessTokenList) Get() *AccessTokenList { + return v.value +} + +func (v *NullableAccessTokenList) Set(val *AccessTokenList) { + v.value = val + v.isSet = true +} + +func (v NullableAccessTokenList) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessTokenList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessTokenList(val *AccessTokenList) *NullableAccessTokenList { + return &NullableAccessTokenList{value: val, isSet: true} +} + +func (v NullableAccessTokenList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessTokenList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsbeta/model_access_token_list_test.go b/pkg/logsbeta/model_access_token_list_test.go new file mode 100644 index 00000000..c3941b67 --- /dev/null +++ b/pkg/logsbeta/model_access_token_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta diff --git a/pkg/logsbeta/model_access_token_test.go b/pkg/logsbeta/model_access_token_test.go new file mode 100644 index 00000000..e2e9d3bb --- /dev/null +++ b/pkg/logsbeta/model_access_token_test.go @@ -0,0 +1,58 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "testing" +) + +// isEnum + +func TestAccessTokenStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"expired"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := AccessTokenStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/logsbeta/model_create_access_token_payload.go b/pkg/logsbeta/model_create_access_token_payload.go new file mode 100644 index 00000000..f3a97c13 --- /dev/null +++ b/pkg/logsbeta/model_create_access_token_payload.go @@ -0,0 +1,269 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "encoding/json" +) + +// checks if the CreateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAccessTokenPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateAccessTokenPayloadGetDescriptionAttributeType = *string + +func getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(arg CreateAccessTokenPayloadGetDescriptionAttributeType) (ret CreateAccessTokenPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAccessTokenPayloadGetDescriptionAttributeType(arg *CreateAccessTokenPayloadGetDescriptionAttributeType, val CreateAccessTokenPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateAccessTokenPayloadGetDescriptionArgType = string +type CreateAccessTokenPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateAccessTokenPayloadGetDisplayNameAttributeType = *string + +func getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(arg CreateAccessTokenPayloadGetDisplayNameAttributeType) (ret CreateAccessTokenPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAccessTokenPayloadGetDisplayNameAttributeType(arg *CreateAccessTokenPayloadGetDisplayNameAttributeType, val CreateAccessTokenPayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateAccessTokenPayloadGetDisplayNameArgType = string +type CreateAccessTokenPayloadGetDisplayNameRetType = string + +/* + types and functions for lifetime +*/ + +// isInteger +type CreateAccessTokenPayloadGetLifetimeAttributeType = *int64 +type CreateAccessTokenPayloadGetLifetimeArgType = int64 +type CreateAccessTokenPayloadGetLifetimeRetType = int64 + +func getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(arg CreateAccessTokenPayloadGetLifetimeAttributeType) (ret CreateAccessTokenPayloadGetLifetimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAccessTokenPayloadGetLifetimeAttributeType(arg *CreateAccessTokenPayloadGetLifetimeAttributeType, val CreateAccessTokenPayloadGetLifetimeRetType) { + *arg = &val +} + +/* + types and functions for permissions +*/ + +// isArray +type CreateAccessTokenPayloadGetPermissionsAttributeType = *[]string +type CreateAccessTokenPayloadGetPermissionsArgType = []string +type CreateAccessTokenPayloadGetPermissionsRetType = []string + +func getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(arg CreateAccessTokenPayloadGetPermissionsAttributeType) (ret CreateAccessTokenPayloadGetPermissionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAccessTokenPayloadGetPermissionsAttributeType(arg *CreateAccessTokenPayloadGetPermissionsAttributeType, val CreateAccessTokenPayloadGetPermissionsRetType) { + *arg = &val +} + +// CreateAccessTokenPayload struct for CreateAccessTokenPayload +type CreateAccessTokenPayload struct { + // The description of the access token. + Description CreateAccessTokenPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name of the access token. + // REQUIRED + DisplayName CreateAccessTokenPayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + // A lifetime period for an access token in days. If unset the token will not expire. + // Can be cast to int32 without loss of precision. + Lifetime CreateAccessTokenPayloadGetLifetimeAttributeType `json:"lifetime,omitempty"` + // The access permissions granted to the access token. + // REQUIRED + Permissions CreateAccessTokenPayloadGetPermissionsAttributeType `json:"permissions" required:"true"` +} + +type _CreateAccessTokenPayload CreateAccessTokenPayload + +// NewCreateAccessTokenPayload instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayload(displayName CreateAccessTokenPayloadGetDisplayNameArgType, permissions CreateAccessTokenPayloadGetPermissionsArgType) *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + setCreateAccessTokenPayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + setCreateAccessTokenPayloadGetPermissionsAttributeType(&this.Permissions, permissions) + return &this +} + +// NewCreateAccessTokenPayloadWithDefaults instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayloadWithDefaults() *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) GetDescription() (res CreateAccessTokenPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDescriptionOk() (ret CreateAccessTokenPayloadGetDescriptionRetType, ok bool) { + return getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateAccessTokenPayload) SetDescription(v CreateAccessTokenPayloadGetDescriptionRetType) { + setCreateAccessTokenPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateAccessTokenPayload) GetDisplayName() (ret CreateAccessTokenPayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDisplayNameOk() (ret CreateAccessTokenPayloadGetDisplayNameRetType, ok bool) { + return getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateAccessTokenPayload) SetDisplayName(v CreateAccessTokenPayloadGetDisplayNameRetType) { + setCreateAccessTokenPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetLifetime returns the Lifetime field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) GetLifetime() (res CreateAccessTokenPayloadGetLifetimeRetType) { + res, _ = o.GetLifetimeOk() + return +} + +// GetLifetimeOk returns a tuple with the Lifetime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetLifetimeOk() (ret CreateAccessTokenPayloadGetLifetimeRetType, ok bool) { + return getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(o.Lifetime) +} + +// HasLifetime returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasLifetime() bool { + _, ok := o.GetLifetimeOk() + return ok +} + +// SetLifetime gets a reference to the given int64 and assigns it to the Lifetime field. +func (o *CreateAccessTokenPayload) SetLifetime(v CreateAccessTokenPayloadGetLifetimeRetType) { + setCreateAccessTokenPayloadGetLifetimeAttributeType(&o.Lifetime, v) +} + +// GetPermissions returns the Permissions field value +func (o *CreateAccessTokenPayload) GetPermissions() (ret CreateAccessTokenPayloadGetPermissionsRetType) { + ret, _ = o.GetPermissionsOk() + return ret +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetPermissionsOk() (ret CreateAccessTokenPayloadGetPermissionsRetType, ok bool) { + return getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(o.Permissions) +} + +// SetPermissions sets field value +func (o *CreateAccessTokenPayload) SetPermissions(v CreateAccessTokenPayloadGetPermissionsRetType) { + setCreateAccessTokenPayloadGetPermissionsAttributeType(&o.Permissions, v) +} + +func (o CreateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(o.Lifetime); ok { + toSerialize["Lifetime"] = val + } + if val, ok := getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(o.Permissions); ok { + toSerialize["Permissions"] = val + } + return toSerialize, nil +} + +type NullableCreateAccessTokenPayload struct { + value *CreateAccessTokenPayload + isSet bool +} + +func (v NullableCreateAccessTokenPayload) Get() *CreateAccessTokenPayload { + return v.value +} + +func (v *NullableCreateAccessTokenPayload) Set(val *CreateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAccessTokenPayload(val *CreateAccessTokenPayload) *NullableCreateAccessTokenPayload { + return &NullableCreateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableCreateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsbeta/model_create_access_token_payload_test.go b/pkg/logsbeta/model_create_access_token_payload_test.go new file mode 100644 index 00000000..c3941b67 --- /dev/null +++ b/pkg/logsbeta/model_create_access_token_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta diff --git a/pkg/logsbeta/model_create_logs_instance_payload.go b/pkg/logsbeta/model_create_logs_instance_payload.go new file mode 100644 index 00000000..c4223196 --- /dev/null +++ b/pkg/logsbeta/model_create_logs_instance_payload.go @@ -0,0 +1,269 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "encoding/json" +) + +// checks if the CreateLogsInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateLogsInstancePayload{} + +/* + types and functions for acl +*/ + +// isArray +type CreateLogsInstancePayloadGetAclAttributeType = *[]string +type CreateLogsInstancePayloadGetAclArgType = []string +type CreateLogsInstancePayloadGetAclRetType = []string + +func getCreateLogsInstancePayloadGetAclAttributeTypeOk(arg CreateLogsInstancePayloadGetAclAttributeType) (ret CreateLogsInstancePayloadGetAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLogsInstancePayloadGetAclAttributeType(arg *CreateLogsInstancePayloadGetAclAttributeType, val CreateLogsInstancePayloadGetAclRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateLogsInstancePayloadGetDescriptionAttributeType = *string + +func getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(arg CreateLogsInstancePayloadGetDescriptionAttributeType) (ret CreateLogsInstancePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLogsInstancePayloadGetDescriptionAttributeType(arg *CreateLogsInstancePayloadGetDescriptionAttributeType, val CreateLogsInstancePayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateLogsInstancePayloadGetDescriptionArgType = string +type CreateLogsInstancePayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type CreateLogsInstancePayloadGetDisplayNameAttributeType = *string + +func getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(arg CreateLogsInstancePayloadGetDisplayNameAttributeType) (ret CreateLogsInstancePayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLogsInstancePayloadGetDisplayNameAttributeType(arg *CreateLogsInstancePayloadGetDisplayNameAttributeType, val CreateLogsInstancePayloadGetDisplayNameRetType) { + *arg = &val +} + +type CreateLogsInstancePayloadGetDisplayNameArgType = string +type CreateLogsInstancePayloadGetDisplayNameRetType = string + +/* + types and functions for retentionDays +*/ + +// isInteger +type CreateLogsInstancePayloadGetRetentionDaysAttributeType = *int64 +type CreateLogsInstancePayloadGetRetentionDaysArgType = int64 +type CreateLogsInstancePayloadGetRetentionDaysRetType = int64 + +func getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(arg CreateLogsInstancePayloadGetRetentionDaysAttributeType) (ret CreateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateLogsInstancePayloadGetRetentionDaysAttributeType(arg *CreateLogsInstancePayloadGetRetentionDaysAttributeType, val CreateLogsInstancePayloadGetRetentionDaysRetType) { + *arg = &val +} + +// CreateLogsInstancePayload struct for CreateLogsInstancePayload +type CreateLogsInstancePayload struct { + // The access control list for the Logs instance. + Acl CreateLogsInstancePayloadGetAclAttributeType `json:"acl,omitempty"` + // The description of the access token. + Description CreateLogsInstancePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name to distinguish multiple Logs instances. + // REQUIRED + DisplayName CreateLogsInstancePayloadGetDisplayNameAttributeType `json:"displayName" required:"true"` + // The log retention time in days. + // Can be cast to int32 without loss of precision. + // REQUIRED + RetentionDays CreateLogsInstancePayloadGetRetentionDaysAttributeType `json:"retentionDays" required:"true"` +} + +type _CreateLogsInstancePayload CreateLogsInstancePayload + +// NewCreateLogsInstancePayload instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayload(displayName CreateLogsInstancePayloadGetDisplayNameArgType, retentionDays CreateLogsInstancePayloadGetRetentionDaysArgType) *CreateLogsInstancePayload { + this := CreateLogsInstancePayload{} + setCreateLogsInstancePayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) + setCreateLogsInstancePayloadGetRetentionDaysAttributeType(&this.RetentionDays, retentionDays) + return &this +} + +// NewCreateLogsInstancePayloadWithDefaults instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayloadWithDefaults() *CreateLogsInstancePayload { + this := CreateLogsInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *CreateLogsInstancePayload) GetAcl() (res CreateLogsInstancePayloadGetAclRetType) { + res, _ = o.GetAclOk() + return +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetAclOk() (ret CreateLogsInstancePayloadGetAclRetType, ok bool) { + return getCreateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl) +} + +// HasAcl returns a boolean if a field has been set. +func (o *CreateLogsInstancePayload) HasAcl() bool { + _, ok := o.GetAclOk() + return ok +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *CreateLogsInstancePayload) SetAcl(v CreateLogsInstancePayloadGetAclRetType) { + setCreateLogsInstancePayloadGetAclAttributeType(&o.Acl, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateLogsInstancePayload) GetDescription() (res CreateLogsInstancePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetDescriptionOk() (ret CreateLogsInstancePayloadGetDescriptionRetType, ok bool) { + return getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateLogsInstancePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateLogsInstancePayload) SetDescription(v CreateLogsInstancePayloadGetDescriptionRetType) { + setCreateLogsInstancePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateLogsInstancePayload) GetDisplayName() (ret CreateLogsInstancePayloadGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetDisplayNameOk() (ret CreateLogsInstancePayloadGetDisplayNameRetType, ok bool) { + return getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *CreateLogsInstancePayload) SetDisplayName(v CreateLogsInstancePayloadGetDisplayNameRetType) { + setCreateLogsInstancePayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetRetentionDays returns the RetentionDays field value +func (o *CreateLogsInstancePayload) GetRetentionDays() (ret CreateLogsInstancePayloadGetRetentionDaysRetType) { + ret, _ = o.GetRetentionDaysOk() + return ret +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetRetentionDaysOk() (ret CreateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { + return getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays) +} + +// SetRetentionDays sets field value +func (o *CreateLogsInstancePayload) SetRetentionDays(v CreateLogsInstancePayloadGetRetentionDaysRetType) { + setCreateLogsInstancePayloadGetRetentionDaysAttributeType(&o.RetentionDays, v) +} + +func (o CreateLogsInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl); ok { + toSerialize["Acl"] = val + } + if val, ok := getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays); ok { + toSerialize["RetentionDays"] = val + } + return toSerialize, nil +} + +type NullableCreateLogsInstancePayload struct { + value *CreateLogsInstancePayload + isSet bool +} + +func (v NullableCreateLogsInstancePayload) Get() *CreateLogsInstancePayload { + return v.value +} + +func (v *NullableCreateLogsInstancePayload) Set(val *CreateLogsInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLogsInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLogsInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLogsInstancePayload(val *CreateLogsInstancePayload) *NullableCreateLogsInstancePayload { + return &NullableCreateLogsInstancePayload{value: val, isSet: true} +} + +func (v NullableCreateLogsInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLogsInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsbeta/model_create_logs_instance_payload_test.go b/pkg/logsbeta/model_create_logs_instance_payload_test.go new file mode 100644 index 00000000..c3941b67 --- /dev/null +++ b/pkg/logsbeta/model_create_logs_instance_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta diff --git a/pkg/logsbeta/model_logs_instance.go b/pkg/logsbeta/model_logs_instance.go new file mode 100644 index 00000000..e75f1d14 --- /dev/null +++ b/pkg/logsbeta/model_logs_instance.go @@ -0,0 +1,755 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the LogsInstance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogsInstance{} + +/* + types and functions for acl +*/ + +// isArray +type LogsInstanceGetAclAttributeType = *[]string +type LogsInstanceGetAclArgType = []string +type LogsInstanceGetAclRetType = []string + +func getLogsInstanceGetAclAttributeTypeOk(arg LogsInstanceGetAclAttributeType) (ret LogsInstanceGetAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetAclAttributeType(arg *LogsInstanceGetAclAttributeType, val LogsInstanceGetAclRetType) { + *arg = &val +} + +/* + types and functions for created +*/ + +// isDateTime +type LogsInstanceGetCreatedAttributeType = *time.Time +type LogsInstanceGetCreatedArgType = time.Time +type LogsInstanceGetCreatedRetType = time.Time + +func getLogsInstanceGetCreatedAttributeTypeOk(arg LogsInstanceGetCreatedAttributeType) (ret LogsInstanceGetCreatedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetCreatedAttributeType(arg *LogsInstanceGetCreatedAttributeType, val LogsInstanceGetCreatedRetType) { + *arg = &val +} + +/* + types and functions for datasourceUrl +*/ + +// isNotNullableString +type LogsInstanceGetDatasourceUrlAttributeType = *string + +func getLogsInstanceGetDatasourceUrlAttributeTypeOk(arg LogsInstanceGetDatasourceUrlAttributeType) (ret LogsInstanceGetDatasourceUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetDatasourceUrlAttributeType(arg *LogsInstanceGetDatasourceUrlAttributeType, val LogsInstanceGetDatasourceUrlRetType) { + *arg = &val +} + +type LogsInstanceGetDatasourceUrlArgType = string +type LogsInstanceGetDatasourceUrlRetType = string + +/* + types and functions for description +*/ + +// isNotNullableString +type LogsInstanceGetDescriptionAttributeType = *string + +func getLogsInstanceGetDescriptionAttributeTypeOk(arg LogsInstanceGetDescriptionAttributeType) (ret LogsInstanceGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetDescriptionAttributeType(arg *LogsInstanceGetDescriptionAttributeType, val LogsInstanceGetDescriptionRetType) { + *arg = &val +} + +type LogsInstanceGetDescriptionArgType = string +type LogsInstanceGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type LogsInstanceGetDisplayNameAttributeType = *string + +func getLogsInstanceGetDisplayNameAttributeTypeOk(arg LogsInstanceGetDisplayNameAttributeType) (ret LogsInstanceGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetDisplayNameAttributeType(arg *LogsInstanceGetDisplayNameAttributeType, val LogsInstanceGetDisplayNameRetType) { + *arg = &val +} + +type LogsInstanceGetDisplayNameArgType = string +type LogsInstanceGetDisplayNameRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type LogsInstanceGetIdAttributeType = *string + +func getLogsInstanceGetIdAttributeTypeOk(arg LogsInstanceGetIdAttributeType) (ret LogsInstanceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetIdAttributeType(arg *LogsInstanceGetIdAttributeType, val LogsInstanceGetIdRetType) { + *arg = &val +} + +type LogsInstanceGetIdArgType = string +type LogsInstanceGetIdRetType = string + +/* + types and functions for ingestOtlpUrl +*/ + +// isNotNullableString +type LogsInstanceGetIngestOtlpUrlAttributeType = *string + +func getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(arg LogsInstanceGetIngestOtlpUrlAttributeType) (ret LogsInstanceGetIngestOtlpUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetIngestOtlpUrlAttributeType(arg *LogsInstanceGetIngestOtlpUrlAttributeType, val LogsInstanceGetIngestOtlpUrlRetType) { + *arg = &val +} + +type LogsInstanceGetIngestOtlpUrlArgType = string +type LogsInstanceGetIngestOtlpUrlRetType = string + +/* + types and functions for ingestUrl +*/ + +// isNotNullableString +type LogsInstanceGetIngestUrlAttributeType = *string + +func getLogsInstanceGetIngestUrlAttributeTypeOk(arg LogsInstanceGetIngestUrlAttributeType) (ret LogsInstanceGetIngestUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetIngestUrlAttributeType(arg *LogsInstanceGetIngestUrlAttributeType, val LogsInstanceGetIngestUrlRetType) { + *arg = &val +} + +type LogsInstanceGetIngestUrlArgType = string +type LogsInstanceGetIngestUrlRetType = string + +/* + types and functions for queryRangeUrl +*/ + +// isNotNullableString +type LogsInstanceGetQueryRangeUrlAttributeType = *string + +func getLogsInstanceGetQueryRangeUrlAttributeTypeOk(arg LogsInstanceGetQueryRangeUrlAttributeType) (ret LogsInstanceGetQueryRangeUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetQueryRangeUrlAttributeType(arg *LogsInstanceGetQueryRangeUrlAttributeType, val LogsInstanceGetQueryRangeUrlRetType) { + *arg = &val +} + +type LogsInstanceGetQueryRangeUrlArgType = string +type LogsInstanceGetQueryRangeUrlRetType = string + +/* + types and functions for queryUrl +*/ + +// isNotNullableString +type LogsInstanceGetQueryUrlAttributeType = *string + +func getLogsInstanceGetQueryUrlAttributeTypeOk(arg LogsInstanceGetQueryUrlAttributeType) (ret LogsInstanceGetQueryUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetQueryUrlAttributeType(arg *LogsInstanceGetQueryUrlAttributeType, val LogsInstanceGetQueryUrlRetType) { + *arg = &val +} + +type LogsInstanceGetQueryUrlArgType = string +type LogsInstanceGetQueryUrlRetType = string + +/* + types and functions for retentionDays +*/ + +// isInteger +type LogsInstanceGetRetentionDaysAttributeType = *int64 +type LogsInstanceGetRetentionDaysArgType = int64 +type LogsInstanceGetRetentionDaysRetType = int64 + +func getLogsInstanceGetRetentionDaysAttributeTypeOk(arg LogsInstanceGetRetentionDaysAttributeType) (ret LogsInstanceGetRetentionDaysRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetRetentionDaysAttributeType(arg *LogsInstanceGetRetentionDaysAttributeType, val LogsInstanceGetRetentionDaysRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isEnum + +// LogsInstanceStatus The current status of the Logs instance. +// value type for enums +type LogsInstanceStatus string + +// List of Status +const ( + LOGSINSTANCESTATUS_ACTIVE LogsInstanceStatus = "active" + LOGSINSTANCESTATUS_DELETING LogsInstanceStatus = "deleting" + LOGSINSTANCESTATUS_RECONCILING LogsInstanceStatus = "reconciling" +) + +// All allowed values of LogsInstance enum +var AllowedLogsInstanceStatusEnumValues = []LogsInstanceStatus{ + "active", + "deleting", + "reconciling", +} + +func (v *LogsInstanceStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson LogsInstanceStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := LogsInstanceStatus(value) + for _, existing := range AllowedLogsInstanceStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid LogsInstance", value) +} + +// NewLogsInstanceStatusFromValue returns a pointer to a valid LogsInstanceStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewLogsInstanceStatusFromValue(v LogsInstanceStatus) (*LogsInstanceStatus, error) { + ev := LogsInstanceStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for LogsInstanceStatus: valid values are %v", v, AllowedLogsInstanceStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v LogsInstanceStatus) IsValid() bool { + for _, existing := range AllowedLogsInstanceStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v LogsInstanceStatus) Ptr() *LogsInstanceStatus { + return &v +} + +type NullableLogsInstanceStatus struct { + value *LogsInstanceStatus + isSet bool +} + +func (v NullableLogsInstanceStatus) Get() *LogsInstanceStatus { + return v.value +} + +func (v *NullableLogsInstanceStatus) Set(val *LogsInstanceStatus) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstanceStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstanceStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstanceStatus(val *LogsInstanceStatus) *NullableLogsInstanceStatus { + return &NullableLogsInstanceStatus{value: val, isSet: true} +} + +func (v NullableLogsInstanceStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstanceStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type LogsInstanceGetStatusAttributeType = *LogsInstanceStatus +type LogsInstanceGetStatusArgType = LogsInstanceStatus +type LogsInstanceGetStatusRetType = LogsInstanceStatus + +func getLogsInstanceGetStatusAttributeTypeOk(arg LogsInstanceGetStatusAttributeType) (ret LogsInstanceGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstanceGetStatusAttributeType(arg *LogsInstanceGetStatusAttributeType, val LogsInstanceGetStatusRetType) { + *arg = &val +} + +// LogsInstance struct for LogsInstance +type LogsInstance struct { + // The access control list for the Logs instance. + Acl LogsInstanceGetAclAttributeType `json:"acl,omitempty"` + // The date and time the creation of the Logs instance was triggered. + // REQUIRED + Created LogsInstanceGetCreatedAttributeType `json:"created" required:"true"` + // The Logs instance's datasource URL, can be used in Grafana as a datasource URL + DatasourceUrl LogsInstanceGetDatasourceUrlAttributeType `json:"datasourceUrl,omitempty"` + // The description of the Logs instance. + Description LogsInstanceGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name of the Logs instance. + // REQUIRED + DisplayName LogsInstanceGetDisplayNameAttributeType `json:"displayName" required:"true"` + // A auto generated unique id which identifies the Logs instance. + // REQUIRED + Id LogsInstanceGetIdAttributeType `json:"id" required:"true"` + // The Logs instance's ingest logs via OTLP URL + IngestOtlpUrl LogsInstanceGetIngestOtlpUrlAttributeType `json:"ingestOtlpUrl,omitempty"` + // The Logs instance's ingest logs URL + IngestUrl LogsInstanceGetIngestUrlAttributeType `json:"ingestUrl,omitempty"` + // The Logs instance's query range URL + QueryRangeUrl LogsInstanceGetQueryRangeUrlAttributeType `json:"queryRangeUrl,omitempty"` + // The Logs instance's query URL + QueryUrl LogsInstanceGetQueryUrlAttributeType `json:"queryUrl,omitempty"` + // The log retention time in days. + // Can be cast to int32 without loss of precision. + // REQUIRED + RetentionDays LogsInstanceGetRetentionDaysAttributeType `json:"retentionDays" required:"true"` + // The current status of the Logs instance. + // REQUIRED + Status LogsInstanceGetStatusAttributeType `json:"status" required:"true"` +} + +type _LogsInstance LogsInstance + +// NewLogsInstance instantiates a new LogsInstance 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 NewLogsInstance(created LogsInstanceGetCreatedArgType, displayName LogsInstanceGetDisplayNameArgType, id LogsInstanceGetIdArgType, retentionDays LogsInstanceGetRetentionDaysArgType, status LogsInstanceGetStatusArgType) *LogsInstance { + this := LogsInstance{} + setLogsInstanceGetCreatedAttributeType(&this.Created, created) + setLogsInstanceGetDisplayNameAttributeType(&this.DisplayName, displayName) + setLogsInstanceGetIdAttributeType(&this.Id, id) + setLogsInstanceGetRetentionDaysAttributeType(&this.RetentionDays, retentionDays) + setLogsInstanceGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewLogsInstanceWithDefaults instantiates a new LogsInstance 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 NewLogsInstanceWithDefaults() *LogsInstance { + this := LogsInstance{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *LogsInstance) GetAcl() (res LogsInstanceGetAclRetType) { + res, _ = o.GetAclOk() + return +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetAclOk() (ret LogsInstanceGetAclRetType, ok bool) { + return getLogsInstanceGetAclAttributeTypeOk(o.Acl) +} + +// HasAcl returns a boolean if a field has been set. +func (o *LogsInstance) HasAcl() bool { + _, ok := o.GetAclOk() + return ok +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *LogsInstance) SetAcl(v LogsInstanceGetAclRetType) { + setLogsInstanceGetAclAttributeType(&o.Acl, v) +} + +// GetCreated returns the Created field value +func (o *LogsInstance) GetCreated() (ret LogsInstanceGetCreatedRetType) { + ret, _ = o.GetCreatedOk() + return ret +} + +// GetCreatedOk returns a tuple with the Created field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetCreatedOk() (ret LogsInstanceGetCreatedRetType, ok bool) { + return getLogsInstanceGetCreatedAttributeTypeOk(o.Created) +} + +// SetCreated sets field value +func (o *LogsInstance) SetCreated(v LogsInstanceGetCreatedRetType) { + setLogsInstanceGetCreatedAttributeType(&o.Created, v) +} + +// GetDatasourceUrl returns the DatasourceUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetDatasourceUrl() (res LogsInstanceGetDatasourceUrlRetType) { + res, _ = o.GetDatasourceUrlOk() + return +} + +// GetDatasourceUrlOk returns a tuple with the DatasourceUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDatasourceUrlOk() (ret LogsInstanceGetDatasourceUrlRetType, ok bool) { + return getLogsInstanceGetDatasourceUrlAttributeTypeOk(o.DatasourceUrl) +} + +// HasDatasourceUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasDatasourceUrl() bool { + _, ok := o.GetDatasourceUrlOk() + return ok +} + +// SetDatasourceUrl gets a reference to the given string and assigns it to the DatasourceUrl field. +func (o *LogsInstance) SetDatasourceUrl(v LogsInstanceGetDatasourceUrlRetType) { + setLogsInstanceGetDatasourceUrlAttributeType(&o.DatasourceUrl, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *LogsInstance) GetDescription() (res LogsInstanceGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDescriptionOk() (ret LogsInstanceGetDescriptionRetType, ok bool) { + return getLogsInstanceGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *LogsInstance) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *LogsInstance) SetDescription(v LogsInstanceGetDescriptionRetType) { + setLogsInstanceGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value +func (o *LogsInstance) GetDisplayName() (ret LogsInstanceGetDisplayNameRetType) { + ret, _ = o.GetDisplayNameOk() + return ret +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDisplayNameOk() (ret LogsInstanceGetDisplayNameRetType, ok bool) { + return getLogsInstanceGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// SetDisplayName sets field value +func (o *LogsInstance) SetDisplayName(v LogsInstanceGetDisplayNameRetType) { + setLogsInstanceGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetId returns the Id field value +func (o *LogsInstance) GetId() (ret LogsInstanceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIdOk() (ret LogsInstanceGetIdRetType, ok bool) { + return getLogsInstanceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *LogsInstance) SetId(v LogsInstanceGetIdRetType) { + setLogsInstanceGetIdAttributeType(&o.Id, v) +} + +// GetIngestOtlpUrl returns the IngestOtlpUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetIngestOtlpUrl() (res LogsInstanceGetIngestOtlpUrlRetType) { + res, _ = o.GetIngestOtlpUrlOk() + return +} + +// GetIngestOtlpUrlOk returns a tuple with the IngestOtlpUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIngestOtlpUrlOk() (ret LogsInstanceGetIngestOtlpUrlRetType, ok bool) { + return getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(o.IngestOtlpUrl) +} + +// HasIngestOtlpUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasIngestOtlpUrl() bool { + _, ok := o.GetIngestOtlpUrlOk() + return ok +} + +// SetIngestOtlpUrl gets a reference to the given string and assigns it to the IngestOtlpUrl field. +func (o *LogsInstance) SetIngestOtlpUrl(v LogsInstanceGetIngestOtlpUrlRetType) { + setLogsInstanceGetIngestOtlpUrlAttributeType(&o.IngestOtlpUrl, v) +} + +// GetIngestUrl returns the IngestUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetIngestUrl() (res LogsInstanceGetIngestUrlRetType) { + res, _ = o.GetIngestUrlOk() + return +} + +// GetIngestUrlOk returns a tuple with the IngestUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIngestUrlOk() (ret LogsInstanceGetIngestUrlRetType, ok bool) { + return getLogsInstanceGetIngestUrlAttributeTypeOk(o.IngestUrl) +} + +// HasIngestUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasIngestUrl() bool { + _, ok := o.GetIngestUrlOk() + return ok +} + +// SetIngestUrl gets a reference to the given string and assigns it to the IngestUrl field. +func (o *LogsInstance) SetIngestUrl(v LogsInstanceGetIngestUrlRetType) { + setLogsInstanceGetIngestUrlAttributeType(&o.IngestUrl, v) +} + +// GetQueryRangeUrl returns the QueryRangeUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetQueryRangeUrl() (res LogsInstanceGetQueryRangeUrlRetType) { + res, _ = o.GetQueryRangeUrlOk() + return +} + +// GetQueryRangeUrlOk returns a tuple with the QueryRangeUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetQueryRangeUrlOk() (ret LogsInstanceGetQueryRangeUrlRetType, ok bool) { + return getLogsInstanceGetQueryRangeUrlAttributeTypeOk(o.QueryRangeUrl) +} + +// HasQueryRangeUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasQueryRangeUrl() bool { + _, ok := o.GetQueryRangeUrlOk() + return ok +} + +// SetQueryRangeUrl gets a reference to the given string and assigns it to the QueryRangeUrl field. +func (o *LogsInstance) SetQueryRangeUrl(v LogsInstanceGetQueryRangeUrlRetType) { + setLogsInstanceGetQueryRangeUrlAttributeType(&o.QueryRangeUrl, v) +} + +// GetQueryUrl returns the QueryUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetQueryUrl() (res LogsInstanceGetQueryUrlRetType) { + res, _ = o.GetQueryUrlOk() + return +} + +// GetQueryUrlOk returns a tuple with the QueryUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetQueryUrlOk() (ret LogsInstanceGetQueryUrlRetType, ok bool) { + return getLogsInstanceGetQueryUrlAttributeTypeOk(o.QueryUrl) +} + +// HasQueryUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasQueryUrl() bool { + _, ok := o.GetQueryUrlOk() + return ok +} + +// SetQueryUrl gets a reference to the given string and assigns it to the QueryUrl field. +func (o *LogsInstance) SetQueryUrl(v LogsInstanceGetQueryUrlRetType) { + setLogsInstanceGetQueryUrlAttributeType(&o.QueryUrl, v) +} + +// GetRetentionDays returns the RetentionDays field value +func (o *LogsInstance) GetRetentionDays() (ret LogsInstanceGetRetentionDaysRetType) { + ret, _ = o.GetRetentionDaysOk() + return ret +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetRetentionDaysOk() (ret LogsInstanceGetRetentionDaysRetType, ok bool) { + return getLogsInstanceGetRetentionDaysAttributeTypeOk(o.RetentionDays) +} + +// SetRetentionDays sets field value +func (o *LogsInstance) SetRetentionDays(v LogsInstanceGetRetentionDaysRetType) { + setLogsInstanceGetRetentionDaysAttributeType(&o.RetentionDays, v) +} + +// GetStatus returns the Status field value +func (o *LogsInstance) GetStatus() (ret LogsInstanceGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetStatusOk() (ret LogsInstanceGetStatusRetType, ok bool) { + return getLogsInstanceGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *LogsInstance) SetStatus(v LogsInstanceGetStatusRetType) { + setLogsInstanceGetStatusAttributeType(&o.Status, v) +} + +func (o LogsInstance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLogsInstanceGetAclAttributeTypeOk(o.Acl); ok { + toSerialize["Acl"] = val + } + if val, ok := getLogsInstanceGetCreatedAttributeTypeOk(o.Created); ok { + toSerialize["Created"] = val + } + if val, ok := getLogsInstanceGetDatasourceUrlAttributeTypeOk(o.DatasourceUrl); ok { + toSerialize["DatasourceUrl"] = val + } + if val, ok := getLogsInstanceGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getLogsInstanceGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getLogsInstanceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(o.IngestOtlpUrl); ok { + toSerialize["IngestOtlpUrl"] = val + } + if val, ok := getLogsInstanceGetIngestUrlAttributeTypeOk(o.IngestUrl); ok { + toSerialize["IngestUrl"] = val + } + if val, ok := getLogsInstanceGetQueryRangeUrlAttributeTypeOk(o.QueryRangeUrl); ok { + toSerialize["QueryRangeUrl"] = val + } + if val, ok := getLogsInstanceGetQueryUrlAttributeTypeOk(o.QueryUrl); ok { + toSerialize["QueryUrl"] = val + } + if val, ok := getLogsInstanceGetRetentionDaysAttributeTypeOk(o.RetentionDays); ok { + toSerialize["RetentionDays"] = val + } + if val, ok := getLogsInstanceGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableLogsInstance struct { + value *LogsInstance + isSet bool +} + +func (v NullableLogsInstance) Get() *LogsInstance { + return v.value +} + +func (v *NullableLogsInstance) Set(val *LogsInstance) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstance(val *LogsInstance) *NullableLogsInstance { + return &NullableLogsInstance{value: val, isSet: true} +} + +func (v NullableLogsInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsbeta/model_logs_instance_test.go b/pkg/logsbeta/model_logs_instance_test.go new file mode 100644 index 00000000..c0eda86c --- /dev/null +++ b/pkg/logsbeta/model_logs_instance_test.go @@ -0,0 +1,65 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "testing" +) + +// isEnum + +func TestLogsInstanceStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"active"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"deleting"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"reconciling"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := LogsInstanceStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/logsbeta/model_logs_instances_list.go b/pkg/logsbeta/model_logs_instances_list.go new file mode 100644 index 00000000..f499a47d --- /dev/null +++ b/pkg/logsbeta/model_logs_instances_list.go @@ -0,0 +1,125 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "encoding/json" +) + +// checks if the LogsInstancesList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogsInstancesList{} + +/* + types and functions for instances +*/ + +// isArray +type LogsInstancesListGetInstancesAttributeType = *[]LogsInstance +type LogsInstancesListGetInstancesArgType = []LogsInstance +type LogsInstancesListGetInstancesRetType = []LogsInstance + +func getLogsInstancesListGetInstancesAttributeTypeOk(arg LogsInstancesListGetInstancesAttributeType) (ret LogsInstancesListGetInstancesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setLogsInstancesListGetInstancesAttributeType(arg *LogsInstancesListGetInstancesAttributeType, val LogsInstancesListGetInstancesRetType) { + *arg = &val +} + +// LogsInstancesList struct for LogsInstancesList +type LogsInstancesList struct { + // REQUIRED + Instances LogsInstancesListGetInstancesAttributeType `json:"instances" required:"true"` +} + +type _LogsInstancesList LogsInstancesList + +// NewLogsInstancesList instantiates a new LogsInstancesList 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 NewLogsInstancesList(instances LogsInstancesListGetInstancesArgType) *LogsInstancesList { + this := LogsInstancesList{} + setLogsInstancesListGetInstancesAttributeType(&this.Instances, instances) + return &this +} + +// NewLogsInstancesListWithDefaults instantiates a new LogsInstancesList 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 NewLogsInstancesListWithDefaults() *LogsInstancesList { + this := LogsInstancesList{} + return &this +} + +// GetInstances returns the Instances field value +func (o *LogsInstancesList) GetInstances() (ret LogsInstancesListGetInstancesRetType) { + ret, _ = o.GetInstancesOk() + return ret +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *LogsInstancesList) GetInstancesOk() (ret LogsInstancesListGetInstancesRetType, ok bool) { + return getLogsInstancesListGetInstancesAttributeTypeOk(o.Instances) +} + +// SetInstances sets field value +func (o *LogsInstancesList) SetInstances(v LogsInstancesListGetInstancesRetType) { + setLogsInstancesListGetInstancesAttributeType(&o.Instances, v) +} + +func (o LogsInstancesList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getLogsInstancesListGetInstancesAttributeTypeOk(o.Instances); ok { + toSerialize["Instances"] = val + } + return toSerialize, nil +} + +type NullableLogsInstancesList struct { + value *LogsInstancesList + isSet bool +} + +func (v NullableLogsInstancesList) Get() *LogsInstancesList { + return v.value +} + +func (v *NullableLogsInstancesList) Set(val *LogsInstancesList) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstancesList) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstancesList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstancesList(val *LogsInstancesList) *NullableLogsInstancesList { + return &NullableLogsInstancesList{value: val, isSet: true} +} + +func (v NullableLogsInstancesList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstancesList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsbeta/model_logs_instances_list_test.go b/pkg/logsbeta/model_logs_instances_list_test.go new file mode 100644 index 00000000..c3941b67 --- /dev/null +++ b/pkg/logsbeta/model_logs_instances_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta diff --git a/pkg/logsbeta/model_update_access_token_payload.go b/pkg/logsbeta/model_update_access_token_payload.go new file mode 100644 index 00000000..ace17149 --- /dev/null +++ b/pkg/logsbeta/model_update_access_token_payload.go @@ -0,0 +1,178 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "encoding/json" +) + +// checks if the UpdateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAccessTokenPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateAccessTokenPayloadGetDescriptionAttributeType = *string + +func getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(arg UpdateAccessTokenPayloadGetDescriptionAttributeType) (ret UpdateAccessTokenPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAccessTokenPayloadGetDescriptionAttributeType(arg *UpdateAccessTokenPayloadGetDescriptionAttributeType, val UpdateAccessTokenPayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateAccessTokenPayloadGetDescriptionArgType = string +type UpdateAccessTokenPayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type UpdateAccessTokenPayloadGetDisplayNameAttributeType = *string + +func getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(arg UpdateAccessTokenPayloadGetDisplayNameAttributeType) (ret UpdateAccessTokenPayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAccessTokenPayloadGetDisplayNameAttributeType(arg *UpdateAccessTokenPayloadGetDisplayNameAttributeType, val UpdateAccessTokenPayloadGetDisplayNameRetType) { + *arg = &val +} + +type UpdateAccessTokenPayloadGetDisplayNameArgType = string +type UpdateAccessTokenPayloadGetDisplayNameRetType = string + +// UpdateAccessTokenPayload struct for UpdateAccessTokenPayload +type UpdateAccessTokenPayload struct { + // The description of the access token. + Description UpdateAccessTokenPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName UpdateAccessTokenPayloadGetDisplayNameAttributeType `json:"displayName,omitempty"` +} + +// NewUpdateAccessTokenPayload instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayload() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// NewUpdateAccessTokenPayloadWithDefaults instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayloadWithDefaults() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateAccessTokenPayload) GetDescription() (res UpdateAccessTokenPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenPayload) GetDescriptionOk() (ret UpdateAccessTokenPayloadGetDescriptionRetType, ok bool) { + return getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateAccessTokenPayload) SetDescription(v UpdateAccessTokenPayloadGetDescriptionRetType) { + setUpdateAccessTokenPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateAccessTokenPayload) GetDisplayName() (res UpdateAccessTokenPayloadGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenPayload) GetDisplayNameOk() (ret UpdateAccessTokenPayloadGetDisplayNameRetType, ok bool) { + return getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateAccessTokenPayload) SetDisplayName(v UpdateAccessTokenPayloadGetDisplayNameRetType) { + setUpdateAccessTokenPayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +func (o UpdateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + return toSerialize, nil +} + +type NullableUpdateAccessTokenPayload struct { + value *UpdateAccessTokenPayload + isSet bool +} + +func (v NullableUpdateAccessTokenPayload) Get() *UpdateAccessTokenPayload { + return v.value +} + +func (v *NullableUpdateAccessTokenPayload) Set(val *UpdateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAccessTokenPayload(val *UpdateAccessTokenPayload) *NullableUpdateAccessTokenPayload { + return &NullableUpdateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableUpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsbeta/model_update_access_token_payload_test.go b/pkg/logsbeta/model_update_access_token_payload_test.go new file mode 100644 index 00000000..c3941b67 --- /dev/null +++ b/pkg/logsbeta/model_update_access_token_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta diff --git a/pkg/logsbeta/model_update_logs_instance_payload.go b/pkg/logsbeta/model_update_logs_instance_payload.go new file mode 100644 index 00000000..f7c4800d --- /dev/null +++ b/pkg/logsbeta/model_update_logs_instance_payload.go @@ -0,0 +1,275 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "encoding/json" +) + +// checks if the UpdateLogsInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLogsInstancePayload{} + +/* + types and functions for acl +*/ + +// isArray +type UpdateLogsInstancePayloadGetAclAttributeType = *[]string +type UpdateLogsInstancePayloadGetAclArgType = []string +type UpdateLogsInstancePayloadGetAclRetType = []string + +func getUpdateLogsInstancePayloadGetAclAttributeTypeOk(arg UpdateLogsInstancePayloadGetAclAttributeType) (ret UpdateLogsInstancePayloadGetAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLogsInstancePayloadGetAclAttributeType(arg *UpdateLogsInstancePayloadGetAclAttributeType, val UpdateLogsInstancePayloadGetAclRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateLogsInstancePayloadGetDescriptionAttributeType = *string + +func getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(arg UpdateLogsInstancePayloadGetDescriptionAttributeType) (ret UpdateLogsInstancePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLogsInstancePayloadGetDescriptionAttributeType(arg *UpdateLogsInstancePayloadGetDescriptionAttributeType, val UpdateLogsInstancePayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateLogsInstancePayloadGetDescriptionArgType = string +type UpdateLogsInstancePayloadGetDescriptionRetType = string + +/* + types and functions for displayName +*/ + +// isNotNullableString +type UpdateLogsInstancePayloadGetDisplayNameAttributeType = *string + +func getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(arg UpdateLogsInstancePayloadGetDisplayNameAttributeType) (ret UpdateLogsInstancePayloadGetDisplayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLogsInstancePayloadGetDisplayNameAttributeType(arg *UpdateLogsInstancePayloadGetDisplayNameAttributeType, val UpdateLogsInstancePayloadGetDisplayNameRetType) { + *arg = &val +} + +type UpdateLogsInstancePayloadGetDisplayNameArgType = string +type UpdateLogsInstancePayloadGetDisplayNameRetType = string + +/* + types and functions for retentionDays +*/ + +// isInteger +type UpdateLogsInstancePayloadGetRetentionDaysAttributeType = *int64 +type UpdateLogsInstancePayloadGetRetentionDaysArgType = int64 +type UpdateLogsInstancePayloadGetRetentionDaysRetType = int64 + +func getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(arg UpdateLogsInstancePayloadGetRetentionDaysAttributeType) (ret UpdateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateLogsInstancePayloadGetRetentionDaysAttributeType(arg *UpdateLogsInstancePayloadGetRetentionDaysAttributeType, val UpdateLogsInstancePayloadGetRetentionDaysRetType) { + *arg = &val +} + +// UpdateLogsInstancePayload struct for UpdateLogsInstancePayload +type UpdateLogsInstancePayload struct { + // The access control list for the Logs instance. + Acl UpdateLogsInstancePayloadGetAclAttributeType `json:"acl,omitempty"` + // The description of the Logs instance. + Description UpdateLogsInstancePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The displayed name to distinguish multiple Logs instances. + DisplayName UpdateLogsInstancePayloadGetDisplayNameAttributeType `json:"displayName,omitempty"` + // The log retention time in days. + // Can be cast to int32 without loss of precision. + RetentionDays UpdateLogsInstancePayloadGetRetentionDaysAttributeType `json:"retentionDays,omitempty"` +} + +// NewUpdateLogsInstancePayload instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayload() *UpdateLogsInstancePayload { + this := UpdateLogsInstancePayload{} + return &this +} + +// NewUpdateLogsInstancePayloadWithDefaults instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayloadWithDefaults() *UpdateLogsInstancePayload { + this := UpdateLogsInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetAcl() (res UpdateLogsInstancePayloadGetAclRetType) { + res, _ = o.GetAclOk() + return +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetAclOk() (ret UpdateLogsInstancePayloadGetAclRetType, ok bool) { + return getUpdateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl) +} + +// HasAcl returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasAcl() bool { + _, ok := o.GetAclOk() + return ok +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *UpdateLogsInstancePayload) SetAcl(v UpdateLogsInstancePayloadGetAclRetType) { + setUpdateLogsInstancePayloadGetAclAttributeType(&o.Acl, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetDescription() (res UpdateLogsInstancePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetDescriptionOk() (ret UpdateLogsInstancePayloadGetDescriptionRetType, ok bool) { + return getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateLogsInstancePayload) SetDescription(v UpdateLogsInstancePayloadGetDescriptionRetType) { + setUpdateLogsInstancePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetDisplayName() (res UpdateLogsInstancePayloadGetDisplayNameRetType) { + res, _ = o.GetDisplayNameOk() + return +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetDisplayNameOk() (ret UpdateLogsInstancePayloadGetDisplayNameRetType, ok bool) { + return getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName) +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasDisplayName() bool { + _, ok := o.GetDisplayNameOk() + return ok +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateLogsInstancePayload) SetDisplayName(v UpdateLogsInstancePayloadGetDisplayNameRetType) { + setUpdateLogsInstancePayloadGetDisplayNameAttributeType(&o.DisplayName, v) +} + +// GetRetentionDays returns the RetentionDays field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetRetentionDays() (res UpdateLogsInstancePayloadGetRetentionDaysRetType) { + res, _ = o.GetRetentionDaysOk() + return +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetRetentionDaysOk() (ret UpdateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { + return getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays) +} + +// HasRetentionDays returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasRetentionDays() bool { + _, ok := o.GetRetentionDaysOk() + return ok +} + +// SetRetentionDays gets a reference to the given int64 and assigns it to the RetentionDays field. +func (o *UpdateLogsInstancePayload) SetRetentionDays(v UpdateLogsInstancePayloadGetRetentionDaysRetType) { + setUpdateLogsInstancePayloadGetRetentionDaysAttributeType(&o.RetentionDays, v) +} + +func (o UpdateLogsInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl); ok { + toSerialize["Acl"] = val + } + if val, ok := getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok { + toSerialize["DisplayName"] = val + } + if val, ok := getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays); ok { + toSerialize["RetentionDays"] = val + } + return toSerialize, nil +} + +type NullableUpdateLogsInstancePayload struct { + value *UpdateLogsInstancePayload + isSet bool +} + +func (v NullableUpdateLogsInstancePayload) Get() *UpdateLogsInstancePayload { + return v.value +} + +func (v *NullableUpdateLogsInstancePayload) Set(val *UpdateLogsInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateLogsInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateLogsInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateLogsInstancePayload(val *UpdateLogsInstancePayload) *NullableUpdateLogsInstancePayload { + return &NullableUpdateLogsInstancePayload{value: val, isSet: true} +} + +func (v NullableUpdateLogsInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateLogsInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/logsbeta/model_update_logs_instance_payload_test.go b/pkg/logsbeta/model_update_logs_instance_payload_test.go new file mode 100644 index 00000000..c3941b67 --- /dev/null +++ b/pkg/logsbeta/model_update_logs_instance_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta diff --git a/pkg/logsbeta/utils.go b/pkg/logsbeta/utils.go new file mode 100644 index 00000000..5a49edbc --- /dev/null +++ b/pkg/logsbeta/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package logsbeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/postgresflexalpha/api_default_test.go b/pkg/postgresflexalpha/api_default_test.go index 6568b7b7..81f31fc1 100644 --- a/pkg/postgresflexalpha/api_default_test.go +++ b/pkg/postgresflexalpha/api_default_test.go @@ -23,2241 +23,1549 @@ import ( func Test_postgresflexalpha_DefaultApiService(t *testing.T) { - t.Run( - "Test DefaultApiService CreateDatabaseRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService CreateDatabaseRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := CreateDatabaseResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateDatabaseResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - createDatabaseRequestPayload := CreateDatabaseRequestPayload{} + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + createDatabaseRequestPayload := CreateDatabaseRequestPayload{} - resp, reqErr := apiClient.CreateDatabaseRequest( - context.Background(), - projectId, - region, - instanceId, - ).CreateDatabaseRequestPayload(createDatabaseRequestPayload).Execute() + resp, reqErr := apiClient.CreateDatabaseRequest(context.Background(), projectId, region, instanceId).CreateDatabaseRequestPayload(createDatabaseRequestPayload).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService CreateInstanceRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) + t.Run("Test DefaultApiService CreateInstanceRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := CreateInstanceResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateInstanceResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - createInstanceRequestPayload := CreateInstanceRequestPayload{} + projectId := projectIdValue + region := regionValue + createInstanceRequestPayload := CreateInstanceRequestPayload{} - resp, reqErr := apiClient.CreateInstanceRequest( - context.Background(), - projectId, - region, - ).CreateInstanceRequestPayload(createInstanceRequestPayload).Execute() + resp, reqErr := apiClient.CreateInstanceRequest(context.Background(), projectId, region).CreateInstanceRequestPayload(createInstanceRequestPayload).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService CreateUserRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService CreateUserRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := CreateUserResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateUserResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - createUserRequestPayload := CreateUserRequestPayload{} + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + createUserRequestPayload := CreateUserRequestPayload{} - resp, reqErr := apiClient.CreateUserRequest( - context.Background(), - projectId, - region, - instanceId, - ).CreateUserRequestPayload(createUserRequestPayload).Execute() + resp, reqErr := apiClient.CreateUserRequest(context.Background(), projectId, region, instanceId).CreateUserRequestPayload(createUserRequestPayload).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService DeleteDatabaseRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) - databaseIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"databaseId"+"}", - url.PathEscape(ParameterValueToString(databaseIdValue, "databaseId")), - ) + t.Run("Test DefaultApiService DeleteDatabaseRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + databaseIdValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseId"+"}", url.PathEscape(ParameterValueToString(databaseIdValue, "databaseId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - databaseId := databaseIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + databaseId := databaseIdValue - reqErr := apiClient.DeleteDatabaseRequest( - context.Background(), - projectId, - region, - instanceId, - databaseId, - ).Execute() + reqErr := apiClient.DeleteDatabaseRequest(context.Background(), projectId, region, instanceId, databaseId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) - t.Run( - "Test DefaultApiService DeleteInstanceRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService DeleteInstanceRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue - reqErr := apiClient.DeleteInstanceRequest(context.Background(), projectId, region, instanceId).Execute() + reqErr := apiClient.DeleteInstanceRequest(context.Background(), projectId, region, instanceId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) - t.Run( - "Test DefaultApiService DeleteUserRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) - userIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"userId"+"}", - url.PathEscape(ParameterValueToString(userIdValue, "userId")), - ) + t.Run("Test DefaultApiService DeleteUserRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + userIdValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - userId := userIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + userId := userIdValue - reqErr := apiClient.DeleteUserRequest(context.Background(), projectId, region, instanceId, userId).Execute() + reqErr := apiClient.DeleteUserRequest(context.Background(), projectId, region, instanceId, userId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) - t.Run( - "Test DefaultApiService GetBackupRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/{backupId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) - backupIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"backupId"+"}", - url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), - ) + t.Run("Test DefaultApiService GetBackupRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/{backupId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + backupIdValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetBackupResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetBackupResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - backupId := backupIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + backupId := backupIdValue - resp, reqErr := apiClient.GetBackupRequest( - context.Background(), - projectId, - region, - instanceId, - backupId, - ).Execute() + resp, reqErr := apiClient.GetBackupRequest(context.Background(), projectId, region, instanceId, backupId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService GetCollationsRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/collations" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService GetCollationsRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/collations" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetCollationsResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetCollationsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue - resp, reqErr := apiClient.GetCollationsRequest( - context.Background(), - projectId, - region, - instanceId, - ).Execute() + resp, reqErr := apiClient.GetCollationsRequest(context.Background(), projectId, region, instanceId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService GetFlavorsRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/flavors" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) + t.Run("Test DefaultApiService GetFlavorsRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/flavors" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetFlavorsResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetFlavorsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue + projectId := projectIdValue + region := regionValue - resp, reqErr := apiClient.GetFlavorsRequest(context.Background(), projectId, region).Execute() + resp, reqErr := apiClient.GetFlavorsRequest(context.Background(), projectId, region).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService GetInstanceRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService GetInstanceRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetInstanceResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetInstanceResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue - resp, reqErr := apiClient.GetInstanceRequest(context.Background(), projectId, region, instanceId).Execute() + resp, reqErr := apiClient.GetInstanceRequest(context.Background(), projectId, region, instanceId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService GetUserRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) - userIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"userId"+"}", - url.PathEscape(ParameterValueToString(userIdValue, "userId")), - ) + t.Run("Test DefaultApiService GetUserRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + userIdValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetUserResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetUserResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - userId := userIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + userId := userIdValue - resp, reqErr := apiClient.GetUserRequest( - context.Background(), - projectId, - region, - instanceId, - userId, - ).Execute() + resp, reqErr := apiClient.GetUserRequest(context.Background(), projectId, region, instanceId, userId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService GetVersionsRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/versions" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) + t.Run("Test DefaultApiService GetVersionsRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/versions" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetVersionsResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetVersionsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue + projectId := projectIdValue + region := regionValue - resp, reqErr := apiClient.GetVersionsRequest(context.Background(), projectId, region).Execute() + resp, reqErr := apiClient.GetVersionsRequest(context.Background(), projectId, region).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService ListBackupsRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService ListBackupsRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListBackupResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListBackupResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue - resp, reqErr := apiClient.ListBackupsRequest(context.Background(), projectId, region, instanceId).Execute() + resp, reqErr := apiClient.ListBackupsRequest(context.Background(), projectId, region, instanceId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService ListDatabasesRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService ListDatabasesRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListDatabasesResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListDatabasesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue - resp, reqErr := apiClient.ListDatabasesRequest( - context.Background(), - projectId, - region, - instanceId, - ).Execute() + resp, reqErr := apiClient.ListDatabasesRequest(context.Background(), projectId, region, instanceId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService ListInstancesRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) + t.Run("Test DefaultApiService ListInstancesRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListInstancesResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListInstancesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue + projectId := projectIdValue + region := regionValue - resp, reqErr := apiClient.ListInstancesRequest(context.Background(), projectId, region).Execute() + resp, reqErr := apiClient.ListInstancesRequest(context.Background(), projectId, region).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService ListRolesRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/roles" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService ListRolesRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/roles" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListRolesResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListRolesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue - resp, reqErr := apiClient.ListRolesRequest(context.Background(), projectId, region, instanceId).Execute() + resp, reqErr := apiClient.ListRolesRequest(context.Background(), projectId, region, instanceId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService ListUsersRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService ListUsersRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListUserResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListUserResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue - resp, reqErr := apiClient.ListUsersRequest(context.Background(), projectId, region, instanceId).Execute() + resp, reqErr := apiClient.ListUsersRequest(context.Background(), projectId, region, instanceId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService PointInTimeRecoveryRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/recoveries" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService PointInTimeRecoveryRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/recoveries" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := RecoveryResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := RecoveryResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue - resp, reqErr := apiClient.PointInTimeRecoveryRequest( - context.Background(), - projectId, - region, - instanceId, - ).Execute() + resp, reqErr := apiClient.PointInTimeRecoveryRequest(context.Background(), projectId, region, instanceId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService ProtectInstanceRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/protections" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService ProtectInstanceRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/protections" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ProtectInstanceResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ProtectInstanceResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - protectInstanceRequestPayload := ProtectInstanceRequestPayload{} + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + protectInstanceRequestPayload := ProtectInstanceRequestPayload{} - resp, reqErr := apiClient.ProtectInstanceRequest( - context.Background(), - projectId, - region, - instanceId, - ).ProtectInstanceRequestPayload(protectInstanceRequestPayload).Execute() + resp, reqErr := apiClient.ProtectInstanceRequest(context.Background(), projectId, region, instanceId).ProtectInstanceRequestPayload(protectInstanceRequestPayload).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService ResetUserRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}/reset" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) - userIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"userId"+"}", - url.PathEscape(ParameterValueToString(userIdValue, "userId")), - ) + t.Run("Test DefaultApiService ResetUserRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}/reset" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + userIdValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ResetUserResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ResetUserResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - userId := userIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + userId := userIdValue - resp, reqErr := apiClient.ResetUserRequest( - context.Background(), - projectId, - region, - instanceId, - userId, - ).Execute() + resp, reqErr := apiClient.ResetUserRequest(context.Background(), projectId, region, instanceId, userId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService RestoreInstanceRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/{backupId}/restores" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) - backupIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"backupId"+"}", - url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), - ) + t.Run("Test DefaultApiService RestoreInstanceRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/{backupId}/restores" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + backupIdValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - backupId := backupIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + backupId := backupIdValue - reqErr := apiClient.RestoreInstanceRequest( - context.Background(), - projectId, - region, - instanceId, - backupId, - ).Execute() + reqErr := apiClient.RestoreInstanceRequest(context.Background(), projectId, region, instanceId, backupId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) - t.Run( - "Test DefaultApiService UpdateDatabasePartiallyRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) - databaseIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"databaseId"+"}", - url.PathEscape(ParameterValueToString(databaseIdValue, "databaseId")), - ) + t.Run("Test DefaultApiService UpdateDatabasePartiallyRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + databaseIdValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseId"+"}", url.PathEscape(ParameterValueToString(databaseIdValue, "databaseId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := UpdateDatabasePartiallyResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := UpdateDatabasePartiallyResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - databaseId := databaseIdValue - updateDatabasePartiallyRequestPayload := UpdateDatabasePartiallyRequestPayload{} + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + databaseId := databaseIdValue + updateDatabasePartiallyRequestPayload := UpdateDatabasePartiallyRequestPayload{} - resp, reqErr := apiClient.UpdateDatabasePartiallyRequest( - context.Background(), - projectId, - region, - instanceId, - databaseId, - ).UpdateDatabasePartiallyRequestPayload(updateDatabasePartiallyRequestPayload).Execute() + resp, reqErr := apiClient.UpdateDatabasePartiallyRequest(context.Background(), projectId, region, instanceId, databaseId).UpdateDatabasePartiallyRequestPayload(updateDatabasePartiallyRequestPayload).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService UpdateDatabaseRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) - databaseIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"databaseId"+"}", - url.PathEscape(ParameterValueToString(databaseIdValue, "databaseId")), - ) + t.Run("Test DefaultApiService UpdateDatabaseRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + databaseIdValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseId"+"}", url.PathEscape(ParameterValueToString(databaseIdValue, "databaseId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := UpdateDatabaseResponse{} - w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := UpdateDatabaseResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - databaseId := databaseIdValue - updateDatabaseRequestPayload := UpdateDatabaseRequestPayload{} + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + databaseId := databaseIdValue + updateDatabaseRequestPayload := UpdateDatabaseRequestPayload{} - resp, reqErr := apiClient.UpdateDatabaseRequest( - context.Background(), - projectId, - region, - instanceId, - databaseId, - ).UpdateDatabaseRequestPayload(updateDatabaseRequestPayload).Execute() + resp, reqErr := apiClient.UpdateDatabaseRequest(context.Background(), projectId, region, instanceId, databaseId).UpdateDatabaseRequestPayload(updateDatabaseRequestPayload).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - if IsNil(resp) { - t.Fatalf("response not present") - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) - t.Run( - "Test DefaultApiService UpdateInstancePartiallyRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService UpdateInstancePartiallyRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - updateInstancePartiallyRequestPayload := UpdateInstancePartiallyRequestPayload{} + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + updateInstancePartiallyRequestPayload := UpdateInstancePartiallyRequestPayload{} - reqErr := apiClient.UpdateInstancePartiallyRequest( - context.Background(), - projectId, - region, - instanceId, - ).UpdateInstancePartiallyRequestPayload(updateInstancePartiallyRequestPayload).Execute() + reqErr := apiClient.UpdateInstancePartiallyRequest(context.Background(), projectId, region, instanceId).UpdateInstancePartiallyRequestPayload(updateInstancePartiallyRequestPayload).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) - t.Run( - "Test DefaultApiService UpdateInstanceRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) + t.Run("Test DefaultApiService UpdateInstanceRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - updateInstanceRequestPayload := UpdateInstanceRequestPayload{} + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + updateInstanceRequestPayload := UpdateInstanceRequestPayload{} - reqErr := apiClient.UpdateInstanceRequest( - context.Background(), - projectId, - region, - instanceId, - ).UpdateInstanceRequestPayload(updateInstanceRequestPayload).Execute() + reqErr := apiClient.UpdateInstanceRequest(context.Background(), projectId, region, instanceId).UpdateInstanceRequestPayload(updateInstanceRequestPayload).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) - t.Run( - "Test DefaultApiService UpdateUserPartiallyRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) - userIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"userId"+"}", - url.PathEscape(ParameterValueToString(userIdValue, "userId")), - ) + t.Run("Test DefaultApiService UpdateUserPartiallyRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + userIdValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - userId := userIdValue + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + userId := userIdValue - reqErr := apiClient.UpdateUserPartiallyRequest( - context.Background(), - projectId, - region, - instanceId, - userId, - ).Execute() + reqErr := apiClient.UpdateUserPartiallyRequest(context.Background(), projectId, region, instanceId, userId).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) - t.Run( - "Test DefaultApiService UpdateUserRequest", func(t *testing.T) { - _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" - projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"projectId"+"}", - url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), - ) - regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"region"+"}", - url.PathEscape(ParameterValueToString(regionValue, "region")), - ) - instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"instanceId"+"}", - url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), - ) - userIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll( - _apiUrlPath, - "{"+"userId"+"}", - url.PathEscape(ParameterValueToString(userIdValue, "userId")), - ) + t.Run("Test DefaultApiService UpdateUserRequest", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + userIdValue := int64(123) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) - testDefaultApiServeMux := http.NewServeMux() - testDefaultApiServeMux.HandleFunc( - _apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - }, - ) - testServer := httptest.NewServer(testDefaultApiServeMux) - defer testServer.Close() + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() - configuration := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "OpenAPI-Generator/1.0.0/go", - Debug: false, - Region: "test_region", - Servers: config.ServerConfigurations{ - { - URL: testServer.URL, - Description: "Localhost for postgresflexalpha_DefaultApi", - Variables: map[string]config.ServerVariable{ - "region": { - DefaultValue: "test_region.", - EnumValues: []string{ - "test_region.", - }, + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for postgresflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", }, }, }, }, - OperationServers: map[string]config.ServerConfigurations{}, - } - apiClient, err := NewAPIClient( - config.WithCustomConfiguration(configuration), - config.WithoutAuthentication(), - ) - if err != nil { - t.Fatalf("creating API client: %v", err) - } + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } - projectId := projectIdValue - region := regionValue - instanceId := instanceIdValue - userId := userIdValue - updateUserRequestPayload := UpdateUserRequestPayload{} + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + userId := userIdValue + updateUserRequestPayload := UpdateUserRequestPayload{} - reqErr := apiClient.UpdateUserRequest( - context.Background(), - projectId, - region, - instanceId, - userId, - ).UpdateUserRequestPayload(updateUserRequestPayload).Execute() + reqErr := apiClient.UpdateUserRequest(context.Background(), projectId, region, instanceId, userId).UpdateUserRequestPayload(updateUserRequestPayload).Execute() - if reqErr != nil { - t.Fatalf("error in call: %v", reqErr) - } - }, - ) + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) } diff --git a/pkg/postgresflexalpha/client.go b/pkg/postgresflexalpha/client.go index f5ab16f9..d2c38194 100644 --- a/pkg/postgresflexalpha/client.go +++ b/pkg/postgresflexalpha/client.go @@ -501,10 +501,7 @@ func addFile(w *multipart.Writer, fieldName, path string) error { if err != nil { return err } - err = file.Close() - if err != nil { - return err - } + defer file.Close() part, err := w.CreateFormFile(fieldName, filepath.Base(path)) if err != nil { diff --git a/pkg/postgresflexalpha/model_create_instance_request_payload.go b/pkg/postgresflexalpha/model_create_instance_request_payload.go index 8f1f668e..96d88b0c 100644 --- a/pkg/postgresflexalpha/model_create_instance_request_payload.go +++ b/pkg/postgresflexalpha/model_create_instance_request_payload.go @@ -17,26 +17,6 @@ import ( // checks if the CreateInstanceRequestPayload type satisfies the MappedNullable interface at compile time var _ MappedNullable = &CreateInstanceRequestPayload{} -/* - types and functions for acl -*/ - -// isArray -type CreateInstanceRequestPayloadGetAclAttributeType = *[]string -type CreateInstanceRequestPayloadGetAclArgType = []string -type CreateInstanceRequestPayloadGetAclRetType = []string - -func getCreateInstanceRequestPayloadGetAclAttributeTypeOk(arg CreateInstanceRequestPayloadGetAclAttributeType) (ret CreateInstanceRequestPayloadGetAclRetType, ok bool) { - if arg == nil { - return ret, false - } - return *arg, true -} - -func setCreateInstanceRequestPayloadGetAclAttributeType(arg *CreateInstanceRequestPayloadGetAclAttributeType, val CreateInstanceRequestPayloadGetAclRetType) { - *arg = &val -} - /* types and functions for backupSchedule */ @@ -223,7 +203,6 @@ type CreateInstanceRequestPayloadGetVersionRetType = string // CreateInstanceRequestPayload struct for CreateInstanceRequestPayload type CreateInstanceRequestPayload struct { - Acl CreateInstanceRequestPayloadGetAclAttributeType `json:"acl" required:"true"` // The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule. // REQUIRED BackupSchedule CreateInstanceRequestPayloadGetBackupScheduleAttributeType `json:"backupSchedule" required:"true"` diff --git a/pkg/postgresflexalpha/model_get_instance_response.go b/pkg/postgresflexalpha/model_get_instance_response.go index 066ef5fe..100d415d 100644 --- a/pkg/postgresflexalpha/model_get_instance_response.go +++ b/pkg/postgresflexalpha/model_get_instance_response.go @@ -38,6 +38,46 @@ func setGetInstanceResponseGetBackupScheduleAttributeType(arg *GetInstanceRespon type GetInstanceResponseGetBackupScheduleArgType = string type GetInstanceResponseGetBackupScheduleRetType = string +/* + types and functions for connectionInfo +*/ + +// isModel +type GetInstanceResponseGetConnectionInfoAttributeType = *InstanceConnectionInfo +type GetInstanceResponseGetConnectionInfoArgType = InstanceConnectionInfo +type GetInstanceResponseGetConnectionInfoRetType = InstanceConnectionInfo + +func getGetInstanceResponseGetConnectionInfoAttributeTypeOk(arg GetInstanceResponseGetConnectionInfoAttributeType) (ret GetInstanceResponseGetConnectionInfoRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetInstanceResponseGetConnectionInfoAttributeType(arg *GetInstanceResponseGetConnectionInfoAttributeType, val GetInstanceResponseGetConnectionInfoRetType) { + *arg = &val +} + +/* + types and functions for encryption +*/ + +// isModel +type GetInstanceResponseGetEncryptionAttributeType = *InstanceEncryption +type GetInstanceResponseGetEncryptionArgType = InstanceEncryption +type GetInstanceResponseGetEncryptionRetType = InstanceEncryption + +func getGetInstanceResponseGetEncryptionAttributeTypeOk(arg GetInstanceResponseGetEncryptionAttributeType) (ret GetInstanceResponseGetEncryptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetInstanceResponseGetEncryptionAttributeType(arg *GetInstanceResponseGetEncryptionAttributeType, val GetInstanceResponseGetEncryptionRetType) { + *arg = &val +} + /* types and functions for flavorId */ @@ -221,26 +261,6 @@ func setGetInstanceResponseGetStorageAttributeType(arg *GetInstanceResponseGetSt *arg = &val } -/* - types and functions for encryption -*/ - -// isModel -type GetInstanceResponseGetEncryptionAttributeType = *InstanceEncryption -type GetInstanceResponseGetEncryptionArgType = InstanceEncryption -type GetInstanceResponseGetEncryptionRetType = InstanceEncryption - -func getGetInstanceResponseGetEncryptionAttributeTypeOk(arg GetInstanceResponseGetEncryptionAttributeType) (ret GetInstanceResponseGetEncryptionRetType, ok bool) { - if arg == nil { - return ret, false - } - return *arg, true -} - -func setGetInstanceResponseGetEncryptionAttributeType(arg *GetInstanceResponseGetEncryptionAttributeType, val GetInstanceResponseGetEncryptionRetType) { - *arg = &val -} - /* types and functions for version */ @@ -267,6 +287,9 @@ type GetInstanceResponse struct { // The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule. // REQUIRED BackupSchedule GetInstanceResponseGetBackupScheduleAttributeType `json:"backupSchedule" required:"true"` + // REQUIRED + ConnectionInfo GetInstanceResponseGetConnectionInfoAttributeType `json:"connectionInfo" required:"true"` + Encryption GetInstanceResponseGetEncryptionAttributeType `json:"encryption,omitempty"` // The id of the instance flavor. // REQUIRED FlavorId GetInstanceResponseGetFlavorIdAttributeType `json:"flavorId" required:"true"` @@ -276,7 +299,6 @@ type GetInstanceResponse struct { // Whether the instance can be deleted or not. // REQUIRED IsDeletable GetInstanceResponsegetIsDeletableAttributeType `json:"isDeletable" required:"true"` - Encryption GetInstanceResponseGetEncryptionAttributeType `json:"encryption,omitempty"` // The name of the instance. // REQUIRED Name GetInstanceResponseGetNameAttributeType `json:"name" required:"true"` @@ -303,9 +325,10 @@ type _GetInstanceResponse GetInstanceResponse // 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 NewGetInstanceResponse(backupSchedule GetInstanceResponseGetBackupScheduleArgType, flavorId GetInstanceResponseGetFlavorIdArgType, id GetInstanceResponseGetIdArgType, isDeletable GetInstanceResponsegetIsDeletableArgType, name GetInstanceResponseGetNameArgType, network GetInstanceResponseGetNetworkArgType, replicas GetInstanceResponseGetReplicasArgType, retentionDays GetInstanceResponseGetRetentionDaysArgType, status GetInstanceResponseGetStatusArgType, storage GetInstanceResponseGetStorageArgType, version GetInstanceResponseGetVersionArgType) *GetInstanceResponse { +func NewGetInstanceResponse(backupSchedule GetInstanceResponseGetBackupScheduleArgType, connectionInfo GetInstanceResponseGetConnectionInfoArgType, flavorId GetInstanceResponseGetFlavorIdArgType, id GetInstanceResponseGetIdArgType, isDeletable GetInstanceResponsegetIsDeletableArgType, name GetInstanceResponseGetNameArgType, network GetInstanceResponseGetNetworkArgType, replicas GetInstanceResponseGetReplicasArgType, retentionDays GetInstanceResponseGetRetentionDaysArgType, status GetInstanceResponseGetStatusArgType, storage GetInstanceResponseGetStorageArgType, version GetInstanceResponseGetVersionArgType) *GetInstanceResponse { this := GetInstanceResponse{} setGetInstanceResponseGetBackupScheduleAttributeType(&this.BackupSchedule, backupSchedule) + setGetInstanceResponseGetConnectionInfoAttributeType(&this.ConnectionInfo, connectionInfo) setGetInstanceResponseGetFlavorIdAttributeType(&this.FlavorId, flavorId) setGetInstanceResponseGetIdAttributeType(&this.Id, id) setGetInstanceResponsegetIsDeletableAttributeType(&this.IsDeletable, isDeletable) @@ -344,6 +367,46 @@ func (o *GetInstanceResponse) SetBackupSchedule(v GetInstanceResponseGetBackupSc setGetInstanceResponseGetBackupScheduleAttributeType(&o.BackupSchedule, v) } +// GetConnectionInfo returns the ConnectionInfo field value +func (o *GetInstanceResponse) GetConnectionInfo() (ret GetInstanceResponseGetConnectionInfoRetType) { + ret, _ = o.GetConnectionInfoOk() + return ret +} + +// GetConnectionInfoOk returns a tuple with the ConnectionInfo field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetConnectionInfoOk() (ret GetInstanceResponseGetConnectionInfoRetType, ok bool) { + return getGetInstanceResponseGetConnectionInfoAttributeTypeOk(o.ConnectionInfo) +} + +// SetConnectionInfo sets field value +func (o *GetInstanceResponse) SetConnectionInfo(v GetInstanceResponseGetConnectionInfoRetType) { + setGetInstanceResponseGetConnectionInfoAttributeType(&o.ConnectionInfo, v) +} + +// GetEncryption returns the Encryption field value if set, zero value otherwise. +func (o *GetInstanceResponse) GetEncryption() (res GetInstanceResponseGetEncryptionRetType) { + res, _ = o.GetEncryptionOk() + return +} + +// GetEncryptionOk returns a tuple with the Encryption field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetEncryptionOk() (ret GetInstanceResponseGetEncryptionRetType, ok bool) { + return getGetInstanceResponseGetEncryptionAttributeTypeOk(o.Encryption) +} + +// HasEncryption returns a boolean if a field has been set. +func (o *GetInstanceResponse) HasEncryption() bool { + _, ok := o.GetEncryptionOk() + return ok +} + +// SetEncryption gets a reference to the given InstanceEncryption and assigns it to the Encryption field. +func (o *GetInstanceResponse) SetEncryption(v GetInstanceResponseGetEncryptionRetType) { + setGetInstanceResponseGetEncryptionAttributeType(&o.Encryption, v) +} + // GetFlavorId returns the FlavorId field value func (o *GetInstanceResponse) GetFlavorId() (ret GetInstanceResponseGetFlavorIdRetType) { ret, _ = o.GetFlavorIdOk() @@ -519,6 +582,12 @@ func (o GetInstanceResponse) ToMap() (map[string]interface{}, error) { if val, ok := getGetInstanceResponseGetBackupScheduleAttributeTypeOk(o.BackupSchedule); ok { toSerialize["BackupSchedule"] = val } + if val, ok := getGetInstanceResponseGetConnectionInfoAttributeTypeOk(o.ConnectionInfo); ok { + toSerialize["ConnectionInfo"] = val + } + if val, ok := getGetInstanceResponseGetEncryptionAttributeTypeOk(o.Encryption); ok { + toSerialize["Encryption"] = val + } if val, ok := getGetInstanceResponseGetFlavorIdAttributeTypeOk(o.FlavorId); ok { toSerialize["FlavorId"] = val } diff --git a/pkg/postgresflexalpha/model_instance_connection_info.go b/pkg/postgresflexalpha/model_instance_connection_info.go new file mode 100644 index 00000000..ab5b0ed3 --- /dev/null +++ b/pkg/postgresflexalpha/model_instance_connection_info.go @@ -0,0 +1,171 @@ +/* +PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package postgresflexalpha + +import ( + "encoding/json" +) + +// checks if the InstanceConnectionInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceConnectionInfo{} + +/* + types and functions for host +*/ + +// isNotNullableString +type InstanceConnectionInfoGetHostAttributeType = *string + +func getInstanceConnectionInfoGetHostAttributeTypeOk(arg InstanceConnectionInfoGetHostAttributeType) (ret InstanceConnectionInfoGetHostRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceConnectionInfoGetHostAttributeType(arg *InstanceConnectionInfoGetHostAttributeType, val InstanceConnectionInfoGetHostRetType) { + *arg = &val +} + +type InstanceConnectionInfoGetHostArgType = string +type InstanceConnectionInfoGetHostRetType = string + +/* + types and functions for port +*/ + +// isInteger +type InstanceConnectionInfoGetPortAttributeType = *int64 +type InstanceConnectionInfoGetPortArgType = int64 +type InstanceConnectionInfoGetPortRetType = int64 + +func getInstanceConnectionInfoGetPortAttributeTypeOk(arg InstanceConnectionInfoGetPortAttributeType) (ret InstanceConnectionInfoGetPortRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setInstanceConnectionInfoGetPortAttributeType(arg *InstanceConnectionInfoGetPortAttributeType, val InstanceConnectionInfoGetPortRetType) { + *arg = &val +} + +// InstanceConnectionInfo The DNS name and port in the instance overview +type InstanceConnectionInfo struct { + // The host of the instance. + // REQUIRED + Host InstanceConnectionInfoGetHostAttributeType `json:"host" required:"true"` + // The port of the instance. + // REQUIRED + Port InstanceConnectionInfoGetPortAttributeType `json:"port" required:"true"` +} + +type _InstanceConnectionInfo InstanceConnectionInfo + +// NewInstanceConnectionInfo instantiates a new InstanceConnectionInfo 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 NewInstanceConnectionInfo(host InstanceConnectionInfoGetHostArgType, port InstanceConnectionInfoGetPortArgType) *InstanceConnectionInfo { + this := InstanceConnectionInfo{} + setInstanceConnectionInfoGetHostAttributeType(&this.Host, host) + setInstanceConnectionInfoGetPortAttributeType(&this.Port, port) + return &this +} + +// NewInstanceConnectionInfoWithDefaults instantiates a new InstanceConnectionInfo 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 NewInstanceConnectionInfoWithDefaults() *InstanceConnectionInfo { + this := InstanceConnectionInfo{} + return &this +} + +// GetHost returns the Host field value +func (o *InstanceConnectionInfo) GetHost() (ret InstanceConnectionInfoGetHostRetType) { + ret, _ = o.GetHostOk() + return ret +} + +// GetHostOk returns a tuple with the Host field value +// and a boolean to check if the value has been set. +func (o *InstanceConnectionInfo) GetHostOk() (ret InstanceConnectionInfoGetHostRetType, ok bool) { + return getInstanceConnectionInfoGetHostAttributeTypeOk(o.Host) +} + +// SetHost sets field value +func (o *InstanceConnectionInfo) SetHost(v InstanceConnectionInfoGetHostRetType) { + setInstanceConnectionInfoGetHostAttributeType(&o.Host, v) +} + +// GetPort returns the Port field value +func (o *InstanceConnectionInfo) GetPort() (ret InstanceConnectionInfoGetPortRetType) { + ret, _ = o.GetPortOk() + return ret +} + +// GetPortOk returns a tuple with the Port field value +// and a boolean to check if the value has been set. +func (o *InstanceConnectionInfo) GetPortOk() (ret InstanceConnectionInfoGetPortRetType, ok bool) { + return getInstanceConnectionInfoGetPortAttributeTypeOk(o.Port) +} + +// SetPort sets field value +func (o *InstanceConnectionInfo) SetPort(v InstanceConnectionInfoGetPortRetType) { + setInstanceConnectionInfoGetPortAttributeType(&o.Port, v) +} + +func (o InstanceConnectionInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getInstanceConnectionInfoGetHostAttributeTypeOk(o.Host); ok { + toSerialize["Host"] = val + } + if val, ok := getInstanceConnectionInfoGetPortAttributeTypeOk(o.Port); ok { + toSerialize["Port"] = val + } + return toSerialize, nil +} + +type NullableInstanceConnectionInfo struct { + value *InstanceConnectionInfo + isSet bool +} + +func (v NullableInstanceConnectionInfo) Get() *InstanceConnectionInfo { + return v.value +} + +func (v *NullableInstanceConnectionInfo) Set(val *InstanceConnectionInfo) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceConnectionInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceConnectionInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceConnectionInfo(val *InstanceConnectionInfo) *NullableInstanceConnectionInfo { + return &NullableInstanceConnectionInfo{value: val, isSet: true} +} + +func (v NullableInstanceConnectionInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceConnectionInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/postgresflexalpha/model_instance_connection_info_test.go b/pkg/postgresflexalpha/model_instance_connection_info_test.go new file mode 100644 index 00000000..e1ff850e --- /dev/null +++ b/pkg/postgresflexalpha/model_instance_connection_info_test.go @@ -0,0 +1,11 @@ +/* +PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package postgresflexalpha diff --git a/pkg/runcommandbeta/.openapi-generator/VERSION b/pkg/runcommandbeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/runcommandbeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/runcommandbeta/api_default.go b/pkg/runcommandbeta/api_default.go new file mode 100644 index 00000000..3a67ed14 --- /dev/null +++ b/pkg/runcommandbeta/api_default.go @@ -0,0 +1,982 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateCommand Method for CreateCommand + Creates a new command for execution + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param serverId Server ID of the machine + @param region region + @return ApiCreateCommandRequest + */ + CreateCommand(ctx context.Context, projectId string, serverId string, region string) ApiCreateCommandRequest + /* + CreateCommandExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param serverId Server ID of the machine + @param region region + @return NewCommandResponse + + */ + CreateCommandExecute(ctx context.Context, projectId string, serverId string, region string) (*NewCommandResponse, error) + /* + GetCommand Method for GetCommand + Returns details about a command + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param region region + @param serverId Server ID of the machine + @param commandId ID of the command + @return ApiGetCommandRequest + */ + GetCommand(ctx context.Context, projectId string, region string, serverId string, commandId string) ApiGetCommandRequest + /* + GetCommandExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param region region + @param serverId Server ID of the machine + @param commandId ID of the command + @return CommandDetails + + */ + GetCommandExecute(ctx context.Context, projectId string, region string, serverId string, commandId string) (*CommandDetails, error) + /* + GetCommandTemplate Method for GetCommandTemplate + Returns details about a command template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param serverId Server ID of the machine + @param commandTemplateName Name of the template + @param region region + @return ApiGetCommandTemplateRequest + */ + GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) ApiGetCommandTemplateRequest + /* + GetCommandTemplateExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param serverId Server ID of the machine + @param commandTemplateName Name of the template + @param region region + @return CommandTemplateSchema + + */ + GetCommandTemplateExecute(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) (*CommandTemplateSchema, error) + /* + ListCommandTemplates Method for ListCommandTemplates + Returns a list of command templates + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListCommandTemplatesRequest + */ + ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest + /* + ListCommandTemplatesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return CommandTemplateResponse + + */ + ListCommandTemplatesExecute(ctx context.Context) (*CommandTemplateResponse, error) + /* + ListCommands Method for ListCommands + Returns a list of commands + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param serverId Server ID of the machine + @param region region + @return ApiListCommandsRequest + */ + ListCommands(ctx context.Context, projectId string, serverId string, region string) ApiListCommandsRequest + /* + ListCommandsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param serverId Server ID of the machine + @param region region + @return GetCommandsResponse + + */ + ListCommandsExecute(ctx context.Context, projectId string, serverId string, region string) (*GetCommandsResponse, error) +} + +type ApiCreateCommandRequest interface { + // Command to post + CreateCommandPayload(createCommandPayload CreateCommandPayload) ApiCreateCommandRequest + Execute() (*NewCommandResponse, error) +} + +type ApiGetCommandRequest interface { + Execute() (*CommandDetails, error) +} + +type ApiGetCommandTemplateRequest interface { + Execute() (*CommandTemplateSchema, error) +} + +type ApiListCommandTemplatesRequest interface { + // The type of the Operating System (windows or linux). If not provided will return data for all OS types. + OsType(osType string) ApiListCommandTemplatesRequest + Execute() (*CommandTemplateResponse, error) +} + +type ApiListCommandsRequest interface { + Execute() (*GetCommandsResponse, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateCommandRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + region string + createCommandPayload *CreateCommandPayload +} + +// Command to post + +func (r CreateCommandRequest) CreateCommandPayload(createCommandPayload CreateCommandPayload) ApiCreateCommandRequest { + r.createCommandPayload = &createCommandPayload + return r +} + +func (r CreateCommandRequest) Execute() (*NewCommandResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NewCommandResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateCommand") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createCommandPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateCommand: Method for CreateCommand + +Creates a new command for execution + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param serverId Server ID of the machine + @param region region + @return ApiCreateCommandRequest +*/ +func (a *APIClient) CreateCommand(ctx context.Context, projectId string, serverId string, region string) ApiCreateCommandRequest { + return CreateCommandRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } +} + +func (a *APIClient) CreateCommandExecute(ctx context.Context, projectId string, serverId string, region string) (*NewCommandResponse, error) { + r := CreateCommandRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } + return r.Execute() +} + +type GetCommandRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + commandId string +} + +func (r GetCommandRequest) Execute() (*CommandDetails, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandDetails + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCommand") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands/{commandId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commandId"+"}", url.PathEscape(ParameterValueToString(r.commandId, "commandId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCommand: Method for GetCommand + +Returns details about a command + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param region region + @param serverId Server ID of the machine + @param commandId ID of the command + @return ApiGetCommandRequest +*/ +func (a *APIClient) GetCommand(ctx context.Context, projectId string, region string, serverId string, commandId string) ApiGetCommandRequest { + return GetCommandRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + commandId: commandId, + } +} + +func (a *APIClient) GetCommandExecute(ctx context.Context, projectId string, region string, serverId string, commandId string) (*CommandDetails, error) { + r := GetCommandRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + commandId: commandId, + } + return r.Execute() +} + +type GetCommandTemplateRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + commandTemplateName string + region string +} + +func (r GetCommandTemplateRequest) Execute() (*CommandTemplateSchema, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandTemplateSchema + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCommandTemplate") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/command-templates/{commandTemplateName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"commandTemplateName"+"}", url.PathEscape(ParameterValueToString(r.commandTemplateName, "commandTemplateName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCommandTemplate: Method for GetCommandTemplate + +Returns details about a command template + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param serverId Server ID of the machine + @param commandTemplateName Name of the template + @param region region + @return ApiGetCommandTemplateRequest +*/ +func (a *APIClient) GetCommandTemplate(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) ApiGetCommandTemplateRequest { + return GetCommandTemplateRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandTemplateName: commandTemplateName, + region: region, + } +} + +func (a *APIClient) GetCommandTemplateExecute(ctx context.Context, projectId string, serverId string, commandTemplateName string, region string) (*CommandTemplateSchema, error) { + r := GetCommandTemplateRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + commandTemplateName: commandTemplateName, + region: region, + } + return r.Execute() +} + +type ListCommandTemplatesRequest struct { + ctx context.Context + apiService *DefaultApiService + osType *string +} + +// The type of the Operating System (windows or linux). If not provided will return data for all OS types. + +func (r ListCommandTemplatesRequest) OsType(osType string) ApiListCommandTemplatesRequest { + r.osType = &osType + return r +} + +func (r ListCommandTemplatesRequest) Execute() (*CommandTemplateResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommandTemplateResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListCommandTemplates") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta/command-templates" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.osType != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "osType", r.osType, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListCommandTemplates: Method for ListCommandTemplates + +Returns a list of command templates + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListCommandTemplatesRequest +*/ +func (a *APIClient) ListCommandTemplates(ctx context.Context) ApiListCommandTemplatesRequest { + return ListCommandTemplatesRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +func (a *APIClient) ListCommandTemplatesExecute(ctx context.Context) (*CommandTemplateResponse, error) { + r := ListCommandTemplatesRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + +type ListCommandsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + serverId string + region string +} + +func (r ListCommandsRequest) Execute() (*GetCommandsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCommandsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListCommands") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListCommands: Method for ListCommands + +Returns a list of commands + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project + @param serverId Server ID of the machine + @param region region + @return ApiListCommandsRequest +*/ +func (a *APIClient) ListCommands(ctx context.Context, projectId string, serverId string, region string) ApiListCommandsRequest { + return ListCommandsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } +} + +func (a *APIClient) ListCommandsExecute(ctx context.Context, projectId string, serverId string, region string) (*GetCommandsResponse, error) { + r := ListCommandsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + serverId: serverId, + region: region, + } + return r.Execute() +} diff --git a/pkg/runcommandbeta/api_default_test.go b/pkg/runcommandbeta/api_default_test.go new file mode 100644 index 00000000..a6d1cd09 --- /dev/null +++ b/pkg/runcommandbeta/api_default_test.go @@ -0,0 +1,312 @@ +/* +STACKIT Run Commands Service API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package runcommandbeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_runcommandbeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateCommand", func(t *testing.T) { + _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := NewCommandResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for runcommandbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + serverId := serverIdValue + region := regionValue + + resp, reqErr := apiClient.CreateCommand(context.Background(), projectId, serverId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetCommand", func(t *testing.T) { + _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands/{commandId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + serverIdValue := "serverId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + commandIdValue := "commandId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"commandId"+"}", url.PathEscape(ParameterValueToString(commandIdValue, "commandId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CommandDetails{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for runcommandbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + serverId := serverIdValue + commandId := commandIdValue + + resp, reqErr := apiClient.GetCommand(context.Background(), projectId, region, serverId, commandId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetCommandTemplate", func(t *testing.T) { + _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/command-templates/{commandTemplateName}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + commandTemplateNameValue := "commandTemplateName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"commandTemplateName"+"}", url.PathEscape(ParameterValueToString(commandTemplateNameValue, "commandTemplateName")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CommandTemplateSchema{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for runcommandbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + serverId := serverIdValue + commandTemplateName := commandTemplateNameValue + region := regionValue + + resp, reqErr := apiClient.GetCommandTemplate(context.Background(), projectId, serverId, commandTemplateName, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListCommandTemplates", func(t *testing.T) { + _apiUrlPath := "/v2beta/command-templates" + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CommandTemplateResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for runcommandbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + resp, reqErr := apiClient.ListCommandTemplates(context.Background()).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListCommands", func(t *testing.T) { + _apiUrlPath := "/v2beta/projects/{projectId}/regions/{region}/servers/{serverId}/commands" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + serverIdValue := "serverId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(serverIdValue, "serverId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetCommandsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for runcommandbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + serverId := serverIdValue + region := regionValue + + resp, reqErr := apiClient.ListCommands(context.Background(), projectId, serverId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/runcommandbeta/client.go b/pkg/runcommandbeta/client.go new file mode 100644 index 00000000..183ad9ca --- /dev/null +++ b/pkg/runcommandbeta/client.go @@ -0,0 +1,628 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Run Commands Service API API v2beta.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/runcommandbeta/configuration.go b/pkg/runcommandbeta/configuration.go new file mode 100644 index 00000000..ddec6a1b --- /dev/null +++ b/pkg/runcommandbeta/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/runcommandbeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://run-command.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/runcommandbeta/model_command_details.go b/pkg/runcommandbeta/model_command_details.go new file mode 100644 index 00000000..bff1ac28 --- /dev/null +++ b/pkg/runcommandbeta/model_command_details.go @@ -0,0 +1,620 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the CommandDetails type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandDetails{} + +/* + types and functions for commandTemplateName +*/ + +// isNotNullableString +type CommandDetailsGetCommandTemplateNameAttributeType = *string + +func getCommandDetailsGetCommandTemplateNameAttributeTypeOk(arg CommandDetailsGetCommandTemplateNameAttributeType) (ret CommandDetailsGetCommandTemplateNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandDetailsGetCommandTemplateNameAttributeType(arg *CommandDetailsGetCommandTemplateNameAttributeType, val CommandDetailsGetCommandTemplateNameRetType) { + *arg = &val +} + +type CommandDetailsGetCommandTemplateNameArgType = string +type CommandDetailsGetCommandTemplateNameRetType = string + +/* + types and functions for commandTemplateTitle +*/ + +// isNotNullableString +type CommandDetailsGetCommandTemplateTitleAttributeType = *string + +func getCommandDetailsGetCommandTemplateTitleAttributeTypeOk(arg CommandDetailsGetCommandTemplateTitleAttributeType) (ret CommandDetailsGetCommandTemplateTitleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandDetailsGetCommandTemplateTitleAttributeType(arg *CommandDetailsGetCommandTemplateTitleAttributeType, val CommandDetailsGetCommandTemplateTitleRetType) { + *arg = &val +} + +type CommandDetailsGetCommandTemplateTitleArgType = string +type CommandDetailsGetCommandTemplateTitleRetType = string + +/* + types and functions for exitCode +*/ + +// isInteger +type CommandDetailsGetExitCodeAttributeType = *int64 +type CommandDetailsGetExitCodeArgType = int64 +type CommandDetailsGetExitCodeRetType = int64 + +func getCommandDetailsGetExitCodeAttributeTypeOk(arg CommandDetailsGetExitCodeAttributeType) (ret CommandDetailsGetExitCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandDetailsGetExitCodeAttributeType(arg *CommandDetailsGetExitCodeAttributeType, val CommandDetailsGetExitCodeRetType) { + *arg = &val +} + +/* + types and functions for finishedAt +*/ + +// isNotNullableString +type CommandDetailsGetFinishedAtAttributeType = *string + +func getCommandDetailsGetFinishedAtAttributeTypeOk(arg CommandDetailsGetFinishedAtAttributeType) (ret CommandDetailsGetFinishedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandDetailsGetFinishedAtAttributeType(arg *CommandDetailsGetFinishedAtAttributeType, val CommandDetailsGetFinishedAtRetType) { + *arg = &val +} + +type CommandDetailsGetFinishedAtArgType = string +type CommandDetailsGetFinishedAtRetType = string + +/* + types and functions for id +*/ + +// isInteger +type CommandDetailsGetIdAttributeType = *int64 +type CommandDetailsGetIdArgType = int64 +type CommandDetailsGetIdRetType = int64 + +func getCommandDetailsGetIdAttributeTypeOk(arg CommandDetailsGetIdAttributeType) (ret CommandDetailsGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandDetailsGetIdAttributeType(arg *CommandDetailsGetIdAttributeType, val CommandDetailsGetIdRetType) { + *arg = &val +} + +/* + types and functions for output +*/ + +// isNotNullableString +type CommandDetailsGetOutputAttributeType = *string + +func getCommandDetailsGetOutputAttributeTypeOk(arg CommandDetailsGetOutputAttributeType) (ret CommandDetailsGetOutputRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandDetailsGetOutputAttributeType(arg *CommandDetailsGetOutputAttributeType, val CommandDetailsGetOutputRetType) { + *arg = &val +} + +type CommandDetailsGetOutputArgType = string +type CommandDetailsGetOutputRetType = string + +/* + types and functions for script +*/ + +// isNotNullableString +type CommandDetailsGetScriptAttributeType = *string + +func getCommandDetailsGetScriptAttributeTypeOk(arg CommandDetailsGetScriptAttributeType) (ret CommandDetailsGetScriptRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandDetailsGetScriptAttributeType(arg *CommandDetailsGetScriptAttributeType, val CommandDetailsGetScriptRetType) { + *arg = &val +} + +type CommandDetailsGetScriptArgType = string +type CommandDetailsGetScriptRetType = string + +/* + types and functions for startedAt +*/ + +// isNotNullableString +type CommandDetailsGetStartedAtAttributeType = *string + +func getCommandDetailsGetStartedAtAttributeTypeOk(arg CommandDetailsGetStartedAtAttributeType) (ret CommandDetailsGetStartedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandDetailsGetStartedAtAttributeType(arg *CommandDetailsGetStartedAtAttributeType, val CommandDetailsGetStartedAtRetType) { + *arg = &val +} + +type CommandDetailsGetStartedAtArgType = string +type CommandDetailsGetStartedAtRetType = string + +/* + types and functions for status +*/ + +// isEnum + +// CommandDetailsStatus the model 'CommandDetails' +// value type for enums +type CommandDetailsStatus string + +// List of Status +const ( + COMMANDDETAILSSTATUS_PENDING CommandDetailsStatus = "pending" + COMMANDDETAILSSTATUS_RUNNING CommandDetailsStatus = "running" + COMMANDDETAILSSTATUS_COMPLETED CommandDetailsStatus = "completed" + COMMANDDETAILSSTATUS_FAILED CommandDetailsStatus = "failed" +) + +// All allowed values of CommandDetails enum +var AllowedCommandDetailsStatusEnumValues = []CommandDetailsStatus{ + "pending", + "running", + "completed", + "failed", +} + +func (v *CommandDetailsStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson CommandDetailsStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := CommandDetailsStatus(value) + for _, existing := range AllowedCommandDetailsStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid CommandDetails", value) +} + +// NewCommandDetailsStatusFromValue returns a pointer to a valid CommandDetailsStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCommandDetailsStatusFromValue(v CommandDetailsStatus) (*CommandDetailsStatus, error) { + ev := CommandDetailsStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CommandDetailsStatus: valid values are %v", v, AllowedCommandDetailsStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CommandDetailsStatus) IsValid() bool { + for _, existing := range AllowedCommandDetailsStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v CommandDetailsStatus) Ptr() *CommandDetailsStatus { + return &v +} + +type NullableCommandDetailsStatus struct { + value *CommandDetailsStatus + isSet bool +} + +func (v NullableCommandDetailsStatus) Get() *CommandDetailsStatus { + return v.value +} + +func (v *NullableCommandDetailsStatus) Set(val *CommandDetailsStatus) { + v.value = val + v.isSet = true +} + +func (v NullableCommandDetailsStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableCommandDetailsStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommandDetailsStatus(val *CommandDetailsStatus) *NullableCommandDetailsStatus { + return &NullableCommandDetailsStatus{value: val, isSet: true} +} + +func (v NullableCommandDetailsStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommandDetailsStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CommandDetailsGetStatusAttributeType = *CommandDetailsStatus +type CommandDetailsGetStatusArgType = CommandDetailsStatus +type CommandDetailsGetStatusRetType = CommandDetailsStatus + +func getCommandDetailsGetStatusAttributeTypeOk(arg CommandDetailsGetStatusAttributeType) (ret CommandDetailsGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandDetailsGetStatusAttributeType(arg *CommandDetailsGetStatusAttributeType, val CommandDetailsGetStatusRetType) { + *arg = &val +} + +// CommandDetails struct for CommandDetails +type CommandDetails struct { + CommandTemplateName CommandDetailsGetCommandTemplateNameAttributeType `json:"commandTemplateName,omitempty"` + CommandTemplateTitle CommandDetailsGetCommandTemplateTitleAttributeType `json:"commandTemplateTitle,omitempty"` + // Can be cast to int32 without loss of precision. + ExitCode CommandDetailsGetExitCodeAttributeType `json:"exitCode,omitempty"` + FinishedAt CommandDetailsGetFinishedAtAttributeType `json:"finishedAt,omitempty"` + // Can be cast to int32 without loss of precision. + Id CommandDetailsGetIdAttributeType `json:"id,omitempty"` + Output CommandDetailsGetOutputAttributeType `json:"output,omitempty"` + Script CommandDetailsGetScriptAttributeType `json:"script,omitempty"` + StartedAt CommandDetailsGetStartedAtAttributeType `json:"startedAt,omitempty"` + Status CommandDetailsGetStatusAttributeType `json:"status,omitempty"` +} + +// NewCommandDetails instantiates a new CommandDetails 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 NewCommandDetails() *CommandDetails { + this := CommandDetails{} + return &this +} + +// NewCommandDetailsWithDefaults instantiates a new CommandDetails 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 NewCommandDetailsWithDefaults() *CommandDetails { + this := CommandDetails{} + return &this +} + +// GetCommandTemplateName returns the CommandTemplateName field value if set, zero value otherwise. +func (o *CommandDetails) GetCommandTemplateName() (res CommandDetailsGetCommandTemplateNameRetType) { + res, _ = o.GetCommandTemplateNameOk() + return +} + +// GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetCommandTemplateNameOk() (ret CommandDetailsGetCommandTemplateNameRetType, ok bool) { + return getCommandDetailsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName) +} + +// HasCommandTemplateName returns a boolean if a field has been set. +func (o *CommandDetails) HasCommandTemplateName() bool { + _, ok := o.GetCommandTemplateNameOk() + return ok +} + +// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +func (o *CommandDetails) SetCommandTemplateName(v CommandDetailsGetCommandTemplateNameRetType) { + setCommandDetailsGetCommandTemplateNameAttributeType(&o.CommandTemplateName, v) +} + +// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +func (o *CommandDetails) GetCommandTemplateTitle() (res CommandDetailsGetCommandTemplateTitleRetType) { + res, _ = o.GetCommandTemplateTitleOk() + return +} + +// GetCommandTemplateTitleOk returns a tuple with the CommandTemplateTitle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetCommandTemplateTitleOk() (ret CommandDetailsGetCommandTemplateTitleRetType, ok bool) { + return getCommandDetailsGetCommandTemplateTitleAttributeTypeOk(o.CommandTemplateTitle) +} + +// HasCommandTemplateTitle returns a boolean if a field has been set. +func (o *CommandDetails) HasCommandTemplateTitle() bool { + _, ok := o.GetCommandTemplateTitleOk() + return ok +} + +// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +func (o *CommandDetails) SetCommandTemplateTitle(v CommandDetailsGetCommandTemplateTitleRetType) { + setCommandDetailsGetCommandTemplateTitleAttributeType(&o.CommandTemplateTitle, v) +} + +// GetExitCode returns the ExitCode field value if set, zero value otherwise. +func (o *CommandDetails) GetExitCode() (res CommandDetailsGetExitCodeRetType) { + res, _ = o.GetExitCodeOk() + return +} + +// GetExitCodeOk returns a tuple with the ExitCode field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetExitCodeOk() (ret CommandDetailsGetExitCodeRetType, ok bool) { + return getCommandDetailsGetExitCodeAttributeTypeOk(o.ExitCode) +} + +// HasExitCode returns a boolean if a field has been set. +func (o *CommandDetails) HasExitCode() bool { + _, ok := o.GetExitCodeOk() + return ok +} + +// SetExitCode gets a reference to the given int64 and assigns it to the ExitCode field. +func (o *CommandDetails) SetExitCode(v CommandDetailsGetExitCodeRetType) { + setCommandDetailsGetExitCodeAttributeType(&o.ExitCode, v) +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *CommandDetails) GetFinishedAt() (res CommandDetailsGetFinishedAtRetType) { + res, _ = o.GetFinishedAtOk() + return +} + +// GetFinishedAtOk returns a tuple with the FinishedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetFinishedAtOk() (ret CommandDetailsGetFinishedAtRetType, ok bool) { + return getCommandDetailsGetFinishedAtAttributeTypeOk(o.FinishedAt) +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *CommandDetails) HasFinishedAt() bool { + _, ok := o.GetFinishedAtOk() + return ok +} + +// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +func (o *CommandDetails) SetFinishedAt(v CommandDetailsGetFinishedAtRetType) { + setCommandDetailsGetFinishedAtAttributeType(&o.FinishedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CommandDetails) GetId() (res CommandDetailsGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetIdOk() (ret CommandDetailsGetIdRetType, ok bool) { + return getCommandDetailsGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CommandDetails) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *CommandDetails) SetId(v CommandDetailsGetIdRetType) { + setCommandDetailsGetIdAttributeType(&o.Id, v) +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *CommandDetails) GetOutput() (res CommandDetailsGetOutputRetType) { + res, _ = o.GetOutputOk() + return +} + +// GetOutputOk returns a tuple with the Output field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetOutputOk() (ret CommandDetailsGetOutputRetType, ok bool) { + return getCommandDetailsGetOutputAttributeTypeOk(o.Output) +} + +// HasOutput returns a boolean if a field has been set. +func (o *CommandDetails) HasOutput() bool { + _, ok := o.GetOutputOk() + return ok +} + +// SetOutput gets a reference to the given string and assigns it to the Output field. +func (o *CommandDetails) SetOutput(v CommandDetailsGetOutputRetType) { + setCommandDetailsGetOutputAttributeType(&o.Output, v) +} + +// GetScript returns the Script field value if set, zero value otherwise. +func (o *CommandDetails) GetScript() (res CommandDetailsGetScriptRetType) { + res, _ = o.GetScriptOk() + return +} + +// GetScriptOk returns a tuple with the Script field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetScriptOk() (ret CommandDetailsGetScriptRetType, ok bool) { + return getCommandDetailsGetScriptAttributeTypeOk(o.Script) +} + +// HasScript returns a boolean if a field has been set. +func (o *CommandDetails) HasScript() bool { + _, ok := o.GetScriptOk() + return ok +} + +// SetScript gets a reference to the given string and assigns it to the Script field. +func (o *CommandDetails) SetScript(v CommandDetailsGetScriptRetType) { + setCommandDetailsGetScriptAttributeType(&o.Script, v) +} + +// GetStartedAt returns the StartedAt field value if set, zero value otherwise. +func (o *CommandDetails) GetStartedAt() (res CommandDetailsGetStartedAtRetType) { + res, _ = o.GetStartedAtOk() + return +} + +// GetStartedAtOk returns a tuple with the StartedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetStartedAtOk() (ret CommandDetailsGetStartedAtRetType, ok bool) { + return getCommandDetailsGetStartedAtAttributeTypeOk(o.StartedAt) +} + +// HasStartedAt returns a boolean if a field has been set. +func (o *CommandDetails) HasStartedAt() bool { + _, ok := o.GetStartedAtOk() + return ok +} + +// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +func (o *CommandDetails) SetStartedAt(v CommandDetailsGetStartedAtRetType) { + setCommandDetailsGetStartedAtAttributeType(&o.StartedAt, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CommandDetails) GetStatus() (res CommandDetailsGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandDetails) GetStatusOk() (ret CommandDetailsGetStatusRetType, ok bool) { + return getCommandDetailsGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CommandDetails) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CommandDetails) SetStatus(v CommandDetailsGetStatusRetType) { + setCommandDetailsGetStatusAttributeType(&o.Status, v) +} + +func (o CommandDetails) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCommandDetailsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName); ok { + toSerialize["CommandTemplateName"] = val + } + if val, ok := getCommandDetailsGetCommandTemplateTitleAttributeTypeOk(o.CommandTemplateTitle); ok { + toSerialize["CommandTemplateTitle"] = val + } + if val, ok := getCommandDetailsGetExitCodeAttributeTypeOk(o.ExitCode); ok { + toSerialize["ExitCode"] = val + } + if val, ok := getCommandDetailsGetFinishedAtAttributeTypeOk(o.FinishedAt); ok { + toSerialize["FinishedAt"] = val + } + if val, ok := getCommandDetailsGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCommandDetailsGetOutputAttributeTypeOk(o.Output); ok { + toSerialize["Output"] = val + } + if val, ok := getCommandDetailsGetScriptAttributeTypeOk(o.Script); ok { + toSerialize["Script"] = val + } + if val, ok := getCommandDetailsGetStartedAtAttributeTypeOk(o.StartedAt); ok { + toSerialize["StartedAt"] = val + } + if val, ok := getCommandDetailsGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableCommandDetails struct { + value *CommandDetails + isSet bool +} + +func (v NullableCommandDetails) Get() *CommandDetails { + return v.value +} + +func (v *NullableCommandDetails) Set(val *CommandDetails) { + v.value = val + v.isSet = true +} + +func (v NullableCommandDetails) IsSet() bool { + return v.isSet +} + +func (v *NullableCommandDetails) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommandDetails(val *CommandDetails) *NullableCommandDetails { + return &NullableCommandDetails{value: val, isSet: true} +} + +func (v NullableCommandDetails) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommandDetails) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_command_details_test.go b/pkg/runcommandbeta/model_command_details_test.go new file mode 100644 index 00000000..26d16348 --- /dev/null +++ b/pkg/runcommandbeta/model_command_details_test.go @@ -0,0 +1,72 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "testing" +) + +// isEnum + +func TestCommandDetailsStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"pending"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"running"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"completed"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"failed"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := CommandDetailsStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/runcommandbeta/model_command_template.go b/pkg/runcommandbeta/model_command_template.go new file mode 100644 index 00000000..2078b7ac --- /dev/null +++ b/pkg/runcommandbeta/model_command_template.go @@ -0,0 +1,223 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" +) + +// checks if the CommandTemplate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplate{} + +/* + types and functions for name +*/ + +// isNotNullableString +type CommandTemplateGetNameAttributeType = *string + +func getCommandTemplateGetNameAttributeTypeOk(arg CommandTemplateGetNameAttributeType) (ret CommandTemplateGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandTemplateGetNameAttributeType(arg *CommandTemplateGetNameAttributeType, val CommandTemplateGetNameRetType) { + *arg = &val +} + +type CommandTemplateGetNameArgType = string +type CommandTemplateGetNameRetType = string + +/* + types and functions for osType +*/ + +// isArray +type CommandTemplateGetOsTypeAttributeType = *[]string +type CommandTemplateGetOsTypeArgType = []string +type CommandTemplateGetOsTypeRetType = []string + +func getCommandTemplateGetOsTypeAttributeTypeOk(arg CommandTemplateGetOsTypeAttributeType) (ret CommandTemplateGetOsTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandTemplateGetOsTypeAttributeType(arg *CommandTemplateGetOsTypeAttributeType, val CommandTemplateGetOsTypeRetType) { + *arg = &val +} + +/* + types and functions for title +*/ + +// isNotNullableString +type CommandTemplateGetTitleAttributeType = *string + +func getCommandTemplateGetTitleAttributeTypeOk(arg CommandTemplateGetTitleAttributeType) (ret CommandTemplateGetTitleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandTemplateGetTitleAttributeType(arg *CommandTemplateGetTitleAttributeType, val CommandTemplateGetTitleRetType) { + *arg = &val +} + +type CommandTemplateGetTitleArgType = string +type CommandTemplateGetTitleRetType = string + +// CommandTemplate struct for CommandTemplate +type CommandTemplate struct { + Name CommandTemplateGetNameAttributeType `json:"name,omitempty"` + OsType CommandTemplateGetOsTypeAttributeType `json:"osType,omitempty"` + Title CommandTemplateGetTitleAttributeType `json:"title,omitempty"` +} + +// NewCommandTemplate instantiates a new CommandTemplate 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 NewCommandTemplate() *CommandTemplate { + this := CommandTemplate{} + return &this +} + +// NewCommandTemplateWithDefaults instantiates a new CommandTemplate 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 NewCommandTemplateWithDefaults() *CommandTemplate { + this := CommandTemplate{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CommandTemplate) GetName() (res CommandTemplateGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplate) GetNameOk() (ret CommandTemplateGetNameRetType, ok bool) { + return getCommandTemplateGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CommandTemplate) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CommandTemplate) SetName(v CommandTemplateGetNameRetType) { + setCommandTemplateGetNameAttributeType(&o.Name, v) +} + +// GetOsType returns the OsType field value if set, zero value otherwise. +func (o *CommandTemplate) GetOsType() (res CommandTemplateGetOsTypeRetType) { + res, _ = o.GetOsTypeOk() + return +} + +// GetOsTypeOk returns a tuple with the OsType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplate) GetOsTypeOk() (ret CommandTemplateGetOsTypeRetType, ok bool) { + return getCommandTemplateGetOsTypeAttributeTypeOk(o.OsType) +} + +// HasOsType returns a boolean if a field has been set. +func (o *CommandTemplate) HasOsType() bool { + _, ok := o.GetOsTypeOk() + return ok +} + +// SetOsType gets a reference to the given []string and assigns it to the OsType field. +func (o *CommandTemplate) SetOsType(v CommandTemplateGetOsTypeRetType) { + setCommandTemplateGetOsTypeAttributeType(&o.OsType, v) +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CommandTemplate) GetTitle() (res CommandTemplateGetTitleRetType) { + res, _ = o.GetTitleOk() + return +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplate) GetTitleOk() (ret CommandTemplateGetTitleRetType, ok bool) { + return getCommandTemplateGetTitleAttributeTypeOk(o.Title) +} + +// HasTitle returns a boolean if a field has been set. +func (o *CommandTemplate) HasTitle() bool { + _, ok := o.GetTitleOk() + return ok +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CommandTemplate) SetTitle(v CommandTemplateGetTitleRetType) { + setCommandTemplateGetTitleAttributeType(&o.Title, v) +} + +func (o CommandTemplate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCommandTemplateGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCommandTemplateGetOsTypeAttributeTypeOk(o.OsType); ok { + toSerialize["OsType"] = val + } + if val, ok := getCommandTemplateGetTitleAttributeTypeOk(o.Title); ok { + toSerialize["Title"] = val + } + return toSerialize, nil +} + +type NullableCommandTemplate struct { + value *CommandTemplate + isSet bool +} + +func (v NullableCommandTemplate) Get() *CommandTemplate { + return v.value +} + +func (v *NullableCommandTemplate) Set(val *CommandTemplate) { + v.value = val + v.isSet = true +} + +func (v NullableCommandTemplate) IsSet() bool { + return v.isSet +} + +func (v *NullableCommandTemplate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommandTemplate(val *CommandTemplate) *NullableCommandTemplate { + return &NullableCommandTemplate{value: val, isSet: true} +} + +func (v NullableCommandTemplate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommandTemplate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_command_template_response.go b/pkg/runcommandbeta/model_command_template_response.go new file mode 100644 index 00000000..82dc5b80 --- /dev/null +++ b/pkg/runcommandbeta/model_command_template_response.go @@ -0,0 +1,127 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" +) + +// checks if the CommandTemplateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplateResponse{} + +/* + types and functions for items +*/ + +// isArray +type CommandTemplateResponseGetItemsAttributeType = *[]CommandTemplate +type CommandTemplateResponseGetItemsArgType = []CommandTemplate +type CommandTemplateResponseGetItemsRetType = []CommandTemplate + +func getCommandTemplateResponseGetItemsAttributeTypeOk(arg CommandTemplateResponseGetItemsAttributeType) (ret CommandTemplateResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandTemplateResponseGetItemsAttributeType(arg *CommandTemplateResponseGetItemsAttributeType, val CommandTemplateResponseGetItemsRetType) { + *arg = &val +} + +// CommandTemplateResponse struct for CommandTemplateResponse +type CommandTemplateResponse struct { + Items CommandTemplateResponseGetItemsAttributeType `json:"items,omitempty"` +} + +// NewCommandTemplateResponse instantiates a new CommandTemplateResponse 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 NewCommandTemplateResponse() *CommandTemplateResponse { + this := CommandTemplateResponse{} + return &this +} + +// NewCommandTemplateResponseWithDefaults instantiates a new CommandTemplateResponse 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 NewCommandTemplateResponseWithDefaults() *CommandTemplateResponse { + this := CommandTemplateResponse{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *CommandTemplateResponse) GetItems() (res CommandTemplateResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateResponse) GetItemsOk() (ret CommandTemplateResponseGetItemsRetType, ok bool) { + return getCommandTemplateResponseGetItemsAttributeTypeOk(o.Items) +} + +// HasItems returns a boolean if a field has been set. +func (o *CommandTemplateResponse) HasItems() bool { + _, ok := o.GetItemsOk() + return ok +} + +// SetItems gets a reference to the given []CommandTemplate and assigns it to the Items field. +func (o *CommandTemplateResponse) SetItems(v CommandTemplateResponseGetItemsRetType) { + setCommandTemplateResponseGetItemsAttributeType(&o.Items, v) +} + +func (o CommandTemplateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCommandTemplateResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableCommandTemplateResponse struct { + value *CommandTemplateResponse + isSet bool +} + +func (v NullableCommandTemplateResponse) Get() *CommandTemplateResponse { + return v.value +} + +func (v *NullableCommandTemplateResponse) Set(val *CommandTemplateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCommandTemplateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCommandTemplateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommandTemplateResponse(val *CommandTemplateResponse) *NullableCommandTemplateResponse { + return &NullableCommandTemplateResponse{value: val, isSet: true} +} + +func (v NullableCommandTemplateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommandTemplateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_command_template_response_test.go b/pkg/runcommandbeta/model_command_template_response_test.go new file mode 100644 index 00000000..f2f36c24 --- /dev/null +++ b/pkg/runcommandbeta/model_command_template_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta diff --git a/pkg/runcommandbeta/model_command_template_schema.go b/pkg/runcommandbeta/model_command_template_schema.go new file mode 100644 index 00000000..3dd3c3d8 --- /dev/null +++ b/pkg/runcommandbeta/model_command_template_schema.go @@ -0,0 +1,318 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" +) + +// checks if the CommandTemplateSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommandTemplateSchema{} + +/* + types and functions for description +*/ + +// isNotNullableString +type CommandTemplateSchemaGetDescriptionAttributeType = *string + +func getCommandTemplateSchemaGetDescriptionAttributeTypeOk(arg CommandTemplateSchemaGetDescriptionAttributeType) (ret CommandTemplateSchemaGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandTemplateSchemaGetDescriptionAttributeType(arg *CommandTemplateSchemaGetDescriptionAttributeType, val CommandTemplateSchemaGetDescriptionRetType) { + *arg = &val +} + +type CommandTemplateSchemaGetDescriptionArgType = string +type CommandTemplateSchemaGetDescriptionRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CommandTemplateSchemaGetNameAttributeType = *string + +func getCommandTemplateSchemaGetNameAttributeTypeOk(arg CommandTemplateSchemaGetNameAttributeType) (ret CommandTemplateSchemaGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandTemplateSchemaGetNameAttributeType(arg *CommandTemplateSchemaGetNameAttributeType, val CommandTemplateSchemaGetNameRetType) { + *arg = &val +} + +type CommandTemplateSchemaGetNameArgType = string +type CommandTemplateSchemaGetNameRetType = string + +/* + types and functions for osType +*/ + +// isArray +type CommandTemplateSchemaGetOsTypeAttributeType = *[]string +type CommandTemplateSchemaGetOsTypeArgType = []string +type CommandTemplateSchemaGetOsTypeRetType = []string + +func getCommandTemplateSchemaGetOsTypeAttributeTypeOk(arg CommandTemplateSchemaGetOsTypeAttributeType) (ret CommandTemplateSchemaGetOsTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandTemplateSchemaGetOsTypeAttributeType(arg *CommandTemplateSchemaGetOsTypeAttributeType, val CommandTemplateSchemaGetOsTypeRetType) { + *arg = &val +} + +/* + types and functions for parameterSchema +*/ + +// isModel +type CommandTemplateSchemaGetParameterSchemaAttributeType = *ParametersSchema +type CommandTemplateSchemaGetParameterSchemaArgType = ParametersSchema +type CommandTemplateSchemaGetParameterSchemaRetType = ParametersSchema + +func getCommandTemplateSchemaGetParameterSchemaAttributeTypeOk(arg CommandTemplateSchemaGetParameterSchemaAttributeType) (ret CommandTemplateSchemaGetParameterSchemaRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandTemplateSchemaGetParameterSchemaAttributeType(arg *CommandTemplateSchemaGetParameterSchemaAttributeType, val CommandTemplateSchemaGetParameterSchemaRetType) { + *arg = &val +} + +/* + types and functions for title +*/ + +// isNotNullableString +type CommandTemplateSchemaGetTitleAttributeType = *string + +func getCommandTemplateSchemaGetTitleAttributeTypeOk(arg CommandTemplateSchemaGetTitleAttributeType) (ret CommandTemplateSchemaGetTitleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandTemplateSchemaGetTitleAttributeType(arg *CommandTemplateSchemaGetTitleAttributeType, val CommandTemplateSchemaGetTitleRetType) { + *arg = &val +} + +type CommandTemplateSchemaGetTitleArgType = string +type CommandTemplateSchemaGetTitleRetType = string + +// CommandTemplateSchema struct for CommandTemplateSchema +type CommandTemplateSchema struct { + Description CommandTemplateSchemaGetDescriptionAttributeType `json:"description,omitempty"` + Name CommandTemplateSchemaGetNameAttributeType `json:"name,omitempty"` + OsType CommandTemplateSchemaGetOsTypeAttributeType `json:"osType,omitempty"` + ParameterSchema CommandTemplateSchemaGetParameterSchemaAttributeType `json:"parameterSchema,omitempty"` + Title CommandTemplateSchemaGetTitleAttributeType `json:"title,omitempty"` +} + +// NewCommandTemplateSchema instantiates a new CommandTemplateSchema 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 NewCommandTemplateSchema() *CommandTemplateSchema { + this := CommandTemplateSchema{} + return &this +} + +// NewCommandTemplateSchemaWithDefaults instantiates a new CommandTemplateSchema 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 NewCommandTemplateSchemaWithDefaults() *CommandTemplateSchema { + this := CommandTemplateSchema{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetDescription() (res CommandTemplateSchemaGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateSchema) GetDescriptionOk() (ret CommandTemplateSchemaGetDescriptionRetType, ok bool) { + return getCommandTemplateSchemaGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CommandTemplateSchema) SetDescription(v CommandTemplateSchemaGetDescriptionRetType) { + setCommandTemplateSchemaGetDescriptionAttributeType(&o.Description, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetName() (res CommandTemplateSchemaGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateSchema) GetNameOk() (ret CommandTemplateSchemaGetNameRetType, ok bool) { + return getCommandTemplateSchemaGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CommandTemplateSchema) SetName(v CommandTemplateSchemaGetNameRetType) { + setCommandTemplateSchemaGetNameAttributeType(&o.Name, v) +} + +// GetOsType returns the OsType field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetOsType() (res CommandTemplateSchemaGetOsTypeRetType) { + res, _ = o.GetOsTypeOk() + return +} + +// GetOsTypeOk returns a tuple with the OsType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateSchema) GetOsTypeOk() (ret CommandTemplateSchemaGetOsTypeRetType, ok bool) { + return getCommandTemplateSchemaGetOsTypeAttributeTypeOk(o.OsType) +} + +// HasOsType returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasOsType() bool { + _, ok := o.GetOsTypeOk() + return ok +} + +// SetOsType gets a reference to the given []string and assigns it to the OsType field. +func (o *CommandTemplateSchema) SetOsType(v CommandTemplateSchemaGetOsTypeRetType) { + setCommandTemplateSchemaGetOsTypeAttributeType(&o.OsType, v) +} + +// GetParameterSchema returns the ParameterSchema field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetParameterSchema() (res CommandTemplateSchemaGetParameterSchemaRetType) { + res, _ = o.GetParameterSchemaOk() + return +} + +// GetParameterSchemaOk returns a tuple with the ParameterSchema field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateSchema) GetParameterSchemaOk() (ret CommandTemplateSchemaGetParameterSchemaRetType, ok bool) { + return getCommandTemplateSchemaGetParameterSchemaAttributeTypeOk(o.ParameterSchema) +} + +// HasParameterSchema returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasParameterSchema() bool { + _, ok := o.GetParameterSchemaOk() + return ok +} + +// SetParameterSchema gets a reference to the given ParametersSchema and assigns it to the ParameterSchema field. +func (o *CommandTemplateSchema) SetParameterSchema(v CommandTemplateSchemaGetParameterSchemaRetType) { + setCommandTemplateSchemaGetParameterSchemaAttributeType(&o.ParameterSchema, v) +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *CommandTemplateSchema) GetTitle() (res CommandTemplateSchemaGetTitleRetType) { + res, _ = o.GetTitleOk() + return +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CommandTemplateSchema) GetTitleOk() (ret CommandTemplateSchemaGetTitleRetType, ok bool) { + return getCommandTemplateSchemaGetTitleAttributeTypeOk(o.Title) +} + +// HasTitle returns a boolean if a field has been set. +func (o *CommandTemplateSchema) HasTitle() bool { + _, ok := o.GetTitleOk() + return ok +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *CommandTemplateSchema) SetTitle(v CommandTemplateSchemaGetTitleRetType) { + setCommandTemplateSchemaGetTitleAttributeType(&o.Title, v) +} + +func (o CommandTemplateSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCommandTemplateSchemaGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCommandTemplateSchemaGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCommandTemplateSchemaGetOsTypeAttributeTypeOk(o.OsType); ok { + toSerialize["OsType"] = val + } + if val, ok := getCommandTemplateSchemaGetParameterSchemaAttributeTypeOk(o.ParameterSchema); ok { + toSerialize["ParameterSchema"] = val + } + if val, ok := getCommandTemplateSchemaGetTitleAttributeTypeOk(o.Title); ok { + toSerialize["Title"] = val + } + return toSerialize, nil +} + +type NullableCommandTemplateSchema struct { + value *CommandTemplateSchema + isSet bool +} + +func (v NullableCommandTemplateSchema) Get() *CommandTemplateSchema { + return v.value +} + +func (v *NullableCommandTemplateSchema) Set(val *CommandTemplateSchema) { + v.value = val + v.isSet = true +} + +func (v NullableCommandTemplateSchema) IsSet() bool { + return v.isSet +} + +func (v *NullableCommandTemplateSchema) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommandTemplateSchema(val *CommandTemplateSchema) *NullableCommandTemplateSchema { + return &NullableCommandTemplateSchema{value: val, isSet: true} +} + +func (v NullableCommandTemplateSchema) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommandTemplateSchema) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_command_template_schema_test.go b/pkg/runcommandbeta/model_command_template_schema_test.go new file mode 100644 index 00000000..f2f36c24 --- /dev/null +++ b/pkg/runcommandbeta/model_command_template_schema_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta diff --git a/pkg/runcommandbeta/model_command_template_test.go b/pkg/runcommandbeta/model_command_template_test.go new file mode 100644 index 00000000..f2f36c24 --- /dev/null +++ b/pkg/runcommandbeta/model_command_template_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta diff --git a/pkg/runcommandbeta/model_commands.go b/pkg/runcommandbeta/model_commands.go new file mode 100644 index 00000000..68f3a6be --- /dev/null +++ b/pkg/runcommandbeta/model_commands.go @@ -0,0 +1,476 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" + "fmt" +) + +// checks if the Commands type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Commands{} + +/* + types and functions for commandTemplateName +*/ + +// isNotNullableString +type CommandsGetCommandTemplateNameAttributeType = *string + +func getCommandsGetCommandTemplateNameAttributeTypeOk(arg CommandsGetCommandTemplateNameAttributeType) (ret CommandsGetCommandTemplateNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandsGetCommandTemplateNameAttributeType(arg *CommandsGetCommandTemplateNameAttributeType, val CommandsGetCommandTemplateNameRetType) { + *arg = &val +} + +type CommandsGetCommandTemplateNameArgType = string +type CommandsGetCommandTemplateNameRetType = string + +/* + types and functions for commandTemplateTitle +*/ + +// isNotNullableString +type CommandsGetCommandTemplateTitleAttributeType = *string + +func getCommandsGetCommandTemplateTitleAttributeTypeOk(arg CommandsGetCommandTemplateTitleAttributeType) (ret CommandsGetCommandTemplateTitleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandsGetCommandTemplateTitleAttributeType(arg *CommandsGetCommandTemplateTitleAttributeType, val CommandsGetCommandTemplateTitleRetType) { + *arg = &val +} + +type CommandsGetCommandTemplateTitleArgType = string +type CommandsGetCommandTemplateTitleRetType = string + +/* + types and functions for finishedAt +*/ + +// isNotNullableString +type CommandsGetFinishedAtAttributeType = *string + +func getCommandsGetFinishedAtAttributeTypeOk(arg CommandsGetFinishedAtAttributeType) (ret CommandsGetFinishedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandsGetFinishedAtAttributeType(arg *CommandsGetFinishedAtAttributeType, val CommandsGetFinishedAtRetType) { + *arg = &val +} + +type CommandsGetFinishedAtArgType = string +type CommandsGetFinishedAtRetType = string + +/* + types and functions for id +*/ + +// isInteger +type CommandsGetIdAttributeType = *int64 +type CommandsGetIdArgType = int64 +type CommandsGetIdRetType = int64 + +func getCommandsGetIdAttributeTypeOk(arg CommandsGetIdAttributeType) (ret CommandsGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandsGetIdAttributeType(arg *CommandsGetIdAttributeType, val CommandsGetIdRetType) { + *arg = &val +} + +/* + types and functions for startedAt +*/ + +// isNotNullableString +type CommandsGetStartedAtAttributeType = *string + +func getCommandsGetStartedAtAttributeTypeOk(arg CommandsGetStartedAtAttributeType) (ret CommandsGetStartedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandsGetStartedAtAttributeType(arg *CommandsGetStartedAtAttributeType, val CommandsGetStartedAtRetType) { + *arg = &val +} + +type CommandsGetStartedAtArgType = string +type CommandsGetStartedAtRetType = string + +/* + types and functions for status +*/ + +// isEnum + +// CommandsStatus the model 'Commands' +// value type for enums +type CommandsStatus string + +// List of Status +const ( + COMMANDSSTATUS_PENDING CommandsStatus = "pending" + COMMANDSSTATUS_RUNNING CommandsStatus = "running" + COMMANDSSTATUS_COMPLETED CommandsStatus = "completed" + COMMANDSSTATUS_FAILED CommandsStatus = "failed" +) + +// All allowed values of Commands enum +var AllowedCommandsStatusEnumValues = []CommandsStatus{ + "pending", + "running", + "completed", + "failed", +} + +func (v *CommandsStatus) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson CommandsStatus + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := CommandsStatus(value) + for _, existing := range AllowedCommandsStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Commands", value) +} + +// NewCommandsStatusFromValue returns a pointer to a valid CommandsStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCommandsStatusFromValue(v CommandsStatus) (*CommandsStatus, error) { + ev := CommandsStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for CommandsStatus: valid values are %v", v, AllowedCommandsStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v CommandsStatus) IsValid() bool { + for _, existing := range AllowedCommandsStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StatusStatus value +func (v CommandsStatus) Ptr() *CommandsStatus { + return &v +} + +type NullableCommandsStatus struct { + value *CommandsStatus + isSet bool +} + +func (v NullableCommandsStatus) Get() *CommandsStatus { + return v.value +} + +func (v *NullableCommandsStatus) Set(val *CommandsStatus) { + v.value = val + v.isSet = true +} + +func (v NullableCommandsStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableCommandsStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommandsStatus(val *CommandsStatus) *NullableCommandsStatus { + return &NullableCommandsStatus{value: val, isSet: true} +} + +func (v NullableCommandsStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommandsStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type CommandsGetStatusAttributeType = *CommandsStatus +type CommandsGetStatusArgType = CommandsStatus +type CommandsGetStatusRetType = CommandsStatus + +func getCommandsGetStatusAttributeTypeOk(arg CommandsGetStatusAttributeType) (ret CommandsGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCommandsGetStatusAttributeType(arg *CommandsGetStatusAttributeType, val CommandsGetStatusRetType) { + *arg = &val +} + +// Commands struct for Commands +type Commands struct { + CommandTemplateName CommandsGetCommandTemplateNameAttributeType `json:"commandTemplateName,omitempty"` + CommandTemplateTitle CommandsGetCommandTemplateTitleAttributeType `json:"commandTemplateTitle,omitempty"` + FinishedAt CommandsGetFinishedAtAttributeType `json:"finishedAt,omitempty"` + // Can be cast to int32 without loss of precision. + Id CommandsGetIdAttributeType `json:"id,omitempty"` + StartedAt CommandsGetStartedAtAttributeType `json:"startedAt,omitempty"` + Status CommandsGetStatusAttributeType `json:"status,omitempty"` +} + +// NewCommands instantiates a new Commands 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 NewCommands() *Commands { + this := Commands{} + return &this +} + +// NewCommandsWithDefaults instantiates a new Commands 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 NewCommandsWithDefaults() *Commands { + this := Commands{} + return &this +} + +// GetCommandTemplateName returns the CommandTemplateName field value if set, zero value otherwise. +func (o *Commands) GetCommandTemplateName() (res CommandsGetCommandTemplateNameRetType) { + res, _ = o.GetCommandTemplateNameOk() + return +} + +// GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commands) GetCommandTemplateNameOk() (ret CommandsGetCommandTemplateNameRetType, ok bool) { + return getCommandsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName) +} + +// HasCommandTemplateName returns a boolean if a field has been set. +func (o *Commands) HasCommandTemplateName() bool { + _, ok := o.GetCommandTemplateNameOk() + return ok +} + +// SetCommandTemplateName gets a reference to the given string and assigns it to the CommandTemplateName field. +func (o *Commands) SetCommandTemplateName(v CommandsGetCommandTemplateNameRetType) { + setCommandsGetCommandTemplateNameAttributeType(&o.CommandTemplateName, v) +} + +// GetCommandTemplateTitle returns the CommandTemplateTitle field value if set, zero value otherwise. +func (o *Commands) GetCommandTemplateTitle() (res CommandsGetCommandTemplateTitleRetType) { + res, _ = o.GetCommandTemplateTitleOk() + return +} + +// GetCommandTemplateTitleOk returns a tuple with the CommandTemplateTitle field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commands) GetCommandTemplateTitleOk() (ret CommandsGetCommandTemplateTitleRetType, ok bool) { + return getCommandsGetCommandTemplateTitleAttributeTypeOk(o.CommandTemplateTitle) +} + +// HasCommandTemplateTitle returns a boolean if a field has been set. +func (o *Commands) HasCommandTemplateTitle() bool { + _, ok := o.GetCommandTemplateTitleOk() + return ok +} + +// SetCommandTemplateTitle gets a reference to the given string and assigns it to the CommandTemplateTitle field. +func (o *Commands) SetCommandTemplateTitle(v CommandsGetCommandTemplateTitleRetType) { + setCommandsGetCommandTemplateTitleAttributeType(&o.CommandTemplateTitle, v) +} + +// GetFinishedAt returns the FinishedAt field value if set, zero value otherwise. +func (o *Commands) GetFinishedAt() (res CommandsGetFinishedAtRetType) { + res, _ = o.GetFinishedAtOk() + return +} + +// GetFinishedAtOk returns a tuple with the FinishedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commands) GetFinishedAtOk() (ret CommandsGetFinishedAtRetType, ok bool) { + return getCommandsGetFinishedAtAttributeTypeOk(o.FinishedAt) +} + +// HasFinishedAt returns a boolean if a field has been set. +func (o *Commands) HasFinishedAt() bool { + _, ok := o.GetFinishedAtOk() + return ok +} + +// SetFinishedAt gets a reference to the given string and assigns it to the FinishedAt field. +func (o *Commands) SetFinishedAt(v CommandsGetFinishedAtRetType) { + setCommandsGetFinishedAtAttributeType(&o.FinishedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Commands) GetId() (res CommandsGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commands) GetIdOk() (ret CommandsGetIdRetType, ok bool) { + return getCommandsGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Commands) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *Commands) SetId(v CommandsGetIdRetType) { + setCommandsGetIdAttributeType(&o.Id, v) +} + +// GetStartedAt returns the StartedAt field value if set, zero value otherwise. +func (o *Commands) GetStartedAt() (res CommandsGetStartedAtRetType) { + res, _ = o.GetStartedAtOk() + return +} + +// GetStartedAtOk returns a tuple with the StartedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commands) GetStartedAtOk() (ret CommandsGetStartedAtRetType, ok bool) { + return getCommandsGetStartedAtAttributeTypeOk(o.StartedAt) +} + +// HasStartedAt returns a boolean if a field has been set. +func (o *Commands) HasStartedAt() bool { + _, ok := o.GetStartedAtOk() + return ok +} + +// SetStartedAt gets a reference to the given string and assigns it to the StartedAt field. +func (o *Commands) SetStartedAt(v CommandsGetStartedAtRetType) { + setCommandsGetStartedAtAttributeType(&o.StartedAt, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Commands) GetStatus() (res CommandsGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commands) GetStatusOk() (ret CommandsGetStatusRetType, ok bool) { + return getCommandsGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Commands) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Commands) SetStatus(v CommandsGetStatusRetType) { + setCommandsGetStatusAttributeType(&o.Status, v) +} + +func (o Commands) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCommandsGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName); ok { + toSerialize["CommandTemplateName"] = val + } + if val, ok := getCommandsGetCommandTemplateTitleAttributeTypeOk(o.CommandTemplateTitle); ok { + toSerialize["CommandTemplateTitle"] = val + } + if val, ok := getCommandsGetFinishedAtAttributeTypeOk(o.FinishedAt); ok { + toSerialize["FinishedAt"] = val + } + if val, ok := getCommandsGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCommandsGetStartedAtAttributeTypeOk(o.StartedAt); ok { + toSerialize["StartedAt"] = val + } + if val, ok := getCommandsGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableCommands struct { + value *Commands + isSet bool +} + +func (v NullableCommands) Get() *Commands { + return v.value +} + +func (v *NullableCommands) Set(val *Commands) { + v.value = val + v.isSet = true +} + +func (v NullableCommands) IsSet() bool { + return v.isSet +} + +func (v *NullableCommands) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommands(val *Commands) *NullableCommands { + return &NullableCommands{value: val, isSet: true} +} + +func (v NullableCommands) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommands) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_commands_test.go b/pkg/runcommandbeta/model_commands_test.go new file mode 100644 index 00000000..23a67037 --- /dev/null +++ b/pkg/runcommandbeta/model_commands_test.go @@ -0,0 +1,72 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "testing" +) + +// isEnum + +func TestCommandsStatus_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"pending"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"running"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"completed"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"failed"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := CommandsStatus("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/runcommandbeta/model_create_command_payload.go b/pkg/runcommandbeta/model_create_command_payload.go new file mode 100644 index 00000000..58d7cf01 --- /dev/null +++ b/pkg/runcommandbeta/model_create_command_payload.go @@ -0,0 +1,173 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" +) + +// checks if the CreateCommandPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCommandPayload{} + +/* + types and functions for commandTemplateName +*/ + +// isNotNullableString +type CreateCommandPayloadGetCommandTemplateNameAttributeType = *string + +func getCreateCommandPayloadGetCommandTemplateNameAttributeTypeOk(arg CreateCommandPayloadGetCommandTemplateNameAttributeType) (ret CreateCommandPayloadGetCommandTemplateNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCommandPayloadGetCommandTemplateNameAttributeType(arg *CreateCommandPayloadGetCommandTemplateNameAttributeType, val CreateCommandPayloadGetCommandTemplateNameRetType) { + *arg = &val +} + +type CreateCommandPayloadGetCommandTemplateNameArgType = string +type CreateCommandPayloadGetCommandTemplateNameRetType = string + +/* + types and functions for parameters +*/ + +// isContainer +type CreateCommandPayloadGetParametersAttributeType = *map[string]string +type CreateCommandPayloadGetParametersArgType = map[string]string +type CreateCommandPayloadGetParametersRetType = map[string]string + +func getCreateCommandPayloadGetParametersAttributeTypeOk(arg CreateCommandPayloadGetParametersAttributeType) (ret CreateCommandPayloadGetParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCommandPayloadGetParametersAttributeType(arg *CreateCommandPayloadGetParametersAttributeType, val CreateCommandPayloadGetParametersRetType) { + *arg = &val +} + +// CreateCommandPayload struct for CreateCommandPayload +type CreateCommandPayload struct { + // REQUIRED + CommandTemplateName CreateCommandPayloadGetCommandTemplateNameAttributeType `json:"commandTemplateName" required:"true"` + Parameters CreateCommandPayloadGetParametersAttributeType `json:"parameters,omitempty"` +} + +type _CreateCommandPayload CreateCommandPayload + +// NewCreateCommandPayload instantiates a new CreateCommandPayload 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 NewCreateCommandPayload(commandTemplateName CreateCommandPayloadGetCommandTemplateNameArgType) *CreateCommandPayload { + this := CreateCommandPayload{} + setCreateCommandPayloadGetCommandTemplateNameAttributeType(&this.CommandTemplateName, commandTemplateName) + return &this +} + +// NewCreateCommandPayloadWithDefaults instantiates a new CreateCommandPayload 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 NewCreateCommandPayloadWithDefaults() *CreateCommandPayload { + this := CreateCommandPayload{} + return &this +} + +// GetCommandTemplateName returns the CommandTemplateName field value +func (o *CreateCommandPayload) GetCommandTemplateName() (ret CreateCommandPayloadGetCommandTemplateNameRetType) { + ret, _ = o.GetCommandTemplateNameOk() + return ret +} + +// GetCommandTemplateNameOk returns a tuple with the CommandTemplateName field value +// and a boolean to check if the value has been set. +func (o *CreateCommandPayload) GetCommandTemplateNameOk() (ret CreateCommandPayloadGetCommandTemplateNameRetType, ok bool) { + return getCreateCommandPayloadGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName) +} + +// SetCommandTemplateName sets field value +func (o *CreateCommandPayload) SetCommandTemplateName(v CreateCommandPayloadGetCommandTemplateNameRetType) { + setCreateCommandPayloadGetCommandTemplateNameAttributeType(&o.CommandTemplateName, v) +} + +// GetParameters returns the Parameters field value if set, zero value otherwise. +func (o *CreateCommandPayload) GetParameters() (res CreateCommandPayloadGetParametersRetType) { + res, _ = o.GetParametersOk() + return +} + +// GetParametersOk returns a tuple with the Parameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateCommandPayload) GetParametersOk() (ret CreateCommandPayloadGetParametersRetType, ok bool) { + return getCreateCommandPayloadGetParametersAttributeTypeOk(o.Parameters) +} + +// HasParameters returns a boolean if a field has been set. +func (o *CreateCommandPayload) HasParameters() bool { + _, ok := o.GetParametersOk() + return ok +} + +// SetParameters gets a reference to the given map[string]string and assigns it to the Parameters field. +func (o *CreateCommandPayload) SetParameters(v CreateCommandPayloadGetParametersRetType) { + setCreateCommandPayloadGetParametersAttributeType(&o.Parameters, v) +} + +func (o CreateCommandPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateCommandPayloadGetCommandTemplateNameAttributeTypeOk(o.CommandTemplateName); ok { + toSerialize["CommandTemplateName"] = val + } + if val, ok := getCreateCommandPayloadGetParametersAttributeTypeOk(o.Parameters); ok { + toSerialize["Parameters"] = val + } + return toSerialize, nil +} + +type NullableCreateCommandPayload struct { + value *CreateCommandPayload + isSet bool +} + +func (v NullableCreateCommandPayload) Get() *CreateCommandPayload { + return v.value +} + +func (v *NullableCreateCommandPayload) Set(val *CreateCommandPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateCommandPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateCommandPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateCommandPayload(val *CreateCommandPayload) *NullableCreateCommandPayload { + return &NullableCreateCommandPayload{value: val, isSet: true} +} + +func (v NullableCreateCommandPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateCommandPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_create_command_payload_test.go b/pkg/runcommandbeta/model_create_command_payload_test.go new file mode 100644 index 00000000..f2f36c24 --- /dev/null +++ b/pkg/runcommandbeta/model_create_command_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta diff --git a/pkg/runcommandbeta/model_error_response.go b/pkg/runcommandbeta/model_error_response.go new file mode 100644 index 00000000..2b5dcba4 --- /dev/null +++ b/pkg/runcommandbeta/model_error_response.go @@ -0,0 +1,172 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +/* + types and functions for message +*/ + +// isNotNullableString +type ErrorResponseGetMessageAttributeType = *string + +func getErrorResponseGetMessageAttributeTypeOk(arg ErrorResponseGetMessageAttributeType) (ret ErrorResponseGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorResponseGetMessageAttributeType(arg *ErrorResponseGetMessageAttributeType, val ErrorResponseGetMessageRetType) { + *arg = &val +} + +type ErrorResponseGetMessageArgType = string +type ErrorResponseGetMessageRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type ErrorResponseGetStatusAttributeType = *string + +func getErrorResponseGetStatusAttributeTypeOk(arg ErrorResponseGetStatusAttributeType) (ret ErrorResponseGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorResponseGetStatusAttributeType(arg *ErrorResponseGetStatusAttributeType, val ErrorResponseGetStatusRetType) { + *arg = &val +} + +type ErrorResponseGetStatusArgType = string +type ErrorResponseGetStatusRetType = string + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + // Details about the error + // REQUIRED + Message ErrorResponseGetMessageAttributeType `json:"message" required:"true"` + // The string representation of the http status code (i.e. Not Found, Bad Request, etc) + // REQUIRED + Status ErrorResponseGetStatusAttributeType `json:"status" required:"true"` +} + +type _ErrorResponse ErrorResponse + +// NewErrorResponse instantiates a new ErrorResponse 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 NewErrorResponse(message ErrorResponseGetMessageArgType, status ErrorResponseGetStatusArgType) *ErrorResponse { + this := ErrorResponse{} + setErrorResponseGetMessageAttributeType(&this.Message, message) + setErrorResponseGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewErrorResponseWithDefaults instantiates a new ErrorResponse 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 NewErrorResponseWithDefaults() *ErrorResponse { + this := ErrorResponse{} + return &this +} + +// GetMessage returns the Message field value +func (o *ErrorResponse) GetMessage() (ret ErrorResponseGetMessageRetType) { + ret, _ = o.GetMessageOk() + return ret +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetMessageOk() (ret ErrorResponseGetMessageRetType, ok bool) { + return getErrorResponseGetMessageAttributeTypeOk(o.Message) +} + +// SetMessage sets field value +func (o *ErrorResponse) SetMessage(v ErrorResponseGetMessageRetType) { + setErrorResponseGetMessageAttributeType(&o.Message, v) +} + +// GetStatus returns the Status field value +func (o *ErrorResponse) GetStatus() (ret ErrorResponseGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetStatusOk() (ret ErrorResponseGetStatusRetType, ok bool) { + return getErrorResponseGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *ErrorResponse) SetStatus(v ErrorResponseGetStatusRetType) { + setErrorResponseGetStatusAttributeType(&o.Status, v) +} + +func (o ErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getErrorResponseGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + if val, ok := getErrorResponseGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableErrorResponse struct { + value *ErrorResponse + isSet bool +} + +func (v NullableErrorResponse) Get() *ErrorResponse { + return v.value +} + +func (v *NullableErrorResponse) Set(val *ErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorResponse(val *ErrorResponse) *NullableErrorResponse { + return &NullableErrorResponse{value: val, isSet: true} +} + +func (v NullableErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_error_response_test.go b/pkg/runcommandbeta/model_error_response_test.go new file mode 100644 index 00000000..f2f36c24 --- /dev/null +++ b/pkg/runcommandbeta/model_error_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta diff --git a/pkg/runcommandbeta/model_field.go b/pkg/runcommandbeta/model_field.go new file mode 100644 index 00000000..426854e2 --- /dev/null +++ b/pkg/runcommandbeta/model_field.go @@ -0,0 +1,415 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" +) + +// checks if the Field type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Field{} + +/* + types and functions for default +*/ + +// isNotNullableString +type FieldGetDefaultAttributeType = *string + +func getFieldGetDefaultAttributeTypeOk(arg FieldGetDefaultAttributeType) (ret FieldGetDefaultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFieldGetDefaultAttributeType(arg *FieldGetDefaultAttributeType, val FieldGetDefaultRetType) { + *arg = &val +} + +type FieldGetDefaultArgType = string +type FieldGetDefaultRetType = string + +/* + types and functions for description +*/ + +// isNotNullableString +type FieldGetDescriptionAttributeType = *string + +func getFieldGetDescriptionAttributeTypeOk(arg FieldGetDescriptionAttributeType) (ret FieldGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFieldGetDescriptionAttributeType(arg *FieldGetDescriptionAttributeType, val FieldGetDescriptionRetType) { + *arg = &val +} + +type FieldGetDescriptionArgType = string +type FieldGetDescriptionRetType = string + +/* + types and functions for maxLen +*/ + +// isInteger +type FieldGetMaxLenAttributeType = *int64 +type FieldGetMaxLenArgType = int64 +type FieldGetMaxLenRetType = int64 + +func getFieldGetMaxLenAttributeTypeOk(arg FieldGetMaxLenAttributeType) (ret FieldGetMaxLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFieldGetMaxLenAttributeType(arg *FieldGetMaxLenAttributeType, val FieldGetMaxLenRetType) { + *arg = &val +} + +/* + types and functions for minLen +*/ + +// isInteger +type FieldGetMinLenAttributeType = *int64 +type FieldGetMinLenArgType = int64 +type FieldGetMinLenRetType = int64 + +func getFieldGetMinLenAttributeTypeOk(arg FieldGetMinLenAttributeType) (ret FieldGetMinLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFieldGetMinLenAttributeType(arg *FieldGetMinLenAttributeType, val FieldGetMinLenRetType) { + *arg = &val +} + +/* + types and functions for readOnly +*/ + +// isBoolean +type FieldgetReadOnlyAttributeType = *bool +type FieldgetReadOnlyArgType = bool +type FieldgetReadOnlyRetType = bool + +func getFieldgetReadOnlyAttributeTypeOk(arg FieldgetReadOnlyAttributeType) (ret FieldgetReadOnlyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFieldgetReadOnlyAttributeType(arg *FieldgetReadOnlyAttributeType, val FieldgetReadOnlyRetType) { + *arg = &val +} + +/* + types and functions for title +*/ + +// isNotNullableString +type FieldGetTitleAttributeType = *string + +func getFieldGetTitleAttributeTypeOk(arg FieldGetTitleAttributeType) (ret FieldGetTitleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFieldGetTitleAttributeType(arg *FieldGetTitleAttributeType, val FieldGetTitleRetType) { + *arg = &val +} + +type FieldGetTitleArgType = string +type FieldGetTitleRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type FieldGetTypeAttributeType = *string + +func getFieldGetTypeAttributeTypeOk(arg FieldGetTypeAttributeType) (ret FieldGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setFieldGetTypeAttributeType(arg *FieldGetTypeAttributeType, val FieldGetTypeRetType) { + *arg = &val +} + +type FieldGetTypeArgType = string +type FieldGetTypeRetType = string + +// Field struct for Field +type Field struct { + Default FieldGetDefaultAttributeType `json:"default,omitempty"` + Description FieldGetDescriptionAttributeType `json:"description,omitempty"` + // Can be cast to int32 without loss of precision. + MaxLen FieldGetMaxLenAttributeType `json:"maxLen,omitempty"` + // Can be cast to int32 without loss of precision. + MinLen FieldGetMinLenAttributeType `json:"minLen,omitempty"` + ReadOnly FieldgetReadOnlyAttributeType `json:"readOnly,omitempty"` + Title FieldGetTitleAttributeType `json:"title,omitempty"` + Type FieldGetTypeAttributeType `json:"type,omitempty"` +} + +// NewField instantiates a new Field 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 NewField() *Field { + this := Field{} + return &this +} + +// NewFieldWithDefaults instantiates a new Field 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 NewFieldWithDefaults() *Field { + this := Field{} + return &this +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *Field) GetDefault() (res FieldGetDefaultRetType) { + res, _ = o.GetDefaultOk() + return +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetDefaultOk() (ret FieldGetDefaultRetType, ok bool) { + return getFieldGetDefaultAttributeTypeOk(o.Default) +} + +// HasDefault returns a boolean if a field has been set. +func (o *Field) HasDefault() bool { + _, ok := o.GetDefaultOk() + return ok +} + +// SetDefault gets a reference to the given string and assigns it to the Default field. +func (o *Field) SetDefault(v FieldGetDefaultRetType) { + setFieldGetDefaultAttributeType(&o.Default, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Field) GetDescription() (res FieldGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetDescriptionOk() (ret FieldGetDescriptionRetType, ok bool) { + return getFieldGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *Field) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Field) SetDescription(v FieldGetDescriptionRetType) { + setFieldGetDescriptionAttributeType(&o.Description, v) +} + +// GetMaxLen returns the MaxLen field value if set, zero value otherwise. +func (o *Field) GetMaxLen() (res FieldGetMaxLenRetType) { + res, _ = o.GetMaxLenOk() + return +} + +// GetMaxLenOk returns a tuple with the MaxLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetMaxLenOk() (ret FieldGetMaxLenRetType, ok bool) { + return getFieldGetMaxLenAttributeTypeOk(o.MaxLen) +} + +// HasMaxLen returns a boolean if a field has been set. +func (o *Field) HasMaxLen() bool { + _, ok := o.GetMaxLenOk() + return ok +} + +// SetMaxLen gets a reference to the given int64 and assigns it to the MaxLen field. +func (o *Field) SetMaxLen(v FieldGetMaxLenRetType) { + setFieldGetMaxLenAttributeType(&o.MaxLen, v) +} + +// GetMinLen returns the MinLen field value if set, zero value otherwise. +func (o *Field) GetMinLen() (res FieldGetMinLenRetType) { + res, _ = o.GetMinLenOk() + return +} + +// GetMinLenOk returns a tuple with the MinLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetMinLenOk() (ret FieldGetMinLenRetType, ok bool) { + return getFieldGetMinLenAttributeTypeOk(o.MinLen) +} + +// HasMinLen returns a boolean if a field has been set. +func (o *Field) HasMinLen() bool { + _, ok := o.GetMinLenOk() + return ok +} + +// SetMinLen gets a reference to the given int64 and assigns it to the MinLen field. +func (o *Field) SetMinLen(v FieldGetMinLenRetType) { + setFieldGetMinLenAttributeType(&o.MinLen, v) +} + +// GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +func (o *Field) GetReadOnly() (res FieldgetReadOnlyRetType) { + res, _ = o.GetReadOnlyOk() + return +} + +// GetReadOnlyOk returns a tuple with the ReadOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetReadOnlyOk() (ret FieldgetReadOnlyRetType, ok bool) { + return getFieldgetReadOnlyAttributeTypeOk(o.ReadOnly) +} + +// HasReadOnly returns a boolean if a field has been set. +func (o *Field) HasReadOnly() bool { + _, ok := o.GetReadOnlyOk() + return ok +} + +// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +func (o *Field) SetReadOnly(v FieldgetReadOnlyRetType) { + setFieldgetReadOnlyAttributeType(&o.ReadOnly, v) +} + +// GetTitle returns the Title field value if set, zero value otherwise. +func (o *Field) GetTitle() (res FieldGetTitleRetType) { + res, _ = o.GetTitleOk() + return +} + +// GetTitleOk returns a tuple with the Title field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetTitleOk() (ret FieldGetTitleRetType, ok bool) { + return getFieldGetTitleAttributeTypeOk(o.Title) +} + +// HasTitle returns a boolean if a field has been set. +func (o *Field) HasTitle() bool { + _, ok := o.GetTitleOk() + return ok +} + +// SetTitle gets a reference to the given string and assigns it to the Title field. +func (o *Field) SetTitle(v FieldGetTitleRetType) { + setFieldGetTitleAttributeType(&o.Title, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Field) GetType() (res FieldGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Field) GetTypeOk() (ret FieldGetTypeRetType, ok bool) { + return getFieldGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *Field) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Field) SetType(v FieldGetTypeRetType) { + setFieldGetTypeAttributeType(&o.Type, v) +} + +func (o Field) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getFieldGetDefaultAttributeTypeOk(o.Default); ok { + toSerialize["Default"] = val + } + if val, ok := getFieldGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getFieldGetMaxLenAttributeTypeOk(o.MaxLen); ok { + toSerialize["MaxLen"] = val + } + if val, ok := getFieldGetMinLenAttributeTypeOk(o.MinLen); ok { + toSerialize["MinLen"] = val + } + if val, ok := getFieldgetReadOnlyAttributeTypeOk(o.ReadOnly); ok { + toSerialize["ReadOnly"] = val + } + if val, ok := getFieldGetTitleAttributeTypeOk(o.Title); ok { + toSerialize["Title"] = val + } + if val, ok := getFieldGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableField struct { + value *Field + isSet bool +} + +func (v NullableField) Get() *Field { + return v.value +} + +func (v *NullableField) Set(val *Field) { + v.value = val + v.isSet = true +} + +func (v NullableField) IsSet() bool { + return v.isSet +} + +func (v *NullableField) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableField(val *Field) *NullableField { + return &NullableField{value: val, isSet: true} +} + +func (v NullableField) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableField) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_field_test.go b/pkg/runcommandbeta/model_field_test.go new file mode 100644 index 00000000..f2f36c24 --- /dev/null +++ b/pkg/runcommandbeta/model_field_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta diff --git a/pkg/runcommandbeta/model_get_commands_response.go b/pkg/runcommandbeta/model_get_commands_response.go new file mode 100644 index 00000000..c3b4dbdc --- /dev/null +++ b/pkg/runcommandbeta/model_get_commands_response.go @@ -0,0 +1,127 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" +) + +// checks if the GetCommandsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCommandsResponse{} + +/* + types and functions for items +*/ + +// isArray +type GetCommandsResponseGetItemsAttributeType = *[]Commands +type GetCommandsResponseGetItemsArgType = []Commands +type GetCommandsResponseGetItemsRetType = []Commands + +func getGetCommandsResponseGetItemsAttributeTypeOk(arg GetCommandsResponseGetItemsAttributeType) (ret GetCommandsResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetCommandsResponseGetItemsAttributeType(arg *GetCommandsResponseGetItemsAttributeType, val GetCommandsResponseGetItemsRetType) { + *arg = &val +} + +// GetCommandsResponse struct for GetCommandsResponse +type GetCommandsResponse struct { + Items GetCommandsResponseGetItemsAttributeType `json:"items,omitempty"` +} + +// NewGetCommandsResponse instantiates a new GetCommandsResponse 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 NewGetCommandsResponse() *GetCommandsResponse { + this := GetCommandsResponse{} + return &this +} + +// NewGetCommandsResponseWithDefaults instantiates a new GetCommandsResponse 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 NewGetCommandsResponseWithDefaults() *GetCommandsResponse { + this := GetCommandsResponse{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *GetCommandsResponse) GetItems() (res GetCommandsResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetCommandsResponse) GetItemsOk() (ret GetCommandsResponseGetItemsRetType, ok bool) { + return getGetCommandsResponseGetItemsAttributeTypeOk(o.Items) +} + +// HasItems returns a boolean if a field has been set. +func (o *GetCommandsResponse) HasItems() bool { + _, ok := o.GetItemsOk() + return ok +} + +// SetItems gets a reference to the given []Commands and assigns it to the Items field. +func (o *GetCommandsResponse) SetItems(v GetCommandsResponseGetItemsRetType) { + setGetCommandsResponseGetItemsAttributeType(&o.Items, v) +} + +func (o GetCommandsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetCommandsResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableGetCommandsResponse struct { + value *GetCommandsResponse + isSet bool +} + +func (v NullableGetCommandsResponse) Get() *GetCommandsResponse { + return v.value +} + +func (v *NullableGetCommandsResponse) Set(val *GetCommandsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetCommandsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCommandsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCommandsResponse(val *GetCommandsResponse) *NullableGetCommandsResponse { + return &NullableGetCommandsResponse{value: val, isSet: true} +} + +func (v NullableGetCommandsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCommandsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_get_commands_response_test.go b/pkg/runcommandbeta/model_get_commands_response_test.go new file mode 100644 index 00000000..f2f36c24 --- /dev/null +++ b/pkg/runcommandbeta/model_get_commands_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta diff --git a/pkg/runcommandbeta/model_new_command_response.go b/pkg/runcommandbeta/model_new_command_response.go new file mode 100644 index 00000000..80c800c5 --- /dev/null +++ b/pkg/runcommandbeta/model_new_command_response.go @@ -0,0 +1,128 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" +) + +// checks if the NewCommandResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NewCommandResponse{} + +/* + types and functions for id +*/ + +// isInteger +type NewCommandResponseGetIdAttributeType = *int64 +type NewCommandResponseGetIdArgType = int64 +type NewCommandResponseGetIdRetType = int64 + +func getNewCommandResponseGetIdAttributeTypeOk(arg NewCommandResponseGetIdAttributeType) (ret NewCommandResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNewCommandResponseGetIdAttributeType(arg *NewCommandResponseGetIdAttributeType, val NewCommandResponseGetIdRetType) { + *arg = &val +} + +// NewCommandResponse struct for NewCommandResponse +type NewCommandResponse struct { + // Can be cast to int32 without loss of precision. + Id NewCommandResponseGetIdAttributeType `json:"id,omitempty"` +} + +// NewNewCommandResponse instantiates a new NewCommandResponse 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 NewNewCommandResponse() *NewCommandResponse { + this := NewCommandResponse{} + return &this +} + +// NewNewCommandResponseWithDefaults instantiates a new NewCommandResponse 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 NewNewCommandResponseWithDefaults() *NewCommandResponse { + this := NewCommandResponse{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *NewCommandResponse) GetId() (res NewCommandResponseGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NewCommandResponse) GetIdOk() (ret NewCommandResponseGetIdRetType, ok bool) { + return getNewCommandResponseGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *NewCommandResponse) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given int64 and assigns it to the Id field. +func (o *NewCommandResponse) SetId(v NewCommandResponseGetIdRetType) { + setNewCommandResponseGetIdAttributeType(&o.Id, v) +} + +func (o NewCommandResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNewCommandResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + return toSerialize, nil +} + +type NullableNewCommandResponse struct { + value *NewCommandResponse + isSet bool +} + +func (v NullableNewCommandResponse) Get() *NewCommandResponse { + return v.value +} + +func (v *NullableNewCommandResponse) Set(val *NewCommandResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNewCommandResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNewCommandResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNewCommandResponse(val *NewCommandResponse) *NullableNewCommandResponse { + return &NullableNewCommandResponse{value: val, isSet: true} +} + +func (v NullableNewCommandResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNewCommandResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_new_command_response_test.go b/pkg/runcommandbeta/model_new_command_response_test.go new file mode 100644 index 00000000..f2f36c24 --- /dev/null +++ b/pkg/runcommandbeta/model_new_command_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta diff --git a/pkg/runcommandbeta/model_parameters_schema.go b/pkg/runcommandbeta/model_parameters_schema.go new file mode 100644 index 00000000..8055f96e --- /dev/null +++ b/pkg/runcommandbeta/model_parameters_schema.go @@ -0,0 +1,127 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" +) + +// checks if the ParametersSchema type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ParametersSchema{} + +/* + types and functions for properties +*/ + +// isModel +type ParametersSchemaGetPropertiesAttributeType = *Properties +type ParametersSchemaGetPropertiesArgType = Properties +type ParametersSchemaGetPropertiesRetType = Properties + +func getParametersSchemaGetPropertiesAttributeTypeOk(arg ParametersSchemaGetPropertiesAttributeType) (ret ParametersSchemaGetPropertiesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setParametersSchemaGetPropertiesAttributeType(arg *ParametersSchemaGetPropertiesAttributeType, val ParametersSchemaGetPropertiesRetType) { + *arg = &val +} + +// ParametersSchema struct for ParametersSchema +type ParametersSchema struct { + Properties ParametersSchemaGetPropertiesAttributeType `json:"properties,omitempty"` +} + +// NewParametersSchema instantiates a new ParametersSchema 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 NewParametersSchema() *ParametersSchema { + this := ParametersSchema{} + return &this +} + +// NewParametersSchemaWithDefaults instantiates a new ParametersSchema 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 NewParametersSchemaWithDefaults() *ParametersSchema { + this := ParametersSchema{} + return &this +} + +// GetProperties returns the Properties field value if set, zero value otherwise. +func (o *ParametersSchema) GetProperties() (res ParametersSchemaGetPropertiesRetType) { + res, _ = o.GetPropertiesOk() + return +} + +// GetPropertiesOk returns a tuple with the Properties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ParametersSchema) GetPropertiesOk() (ret ParametersSchemaGetPropertiesRetType, ok bool) { + return getParametersSchemaGetPropertiesAttributeTypeOk(o.Properties) +} + +// HasProperties returns a boolean if a field has been set. +func (o *ParametersSchema) HasProperties() bool { + _, ok := o.GetPropertiesOk() + return ok +} + +// SetProperties gets a reference to the given Properties and assigns it to the Properties field. +func (o *ParametersSchema) SetProperties(v ParametersSchemaGetPropertiesRetType) { + setParametersSchemaGetPropertiesAttributeType(&o.Properties, v) +} + +func (o ParametersSchema) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getParametersSchemaGetPropertiesAttributeTypeOk(o.Properties); ok { + toSerialize["Properties"] = val + } + return toSerialize, nil +} + +type NullableParametersSchema struct { + value *ParametersSchema + isSet bool +} + +func (v NullableParametersSchema) Get() *ParametersSchema { + return v.value +} + +func (v *NullableParametersSchema) Set(val *ParametersSchema) { + v.value = val + v.isSet = true +} + +func (v NullableParametersSchema) IsSet() bool { + return v.isSet +} + +func (v *NullableParametersSchema) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableParametersSchema(val *ParametersSchema) *NullableParametersSchema { + return &NullableParametersSchema{value: val, isSet: true} +} + +func (v NullableParametersSchema) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableParametersSchema) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_parameters_schema_test.go b/pkg/runcommandbeta/model_parameters_schema_test.go new file mode 100644 index 00000000..f2f36c24 --- /dev/null +++ b/pkg/runcommandbeta/model_parameters_schema_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta diff --git a/pkg/runcommandbeta/model_properties.go b/pkg/runcommandbeta/model_properties.go new file mode 100644 index 00000000..b13d4925 --- /dev/null +++ b/pkg/runcommandbeta/model_properties.go @@ -0,0 +1,363 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" +) + +// checks if the Properties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Properties{} + +/* + types and functions for ConfirmPassword +*/ + +// isModel +type PropertiesGetConfirmPasswordAttributeType = *Field +type PropertiesGetConfirmPasswordArgType = Field +type PropertiesGetConfirmPasswordRetType = Field + +func getPropertiesGetConfirmPasswordAttributeTypeOk(arg PropertiesGetConfirmPasswordAttributeType) (ret PropertiesGetConfirmPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPropertiesGetConfirmPasswordAttributeType(arg *PropertiesGetConfirmPasswordAttributeType, val PropertiesGetConfirmPasswordRetType) { + *arg = &val +} + +/* + types and functions for Password +*/ + +// isModel +type PropertiesGetPasswordAttributeType = *Field +type PropertiesGetPasswordArgType = Field +type PropertiesGetPasswordRetType = Field + +func getPropertiesGetPasswordAttributeTypeOk(arg PropertiesGetPasswordAttributeType) (ret PropertiesGetPasswordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPropertiesGetPasswordAttributeType(arg *PropertiesGetPasswordAttributeType, val PropertiesGetPasswordRetType) { + *arg = &val +} + +/* + types and functions for Script +*/ + +// isModel +type PropertiesGetScriptAttributeType = *Field +type PropertiesGetScriptArgType = Field +type PropertiesGetScriptRetType = Field + +func getPropertiesGetScriptAttributeTypeOk(arg PropertiesGetScriptAttributeType) (ret PropertiesGetScriptRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPropertiesGetScriptAttributeType(arg *PropertiesGetScriptAttributeType, val PropertiesGetScriptRetType) { + *arg = &val +} + +/* + types and functions for Username +*/ + +// isModel +type PropertiesGetUsernameAttributeType = *Field +type PropertiesGetUsernameArgType = Field +type PropertiesGetUsernameRetType = Field + +func getPropertiesGetUsernameAttributeTypeOk(arg PropertiesGetUsernameAttributeType) (ret PropertiesGetUsernameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPropertiesGetUsernameAttributeType(arg *PropertiesGetUsernameAttributeType, val PropertiesGetUsernameRetType) { + *arg = &val +} + +/* + types and functions for required +*/ + +// isArray +type PropertiesGetRequiredAttributeType = *[]string +type PropertiesGetRequiredArgType = []string +type PropertiesGetRequiredRetType = []string + +func getPropertiesGetRequiredAttributeTypeOk(arg PropertiesGetRequiredAttributeType) (ret PropertiesGetRequiredRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPropertiesGetRequiredAttributeType(arg *PropertiesGetRequiredAttributeType, val PropertiesGetRequiredRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isNotNullableString +type PropertiesGetTypeAttributeType = *string + +func getPropertiesGetTypeAttributeTypeOk(arg PropertiesGetTypeAttributeType) (ret PropertiesGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPropertiesGetTypeAttributeType(arg *PropertiesGetTypeAttributeType, val PropertiesGetTypeRetType) { + *arg = &val +} + +type PropertiesGetTypeArgType = string +type PropertiesGetTypeRetType = string + +// Properties struct for Properties +type Properties struct { + ConfirmPassword PropertiesGetConfirmPasswordAttributeType `json:"ConfirmPassword,omitempty"` + Password PropertiesGetPasswordAttributeType `json:"Password,omitempty"` + Script PropertiesGetScriptAttributeType `json:"Script,omitempty"` + Username PropertiesGetUsernameAttributeType `json:"Username,omitempty"` + Required PropertiesGetRequiredAttributeType `json:"required,omitempty"` + Type PropertiesGetTypeAttributeType `json:"type,omitempty"` +} + +// NewProperties instantiates a new Properties 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 NewProperties() *Properties { + this := Properties{} + return &this +} + +// NewPropertiesWithDefaults instantiates a new Properties 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 NewPropertiesWithDefaults() *Properties { + this := Properties{} + return &this +} + +// GetConfirmPassword returns the ConfirmPassword field value if set, zero value otherwise. +func (o *Properties) GetConfirmPassword() (res PropertiesGetConfirmPasswordRetType) { + res, _ = o.GetConfirmPasswordOk() + return +} + +// GetConfirmPasswordOk returns a tuple with the ConfirmPassword field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Properties) GetConfirmPasswordOk() (ret PropertiesGetConfirmPasswordRetType, ok bool) { + return getPropertiesGetConfirmPasswordAttributeTypeOk(o.ConfirmPassword) +} + +// HasConfirmPassword returns a boolean if a field has been set. +func (o *Properties) HasConfirmPassword() bool { + _, ok := o.GetConfirmPasswordOk() + return ok +} + +// SetConfirmPassword gets a reference to the given Field and assigns it to the ConfirmPassword field. +func (o *Properties) SetConfirmPassword(v PropertiesGetConfirmPasswordRetType) { + setPropertiesGetConfirmPasswordAttributeType(&o.ConfirmPassword, v) +} + +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *Properties) GetPassword() (res PropertiesGetPasswordRetType) { + res, _ = o.GetPasswordOk() + return +} + +// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Properties) GetPasswordOk() (ret PropertiesGetPasswordRetType, ok bool) { + return getPropertiesGetPasswordAttributeTypeOk(o.Password) +} + +// HasPassword returns a boolean if a field has been set. +func (o *Properties) HasPassword() bool { + _, ok := o.GetPasswordOk() + return ok +} + +// SetPassword gets a reference to the given Field and assigns it to the Password field. +func (o *Properties) SetPassword(v PropertiesGetPasswordRetType) { + setPropertiesGetPasswordAttributeType(&o.Password, v) +} + +// GetScript returns the Script field value if set, zero value otherwise. +func (o *Properties) GetScript() (res PropertiesGetScriptRetType) { + res, _ = o.GetScriptOk() + return +} + +// GetScriptOk returns a tuple with the Script field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Properties) GetScriptOk() (ret PropertiesGetScriptRetType, ok bool) { + return getPropertiesGetScriptAttributeTypeOk(o.Script) +} + +// HasScript returns a boolean if a field has been set. +func (o *Properties) HasScript() bool { + _, ok := o.GetScriptOk() + return ok +} + +// SetScript gets a reference to the given Field and assigns it to the Script field. +func (o *Properties) SetScript(v PropertiesGetScriptRetType) { + setPropertiesGetScriptAttributeType(&o.Script, v) +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *Properties) GetUsername() (res PropertiesGetUsernameRetType) { + res, _ = o.GetUsernameOk() + return +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Properties) GetUsernameOk() (ret PropertiesGetUsernameRetType, ok bool) { + return getPropertiesGetUsernameAttributeTypeOk(o.Username) +} + +// HasUsername returns a boolean if a field has been set. +func (o *Properties) HasUsername() bool { + _, ok := o.GetUsernameOk() + return ok +} + +// SetUsername gets a reference to the given Field and assigns it to the Username field. +func (o *Properties) SetUsername(v PropertiesGetUsernameRetType) { + setPropertiesGetUsernameAttributeType(&o.Username, v) +} + +// GetRequired returns the Required field value if set, zero value otherwise. +func (o *Properties) GetRequired() (res PropertiesGetRequiredRetType) { + res, _ = o.GetRequiredOk() + return +} + +// GetRequiredOk returns a tuple with the Required field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Properties) GetRequiredOk() (ret PropertiesGetRequiredRetType, ok bool) { + return getPropertiesGetRequiredAttributeTypeOk(o.Required) +} + +// HasRequired returns a boolean if a field has been set. +func (o *Properties) HasRequired() bool { + _, ok := o.GetRequiredOk() + return ok +} + +// SetRequired gets a reference to the given []string and assigns it to the Required field. +func (o *Properties) SetRequired(v PropertiesGetRequiredRetType) { + setPropertiesGetRequiredAttributeType(&o.Required, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Properties) GetType() (res PropertiesGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Properties) GetTypeOk() (ret PropertiesGetTypeRetType, ok bool) { + return getPropertiesGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *Properties) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Properties) SetType(v PropertiesGetTypeRetType) { + setPropertiesGetTypeAttributeType(&o.Type, v) +} + +func (o Properties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPropertiesGetConfirmPasswordAttributeTypeOk(o.ConfirmPassword); ok { + toSerialize["ConfirmPassword"] = val + } + if val, ok := getPropertiesGetPasswordAttributeTypeOk(o.Password); ok { + toSerialize["Password"] = val + } + if val, ok := getPropertiesGetScriptAttributeTypeOk(o.Script); ok { + toSerialize["Script"] = val + } + if val, ok := getPropertiesGetUsernameAttributeTypeOk(o.Username); ok { + toSerialize["Username"] = val + } + if val, ok := getPropertiesGetRequiredAttributeTypeOk(o.Required); ok { + toSerialize["Required"] = val + } + if val, ok := getPropertiesGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableProperties struct { + value *Properties + isSet bool +} + +func (v NullableProperties) Get() *Properties { + return v.value +} + +func (v *NullableProperties) Set(val *Properties) { + v.value = val + v.isSet = true +} + +func (v NullableProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProperties(val *Properties) *NullableProperties { + return &NullableProperties{value: val, isSet: true} +} + +func (v NullableProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/runcommandbeta/model_properties_test.go b/pkg/runcommandbeta/model_properties_test.go new file mode 100644 index 00000000..f2f36c24 --- /dev/null +++ b/pkg/runcommandbeta/model_properties_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta diff --git a/pkg/runcommandbeta/utils.go b/pkg/runcommandbeta/utils.go new file mode 100644 index 00000000..a54cb320 --- /dev/null +++ b/pkg/runcommandbeta/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT Run Commands Service API + +API endpoints for the STACKIT Run Commands Service API + +API version: 2beta.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package runcommandbeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/sfsbeta/.openapi-generator/VERSION b/pkg/sfsbeta/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/sfsbeta/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/sfsbeta/api_default.go b/pkg/sfsbeta/api_default.go new file mode 100644 index 00000000..89c788ba --- /dev/null +++ b/pkg/sfsbeta/api_default.go @@ -0,0 +1,4055 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateResourcePool Create Resource Pool + Create a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateResourcePoolRequest + */ + CreateResourcePool(ctx context.Context, projectId string, region string) ApiCreateResourcePoolRequest + /* + CreateResourcePoolExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return CreateResourcePoolResponse + + */ + CreateResourcePoolExecute(ctx context.Context, projectId string, region string) (*CreateResourcePoolResponse, error) + /* + CreateResourcePoolSnapshot Create Resource Pool Snapshot + Creates a Snapshot of a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiCreateResourcePoolSnapshotRequest + */ + CreateResourcePoolSnapshot(ctx context.Context, projectId string, region string, resourcePoolId string) ApiCreateResourcePoolSnapshotRequest + /* + CreateResourcePoolSnapshotExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return CreateResourcePoolSnapshotResponse + + */ + CreateResourcePoolSnapshotExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*CreateResourcePoolSnapshotResponse, error) + /* + CreateShare Create Share + Creates a Share in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiCreateShareRequest + */ + CreateShare(ctx context.Context, projectId string, region string, resourcePoolId string) ApiCreateShareRequest + /* + CreateShareExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return CreateShareResponse + + */ + CreateShareExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*CreateShareResponse, error) + /* + CreateShareExportPolicy Create Share Export Policy + Creates a ShareExportPolicy in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateShareExportPolicyRequest + */ + CreateShareExportPolicy(ctx context.Context, projectId string, region string) ApiCreateShareExportPolicyRequest + /* + CreateShareExportPolicyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return CreateShareExportPolicyResponse + + */ + CreateShareExportPolicyExecute(ctx context.Context, projectId string, region string) (*CreateShareExportPolicyResponse, error) + /* + DeleteResourcePool Delete Resource Pool + Deletes a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiDeleteResourcePoolRequest + */ + DeleteResourcePool(ctx context.Context, projectId string, region string, resourcePoolId string) ApiDeleteResourcePoolRequest + /* + DeleteResourcePoolExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return map[string]interface{} + + */ + DeleteResourcePoolExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (map[string]interface{}, error) + /* + DeleteResourcePoolSnapshot Delete Resource Pool Snapshot + Deletes a Snapshot from a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param snapshotName + @return ApiDeleteResourcePoolSnapshotRequest + */ + DeleteResourcePoolSnapshot(ctx context.Context, projectId string, region string, resourcePoolId string, snapshotName string) ApiDeleteResourcePoolSnapshotRequest + /* + DeleteResourcePoolSnapshotExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param snapshotName + @return map[string]interface{} + + */ + DeleteResourcePoolSnapshotExecute(ctx context.Context, projectId string, region string, resourcePoolId string, snapshotName string) (map[string]interface{}, error) + /* + DeleteShare Delete Share + Deletes a Shares in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param shareId + @return ApiDeleteShareRequest + */ + DeleteShare(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) ApiDeleteShareRequest + /* + DeleteShareExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param shareId + @return map[string]interface{} + + */ + DeleteShareExecute(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) (map[string]interface{}, error) + /* + DeleteShareExportPolicy Delete Share Export Policy + Deletes a ShareExportPolicies in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param policyId + @return ApiDeleteShareExportPolicyRequest + */ + DeleteShareExportPolicy(ctx context.Context, projectId string, region string, policyId string) ApiDeleteShareExportPolicyRequest + /* + DeleteShareExportPolicyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param policyId + @return map[string]interface{} + + */ + DeleteShareExportPolicyExecute(ctx context.Context, projectId string, region string, policyId string) (map[string]interface{}, error) + /* + GetResourcePool Get Resource Pool + Retrieves a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiGetResourcePoolRequest + */ + GetResourcePool(ctx context.Context, projectId string, region string, resourcePoolId string) ApiGetResourcePoolRequest + /* + GetResourcePoolExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return GetResourcePoolResponse + + */ + GetResourcePoolExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*GetResourcePoolResponse, error) + /* + GetResourcePoolSnapshot Get Resource Pool Snapshot + Retrieves a Snapshot from a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param snapshotName + @return ApiGetResourcePoolSnapshotRequest + */ + GetResourcePoolSnapshot(ctx context.Context, projectId string, region string, resourcePoolId string, snapshotName string) ApiGetResourcePoolSnapshotRequest + /* + GetResourcePoolSnapshotExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param snapshotName + @return GetResourcePoolSnapshotResponse + + */ + GetResourcePoolSnapshotExecute(ctx context.Context, projectId string, region string, resourcePoolId string, snapshotName string) (*GetResourcePoolSnapshotResponse, error) + /* + GetShare Get Share + Retrieves a Shares in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param shareId + @return ApiGetShareRequest + */ + GetShare(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) ApiGetShareRequest + /* + GetShareExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param shareId + @return GetShareResponse + + */ + GetShareExecute(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) (*GetShareResponse, error) + /* + GetShareExportPolicy Get Share Export Policy + Retrieves a ShareExportPolicies in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param policyId + @return ApiGetShareExportPolicyRequest + */ + GetShareExportPolicy(ctx context.Context, projectId string, region string, policyId string) ApiGetShareExportPolicyRequest + /* + GetShareExportPolicyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param policyId + @return GetShareExportPolicyResponse + + */ + GetShareExportPolicyExecute(ctx context.Context, projectId string, region string, policyId string) (*GetShareExportPolicyResponse, error) + /* + ListPerformanceClasses List Resource Performance Classes + Lists all performances classes available + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListPerformanceClassesRequest + */ + ListPerformanceClasses(ctx context.Context) ApiListPerformanceClassesRequest + /* + ListPerformanceClassesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ListPerformanceClassesResponse + + */ + ListPerformanceClassesExecute(ctx context.Context) (*ListPerformanceClassesResponse, error) + /* + ListResourcePoolSnapshots List Resource Pool Snapshots + Lists the Snapshots of a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiListResourcePoolSnapshotsRequest + */ + ListResourcePoolSnapshots(ctx context.Context, projectId string, region string, resourcePoolId string) ApiListResourcePoolSnapshotsRequest + /* + ListResourcePoolSnapshotsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ListResourcePoolSnapshotsResponse + + */ + ListResourcePoolSnapshotsExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*ListResourcePoolSnapshotsResponse, error) + /* + ListResourcePools List Resource Pools + Lists Resource Pools in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListResourcePoolsRequest + */ + ListResourcePools(ctx context.Context, projectId string, region string) ApiListResourcePoolsRequest + /* + ListResourcePoolsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ListResourcePoolsResponse + + */ + ListResourcePoolsExecute(ctx context.Context, projectId string, region string) (*ListResourcePoolsResponse, error) + /* + ListShareExportPolicies List Share Export Policies + Lists ShareExportPolicies in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListShareExportPoliciesRequest + */ + ListShareExportPolicies(ctx context.Context, projectId string, region string) ApiListShareExportPoliciesRequest + /* + ListShareExportPoliciesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ListShareExportPoliciesResponse + + */ + ListShareExportPoliciesExecute(ctx context.Context, projectId string, region string) (*ListShareExportPoliciesResponse, error) + /* + ListShares List Shares + Lists Shares in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiListSharesRequest + */ + ListShares(ctx context.Context, projectId string, region string, resourcePoolId string) ApiListSharesRequest + /* + ListSharesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ListSharesResponse + + */ + ListSharesExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*ListSharesResponse, error) + /* + ListSnapshotSchedules List Snapshot Schedules + Lists snapshot schedules + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @return ApiListSnapshotSchedulesRequest + */ + ListSnapshotSchedules(ctx context.Context, projectId string) ApiListSnapshotSchedulesRequest + /* + ListSnapshotSchedulesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @return ListSnapshotSchedulesResponse + + */ + ListSnapshotSchedulesExecute(ctx context.Context, projectId string) (*ListSnapshotSchedulesResponse, error) + /* + UpdateResourcePool Update Resource Pool + Updates a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiUpdateResourcePoolRequest + */ + UpdateResourcePool(ctx context.Context, projectId string, region string, resourcePoolId string) ApiUpdateResourcePoolRequest + /* + UpdateResourcePoolExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return UpdateResourcePoolResponse + + */ + UpdateResourcePoolExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*UpdateResourcePoolResponse, error) + /* + UpdateShare Update Share + Updates a Shares in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param shareId + @return ApiUpdateShareRequest + */ + UpdateShare(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) ApiUpdateShareRequest + /* + UpdateShareExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param shareId + @return UpdateShareResponse + + */ + UpdateShareExecute(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) (*UpdateShareResponse, error) + /* + UpdateShareExportPolicy Update Share Export Policy + Updates a ShareExportPolicies in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param policyId + @return ApiUpdateShareExportPolicyRequest + */ + UpdateShareExportPolicy(ctx context.Context, projectId string, region string, policyId string) ApiUpdateShareExportPolicyRequest + /* + UpdateShareExportPolicyExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param policyId + @return UpdateShareExportPolicyResponse + + */ + UpdateShareExportPolicyExecute(ctx context.Context, projectId string, region string, policyId string) (*UpdateShareExportPolicyResponse, error) +} + +type ApiCreateResourcePoolRequest interface { + CreateResourcePoolPayload(createResourcePoolPayload CreateResourcePoolPayload) ApiCreateResourcePoolRequest + Execute() (*CreateResourcePoolResponse, error) +} + +type ApiCreateResourcePoolSnapshotRequest interface { + CreateResourcePoolSnapshotPayload(createResourcePoolSnapshotPayload CreateResourcePoolSnapshotPayload) ApiCreateResourcePoolSnapshotRequest + Execute() (*CreateResourcePoolSnapshotResponse, error) +} + +type ApiCreateShareRequest interface { + CreateSharePayload(createSharePayload CreateSharePayload) ApiCreateShareRequest + Execute() (*CreateShareResponse, error) +} + +type ApiCreateShareExportPolicyRequest interface { + CreateShareExportPolicyPayload(createShareExportPolicyPayload CreateShareExportPolicyPayload) ApiCreateShareExportPolicyRequest + Execute() (*CreateShareExportPolicyResponse, error) +} + +type ApiDeleteResourcePoolRequest interface { + Execute() (map[string]interface{}, error) +} + +type ApiDeleteResourcePoolSnapshotRequest interface { + Execute() (map[string]interface{}, error) +} + +type ApiDeleteShareRequest interface { + Execute() (map[string]interface{}, error) +} + +type ApiDeleteShareExportPolicyRequest interface { + Execute() (map[string]interface{}, error) +} + +type ApiGetResourcePoolRequest interface { + Execute() (*GetResourcePoolResponse, error) +} + +type ApiGetResourcePoolSnapshotRequest interface { + Execute() (*GetResourcePoolSnapshotResponse, error) +} + +type ApiGetShareRequest interface { + Execute() (*GetShareResponse, error) +} + +type ApiGetShareExportPolicyRequest interface { + Execute() (*GetShareExportPolicyResponse, error) +} + +type ApiListPerformanceClassesRequest interface { + Execute() (*ListPerformanceClassesResponse, error) +} + +type ApiListResourcePoolSnapshotsRequest interface { + Execute() (*ListResourcePoolSnapshotsResponse, error) +} + +type ApiListResourcePoolsRequest interface { + Execute() (*ListResourcePoolsResponse, error) +} + +type ApiListShareExportPoliciesRequest interface { + Execute() (*ListShareExportPoliciesResponse, error) +} + +type ApiListSharesRequest interface { + Execute() (*ListSharesResponse, error) +} + +type ApiListSnapshotSchedulesRequest interface { + Execute() (*ListSnapshotSchedulesResponse, error) +} + +type ApiUpdateResourcePoolRequest interface { + UpdateResourcePoolPayload(updateResourcePoolPayload UpdateResourcePoolPayload) ApiUpdateResourcePoolRequest + Execute() (*UpdateResourcePoolResponse, error) +} + +type ApiUpdateShareRequest interface { + UpdateSharePayload(updateSharePayload UpdateSharePayload) ApiUpdateShareRequest + Execute() (*UpdateShareResponse, error) +} + +type ApiUpdateShareExportPolicyRequest interface { + UpdateShareExportPolicyPayload(updateShareExportPolicyPayload UpdateShareExportPolicyPayload) ApiUpdateShareExportPolicyRequest + Execute() (*UpdateShareExportPolicyResponse, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateResourcePoolRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createResourcePoolPayload *CreateResourcePoolPayload +} + +func (r CreateResourcePoolRequest) CreateResourcePoolPayload(createResourcePoolPayload CreateResourcePoolPayload) ApiCreateResourcePoolRequest { + r.createResourcePoolPayload = &createResourcePoolPayload + return r +} + +func (r CreateResourcePoolRequest) Execute() (*CreateResourcePoolResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateResourcePoolResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateResourcePool") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createResourcePoolPayload == nil { + return localVarReturnValue, fmt.Errorf("createResourcePoolPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createResourcePoolPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateResourcePool: Create Resource Pool + +Create a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateResourcePoolRequest +*/ +func (a *APIClient) CreateResourcePool(ctx context.Context, projectId string, region string) ApiCreateResourcePoolRequest { + return CreateResourcePoolRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateResourcePoolExecute(ctx context.Context, projectId string, region string) (*CreateResourcePoolResponse, error) { + r := CreateResourcePoolRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateResourcePoolSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string + createResourcePoolSnapshotPayload *CreateResourcePoolSnapshotPayload +} + +func (r CreateResourcePoolSnapshotRequest) CreateResourcePoolSnapshotPayload(createResourcePoolSnapshotPayload CreateResourcePoolSnapshotPayload) ApiCreateResourcePoolSnapshotRequest { + r.createResourcePoolSnapshotPayload = &createResourcePoolSnapshotPayload + return r +} + +func (r CreateResourcePoolSnapshotRequest) Execute() (*CreateResourcePoolSnapshotResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateResourcePoolSnapshotResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateResourcePoolSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createResourcePoolSnapshotPayload == nil { + return localVarReturnValue, fmt.Errorf("createResourcePoolSnapshotPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createResourcePoolSnapshotPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateResourcePoolSnapshot: Create Resource Pool Snapshot + +Creates a Snapshot of a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiCreateResourcePoolSnapshotRequest +*/ +func (a *APIClient) CreateResourcePoolSnapshot(ctx context.Context, projectId string, region string, resourcePoolId string) ApiCreateResourcePoolSnapshotRequest { + return CreateResourcePoolSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } +} + +func (a *APIClient) CreateResourcePoolSnapshotExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*CreateResourcePoolSnapshotResponse, error) { + r := CreateResourcePoolSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } + return r.Execute() +} + +type CreateShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string + createSharePayload *CreateSharePayload +} + +func (r CreateShareRequest) CreateSharePayload(createSharePayload CreateSharePayload) ApiCreateShareRequest { + r.createSharePayload = &createSharePayload + return r +} + +func (r CreateShareRequest) Execute() (*CreateShareResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateShareResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createSharePayload == nil { + return localVarReturnValue, fmt.Errorf("createSharePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createSharePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateShare: Create Share + +Creates a Share in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiCreateShareRequest +*/ +func (a *APIClient) CreateShare(ctx context.Context, projectId string, region string, resourcePoolId string) ApiCreateShareRequest { + return CreateShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } +} + +func (a *APIClient) CreateShareExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*CreateShareResponse, error) { + r := CreateShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } + return r.Execute() +} + +type CreateShareExportPolicyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createShareExportPolicyPayload *CreateShareExportPolicyPayload +} + +func (r CreateShareExportPolicyRequest) CreateShareExportPolicyPayload(createShareExportPolicyPayload CreateShareExportPolicyPayload) ApiCreateShareExportPolicyRequest { + r.createShareExportPolicyPayload = &createShareExportPolicyPayload + return r +} + +func (r CreateShareExportPolicyRequest) Execute() (*CreateShareExportPolicyResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateShareExportPolicyResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateShareExportPolicy") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/shareExportPolicies" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createShareExportPolicyPayload == nil { + return localVarReturnValue, fmt.Errorf("createShareExportPolicyPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createShareExportPolicyPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateShareExportPolicy: Create Share Export Policy + +Creates a ShareExportPolicy in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateShareExportPolicyRequest +*/ +func (a *APIClient) CreateShareExportPolicy(ctx context.Context, projectId string, region string) ApiCreateShareExportPolicyRequest { + return CreateShareExportPolicyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateShareExportPolicyExecute(ctx context.Context, projectId string, region string) (*CreateShareExportPolicyResponse, error) { + r := CreateShareExportPolicyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type DeleteResourcePoolRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string +} + +func (r DeleteResourcePoolRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteResourcePool") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteResourcePool: Delete Resource Pool + +Deletes a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiDeleteResourcePoolRequest +*/ +func (a *APIClient) DeleteResourcePool(ctx context.Context, projectId string, region string, resourcePoolId string) ApiDeleteResourcePoolRequest { + return DeleteResourcePoolRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } +} + +func (a *APIClient) DeleteResourcePoolExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (map[string]interface{}, error) { + r := DeleteResourcePoolRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } + return r.Execute() +} + +type DeleteResourcePoolSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string + snapshotName string +} + +func (r DeleteResourcePoolSnapshotRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteResourcePoolSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots/{snapshotName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotName"+"}", url.PathEscape(ParameterValueToString(r.snapshotName, "snapshotName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteResourcePoolSnapshot: Delete Resource Pool Snapshot + +Deletes a Snapshot from a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param snapshotName + @return ApiDeleteResourcePoolSnapshotRequest +*/ +func (a *APIClient) DeleteResourcePoolSnapshot(ctx context.Context, projectId string, region string, resourcePoolId string, snapshotName string) ApiDeleteResourcePoolSnapshotRequest { + return DeleteResourcePoolSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + snapshotName: snapshotName, + } +} + +func (a *APIClient) DeleteResourcePoolSnapshotExecute(ctx context.Context, projectId string, region string, resourcePoolId string, snapshotName string) (map[string]interface{}, error) { + r := DeleteResourcePoolSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + snapshotName: snapshotName, + } + return r.Execute() +} + +type DeleteShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string + shareId string +} + +func (r DeleteShareRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares/{shareId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"shareId"+"}", url.PathEscape(ParameterValueToString(r.shareId, "shareId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteShare: Delete Share + +Deletes a Shares in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param shareId + @return ApiDeleteShareRequest +*/ +func (a *APIClient) DeleteShare(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) ApiDeleteShareRequest { + return DeleteShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + shareId: shareId, + } +} + +func (a *APIClient) DeleteShareExecute(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) (map[string]interface{}, error) { + r := DeleteShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + shareId: shareId, + } + return r.Execute() +} + +type DeleteShareExportPolicyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + policyId string +} + +func (r DeleteShareExportPolicyRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteShareExportPolicy") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/shareExportPolicies/{policyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"policyId"+"}", url.PathEscape(ParameterValueToString(r.policyId, "policyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteShareExportPolicy: Delete Share Export Policy + +Deletes a ShareExportPolicies in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param policyId + @return ApiDeleteShareExportPolicyRequest +*/ +func (a *APIClient) DeleteShareExportPolicy(ctx context.Context, projectId string, region string, policyId string) ApiDeleteShareExportPolicyRequest { + return DeleteShareExportPolicyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + policyId: policyId, + } +} + +func (a *APIClient) DeleteShareExportPolicyExecute(ctx context.Context, projectId string, region string, policyId string) (map[string]interface{}, error) { + r := DeleteShareExportPolicyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + policyId: policyId, + } + return r.Execute() +} + +type GetResourcePoolRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string +} + +func (r GetResourcePoolRequest) Execute() (*GetResourcePoolResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetResourcePoolResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetResourcePool") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetResourcePool: Get Resource Pool + +Retrieves a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiGetResourcePoolRequest +*/ +func (a *APIClient) GetResourcePool(ctx context.Context, projectId string, region string, resourcePoolId string) ApiGetResourcePoolRequest { + return GetResourcePoolRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } +} + +func (a *APIClient) GetResourcePoolExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*GetResourcePoolResponse, error) { + r := GetResourcePoolRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } + return r.Execute() +} + +type GetResourcePoolSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string + snapshotName string +} + +func (r GetResourcePoolSnapshotRequest) Execute() (*GetResourcePoolSnapshotResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetResourcePoolSnapshotResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetResourcePoolSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots/{snapshotName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotName"+"}", url.PathEscape(ParameterValueToString(r.snapshotName, "snapshotName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetResourcePoolSnapshot: Get Resource Pool Snapshot + +Retrieves a Snapshot from a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param snapshotName + @return ApiGetResourcePoolSnapshotRequest +*/ +func (a *APIClient) GetResourcePoolSnapshot(ctx context.Context, projectId string, region string, resourcePoolId string, snapshotName string) ApiGetResourcePoolSnapshotRequest { + return GetResourcePoolSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + snapshotName: snapshotName, + } +} + +func (a *APIClient) GetResourcePoolSnapshotExecute(ctx context.Context, projectId string, region string, resourcePoolId string, snapshotName string) (*GetResourcePoolSnapshotResponse, error) { + r := GetResourcePoolSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + snapshotName: snapshotName, + } + return r.Execute() +} + +type GetShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string + shareId string +} + +func (r GetShareRequest) Execute() (*GetShareResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetShareResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares/{shareId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"shareId"+"}", url.PathEscape(ParameterValueToString(r.shareId, "shareId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetShare: Get Share + +Retrieves a Shares in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param shareId + @return ApiGetShareRequest +*/ +func (a *APIClient) GetShare(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) ApiGetShareRequest { + return GetShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + shareId: shareId, + } +} + +func (a *APIClient) GetShareExecute(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) (*GetShareResponse, error) { + r := GetShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + shareId: shareId, + } + return r.Execute() +} + +type GetShareExportPolicyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + policyId string +} + +func (r GetShareExportPolicyRequest) Execute() (*GetShareExportPolicyResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetShareExportPolicyResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetShareExportPolicy") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/shareExportPolicies/{policyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"policyId"+"}", url.PathEscape(ParameterValueToString(r.policyId, "policyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetShareExportPolicy: Get Share Export Policy + +Retrieves a ShareExportPolicies in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param policyId + @return ApiGetShareExportPolicyRequest +*/ +func (a *APIClient) GetShareExportPolicy(ctx context.Context, projectId string, region string, policyId string) ApiGetShareExportPolicyRequest { + return GetShareExportPolicyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + policyId: policyId, + } +} + +func (a *APIClient) GetShareExportPolicyExecute(ctx context.Context, projectId string, region string, policyId string) (*GetShareExportPolicyResponse, error) { + r := GetShareExportPolicyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + policyId: policyId, + } + return r.Execute() +} + +type ListPerformanceClassesRequest struct { + ctx context.Context + apiService *DefaultApiService +} + +func (r ListPerformanceClassesRequest) Execute() (*ListPerformanceClassesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListPerformanceClassesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPerformanceClasses") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/resourcePoolPerformanceClasses" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListPerformanceClasses: List Resource Performance Classes + +Lists all performances classes available + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListPerformanceClassesRequest +*/ +func (a *APIClient) ListPerformanceClasses(ctx context.Context) ApiListPerformanceClassesRequest { + return ListPerformanceClassesRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +func (a *APIClient) ListPerformanceClassesExecute(ctx context.Context) (*ListPerformanceClassesResponse, error) { + r := ListPerformanceClassesRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + +type ListResourcePoolSnapshotsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string +} + +func (r ListResourcePoolSnapshotsRequest) Execute() (*ListResourcePoolSnapshotsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListResourcePoolSnapshotsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListResourcePoolSnapshots") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListResourcePoolSnapshots: List Resource Pool Snapshots + +Lists the Snapshots of a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiListResourcePoolSnapshotsRequest +*/ +func (a *APIClient) ListResourcePoolSnapshots(ctx context.Context, projectId string, region string, resourcePoolId string) ApiListResourcePoolSnapshotsRequest { + return ListResourcePoolSnapshotsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } +} + +func (a *APIClient) ListResourcePoolSnapshotsExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*ListResourcePoolSnapshotsResponse, error) { + r := ListResourcePoolSnapshotsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } + return r.Execute() +} + +type ListResourcePoolsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string +} + +func (r ListResourcePoolsRequest) Execute() (*ListResourcePoolsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListResourcePoolsResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListResourcePools") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListResourcePools: List Resource Pools + +Lists Resource Pools in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListResourcePoolsRequest +*/ +func (a *APIClient) ListResourcePools(ctx context.Context, projectId string, region string) ApiListResourcePoolsRequest { + return ListResourcePoolsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListResourcePoolsExecute(ctx context.Context, projectId string, region string) (*ListResourcePoolsResponse, error) { + r := ListResourcePoolsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListShareExportPoliciesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string +} + +func (r ListShareExportPoliciesRequest) Execute() (*ListShareExportPoliciesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListShareExportPoliciesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListShareExportPolicies") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/shareExportPolicies" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListShareExportPolicies: List Share Export Policies + +Lists ShareExportPolicies in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListShareExportPoliciesRequest +*/ +func (a *APIClient) ListShareExportPolicies(ctx context.Context, projectId string, region string) ApiListShareExportPoliciesRequest { + return ListShareExportPoliciesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListShareExportPoliciesExecute(ctx context.Context, projectId string, region string) (*ListShareExportPoliciesResponse, error) { + r := ListShareExportPoliciesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListSharesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string +} + +func (r ListSharesRequest) Execute() (*ListSharesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListSharesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListShares") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListShares: List Shares + +Lists Shares in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiListSharesRequest +*/ +func (a *APIClient) ListShares(ctx context.Context, projectId string, region string, resourcePoolId string) ApiListSharesRequest { + return ListSharesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } +} + +func (a *APIClient) ListSharesExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*ListSharesResponse, error) { + r := ListSharesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } + return r.Execute() +} + +type ListSnapshotSchedulesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r ListSnapshotSchedulesRequest) Execute() (*ListSnapshotSchedulesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListSnapshotSchedulesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSnapshotSchedules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/snapshotSchedules" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListSnapshotSchedules: List Snapshot Schedules + +Lists snapshot schedules + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @return ApiListSnapshotSchedulesRequest +*/ +func (a *APIClient) ListSnapshotSchedules(ctx context.Context, projectId string) ApiListSnapshotSchedulesRequest { + return ListSnapshotSchedulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListSnapshotSchedulesExecute(ctx context.Context, projectId string) (*ListSnapshotSchedulesResponse, error) { + r := ListSnapshotSchedulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type UpdateResourcePoolRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string + updateResourcePoolPayload *UpdateResourcePoolPayload +} + +func (r UpdateResourcePoolRequest) UpdateResourcePoolPayload(updateResourcePoolPayload UpdateResourcePoolPayload) ApiUpdateResourcePoolRequest { + r.updateResourcePoolPayload = &updateResourcePoolPayload + return r +} + +func (r UpdateResourcePoolRequest) Execute() (*UpdateResourcePoolResponse, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UpdateResourcePoolResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateResourcePool") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateResourcePoolPayload == nil { + return localVarReturnValue, fmt.Errorf("updateResourcePoolPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateResourcePoolPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateResourcePool: Update Resource Pool + +Updates a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @return ApiUpdateResourcePoolRequest +*/ +func (a *APIClient) UpdateResourcePool(ctx context.Context, projectId string, region string, resourcePoolId string) ApiUpdateResourcePoolRequest { + return UpdateResourcePoolRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } +} + +func (a *APIClient) UpdateResourcePoolExecute(ctx context.Context, projectId string, region string, resourcePoolId string) (*UpdateResourcePoolResponse, error) { + r := UpdateResourcePoolRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + } + return r.Execute() +} + +type UpdateShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + resourcePoolId string + shareId string + updateSharePayload *UpdateSharePayload +} + +func (r UpdateShareRequest) UpdateSharePayload(updateSharePayload UpdateSharePayload) ApiUpdateShareRequest { + r.updateSharePayload = &updateSharePayload + return r +} + +func (r UpdateShareRequest) Execute() (*UpdateShareResponse, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UpdateShareResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares/{shareId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(r.resourcePoolId, "resourcePoolId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"shareId"+"}", url.PathEscape(ParameterValueToString(r.shareId, "shareId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateSharePayload == nil { + return localVarReturnValue, fmt.Errorf("updateSharePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateSharePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateShare: Update Share + +Updates a Shares in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param resourcePoolId + @param shareId + @return ApiUpdateShareRequest +*/ +func (a *APIClient) UpdateShare(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) ApiUpdateShareRequest { + return UpdateShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + shareId: shareId, + } +} + +func (a *APIClient) UpdateShareExecute(ctx context.Context, projectId string, region string, resourcePoolId string, shareId string) (*UpdateShareResponse, error) { + r := UpdateShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + resourcePoolId: resourcePoolId, + shareId: shareId, + } + return r.Execute() +} + +type UpdateShareExportPolicyRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + policyId string + updateShareExportPolicyPayload *UpdateShareExportPolicyPayload +} + +func (r UpdateShareExportPolicyRequest) UpdateShareExportPolicyPayload(updateShareExportPolicyPayload UpdateShareExportPolicyPayload) ApiUpdateShareExportPolicyRequest { + r.updateShareExportPolicyPayload = &updateShareExportPolicyPayload + return r +} + +func (r UpdateShareExportPolicyRequest) Execute() (*UpdateShareExportPolicyResponse, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *UpdateShareExportPolicyResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateShareExportPolicy") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{region}/shareExportPolicies/{policyId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"policyId"+"}", url.PathEscape(ParameterValueToString(r.policyId, "policyId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateShareExportPolicyPayload == nil { + return localVarReturnValue, fmt.Errorf("updateShareExportPolicyPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "application/problem+json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateShareExportPolicyPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v ValidationError + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateShareExportPolicy: Update Share Export Policy + +Updates a ShareExportPolicies in a Resource Pool in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param policyId + @return ApiUpdateShareExportPolicyRequest +*/ +func (a *APIClient) UpdateShareExportPolicy(ctx context.Context, projectId string, region string, policyId string) ApiUpdateShareExportPolicyRequest { + return UpdateShareExportPolicyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + policyId: policyId, + } +} + +func (a *APIClient) UpdateShareExportPolicyExecute(ctx context.Context, projectId string, region string, policyId string) (*UpdateShareExportPolicyResponse, error) { + r := UpdateShareExportPolicyRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + policyId: policyId, + } + return r.Execute() +} diff --git a/pkg/sfsbeta/api_default_test.go b/pkg/sfsbeta/api_default_test.go new file mode 100644 index 00000000..30c328a8 --- /dev/null +++ b/pkg/sfsbeta/api_default_test.go @@ -0,0 +1,1238 @@ +/* +STACKIT File Storage (SFS) + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package sfsbeta + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_sfsbeta_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateResourcePool", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateResourcePoolResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createResourcePoolPayload := CreateResourcePoolPayload{} + + resp, reqErr := apiClient.CreateResourcePool(context.Background(), projectId, region).CreateResourcePoolPayload(createResourcePoolPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateResourcePoolSnapshot", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateResourcePoolSnapshotResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + createResourcePoolSnapshotPayload := CreateResourcePoolSnapshotPayload{} + + resp, reqErr := apiClient.CreateResourcePoolSnapshot(context.Background(), projectId, region, resourcePoolId).CreateResourcePoolSnapshotPayload(createResourcePoolSnapshotPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateShare", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateShareResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + createSharePayload := CreateSharePayload{} + + resp, reqErr := apiClient.CreateShare(context.Background(), projectId, region, resourcePoolId).CreateSharePayload(createSharePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateShareExportPolicy", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/shareExportPolicies" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CreateShareExportPolicyResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createShareExportPolicyPayload := CreateShareExportPolicyPayload{} + + resp, reqErr := apiClient.CreateShareExportPolicy(context.Background(), projectId, region).CreateShareExportPolicyPayload(createShareExportPolicyPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteResourcePool", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + + resp, reqErr := apiClient.DeleteResourcePool(context.Background(), projectId, region, resourcePoolId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteResourcePoolSnapshot", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots/{snapshotName}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + snapshotNameValue := "snapshotName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"snapshotName"+"}", url.PathEscape(ParameterValueToString(snapshotNameValue, "snapshotName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + snapshotName := snapshotNameValue + + resp, reqErr := apiClient.DeleteResourcePoolSnapshot(context.Background(), projectId, region, resourcePoolId, snapshotName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteShare", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares/{shareId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + shareIdValue := "shareId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"shareId"+"}", url.PathEscape(ParameterValueToString(shareIdValue, "shareId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + shareId := shareIdValue + + resp, reqErr := apiClient.DeleteShare(context.Background(), projectId, region, resourcePoolId, shareId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteShareExportPolicy", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/shareExportPolicies/{policyId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + policyIdValue := "policyId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"policyId"+"}", url.PathEscape(ParameterValueToString(policyIdValue, "policyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + policyId := policyIdValue + + resp, reqErr := apiClient.DeleteShareExportPolicy(context.Background(), projectId, region, policyId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetResourcePool", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetResourcePoolResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + + resp, reqErr := apiClient.GetResourcePool(context.Background(), projectId, region, resourcePoolId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetResourcePoolSnapshot", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots/{snapshotName}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + snapshotNameValue := "snapshotName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"snapshotName"+"}", url.PathEscape(ParameterValueToString(snapshotNameValue, "snapshotName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetResourcePoolSnapshotResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + snapshotName := snapshotNameValue + + resp, reqErr := apiClient.GetResourcePoolSnapshot(context.Background(), projectId, region, resourcePoolId, snapshotName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetShare", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares/{shareId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + shareIdValue := "shareId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"shareId"+"}", url.PathEscape(ParameterValueToString(shareIdValue, "shareId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetShareResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + shareId := shareIdValue + + resp, reqErr := apiClient.GetShare(context.Background(), projectId, region, resourcePoolId, shareId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetShareExportPolicy", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/shareExportPolicies/{policyId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + policyIdValue := "policyId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"policyId"+"}", url.PathEscape(ParameterValueToString(policyIdValue, "policyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GetShareExportPolicyResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + policyId := policyIdValue + + resp, reqErr := apiClient.GetShareExportPolicy(context.Background(), projectId, region, policyId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListPerformanceClasses", func(t *testing.T) { + _apiUrlPath := "/v1beta/resourcePoolPerformanceClasses" + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListPerformanceClassesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + resp, reqErr := apiClient.ListPerformanceClasses(context.Background()).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListResourcePoolSnapshots", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/snapshots" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListResourcePoolSnapshotsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + + resp, reqErr := apiClient.ListResourcePoolSnapshots(context.Background(), projectId, region, resourcePoolId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListResourcePools", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListResourcePoolsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListResourcePools(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListShareExportPolicies", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/shareExportPolicies" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListShareExportPoliciesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListShareExportPolicies(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListShares", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListSharesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + + resp, reqErr := apiClient.ListShares(context.Background(), projectId, region, resourcePoolId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListSnapshotSchedules", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/snapshotSchedules" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListSnapshotSchedulesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + + resp, reqErr := apiClient.ListSnapshotSchedules(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateResourcePool", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := UpdateResourcePoolResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + updateResourcePoolPayload := UpdateResourcePoolPayload{} + + resp, reqErr := apiClient.UpdateResourcePool(context.Background(), projectId, region, resourcePoolId).UpdateResourcePoolPayload(updateResourcePoolPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateShare", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/resourcePools/{resourcePoolId}/shares/{shareId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + resourcePoolIdValue := "resourcePoolId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"resourcePoolId"+"}", url.PathEscape(ParameterValueToString(resourcePoolIdValue, "resourcePoolId")), -1) + shareIdValue := "shareId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"shareId"+"}", url.PathEscape(ParameterValueToString(shareIdValue, "shareId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := UpdateShareResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + resourcePoolId := resourcePoolIdValue + shareId := shareIdValue + updateSharePayload := UpdateSharePayload{} + + resp, reqErr := apiClient.UpdateShare(context.Background(), projectId, region, resourcePoolId, shareId).UpdateSharePayload(updateSharePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateShareExportPolicy", func(t *testing.T) { + _apiUrlPath := "/v1beta/projects/{projectId}/regions/{region}/shareExportPolicies/{policyId}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + policyIdValue := "policyId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"policyId"+"}", url.PathEscape(ParameterValueToString(policyIdValue, "policyId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := UpdateShareExportPolicyResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sfsbeta_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + policyId := policyIdValue + updateShareExportPolicyPayload := UpdateShareExportPolicyPayload{} + + resp, reqErr := apiClient.UpdateShareExportPolicy(context.Background(), projectId, region, policyId).UpdateShareExportPolicyPayload(updateShareExportPolicyPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/sfsbeta/client.go b/pkg/sfsbeta/client.go new file mode 100644 index 00000000..46d371e9 --- /dev/null +++ b/pkg/sfsbeta/client.go @@ -0,0 +1,628 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT File Storage (SFS) API v1beta.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/sfsbeta/configuration.go b/pkg/sfsbeta/configuration.go new file mode 100644 index 00000000..7d1076ca --- /dev/null +++ b/pkg/sfsbeta/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/sfsbeta", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://sfs.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/sfsbeta/model_create_resource_pool_payload.go b/pkg/sfsbeta/model_create_resource_pool_payload.go new file mode 100644 index 00000000..3a077717 --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_payload.go @@ -0,0 +1,469 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the CreateResourcePoolPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateResourcePoolPayload{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type CreateResourcePoolPayloadGetAvailabilityZoneAttributeType = *string + +func getCreateResourcePoolPayloadGetAvailabilityZoneAttributeTypeOk(arg CreateResourcePoolPayloadGetAvailabilityZoneAttributeType) (ret CreateResourcePoolPayloadGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolPayloadGetAvailabilityZoneAttributeType(arg *CreateResourcePoolPayloadGetAvailabilityZoneAttributeType, val CreateResourcePoolPayloadGetAvailabilityZoneRetType) { + *arg = &val +} + +type CreateResourcePoolPayloadGetAvailabilityZoneArgType = string +type CreateResourcePoolPayloadGetAvailabilityZoneRetType = string + +/* + types and functions for ipAcl +*/ + +// isArray +type CreateResourcePoolPayloadGetIpAclAttributeType = *[]string +type CreateResourcePoolPayloadGetIpAclArgType = []string +type CreateResourcePoolPayloadGetIpAclRetType = []string + +func getCreateResourcePoolPayloadGetIpAclAttributeTypeOk(arg CreateResourcePoolPayloadGetIpAclAttributeType) (ret CreateResourcePoolPayloadGetIpAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolPayloadGetIpAclAttributeType(arg *CreateResourcePoolPayloadGetIpAclAttributeType, val CreateResourcePoolPayloadGetIpAclRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type CreateResourcePoolPayloadGetLabelsAttributeType = *map[string]string +type CreateResourcePoolPayloadGetLabelsArgType = map[string]string +type CreateResourcePoolPayloadGetLabelsRetType = map[string]string + +func getCreateResourcePoolPayloadGetLabelsAttributeTypeOk(arg CreateResourcePoolPayloadGetLabelsAttributeType) (ret CreateResourcePoolPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolPayloadGetLabelsAttributeType(arg *CreateResourcePoolPayloadGetLabelsAttributeType, val CreateResourcePoolPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateResourcePoolPayloadGetNameAttributeType = *string + +func getCreateResourcePoolPayloadGetNameAttributeTypeOk(arg CreateResourcePoolPayloadGetNameAttributeType) (ret CreateResourcePoolPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolPayloadGetNameAttributeType(arg *CreateResourcePoolPayloadGetNameAttributeType, val CreateResourcePoolPayloadGetNameRetType) { + *arg = &val +} + +type CreateResourcePoolPayloadGetNameArgType = string +type CreateResourcePoolPayloadGetNameRetType = string + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type CreateResourcePoolPayloadGetPerformanceClassAttributeType = *string + +func getCreateResourcePoolPayloadGetPerformanceClassAttributeTypeOk(arg CreateResourcePoolPayloadGetPerformanceClassAttributeType) (ret CreateResourcePoolPayloadGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolPayloadGetPerformanceClassAttributeType(arg *CreateResourcePoolPayloadGetPerformanceClassAttributeType, val CreateResourcePoolPayloadGetPerformanceClassRetType) { + *arg = &val +} + +type CreateResourcePoolPayloadGetPerformanceClassArgType = string +type CreateResourcePoolPayloadGetPerformanceClassRetType = string + +/* + types and functions for sizeGigabytes +*/ + +// isInteger +type CreateResourcePoolPayloadGetSizeGigabytesAttributeType = *int64 +type CreateResourcePoolPayloadGetSizeGigabytesArgType = int64 +type CreateResourcePoolPayloadGetSizeGigabytesRetType = int64 + +func getCreateResourcePoolPayloadGetSizeGigabytesAttributeTypeOk(arg CreateResourcePoolPayloadGetSizeGigabytesAttributeType) (ret CreateResourcePoolPayloadGetSizeGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolPayloadGetSizeGigabytesAttributeType(arg *CreateResourcePoolPayloadGetSizeGigabytesAttributeType, val CreateResourcePoolPayloadGetSizeGigabytesRetType) { + *arg = &val +} + +/* + types and functions for snapshotScheduleName +*/ + +// isNotNullableString +type CreateResourcePoolPayloadGetSnapshotScheduleNameAttributeType = *string + +func getCreateResourcePoolPayloadGetSnapshotScheduleNameAttributeTypeOk(arg CreateResourcePoolPayloadGetSnapshotScheduleNameAttributeType) (ret CreateResourcePoolPayloadGetSnapshotScheduleNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolPayloadGetSnapshotScheduleNameAttributeType(arg *CreateResourcePoolPayloadGetSnapshotScheduleNameAttributeType, val CreateResourcePoolPayloadGetSnapshotScheduleNameRetType) { + *arg = &val +} + +type CreateResourcePoolPayloadGetSnapshotScheduleNameArgType = string +type CreateResourcePoolPayloadGetSnapshotScheduleNameRetType = string + +/* + types and functions for snapshotsAreVisible +*/ + +// isBoolean +type CreateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType = *bool +type CreateResourcePoolPayloadgetSnapshotsAreVisibleArgType = bool +type CreateResourcePoolPayloadgetSnapshotsAreVisibleRetType = bool + +func getCreateResourcePoolPayloadgetSnapshotsAreVisibleAttributeTypeOk(arg CreateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType) (ret CreateResourcePoolPayloadgetSnapshotsAreVisibleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType(arg *CreateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType, val CreateResourcePoolPayloadgetSnapshotsAreVisibleRetType) { + *arg = &val +} + +// CreateResourcePoolPayload struct for CreateResourcePoolPayload +type CreateResourcePoolPayload struct { + // Availability zone + AvailabilityZone CreateResourcePoolPayloadGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + // List of IPs that can mount the Resource Pool in read-only; IPs must have a subnet mask (e.g. \"172.16.0.0/24\" for a range of IPs, or \"172.16.0.250/32\" for a specific IP) + IpAcl CreateResourcePoolPayloadGetIpAclAttributeType `json:"ipAcl,omitempty"` + // An optional object that represents the labels associated with the resource pool keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels CreateResourcePoolPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Name of the Resource Pool + Name CreateResourcePoolPayloadGetNameAttributeType `json:"name,omitempty"` + // Name of the performance class + PerformanceClass CreateResourcePoolPayloadGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Size of the Resource Pool (unit: gibibytes) + // Can be cast to int32 without loss of precision. + SizeGigabytes CreateResourcePoolPayloadGetSizeGigabytesAttributeType `json:"sizeGigabytes,omitempty"` + // (optional) Name of the Snapshot Schedule to use + SnapshotScheduleName CreateResourcePoolPayloadGetSnapshotScheduleNameAttributeType `json:"snapshotScheduleName,omitempty"` + // Whether the .snapshot directory is visible when mounting the resource pool. Setting this value to false might prevent you from accessing the snapshots (e.g. for security reasons). Additionally, the access to the snapshots is always controlled by the export policy of the resource pool. That means, if snapshots are visible and the export policy allows for reading the resource pool, then it also allows reading the snapshot of all shares. + SnapshotsAreVisible CreateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType `json:"snapshotsAreVisible,omitempty"` +} + +// NewCreateResourcePoolPayload instantiates a new CreateResourcePoolPayload 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 NewCreateResourcePoolPayload() *CreateResourcePoolPayload { + this := CreateResourcePoolPayload{} + return &this +} + +// NewCreateResourcePoolPayloadWithDefaults instantiates a new CreateResourcePoolPayload 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 NewCreateResourcePoolPayloadWithDefaults() *CreateResourcePoolPayload { + this := CreateResourcePoolPayload{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *CreateResourcePoolPayload) GetAvailabilityZone() (res CreateResourcePoolPayloadGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolPayload) GetAvailabilityZoneOk() (ret CreateResourcePoolPayloadGetAvailabilityZoneRetType, ok bool) { + return getCreateResourcePoolPayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *CreateResourcePoolPayload) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *CreateResourcePoolPayload) SetAvailabilityZone(v CreateResourcePoolPayloadGetAvailabilityZoneRetType) { + setCreateResourcePoolPayloadGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetIpAcl returns the IpAcl field value if set, zero value otherwise. +func (o *CreateResourcePoolPayload) GetIpAcl() (res CreateResourcePoolPayloadGetIpAclRetType) { + res, _ = o.GetIpAclOk() + return +} + +// GetIpAclOk returns a tuple with the IpAcl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolPayload) GetIpAclOk() (ret CreateResourcePoolPayloadGetIpAclRetType, ok bool) { + return getCreateResourcePoolPayloadGetIpAclAttributeTypeOk(o.IpAcl) +} + +// HasIpAcl returns a boolean if a field has been set. +func (o *CreateResourcePoolPayload) HasIpAcl() bool { + _, ok := o.GetIpAclOk() + return ok +} + +// SetIpAcl gets a reference to the given []string and assigns it to the IpAcl field. +func (o *CreateResourcePoolPayload) SetIpAcl(v CreateResourcePoolPayloadGetIpAclRetType) { + setCreateResourcePoolPayloadGetIpAclAttributeType(&o.IpAcl, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateResourcePoolPayload) GetLabels() (res CreateResourcePoolPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolPayload) GetLabelsOk() (ret CreateResourcePoolPayloadGetLabelsRetType, ok bool) { + return getCreateResourcePoolPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateResourcePoolPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateResourcePoolPayload) SetLabels(v CreateResourcePoolPayloadGetLabelsRetType) { + setCreateResourcePoolPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateResourcePoolPayload) GetName() (res CreateResourcePoolPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolPayload) GetNameOk() (ret CreateResourcePoolPayloadGetNameRetType, ok bool) { + return getCreateResourcePoolPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateResourcePoolPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateResourcePoolPayload) SetName(v CreateResourcePoolPayloadGetNameRetType) { + setCreateResourcePoolPayloadGetNameAttributeType(&o.Name, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *CreateResourcePoolPayload) GetPerformanceClass() (res CreateResourcePoolPayloadGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolPayload) GetPerformanceClassOk() (ret CreateResourcePoolPayloadGetPerformanceClassRetType, ok bool) { + return getCreateResourcePoolPayloadGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *CreateResourcePoolPayload) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *CreateResourcePoolPayload) SetPerformanceClass(v CreateResourcePoolPayloadGetPerformanceClassRetType) { + setCreateResourcePoolPayloadGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetSizeGigabytes returns the SizeGigabytes field value if set, zero value otherwise. +func (o *CreateResourcePoolPayload) GetSizeGigabytes() (res CreateResourcePoolPayloadGetSizeGigabytesRetType) { + res, _ = o.GetSizeGigabytesOk() + return +} + +// GetSizeGigabytesOk returns a tuple with the SizeGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolPayload) GetSizeGigabytesOk() (ret CreateResourcePoolPayloadGetSizeGigabytesRetType, ok bool) { + return getCreateResourcePoolPayloadGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes) +} + +// HasSizeGigabytes returns a boolean if a field has been set. +func (o *CreateResourcePoolPayload) HasSizeGigabytes() bool { + _, ok := o.GetSizeGigabytesOk() + return ok +} + +// SetSizeGigabytes gets a reference to the given int64 and assigns it to the SizeGigabytes field. +func (o *CreateResourcePoolPayload) SetSizeGigabytes(v CreateResourcePoolPayloadGetSizeGigabytesRetType) { + setCreateResourcePoolPayloadGetSizeGigabytesAttributeType(&o.SizeGigabytes, v) +} + +// GetSnapshotScheduleName returns the SnapshotScheduleName field value if set, zero value otherwise. +func (o *CreateResourcePoolPayload) GetSnapshotScheduleName() (res CreateResourcePoolPayloadGetSnapshotScheduleNameRetType) { + res, _ = o.GetSnapshotScheduleNameOk() + return +} + +// GetSnapshotScheduleNameOk returns a tuple with the SnapshotScheduleName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolPayload) GetSnapshotScheduleNameOk() (ret CreateResourcePoolPayloadGetSnapshotScheduleNameRetType, ok bool) { + return getCreateResourcePoolPayloadGetSnapshotScheduleNameAttributeTypeOk(o.SnapshotScheduleName) +} + +// HasSnapshotScheduleName returns a boolean if a field has been set. +func (o *CreateResourcePoolPayload) HasSnapshotScheduleName() bool { + _, ok := o.GetSnapshotScheduleNameOk() + return ok +} + +// SetSnapshotScheduleName gets a reference to the given string and assigns it to the SnapshotScheduleName field. +func (o *CreateResourcePoolPayload) SetSnapshotScheduleName(v CreateResourcePoolPayloadGetSnapshotScheduleNameRetType) { + setCreateResourcePoolPayloadGetSnapshotScheduleNameAttributeType(&o.SnapshotScheduleName, v) +} + +// GetSnapshotsAreVisible returns the SnapshotsAreVisible field value if set, zero value otherwise. +func (o *CreateResourcePoolPayload) GetSnapshotsAreVisible() (res CreateResourcePoolPayloadgetSnapshotsAreVisibleRetType) { + res, _ = o.GetSnapshotsAreVisibleOk() + return +} + +// GetSnapshotsAreVisibleOk returns a tuple with the SnapshotsAreVisible field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolPayload) GetSnapshotsAreVisibleOk() (ret CreateResourcePoolPayloadgetSnapshotsAreVisibleRetType, ok bool) { + return getCreateResourcePoolPayloadgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible) +} + +// HasSnapshotsAreVisible returns a boolean if a field has been set. +func (o *CreateResourcePoolPayload) HasSnapshotsAreVisible() bool { + _, ok := o.GetSnapshotsAreVisibleOk() + return ok +} + +// SetSnapshotsAreVisible gets a reference to the given bool and assigns it to the SnapshotsAreVisible field. +func (o *CreateResourcePoolPayload) SetSnapshotsAreVisible(v CreateResourcePoolPayloadgetSnapshotsAreVisibleRetType) { + setCreateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType(&o.SnapshotsAreVisible, v) +} + +func (o CreateResourcePoolPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateResourcePoolPayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getCreateResourcePoolPayloadGetIpAclAttributeTypeOk(o.IpAcl); ok { + toSerialize["IpAcl"] = val + } + if val, ok := getCreateResourcePoolPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateResourcePoolPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateResourcePoolPayloadGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getCreateResourcePoolPayloadGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes); ok { + toSerialize["SizeGigabytes"] = val + } + if val, ok := getCreateResourcePoolPayloadGetSnapshotScheduleNameAttributeTypeOk(o.SnapshotScheduleName); ok { + toSerialize["SnapshotScheduleName"] = val + } + if val, ok := getCreateResourcePoolPayloadgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible); ok { + toSerialize["SnapshotsAreVisible"] = val + } + return toSerialize, nil +} + +type NullableCreateResourcePoolPayload struct { + value *CreateResourcePoolPayload + isSet bool +} + +func (v NullableCreateResourcePoolPayload) Get() *CreateResourcePoolPayload { + return v.value +} + +func (v *NullableCreateResourcePoolPayload) Set(val *CreateResourcePoolPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateResourcePoolPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateResourcePoolPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateResourcePoolPayload(val *CreateResourcePoolPayload) *NullableCreateResourcePoolPayload { + return &NullableCreateResourcePoolPayload{value: val, isSet: true} +} + +func (v NullableCreateResourcePoolPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateResourcePoolPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_resource_pool_payload_test.go b/pkg/sfsbeta/model_create_resource_pool_payload_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_resource_pool_response.go b/pkg/sfsbeta/model_create_resource_pool_response.go new file mode 100644 index 00000000..85c8f0a2 --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the CreateResourcePoolResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateResourcePoolResponse{} + +/* + types and functions for resourcePool +*/ + +// isModel +type CreateResourcePoolResponseGetResourcePoolAttributeType = *CreateResourcePoolResponseResourcePool +type CreateResourcePoolResponseGetResourcePoolArgType = CreateResourcePoolResponseResourcePool +type CreateResourcePoolResponseGetResourcePoolRetType = CreateResourcePoolResponseResourcePool + +func getCreateResourcePoolResponseGetResourcePoolAttributeTypeOk(arg CreateResourcePoolResponseGetResourcePoolAttributeType) (ret CreateResourcePoolResponseGetResourcePoolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseGetResourcePoolAttributeType(arg *CreateResourcePoolResponseGetResourcePoolAttributeType, val CreateResourcePoolResponseGetResourcePoolRetType) { + *arg = &val +} + +// CreateResourcePoolResponse struct for CreateResourcePoolResponse +type CreateResourcePoolResponse struct { + ResourcePool CreateResourcePoolResponseGetResourcePoolAttributeType `json:"resourcePool,omitempty"` +} + +// NewCreateResourcePoolResponse instantiates a new CreateResourcePoolResponse 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 NewCreateResourcePoolResponse() *CreateResourcePoolResponse { + this := CreateResourcePoolResponse{} + return &this +} + +// NewCreateResourcePoolResponseWithDefaults instantiates a new CreateResourcePoolResponse 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 NewCreateResourcePoolResponseWithDefaults() *CreateResourcePoolResponse { + this := CreateResourcePoolResponse{} + return &this +} + +// GetResourcePool returns the ResourcePool field value if set, zero value otherwise. +func (o *CreateResourcePoolResponse) GetResourcePool() (res CreateResourcePoolResponseGetResourcePoolRetType) { + res, _ = o.GetResourcePoolOk() + return +} + +// GetResourcePoolOk returns a tuple with the ResourcePool field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponse) GetResourcePoolOk() (ret CreateResourcePoolResponseGetResourcePoolRetType, ok bool) { + return getCreateResourcePoolResponseGetResourcePoolAttributeTypeOk(o.ResourcePool) +} + +// HasResourcePool returns a boolean if a field has been set. +func (o *CreateResourcePoolResponse) HasResourcePool() bool { + _, ok := o.GetResourcePoolOk() + return ok +} + +// SetResourcePool gets a reference to the given CreateResourcePoolResponseResourcePool and assigns it to the ResourcePool field. +func (o *CreateResourcePoolResponse) SetResourcePool(v CreateResourcePoolResponseGetResourcePoolRetType) { + setCreateResourcePoolResponseGetResourcePoolAttributeType(&o.ResourcePool, v) +} + +func (o CreateResourcePoolResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateResourcePoolResponseGetResourcePoolAttributeTypeOk(o.ResourcePool); ok { + toSerialize["ResourcePool"] = val + } + return toSerialize, nil +} + +type NullableCreateResourcePoolResponse struct { + value *CreateResourcePoolResponse + isSet bool +} + +func (v NullableCreateResourcePoolResponse) Get() *CreateResourcePoolResponse { + return v.value +} + +func (v *NullableCreateResourcePoolResponse) Set(val *CreateResourcePoolResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateResourcePoolResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateResourcePoolResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateResourcePoolResponse(val *CreateResourcePoolResponse) *NullableCreateResourcePoolResponse { + return &NullableCreateResourcePoolResponse{value: val, isSet: true} +} + +func (v NullableCreateResourcePoolResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateResourcePoolResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_resource_pool_response_resource_pool.go b/pkg/sfsbeta/model_create_resource_pool_response_resource_pool.go new file mode 100644 index 00000000..14281e3e --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_response_resource_pool.go @@ -0,0 +1,802 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the CreateResourcePoolResponseResourcePool type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateResourcePoolResponseResourcePool{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type CreateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType = *string + +func getCreateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType) (ret CreateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType(arg *CreateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType, val CreateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType) { + *arg = &val +} + +type CreateResourcePoolResponseResourcePoolGetAvailabilityZoneArgType = string +type CreateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType = string + +/* + types and functions for countShares +*/ + +// isInteger +type CreateResourcePoolResponseResourcePoolGetCountSharesAttributeType = *int64 +type CreateResourcePoolResponseResourcePoolGetCountSharesArgType = int64 +type CreateResourcePoolResponseResourcePoolGetCountSharesRetType = int64 + +func getCreateResourcePoolResponseResourcePoolGetCountSharesAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetCountSharesAttributeType) (ret CreateResourcePoolResponseResourcePoolGetCountSharesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetCountSharesAttributeType(arg *CreateResourcePoolResponseResourcePoolGetCountSharesAttributeType, val CreateResourcePoolResponseResourcePoolGetCountSharesRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateResourcePoolResponseResourcePoolGetCreatedAtAttributeType = *time.Time +type CreateResourcePoolResponseResourcePoolGetCreatedAtArgType = time.Time +type CreateResourcePoolResponseResourcePoolGetCreatedAtRetType = time.Time + +func getCreateResourcePoolResponseResourcePoolGetCreatedAtAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetCreatedAtAttributeType) (ret CreateResourcePoolResponseResourcePoolGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetCreatedAtAttributeType(arg *CreateResourcePoolResponseResourcePoolGetCreatedAtAttributeType, val CreateResourcePoolResponseResourcePoolGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateResourcePoolResponseResourcePoolGetIdAttributeType = *string + +func getCreateResourcePoolResponseResourcePoolGetIdAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetIdAttributeType) (ret CreateResourcePoolResponseResourcePoolGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetIdAttributeType(arg *CreateResourcePoolResponseResourcePoolGetIdAttributeType, val CreateResourcePoolResponseResourcePoolGetIdRetType) { + *arg = &val +} + +type CreateResourcePoolResponseResourcePoolGetIdArgType = string +type CreateResourcePoolResponseResourcePoolGetIdRetType = string + +/* + types and functions for ipAcl +*/ + +// isArray +type CreateResourcePoolResponseResourcePoolGetIpAclAttributeType = *[]string +type CreateResourcePoolResponseResourcePoolGetIpAclArgType = []string +type CreateResourcePoolResponseResourcePoolGetIpAclRetType = []string + +func getCreateResourcePoolResponseResourcePoolGetIpAclAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetIpAclAttributeType) (ret CreateResourcePoolResponseResourcePoolGetIpAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetIpAclAttributeType(arg *CreateResourcePoolResponseResourcePoolGetIpAclAttributeType, val CreateResourcePoolResponseResourcePoolGetIpAclRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type CreateResourcePoolResponseResourcePoolGetLabelsAttributeType = *map[string]string +type CreateResourcePoolResponseResourcePoolGetLabelsArgType = map[string]string +type CreateResourcePoolResponseResourcePoolGetLabelsRetType = map[string]string + +func getCreateResourcePoolResponseResourcePoolGetLabelsAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetLabelsAttributeType) (ret CreateResourcePoolResponseResourcePoolGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetLabelsAttributeType(arg *CreateResourcePoolResponseResourcePoolGetLabelsAttributeType, val CreateResourcePoolResponseResourcePoolGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mountPath +*/ + +// isNotNullableString +type CreateResourcePoolResponseResourcePoolGetMountPathAttributeType = *string + +func getCreateResourcePoolResponseResourcePoolGetMountPathAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetMountPathAttributeType) (ret CreateResourcePoolResponseResourcePoolGetMountPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetMountPathAttributeType(arg *CreateResourcePoolResponseResourcePoolGetMountPathAttributeType, val CreateResourcePoolResponseResourcePoolGetMountPathRetType) { + *arg = &val +} + +type CreateResourcePoolResponseResourcePoolGetMountPathArgType = string +type CreateResourcePoolResponseResourcePoolGetMountPathRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateResourcePoolResponseResourcePoolGetNameAttributeType = *string + +func getCreateResourcePoolResponseResourcePoolGetNameAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetNameAttributeType) (ret CreateResourcePoolResponseResourcePoolGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetNameAttributeType(arg *CreateResourcePoolResponseResourcePoolGetNameAttributeType, val CreateResourcePoolResponseResourcePoolGetNameRetType) { + *arg = &val +} + +type CreateResourcePoolResponseResourcePoolGetNameArgType = string +type CreateResourcePoolResponseResourcePoolGetNameRetType = string + +/* + types and functions for performanceClass +*/ + +// isModel +type CreateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType = *ResourcePoolPerformanceClass +type CreateResourcePoolResponseResourcePoolGetPerformanceClassArgType = ResourcePoolPerformanceClass +type CreateResourcePoolResponseResourcePoolGetPerformanceClassRetType = ResourcePoolPerformanceClass + +func getCreateResourcePoolResponseResourcePoolGetPerformanceClassAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType) (ret CreateResourcePoolResponseResourcePoolGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType(arg *CreateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType, val CreateResourcePoolResponseResourcePoolGetPerformanceClassRetType) { + *arg = &val +} + +/* + types and functions for performanceClassDowngradableAt +*/ + +// isDateTime +type CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType = *time.Time +type CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtArgType = time.Time +type CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType = time.Time + +func getCreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType) (ret CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType(arg *CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType, val CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType) { + *arg = &val +} + +/* + types and functions for sizeReducibleAt +*/ + +// isDateTime +type CreateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType = *time.Time +type CreateResourcePoolResponseResourcePoolGetSizeReducibleAtArgType = time.Time +type CreateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType = time.Time + +func getCreateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType) (ret CreateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType(arg *CreateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType, val CreateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType) { + *arg = &val +} + +/* + types and functions for snapshotSchedule +*/ + +// isModel +type CreateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType = *SnapshotSchedule +type CreateResourcePoolResponseResourcePoolGetSnapshotScheduleArgType = SnapshotSchedule +type CreateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType = SnapshotSchedule + +func getCreateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType) (ret CreateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType(arg *CreateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType, val CreateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType) { + *arg = &val +} + +/* + types and functions for snapshotsAreVisible +*/ + +// isBoolean +type CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType = *bool +type CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleArgType = bool +type CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType = bool + +func getCreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType) (ret CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType(arg *CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType, val CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType) { + *arg = &val +} + +/* + types and functions for space +*/ + +// isModel +type CreateResourcePoolResponseResourcePoolGetSpaceAttributeType = *ResourcePoolSpace +type CreateResourcePoolResponseResourcePoolGetSpaceArgType = ResourcePoolSpace +type CreateResourcePoolResponseResourcePoolGetSpaceRetType = ResourcePoolSpace + +func getCreateResourcePoolResponseResourcePoolGetSpaceAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetSpaceAttributeType) (ret CreateResourcePoolResponseResourcePoolGetSpaceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetSpaceAttributeType(arg *CreateResourcePoolResponseResourcePoolGetSpaceAttributeType, val CreateResourcePoolResponseResourcePoolGetSpaceRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isNotNullableString +type CreateResourcePoolResponseResourcePoolGetStateAttributeType = *string + +func getCreateResourcePoolResponseResourcePoolGetStateAttributeTypeOk(arg CreateResourcePoolResponseResourcePoolGetStateAttributeType) (ret CreateResourcePoolResponseResourcePoolGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolResponseResourcePoolGetStateAttributeType(arg *CreateResourcePoolResponseResourcePoolGetStateAttributeType, val CreateResourcePoolResponseResourcePoolGetStateRetType) { + *arg = &val +} + +type CreateResourcePoolResponseResourcePoolGetStateArgType = string +type CreateResourcePoolResponseResourcePoolGetStateRetType = string + +// CreateResourcePoolResponseResourcePool Created Resource Pool +type CreateResourcePoolResponseResourcePool struct { + // Name of the respective availability zone + AvailabilityZone CreateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + // Number of Shares in the Resource Pool + // Can be cast to int32 without loss of precision. + CountShares CreateResourcePoolResponseResourcePoolGetCountSharesAttributeType `json:"countShares,omitempty"` + CreatedAt CreateResourcePoolResponseResourcePoolGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // ID of the Resource Pool + Id CreateResourcePoolResponseResourcePoolGetIdAttributeType `json:"id,omitempty"` + // List of IPs that can mount the Resource Pool in read-only; IPs must have a subnet mask (e.g. \"172.16.0.0/24\" for a range of IPs, or \"172.16.0.250/32\" for a specific IP) + IpAcl CreateResourcePoolResponseResourcePoolGetIpAclAttributeType `json:"ipAcl,omitempty"` + Labels CreateResourcePoolResponseResourcePoolGetLabelsAttributeType `json:"labels,omitempty"` + // Mount path of the Resource Pool, used to mount the Resource Pool Note that a Resource Pool can only be mounted in read-only + MountPath CreateResourcePoolResponseResourcePoolGetMountPathAttributeType `json:"mountPath,omitempty"` + // Name of the Resource Pool + Name CreateResourcePoolResponseResourcePoolGetNameAttributeType `json:"name,omitempty"` + PerformanceClass CreateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Time when the performance class can be downgraded again. + PerformanceClassDowngradableAt CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType `json:"performanceClassDowngradableAt,omitempty"` + // Time when the size can be reduced again. + SizeReducibleAt CreateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType `json:"sizeReducibleAt,omitempty"` + SnapshotSchedule CreateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType `json:"snapshotSchedule,omitempty"` + // Whether the .snapshot directory is visible when mounting the resource pool. Setting this value to false might prevent you from accessing the snapshots (e.g. for security reasons). Additionally, the access to the snapshots is always controlled by the export policy of the resource pool. That means, if snapshots are visible and the export policy allows for reading the resource pool, then it also allows reading the snapshot of all shares. + SnapshotsAreVisible CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType `json:"snapshotsAreVisible,omitempty"` + Space CreateResourcePoolResponseResourcePoolGetSpaceAttributeType `json:"space,omitempty"` + // State of the Resource Pool (possible values: [\"pending\", \"creating\", \"created\", \"updating\", \"error\", \"deleting\"]) + State CreateResourcePoolResponseResourcePoolGetStateAttributeType `json:"state,omitempty"` +} + +// NewCreateResourcePoolResponseResourcePool instantiates a new CreateResourcePoolResponseResourcePool 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 NewCreateResourcePoolResponseResourcePool() *CreateResourcePoolResponseResourcePool { + this := CreateResourcePoolResponseResourcePool{} + return &this +} + +// NewCreateResourcePoolResponseResourcePoolWithDefaults instantiates a new CreateResourcePoolResponseResourcePool 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 NewCreateResourcePoolResponseResourcePoolWithDefaults() *CreateResourcePoolResponseResourcePool { + this := CreateResourcePoolResponseResourcePool{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetAvailabilityZone() (res CreateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetAvailabilityZoneOk() (ret CreateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *CreateResourcePoolResponseResourcePool) SetAvailabilityZone(v CreateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType) { + setCreateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetCountShares returns the CountShares field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetCountShares() (res CreateResourcePoolResponseResourcePoolGetCountSharesRetType) { + res, _ = o.GetCountSharesOk() + return +} + +// GetCountSharesOk returns a tuple with the CountShares field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetCountSharesOk() (ret CreateResourcePoolResponseResourcePoolGetCountSharesRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetCountSharesAttributeTypeOk(o.CountShares) +} + +// HasCountShares returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasCountShares() bool { + _, ok := o.GetCountSharesOk() + return ok +} + +// SetCountShares gets a reference to the given int64 and assigns it to the CountShares field. +func (o *CreateResourcePoolResponseResourcePool) SetCountShares(v CreateResourcePoolResponseResourcePoolGetCountSharesRetType) { + setCreateResourcePoolResponseResourcePoolGetCountSharesAttributeType(&o.CountShares, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetCreatedAt() (res CreateResourcePoolResponseResourcePoolGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetCreatedAtOk() (ret CreateResourcePoolResponseResourcePoolGetCreatedAtRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateResourcePoolResponseResourcePool) SetCreatedAt(v CreateResourcePoolResponseResourcePoolGetCreatedAtRetType) { + setCreateResourcePoolResponseResourcePoolGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetId() (res CreateResourcePoolResponseResourcePoolGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetIdOk() (ret CreateResourcePoolResponseResourcePoolGetIdRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateResourcePoolResponseResourcePool) SetId(v CreateResourcePoolResponseResourcePoolGetIdRetType) { + setCreateResourcePoolResponseResourcePoolGetIdAttributeType(&o.Id, v) +} + +// GetIpAcl returns the IpAcl field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetIpAcl() (res CreateResourcePoolResponseResourcePoolGetIpAclRetType) { + res, _ = o.GetIpAclOk() + return +} + +// GetIpAclOk returns a tuple with the IpAcl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetIpAclOk() (ret CreateResourcePoolResponseResourcePoolGetIpAclRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetIpAclAttributeTypeOk(o.IpAcl) +} + +// HasIpAcl returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasIpAcl() bool { + _, ok := o.GetIpAclOk() + return ok +} + +// SetIpAcl gets a reference to the given []string and assigns it to the IpAcl field. +func (o *CreateResourcePoolResponseResourcePool) SetIpAcl(v CreateResourcePoolResponseResourcePoolGetIpAclRetType) { + setCreateResourcePoolResponseResourcePoolGetIpAclAttributeType(&o.IpAcl, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetLabels() (res CreateResourcePoolResponseResourcePoolGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetLabelsOk() (ret CreateResourcePoolResponseResourcePoolGetLabelsRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateResourcePoolResponseResourcePool) SetLabels(v CreateResourcePoolResponseResourcePoolGetLabelsRetType) { + setCreateResourcePoolResponseResourcePoolGetLabelsAttributeType(&o.Labels, v) +} + +// GetMountPath returns the MountPath field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetMountPath() (res CreateResourcePoolResponseResourcePoolGetMountPathRetType) { + res, _ = o.GetMountPathOk() + return +} + +// GetMountPathOk returns a tuple with the MountPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetMountPathOk() (ret CreateResourcePoolResponseResourcePoolGetMountPathRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetMountPathAttributeTypeOk(o.MountPath) +} + +// HasMountPath returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasMountPath() bool { + _, ok := o.GetMountPathOk() + return ok +} + +// SetMountPath gets a reference to the given string and assigns it to the MountPath field. +func (o *CreateResourcePoolResponseResourcePool) SetMountPath(v CreateResourcePoolResponseResourcePoolGetMountPathRetType) { + setCreateResourcePoolResponseResourcePoolGetMountPathAttributeType(&o.MountPath, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetName() (res CreateResourcePoolResponseResourcePoolGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetNameOk() (ret CreateResourcePoolResponseResourcePoolGetNameRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateResourcePoolResponseResourcePool) SetName(v CreateResourcePoolResponseResourcePoolGetNameRetType) { + setCreateResourcePoolResponseResourcePoolGetNameAttributeType(&o.Name, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetPerformanceClass() (res CreateResourcePoolResponseResourcePoolGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetPerformanceClassOk() (ret CreateResourcePoolResponseResourcePoolGetPerformanceClassRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given ResourcePoolPerformanceClass and assigns it to the PerformanceClass field. +func (o *CreateResourcePoolResponseResourcePool) SetPerformanceClass(v CreateResourcePoolResponseResourcePoolGetPerformanceClassRetType) { + setCreateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetPerformanceClassDowngradableAt returns the PerformanceClassDowngradableAt field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetPerformanceClassDowngradableAt() (res CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType) { + res, _ = o.GetPerformanceClassDowngradableAtOk() + return +} + +// GetPerformanceClassDowngradableAtOk returns a tuple with the PerformanceClassDowngradableAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetPerformanceClassDowngradableAtOk() (ret CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(o.PerformanceClassDowngradableAt) +} + +// HasPerformanceClassDowngradableAt returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasPerformanceClassDowngradableAt() bool { + _, ok := o.GetPerformanceClassDowngradableAtOk() + return ok +} + +// SetPerformanceClassDowngradableAt gets a reference to the given time.Time and assigns it to the PerformanceClassDowngradableAt field. +func (o *CreateResourcePoolResponseResourcePool) SetPerformanceClassDowngradableAt(v CreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType) { + setCreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType(&o.PerformanceClassDowngradableAt, v) +} + +// GetSizeReducibleAt returns the SizeReducibleAt field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetSizeReducibleAt() (res CreateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType) { + res, _ = o.GetSizeReducibleAtOk() + return +} + +// GetSizeReducibleAtOk returns a tuple with the SizeReducibleAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetSizeReducibleAtOk() (ret CreateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeTypeOk(o.SizeReducibleAt) +} + +// HasSizeReducibleAt returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasSizeReducibleAt() bool { + _, ok := o.GetSizeReducibleAtOk() + return ok +} + +// SetSizeReducibleAt gets a reference to the given time.Time and assigns it to the SizeReducibleAt field. +func (o *CreateResourcePoolResponseResourcePool) SetSizeReducibleAt(v CreateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType) { + setCreateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType(&o.SizeReducibleAt, v) +} + +// GetSnapshotSchedule returns the SnapshotSchedule field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetSnapshotSchedule() (res CreateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType) { + res, _ = o.GetSnapshotScheduleOk() + return +} + +// GetSnapshotScheduleOk returns a tuple with the SnapshotSchedule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetSnapshotScheduleOk() (ret CreateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeTypeOk(o.SnapshotSchedule) +} + +// HasSnapshotSchedule returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasSnapshotSchedule() bool { + _, ok := o.GetSnapshotScheduleOk() + return ok +} + +// SetSnapshotSchedule gets a reference to the given SnapshotSchedule and assigns it to the SnapshotSchedule field. +func (o *CreateResourcePoolResponseResourcePool) SetSnapshotSchedule(v CreateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType) { + setCreateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType(&o.SnapshotSchedule, v) +} + +// GetSnapshotsAreVisible returns the SnapshotsAreVisible field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetSnapshotsAreVisible() (res CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType) { + res, _ = o.GetSnapshotsAreVisibleOk() + return +} + +// GetSnapshotsAreVisibleOk returns a tuple with the SnapshotsAreVisible field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetSnapshotsAreVisibleOk() (ret CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible) +} + +// HasSnapshotsAreVisible returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasSnapshotsAreVisible() bool { + _, ok := o.GetSnapshotsAreVisibleOk() + return ok +} + +// SetSnapshotsAreVisible gets a reference to the given bool and assigns it to the SnapshotsAreVisible field. +func (o *CreateResourcePoolResponseResourcePool) SetSnapshotsAreVisible(v CreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType) { + setCreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType(&o.SnapshotsAreVisible, v) +} + +// GetSpace returns the Space field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetSpace() (res CreateResourcePoolResponseResourcePoolGetSpaceRetType) { + res, _ = o.GetSpaceOk() + return +} + +// GetSpaceOk returns a tuple with the Space field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetSpaceOk() (ret CreateResourcePoolResponseResourcePoolGetSpaceRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetSpaceAttributeTypeOk(o.Space) +} + +// HasSpace returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasSpace() bool { + _, ok := o.GetSpaceOk() + return ok +} + +// SetSpace gets a reference to the given ResourcePoolSpace and assigns it to the Space field. +func (o *CreateResourcePoolResponseResourcePool) SetSpace(v CreateResourcePoolResponseResourcePoolGetSpaceRetType) { + setCreateResourcePoolResponseResourcePoolGetSpaceAttributeType(&o.Space, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *CreateResourcePoolResponseResourcePool) GetState() (res CreateResourcePoolResponseResourcePoolGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolResponseResourcePool) GetStateOk() (ret CreateResourcePoolResponseResourcePoolGetStateRetType, ok bool) { + return getCreateResourcePoolResponseResourcePoolGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *CreateResourcePoolResponseResourcePool) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *CreateResourcePoolResponseResourcePool) SetState(v CreateResourcePoolResponseResourcePoolGetStateRetType) { + setCreateResourcePoolResponseResourcePoolGetStateAttributeType(&o.State, v) +} + +func (o CreateResourcePoolResponseResourcePool) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetCountSharesAttributeTypeOk(o.CountShares); ok { + toSerialize["CountShares"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetIpAclAttributeTypeOk(o.IpAcl); ok { + toSerialize["IpAcl"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetMountPathAttributeTypeOk(o.MountPath); ok { + toSerialize["MountPath"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(o.PerformanceClassDowngradableAt); ok { + toSerialize["PerformanceClassDowngradableAt"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeTypeOk(o.SizeReducibleAt); ok { + toSerialize["SizeReducibleAt"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeTypeOk(o.SnapshotSchedule); ok { + toSerialize["SnapshotSchedule"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible); ok { + toSerialize["SnapshotsAreVisible"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetSpaceAttributeTypeOk(o.Space); ok { + toSerialize["Space"] = val + } + if val, ok := getCreateResourcePoolResponseResourcePoolGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableCreateResourcePoolResponseResourcePool struct { + value *CreateResourcePoolResponseResourcePool + isSet bool +} + +func (v NullableCreateResourcePoolResponseResourcePool) Get() *CreateResourcePoolResponseResourcePool { + return v.value +} + +func (v *NullableCreateResourcePoolResponseResourcePool) Set(val *CreateResourcePoolResponseResourcePool) { + v.value = val + v.isSet = true +} + +func (v NullableCreateResourcePoolResponseResourcePool) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateResourcePoolResponseResourcePool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateResourcePoolResponseResourcePool(val *CreateResourcePoolResponseResourcePool) *NullableCreateResourcePoolResponseResourcePool { + return &NullableCreateResourcePoolResponseResourcePool{value: val, isSet: true} +} + +func (v NullableCreateResourcePoolResponseResourcePool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateResourcePoolResponseResourcePool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_resource_pool_response_resource_pool_test.go b/pkg/sfsbeta/model_create_resource_pool_response_resource_pool_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_response_resource_pool_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_resource_pool_response_test.go b/pkg/sfsbeta/model_create_resource_pool_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_resource_pool_snapshot_payload.go b/pkg/sfsbeta/model_create_resource_pool_snapshot_payload.go new file mode 100644 index 00000000..7bb7cdbf --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_snapshot_payload.go @@ -0,0 +1,193 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the CreateResourcePoolSnapshotPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateResourcePoolSnapshotPayload{} + +/* + types and functions for comment +*/ + +// isNullableString +type CreateResourcePoolSnapshotPayloadGetCommentAttributeType = *NullableString + +func getCreateResourcePoolSnapshotPayloadGetCommentAttributeTypeOk(arg CreateResourcePoolSnapshotPayloadGetCommentAttributeType) (ret CreateResourcePoolSnapshotPayloadGetCommentRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateResourcePoolSnapshotPayloadGetCommentAttributeType(arg *CreateResourcePoolSnapshotPayloadGetCommentAttributeType, val CreateResourcePoolSnapshotPayloadGetCommentRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateResourcePoolSnapshotPayloadGetCommentArgType = *string +type CreateResourcePoolSnapshotPayloadGetCommentRetType = *string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateResourcePoolSnapshotPayloadGetNameAttributeType = *string + +func getCreateResourcePoolSnapshotPayloadGetNameAttributeTypeOk(arg CreateResourcePoolSnapshotPayloadGetNameAttributeType) (ret CreateResourcePoolSnapshotPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolSnapshotPayloadGetNameAttributeType(arg *CreateResourcePoolSnapshotPayloadGetNameAttributeType, val CreateResourcePoolSnapshotPayloadGetNameRetType) { + *arg = &val +} + +type CreateResourcePoolSnapshotPayloadGetNameArgType = string +type CreateResourcePoolSnapshotPayloadGetNameRetType = string + +// CreateResourcePoolSnapshotPayload struct for CreateResourcePoolSnapshotPayload +type CreateResourcePoolSnapshotPayload struct { + // (optional) A comment to add more information about a snapshot + Comment CreateResourcePoolSnapshotPayloadGetCommentAttributeType `json:"comment,omitempty"` + // Name of the Resource Pool Snapshot + Name CreateResourcePoolSnapshotPayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewCreateResourcePoolSnapshotPayload instantiates a new CreateResourcePoolSnapshotPayload 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 NewCreateResourcePoolSnapshotPayload() *CreateResourcePoolSnapshotPayload { + this := CreateResourcePoolSnapshotPayload{} + return &this +} + +// NewCreateResourcePoolSnapshotPayloadWithDefaults instantiates a new CreateResourcePoolSnapshotPayload 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 NewCreateResourcePoolSnapshotPayloadWithDefaults() *CreateResourcePoolSnapshotPayload { + this := CreateResourcePoolSnapshotPayload{} + return &this +} + +// GetComment returns the Comment field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateResourcePoolSnapshotPayload) GetComment() (res CreateResourcePoolSnapshotPayloadGetCommentRetType) { + res, _ = o.GetCommentOk() + return +} + +// GetCommentOk returns a tuple with the Comment field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateResourcePoolSnapshotPayload) GetCommentOk() (ret CreateResourcePoolSnapshotPayloadGetCommentRetType, ok bool) { + return getCreateResourcePoolSnapshotPayloadGetCommentAttributeTypeOk(o.Comment) +} + +// HasComment returns a boolean if a field has been set. +func (o *CreateResourcePoolSnapshotPayload) HasComment() bool { + _, ok := o.GetCommentOk() + return ok +} + +// SetComment gets a reference to the given string and assigns it to the Comment field. +func (o *CreateResourcePoolSnapshotPayload) SetComment(v CreateResourcePoolSnapshotPayloadGetCommentRetType) { + setCreateResourcePoolSnapshotPayloadGetCommentAttributeType(&o.Comment, v) +} + +// SetCommentNil sets the value for Comment to be an explicit nil +func (o *CreateResourcePoolSnapshotPayload) SetCommentNil() { + o.Comment = nil +} + +// UnsetComment ensures that no value is present for Comment, not even an explicit nil +func (o *CreateResourcePoolSnapshotPayload) UnsetComment() { + o.Comment = nil +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateResourcePoolSnapshotPayload) GetName() (res CreateResourcePoolSnapshotPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolSnapshotPayload) GetNameOk() (ret CreateResourcePoolSnapshotPayloadGetNameRetType, ok bool) { + return getCreateResourcePoolSnapshotPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateResourcePoolSnapshotPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateResourcePoolSnapshotPayload) SetName(v CreateResourcePoolSnapshotPayloadGetNameRetType) { + setCreateResourcePoolSnapshotPayloadGetNameAttributeType(&o.Name, v) +} + +func (o CreateResourcePoolSnapshotPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateResourcePoolSnapshotPayloadGetCommentAttributeTypeOk(o.Comment); ok { + toSerialize["Comment"] = val + } + if val, ok := getCreateResourcePoolSnapshotPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableCreateResourcePoolSnapshotPayload struct { + value *CreateResourcePoolSnapshotPayload + isSet bool +} + +func (v NullableCreateResourcePoolSnapshotPayload) Get() *CreateResourcePoolSnapshotPayload { + return v.value +} + +func (v *NullableCreateResourcePoolSnapshotPayload) Set(val *CreateResourcePoolSnapshotPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateResourcePoolSnapshotPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateResourcePoolSnapshotPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateResourcePoolSnapshotPayload(val *CreateResourcePoolSnapshotPayload) *NullableCreateResourcePoolSnapshotPayload { + return &NullableCreateResourcePoolSnapshotPayload{value: val, isSet: true} +} + +func (v NullableCreateResourcePoolSnapshotPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateResourcePoolSnapshotPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_resource_pool_snapshot_payload_test.go b/pkg/sfsbeta/model_create_resource_pool_snapshot_payload_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_snapshot_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_resource_pool_snapshot_response.go b/pkg/sfsbeta/model_create_resource_pool_snapshot_response.go new file mode 100644 index 00000000..79667612 --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_snapshot_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the CreateResourcePoolSnapshotResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateResourcePoolSnapshotResponse{} + +/* + types and functions for resourcePoolSnapshot +*/ + +// isModel +type CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType = *CreateResourcePoolSnapshotResponseResourcePoolSnapshot +type CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotArgType = CreateResourcePoolSnapshotResponseResourcePoolSnapshot +type CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType = CreateResourcePoolSnapshotResponseResourcePoolSnapshot + +func getCreateResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeTypeOk(arg CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType) (ret CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType(arg *CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType, val CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType) { + *arg = &val +} + +// CreateResourcePoolSnapshotResponse struct for CreateResourcePoolSnapshotResponse +type CreateResourcePoolSnapshotResponse struct { + ResourcePoolSnapshot CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType `json:"resourcePoolSnapshot,omitempty"` +} + +// NewCreateResourcePoolSnapshotResponse instantiates a new CreateResourcePoolSnapshotResponse 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 NewCreateResourcePoolSnapshotResponse() *CreateResourcePoolSnapshotResponse { + this := CreateResourcePoolSnapshotResponse{} + return &this +} + +// NewCreateResourcePoolSnapshotResponseWithDefaults instantiates a new CreateResourcePoolSnapshotResponse 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 NewCreateResourcePoolSnapshotResponseWithDefaults() *CreateResourcePoolSnapshotResponse { + this := CreateResourcePoolSnapshotResponse{} + return &this +} + +// GetResourcePoolSnapshot returns the ResourcePoolSnapshot field value if set, zero value otherwise. +func (o *CreateResourcePoolSnapshotResponse) GetResourcePoolSnapshot() (res CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType) { + res, _ = o.GetResourcePoolSnapshotOk() + return +} + +// GetResourcePoolSnapshotOk returns a tuple with the ResourcePoolSnapshot field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolSnapshotResponse) GetResourcePoolSnapshotOk() (ret CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType, ok bool) { + return getCreateResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeTypeOk(o.ResourcePoolSnapshot) +} + +// HasResourcePoolSnapshot returns a boolean if a field has been set. +func (o *CreateResourcePoolSnapshotResponse) HasResourcePoolSnapshot() bool { + _, ok := o.GetResourcePoolSnapshotOk() + return ok +} + +// SetResourcePoolSnapshot gets a reference to the given CreateResourcePoolSnapshotResponseResourcePoolSnapshot and assigns it to the ResourcePoolSnapshot field. +func (o *CreateResourcePoolSnapshotResponse) SetResourcePoolSnapshot(v CreateResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType) { + setCreateResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType(&o.ResourcePoolSnapshot, v) +} + +func (o CreateResourcePoolSnapshotResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeTypeOk(o.ResourcePoolSnapshot); ok { + toSerialize["ResourcePoolSnapshot"] = val + } + return toSerialize, nil +} + +type NullableCreateResourcePoolSnapshotResponse struct { + value *CreateResourcePoolSnapshotResponse + isSet bool +} + +func (v NullableCreateResourcePoolSnapshotResponse) Get() *CreateResourcePoolSnapshotResponse { + return v.value +} + +func (v *NullableCreateResourcePoolSnapshotResponse) Set(val *CreateResourcePoolSnapshotResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateResourcePoolSnapshotResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateResourcePoolSnapshotResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateResourcePoolSnapshotResponse(val *CreateResourcePoolSnapshotResponse) *NullableCreateResourcePoolSnapshotResponse { + return &NullableCreateResourcePoolSnapshotResponse{value: val, isSet: true} +} + +func (v NullableCreateResourcePoolSnapshotResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateResourcePoolSnapshotResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_resource_pool_snapshot_response_resource_pool_snapshot.go b/pkg/sfsbeta/model_create_resource_pool_snapshot_response_resource_pool_snapshot.go new file mode 100644 index 00000000..9fddb61a --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_snapshot_response_resource_pool_snapshot.go @@ -0,0 +1,388 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the CreateResourcePoolSnapshotResponseResourcePoolSnapshot type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateResourcePoolSnapshotResponseResourcePoolSnapshot{} + +/* + types and functions for comment +*/ + +// isNullableString +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType = *NullableString + +func getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeTypeOk(arg CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType) (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType(arg *CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType, val CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentArgType = *string +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType = *string + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType = *time.Time +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtArgType = time.Time +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType = time.Time + +func getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeTypeOk(arg CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType) (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType(arg *CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType, val CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for logicalSizeGigabytes +*/ + +// isInteger +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType = *int64 +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesArgType = int64 +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType = int64 + +func getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeTypeOk(arg CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType) (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType(arg *CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType, val CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType) { + *arg = &val +} + +/* + types and functions for resourcePoolId +*/ + +// isNotNullableString +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType = *string + +func getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeTypeOk(arg CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType) (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType(arg *CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType, val CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType) { + *arg = &val +} + +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdArgType = string +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType = string + +/* + types and functions for sizeGigabytes +*/ + +// isInteger +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType = *int64 +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesArgType = int64 +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType = int64 + +func getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeTypeOk(arg CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType) (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType(arg *CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType, val CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType) { + *arg = &val +} + +/* + types and functions for snapshotName +*/ + +// isNotNullableString +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType = *string + +func getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeTypeOk(arg CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType) (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType(arg *CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType, val CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType) { + *arg = &val +} + +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameArgType = string +type CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType = string + +// CreateResourcePoolSnapshotResponseResourcePoolSnapshot Created Resource Pool Snapshot +type CreateResourcePoolSnapshotResponseResourcePoolSnapshot struct { + // (optional) A comment to add more information about a snapshot + Comment CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType `json:"comment,omitempty"` + CreatedAt CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Represents the user-visible data size at the time of the snapshot in Gibibytes (e.g. what’s in the snapshot) + // Can be cast to int32 without loss of precision. + LogicalSizeGigabytes CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType `json:"logicalSizeGigabytes,omitempty"` + // ID of the Resource Pool of the Snapshot + ResourcePoolId CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType `json:"resourcePoolId,omitempty"` + // Reflects the actual storage footprint in the backend at snapshot time in Gibibytes (e.g. how much storage from the Resource Pool does it use). + // Can be cast to int32 without loss of precision. + SizeGigabytes CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType `json:"sizeGigabytes,omitempty"` + // Name of the Resource Pool Snapshot + SnapshotName CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType `json:"snapshotName,omitempty"` +} + +// NewCreateResourcePoolSnapshotResponseResourcePoolSnapshot instantiates a new CreateResourcePoolSnapshotResponseResourcePoolSnapshot 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 NewCreateResourcePoolSnapshotResponseResourcePoolSnapshot() *CreateResourcePoolSnapshotResponseResourcePoolSnapshot { + this := CreateResourcePoolSnapshotResponseResourcePoolSnapshot{} + return &this +} + +// NewCreateResourcePoolSnapshotResponseResourcePoolSnapshotWithDefaults instantiates a new CreateResourcePoolSnapshotResponseResourcePoolSnapshot 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 NewCreateResourcePoolSnapshotResponseResourcePoolSnapshotWithDefaults() *CreateResourcePoolSnapshotResponseResourcePoolSnapshot { + this := CreateResourcePoolSnapshotResponseResourcePoolSnapshot{} + return &this +} + +// GetComment returns the Comment field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetComment() (res CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType) { + res, _ = o.GetCommentOk() + return +} + +// GetCommentOk returns a tuple with the Comment field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetCommentOk() (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType, ok bool) { + return getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeTypeOk(o.Comment) +} + +// HasComment returns a boolean if a field has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) HasComment() bool { + _, ok := o.GetCommentOk() + return ok +} + +// SetComment gets a reference to the given string and assigns it to the Comment field. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) SetComment(v CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType) { + setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType(&o.Comment, v) +} + +// SetCommentNil sets the value for Comment to be an explicit nil +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) SetCommentNil() { + o.Comment = nil +} + +// UnsetComment ensures that no value is present for Comment, not even an explicit nil +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) UnsetComment() { + o.Comment = nil +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetCreatedAt() (res CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetCreatedAtOk() (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType, ok bool) { + return getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) SetCreatedAt(v CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType) { + setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetLogicalSizeGigabytes returns the LogicalSizeGigabytes field value if set, zero value otherwise. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetLogicalSizeGigabytes() (res CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType) { + res, _ = o.GetLogicalSizeGigabytesOk() + return +} + +// GetLogicalSizeGigabytesOk returns a tuple with the LogicalSizeGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetLogicalSizeGigabytesOk() (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType, ok bool) { + return getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeTypeOk(o.LogicalSizeGigabytes) +} + +// HasLogicalSizeGigabytes returns a boolean if a field has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) HasLogicalSizeGigabytes() bool { + _, ok := o.GetLogicalSizeGigabytesOk() + return ok +} + +// SetLogicalSizeGigabytes gets a reference to the given int64 and assigns it to the LogicalSizeGigabytes field. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) SetLogicalSizeGigabytes(v CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType) { + setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType(&o.LogicalSizeGigabytes, v) +} + +// GetResourcePoolId returns the ResourcePoolId field value if set, zero value otherwise. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetResourcePoolId() (res CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType) { + res, _ = o.GetResourcePoolIdOk() + return +} + +// GetResourcePoolIdOk returns a tuple with the ResourcePoolId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetResourcePoolIdOk() (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType, ok bool) { + return getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeTypeOk(o.ResourcePoolId) +} + +// HasResourcePoolId returns a boolean if a field has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) HasResourcePoolId() bool { + _, ok := o.GetResourcePoolIdOk() + return ok +} + +// SetResourcePoolId gets a reference to the given string and assigns it to the ResourcePoolId field. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) SetResourcePoolId(v CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType) { + setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType(&o.ResourcePoolId, v) +} + +// GetSizeGigabytes returns the SizeGigabytes field value if set, zero value otherwise. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetSizeGigabytes() (res CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType) { + res, _ = o.GetSizeGigabytesOk() + return +} + +// GetSizeGigabytesOk returns a tuple with the SizeGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetSizeGigabytesOk() (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType, ok bool) { + return getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes) +} + +// HasSizeGigabytes returns a boolean if a field has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) HasSizeGigabytes() bool { + _, ok := o.GetSizeGigabytesOk() + return ok +} + +// SetSizeGigabytes gets a reference to the given int64 and assigns it to the SizeGigabytes field. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) SetSizeGigabytes(v CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType) { + setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType(&o.SizeGigabytes, v) +} + +// GetSnapshotName returns the SnapshotName field value if set, zero value otherwise. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetSnapshotName() (res CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType) { + res, _ = o.GetSnapshotNameOk() + return +} + +// GetSnapshotNameOk returns a tuple with the SnapshotName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) GetSnapshotNameOk() (ret CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType, ok bool) { + return getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeTypeOk(o.SnapshotName) +} + +// HasSnapshotName returns a boolean if a field has been set. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) HasSnapshotName() bool { + _, ok := o.GetSnapshotNameOk() + return ok +} + +// SetSnapshotName gets a reference to the given string and assigns it to the SnapshotName field. +func (o *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) SetSnapshotName(v CreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType) { + setCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType(&o.SnapshotName, v) +} + +func (o CreateResourcePoolSnapshotResponseResourcePoolSnapshot) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeTypeOk(o.Comment); ok { + toSerialize["Comment"] = val + } + if val, ok := getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeTypeOk(o.LogicalSizeGigabytes); ok { + toSerialize["LogicalSizeGigabytes"] = val + } + if val, ok := getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeTypeOk(o.ResourcePoolId); ok { + toSerialize["ResourcePoolId"] = val + } + if val, ok := getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes); ok { + toSerialize["SizeGigabytes"] = val + } + if val, ok := getCreateResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeTypeOk(o.SnapshotName); ok { + toSerialize["SnapshotName"] = val + } + return toSerialize, nil +} + +type NullableCreateResourcePoolSnapshotResponseResourcePoolSnapshot struct { + value *CreateResourcePoolSnapshotResponseResourcePoolSnapshot + isSet bool +} + +func (v NullableCreateResourcePoolSnapshotResponseResourcePoolSnapshot) Get() *CreateResourcePoolSnapshotResponseResourcePoolSnapshot { + return v.value +} + +func (v *NullableCreateResourcePoolSnapshotResponseResourcePoolSnapshot) Set(val *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) { + v.value = val + v.isSet = true +} + +func (v NullableCreateResourcePoolSnapshotResponseResourcePoolSnapshot) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateResourcePoolSnapshotResponseResourcePoolSnapshot) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateResourcePoolSnapshotResponseResourcePoolSnapshot(val *CreateResourcePoolSnapshotResponseResourcePoolSnapshot) *NullableCreateResourcePoolSnapshotResponseResourcePoolSnapshot { + return &NullableCreateResourcePoolSnapshotResponseResourcePoolSnapshot{value: val, isSet: true} +} + +func (v NullableCreateResourcePoolSnapshotResponseResourcePoolSnapshot) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateResourcePoolSnapshotResponseResourcePoolSnapshot) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_resource_pool_snapshot_response_resource_pool_snapshot_test.go b/pkg/sfsbeta/model_create_resource_pool_snapshot_response_resource_pool_snapshot_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_snapshot_response_resource_pool_snapshot_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_resource_pool_snapshot_response_test.go b/pkg/sfsbeta/model_create_resource_pool_snapshot_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_resource_pool_snapshot_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_share_export_policy_payload.go b/pkg/sfsbeta/model_create_share_export_policy_payload.go new file mode 100644 index 00000000..cc51ca71 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_export_policy_payload.go @@ -0,0 +1,225 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the CreateShareExportPolicyPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateShareExportPolicyPayload{} + +/* + types and functions for labels +*/ + +// isContainer +type CreateShareExportPolicyPayloadGetLabelsAttributeType = *map[string]string +type CreateShareExportPolicyPayloadGetLabelsArgType = map[string]string +type CreateShareExportPolicyPayloadGetLabelsRetType = map[string]string + +func getCreateShareExportPolicyPayloadGetLabelsAttributeTypeOk(arg CreateShareExportPolicyPayloadGetLabelsAttributeType) (ret CreateShareExportPolicyPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyPayloadGetLabelsAttributeType(arg *CreateShareExportPolicyPayloadGetLabelsAttributeType, val CreateShareExportPolicyPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateShareExportPolicyPayloadGetNameAttributeType = *string + +func getCreateShareExportPolicyPayloadGetNameAttributeTypeOk(arg CreateShareExportPolicyPayloadGetNameAttributeType) (ret CreateShareExportPolicyPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyPayloadGetNameAttributeType(arg *CreateShareExportPolicyPayloadGetNameAttributeType, val CreateShareExportPolicyPayloadGetNameRetType) { + *arg = &val +} + +type CreateShareExportPolicyPayloadGetNameArgType = string +type CreateShareExportPolicyPayloadGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type CreateShareExportPolicyPayloadGetRulesAttributeType = *[]CreateShareExportPolicyRequestRule +type CreateShareExportPolicyPayloadGetRulesArgType = []CreateShareExportPolicyRequestRule +type CreateShareExportPolicyPayloadGetRulesRetType = []CreateShareExportPolicyRequestRule + +func getCreateShareExportPolicyPayloadGetRulesAttributeTypeOk(arg CreateShareExportPolicyPayloadGetRulesAttributeType) (ret CreateShareExportPolicyPayloadGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyPayloadGetRulesAttributeType(arg *CreateShareExportPolicyPayloadGetRulesAttributeType, val CreateShareExportPolicyPayloadGetRulesRetType) { + *arg = &val +} + +// CreateShareExportPolicyPayload struct for CreateShareExportPolicyPayload +type CreateShareExportPolicyPayload struct { + // An optional object that represents the labels associated with the share export policy keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels CreateShareExportPolicyPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Name of the Share Export Policy + Name CreateShareExportPolicyPayloadGetNameAttributeType `json:"name,omitempty"` + // List of rules of the Share Export Policy. The order of the rules within the array does not matter - what matters is the field \"order\" within each rule + Rules CreateShareExportPolicyPayloadGetRulesAttributeType `json:"rules,omitempty"` +} + +// NewCreateShareExportPolicyPayload instantiates a new CreateShareExportPolicyPayload 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 NewCreateShareExportPolicyPayload() *CreateShareExportPolicyPayload { + this := CreateShareExportPolicyPayload{} + return &this +} + +// NewCreateShareExportPolicyPayloadWithDefaults instantiates a new CreateShareExportPolicyPayload 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 NewCreateShareExportPolicyPayloadWithDefaults() *CreateShareExportPolicyPayload { + this := CreateShareExportPolicyPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateShareExportPolicyPayload) GetLabels() (res CreateShareExportPolicyPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyPayload) GetLabelsOk() (ret CreateShareExportPolicyPayloadGetLabelsRetType, ok bool) { + return getCreateShareExportPolicyPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateShareExportPolicyPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateShareExportPolicyPayload) SetLabels(v CreateShareExportPolicyPayloadGetLabelsRetType) { + setCreateShareExportPolicyPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateShareExportPolicyPayload) GetName() (res CreateShareExportPolicyPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyPayload) GetNameOk() (ret CreateShareExportPolicyPayloadGetNameRetType, ok bool) { + return getCreateShareExportPolicyPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateShareExportPolicyPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateShareExportPolicyPayload) SetName(v CreateShareExportPolicyPayloadGetNameRetType) { + setCreateShareExportPolicyPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *CreateShareExportPolicyPayload) GetRules() (res CreateShareExportPolicyPayloadGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyPayload) GetRulesOk() (ret CreateShareExportPolicyPayloadGetRulesRetType, ok bool) { + return getCreateShareExportPolicyPayloadGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *CreateShareExportPolicyPayload) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given []CreateShareExportPolicyRequestRule and assigns it to the Rules field. +func (o *CreateShareExportPolicyPayload) SetRules(v CreateShareExportPolicyPayloadGetRulesRetType) { + setCreateShareExportPolicyPayloadGetRulesAttributeType(&o.Rules, v) +} + +func (o CreateShareExportPolicyPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateShareExportPolicyPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateShareExportPolicyPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateShareExportPolicyPayloadGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableCreateShareExportPolicyPayload struct { + value *CreateShareExportPolicyPayload + isSet bool +} + +func (v NullableCreateShareExportPolicyPayload) Get() *CreateShareExportPolicyPayload { + return v.value +} + +func (v *NullableCreateShareExportPolicyPayload) Set(val *CreateShareExportPolicyPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateShareExportPolicyPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateShareExportPolicyPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateShareExportPolicyPayload(val *CreateShareExportPolicyPayload) *NullableCreateShareExportPolicyPayload { + return &NullableCreateShareExportPolicyPayload{value: val, isSet: true} +} + +func (v NullableCreateShareExportPolicyPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateShareExportPolicyPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_share_export_policy_payload_test.go b/pkg/sfsbeta/model_create_share_export_policy_payload_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_export_policy_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_share_export_policy_request_rule.go b/pkg/sfsbeta/model_create_share_export_policy_request_rule.go new file mode 100644 index 00000000..f1dd4f01 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_export_policy_request_rule.go @@ -0,0 +1,391 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the CreateShareExportPolicyRequestRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateShareExportPolicyRequestRule{} + +/* + types and functions for description +*/ + +// isNullableString +type CreateShareExportPolicyRequestRuleGetDescriptionAttributeType = *NullableString + +func getCreateShareExportPolicyRequestRuleGetDescriptionAttributeTypeOk(arg CreateShareExportPolicyRequestRuleGetDescriptionAttributeType) (ret CreateShareExportPolicyRequestRuleGetDescriptionRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateShareExportPolicyRequestRuleGetDescriptionAttributeType(arg *CreateShareExportPolicyRequestRuleGetDescriptionAttributeType, val CreateShareExportPolicyRequestRuleGetDescriptionRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateShareExportPolicyRequestRuleGetDescriptionArgType = *string +type CreateShareExportPolicyRequestRuleGetDescriptionRetType = *string + +/* + types and functions for ipAcl +*/ + +// isArray +type CreateShareExportPolicyRequestRuleGetIpAclAttributeType = *[]string +type CreateShareExportPolicyRequestRuleGetIpAclArgType = []string +type CreateShareExportPolicyRequestRuleGetIpAclRetType = []string + +func getCreateShareExportPolicyRequestRuleGetIpAclAttributeTypeOk(arg CreateShareExportPolicyRequestRuleGetIpAclAttributeType) (ret CreateShareExportPolicyRequestRuleGetIpAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyRequestRuleGetIpAclAttributeType(arg *CreateShareExportPolicyRequestRuleGetIpAclAttributeType, val CreateShareExportPolicyRequestRuleGetIpAclRetType) { + *arg = &val +} + +/* + types and functions for order +*/ + +// isInteger +type CreateShareExportPolicyRequestRuleGetOrderAttributeType = *int64 +type CreateShareExportPolicyRequestRuleGetOrderArgType = int64 +type CreateShareExportPolicyRequestRuleGetOrderRetType = int64 + +func getCreateShareExportPolicyRequestRuleGetOrderAttributeTypeOk(arg CreateShareExportPolicyRequestRuleGetOrderAttributeType) (ret CreateShareExportPolicyRequestRuleGetOrderRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyRequestRuleGetOrderAttributeType(arg *CreateShareExportPolicyRequestRuleGetOrderAttributeType, val CreateShareExportPolicyRequestRuleGetOrderRetType) { + *arg = &val +} + +/* + types and functions for readOnly +*/ + +// isBoolean +type CreateShareExportPolicyRequestRulegetReadOnlyAttributeType = *bool +type CreateShareExportPolicyRequestRulegetReadOnlyArgType = bool +type CreateShareExportPolicyRequestRulegetReadOnlyRetType = bool + +func getCreateShareExportPolicyRequestRulegetReadOnlyAttributeTypeOk(arg CreateShareExportPolicyRequestRulegetReadOnlyAttributeType) (ret CreateShareExportPolicyRequestRulegetReadOnlyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyRequestRulegetReadOnlyAttributeType(arg *CreateShareExportPolicyRequestRulegetReadOnlyAttributeType, val CreateShareExportPolicyRequestRulegetReadOnlyRetType) { + *arg = &val +} + +/* + types and functions for setUuid +*/ + +// isBoolean +type CreateShareExportPolicyRequestRulegetSetUuidAttributeType = *bool +type CreateShareExportPolicyRequestRulegetSetUuidArgType = bool +type CreateShareExportPolicyRequestRulegetSetUuidRetType = bool + +func getCreateShareExportPolicyRequestRulegetSetUuidAttributeTypeOk(arg CreateShareExportPolicyRequestRulegetSetUuidAttributeType) (ret CreateShareExportPolicyRequestRulegetSetUuidRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyRequestRulegetSetUuidAttributeType(arg *CreateShareExportPolicyRequestRulegetSetUuidAttributeType, val CreateShareExportPolicyRequestRulegetSetUuidRetType) { + *arg = &val +} + +/* + types and functions for superUser +*/ + +// isBoolean +type CreateShareExportPolicyRequestRulegetSuperUserAttributeType = *bool +type CreateShareExportPolicyRequestRulegetSuperUserArgType = bool +type CreateShareExportPolicyRequestRulegetSuperUserRetType = bool + +func getCreateShareExportPolicyRequestRulegetSuperUserAttributeTypeOk(arg CreateShareExportPolicyRequestRulegetSuperUserAttributeType) (ret CreateShareExportPolicyRequestRulegetSuperUserRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyRequestRulegetSuperUserAttributeType(arg *CreateShareExportPolicyRequestRulegetSuperUserAttributeType, val CreateShareExportPolicyRequestRulegetSuperUserRetType) { + *arg = &val +} + +// CreateShareExportPolicyRequestRule struct for CreateShareExportPolicyRequestRule +type CreateShareExportPolicyRequestRule struct { + // Description of the Rule (optional) + Description CreateShareExportPolicyRequestRuleGetDescriptionAttributeType `json:"description,omitempty"` + // IP access control list, where IPs must have a subnet mask (e.g. \"172.16.0.0/24\" for a range of IPs, or \"172.16.0.250/32\" for a specific IP) This array cannot be empty + IpAcl CreateShareExportPolicyRequestRuleGetIpAclAttributeType `json:"ipAcl,omitempty"` + // Order of the rule within a Share Export Policy. The order is used so that when a client IP matches multiple rules, the first rule is applied This field must be set + // Can be cast to int32 without loss of precision. + Order CreateShareExportPolicyRequestRuleGetOrderAttributeType `json:"order,omitempty"` + // Flag to indicate if client IPs matching this rule can only mount the share in read only mode Default: false + ReadOnly CreateShareExportPolicyRequestRulegetReadOnlyAttributeType `json:"readOnly,omitempty"` + // Flag to honor set UUID Default: false + SetUuid CreateShareExportPolicyRequestRulegetSetUuidAttributeType `json:"setUuid,omitempty"` + // Flag to indicate if client IPs matching this rule have root access on the Share Default: true + SuperUser CreateShareExportPolicyRequestRulegetSuperUserAttributeType `json:"superUser,omitempty"` +} + +// NewCreateShareExportPolicyRequestRule instantiates a new CreateShareExportPolicyRequestRule 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 NewCreateShareExportPolicyRequestRule() *CreateShareExportPolicyRequestRule { + this := CreateShareExportPolicyRequestRule{} + return &this +} + +// NewCreateShareExportPolicyRequestRuleWithDefaults instantiates a new CreateShareExportPolicyRequestRule 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 NewCreateShareExportPolicyRequestRuleWithDefaults() *CreateShareExportPolicyRequestRule { + this := CreateShareExportPolicyRequestRule{} + var readOnly bool = false + this.ReadOnly = &readOnly + var setUuid bool = false + this.SetUuid = &setUuid + var superUser bool = true + this.SuperUser = &superUser + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateShareExportPolicyRequestRule) GetDescription() (res CreateShareExportPolicyRequestRuleGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// 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 *CreateShareExportPolicyRequestRule) GetDescriptionOk() (ret CreateShareExportPolicyRequestRuleGetDescriptionRetType, ok bool) { + return getCreateShareExportPolicyRequestRuleGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateShareExportPolicyRequestRule) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateShareExportPolicyRequestRule) SetDescription(v CreateShareExportPolicyRequestRuleGetDescriptionRetType) { + setCreateShareExportPolicyRequestRuleGetDescriptionAttributeType(&o.Description, v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil +func (o *CreateShareExportPolicyRequestRule) SetDescriptionNil() { + o.Description = nil +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil +func (o *CreateShareExportPolicyRequestRule) UnsetDescription() { + o.Description = nil +} + +// GetIpAcl returns the IpAcl field value if set, zero value otherwise. +func (o *CreateShareExportPolicyRequestRule) GetIpAcl() (res CreateShareExportPolicyRequestRuleGetIpAclRetType) { + res, _ = o.GetIpAclOk() + return +} + +// GetIpAclOk returns a tuple with the IpAcl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyRequestRule) GetIpAclOk() (ret CreateShareExportPolicyRequestRuleGetIpAclRetType, ok bool) { + return getCreateShareExportPolicyRequestRuleGetIpAclAttributeTypeOk(o.IpAcl) +} + +// HasIpAcl returns a boolean if a field has been set. +func (o *CreateShareExportPolicyRequestRule) HasIpAcl() bool { + _, ok := o.GetIpAclOk() + return ok +} + +// SetIpAcl gets a reference to the given []string and assigns it to the IpAcl field. +func (o *CreateShareExportPolicyRequestRule) SetIpAcl(v CreateShareExportPolicyRequestRuleGetIpAclRetType) { + setCreateShareExportPolicyRequestRuleGetIpAclAttributeType(&o.IpAcl, v) +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *CreateShareExportPolicyRequestRule) GetOrder() (res CreateShareExportPolicyRequestRuleGetOrderRetType) { + res, _ = o.GetOrderOk() + return +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyRequestRule) GetOrderOk() (ret CreateShareExportPolicyRequestRuleGetOrderRetType, ok bool) { + return getCreateShareExportPolicyRequestRuleGetOrderAttributeTypeOk(o.Order) +} + +// HasOrder returns a boolean if a field has been set. +func (o *CreateShareExportPolicyRequestRule) HasOrder() bool { + _, ok := o.GetOrderOk() + return ok +} + +// SetOrder gets a reference to the given int64 and assigns it to the Order field. +func (o *CreateShareExportPolicyRequestRule) SetOrder(v CreateShareExportPolicyRequestRuleGetOrderRetType) { + setCreateShareExportPolicyRequestRuleGetOrderAttributeType(&o.Order, v) +} + +// GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +func (o *CreateShareExportPolicyRequestRule) GetReadOnly() (res CreateShareExportPolicyRequestRulegetReadOnlyRetType) { + res, _ = o.GetReadOnlyOk() + return +} + +// GetReadOnlyOk returns a tuple with the ReadOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyRequestRule) GetReadOnlyOk() (ret CreateShareExportPolicyRequestRulegetReadOnlyRetType, ok bool) { + return getCreateShareExportPolicyRequestRulegetReadOnlyAttributeTypeOk(o.ReadOnly) +} + +// HasReadOnly returns a boolean if a field has been set. +func (o *CreateShareExportPolicyRequestRule) HasReadOnly() bool { + _, ok := o.GetReadOnlyOk() + return ok +} + +// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +func (o *CreateShareExportPolicyRequestRule) SetReadOnly(v CreateShareExportPolicyRequestRulegetReadOnlyRetType) { + setCreateShareExportPolicyRequestRulegetReadOnlyAttributeType(&o.ReadOnly, v) +} + +// GetSetUuid returns the SetUuid field value if set, zero value otherwise. +func (o *CreateShareExportPolicyRequestRule) GetSetUuid() (res CreateShareExportPolicyRequestRulegetSetUuidRetType) { + res, _ = o.GetSetUuidOk() + return +} + +// GetSetUuidOk returns a tuple with the SetUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyRequestRule) GetSetUuidOk() (ret CreateShareExportPolicyRequestRulegetSetUuidRetType, ok bool) { + return getCreateShareExportPolicyRequestRulegetSetUuidAttributeTypeOk(o.SetUuid) +} + +// HasSetUuid returns a boolean if a field has been set. +func (o *CreateShareExportPolicyRequestRule) HasSetUuid() bool { + _, ok := o.GetSetUuidOk() + return ok +} + +// SetSetUuid gets a reference to the given bool and assigns it to the SetUuid field. +func (o *CreateShareExportPolicyRequestRule) SetSetUuid(v CreateShareExportPolicyRequestRulegetSetUuidRetType) { + setCreateShareExportPolicyRequestRulegetSetUuidAttributeType(&o.SetUuid, v) +} + +// GetSuperUser returns the SuperUser field value if set, zero value otherwise. +func (o *CreateShareExportPolicyRequestRule) GetSuperUser() (res CreateShareExportPolicyRequestRulegetSuperUserRetType) { + res, _ = o.GetSuperUserOk() + return +} + +// GetSuperUserOk returns a tuple with the SuperUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyRequestRule) GetSuperUserOk() (ret CreateShareExportPolicyRequestRulegetSuperUserRetType, ok bool) { + return getCreateShareExportPolicyRequestRulegetSuperUserAttributeTypeOk(o.SuperUser) +} + +// HasSuperUser returns a boolean if a field has been set. +func (o *CreateShareExportPolicyRequestRule) HasSuperUser() bool { + _, ok := o.GetSuperUserOk() + return ok +} + +// SetSuperUser gets a reference to the given bool and assigns it to the SuperUser field. +func (o *CreateShareExportPolicyRequestRule) SetSuperUser(v CreateShareExportPolicyRequestRulegetSuperUserRetType) { + setCreateShareExportPolicyRequestRulegetSuperUserAttributeType(&o.SuperUser, v) +} + +func (o CreateShareExportPolicyRequestRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateShareExportPolicyRequestRuleGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateShareExportPolicyRequestRuleGetIpAclAttributeTypeOk(o.IpAcl); ok { + toSerialize["IpAcl"] = val + } + if val, ok := getCreateShareExportPolicyRequestRuleGetOrderAttributeTypeOk(o.Order); ok { + toSerialize["Order"] = val + } + if val, ok := getCreateShareExportPolicyRequestRulegetReadOnlyAttributeTypeOk(o.ReadOnly); ok { + toSerialize["ReadOnly"] = val + } + if val, ok := getCreateShareExportPolicyRequestRulegetSetUuidAttributeTypeOk(o.SetUuid); ok { + toSerialize["SetUuid"] = val + } + if val, ok := getCreateShareExportPolicyRequestRulegetSuperUserAttributeTypeOk(o.SuperUser); ok { + toSerialize["SuperUser"] = val + } + return toSerialize, nil +} + +type NullableCreateShareExportPolicyRequestRule struct { + value *CreateShareExportPolicyRequestRule + isSet bool +} + +func (v NullableCreateShareExportPolicyRequestRule) Get() *CreateShareExportPolicyRequestRule { + return v.value +} + +func (v *NullableCreateShareExportPolicyRequestRule) Set(val *CreateShareExportPolicyRequestRule) { + v.value = val + v.isSet = true +} + +func (v NullableCreateShareExportPolicyRequestRule) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateShareExportPolicyRequestRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateShareExportPolicyRequestRule(val *CreateShareExportPolicyRequestRule) *NullableCreateShareExportPolicyRequestRule { + return &NullableCreateShareExportPolicyRequestRule{value: val, isSet: true} +} + +func (v NullableCreateShareExportPolicyRequestRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateShareExportPolicyRequestRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_share_export_policy_request_rule_test.go b/pkg/sfsbeta/model_create_share_export_policy_request_rule_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_export_policy_request_rule_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_share_export_policy_response.go b/pkg/sfsbeta/model_create_share_export_policy_response.go new file mode 100644 index 00000000..334b11df --- /dev/null +++ b/pkg/sfsbeta/model_create_share_export_policy_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the CreateShareExportPolicyResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateShareExportPolicyResponse{} + +/* + types and functions for shareExportPolicy +*/ + +// isModel +type CreateShareExportPolicyResponseGetShareExportPolicyAttributeType = *CreateShareExportPolicyResponseShareExportPolicy +type CreateShareExportPolicyResponseGetShareExportPolicyArgType = CreateShareExportPolicyResponseShareExportPolicy +type CreateShareExportPolicyResponseGetShareExportPolicyRetType = CreateShareExportPolicyResponseShareExportPolicy + +func getCreateShareExportPolicyResponseGetShareExportPolicyAttributeTypeOk(arg CreateShareExportPolicyResponseGetShareExportPolicyAttributeType) (ret CreateShareExportPolicyResponseGetShareExportPolicyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyResponseGetShareExportPolicyAttributeType(arg *CreateShareExportPolicyResponseGetShareExportPolicyAttributeType, val CreateShareExportPolicyResponseGetShareExportPolicyRetType) { + *arg = &val +} + +// CreateShareExportPolicyResponse struct for CreateShareExportPolicyResponse +type CreateShareExportPolicyResponse struct { + ShareExportPolicy CreateShareExportPolicyResponseGetShareExportPolicyAttributeType `json:"shareExportPolicy,omitempty"` +} + +// NewCreateShareExportPolicyResponse instantiates a new CreateShareExportPolicyResponse 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 NewCreateShareExportPolicyResponse() *CreateShareExportPolicyResponse { + this := CreateShareExportPolicyResponse{} + return &this +} + +// NewCreateShareExportPolicyResponseWithDefaults instantiates a new CreateShareExportPolicyResponse 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 NewCreateShareExportPolicyResponseWithDefaults() *CreateShareExportPolicyResponse { + this := CreateShareExportPolicyResponse{} + return &this +} + +// GetShareExportPolicy returns the ShareExportPolicy field value if set, zero value otherwise. +func (o *CreateShareExportPolicyResponse) GetShareExportPolicy() (res CreateShareExportPolicyResponseGetShareExportPolicyRetType) { + res, _ = o.GetShareExportPolicyOk() + return +} + +// GetShareExportPolicyOk returns a tuple with the ShareExportPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyResponse) GetShareExportPolicyOk() (ret CreateShareExportPolicyResponseGetShareExportPolicyRetType, ok bool) { + return getCreateShareExportPolicyResponseGetShareExportPolicyAttributeTypeOk(o.ShareExportPolicy) +} + +// HasShareExportPolicy returns a boolean if a field has been set. +func (o *CreateShareExportPolicyResponse) HasShareExportPolicy() bool { + _, ok := o.GetShareExportPolicyOk() + return ok +} + +// SetShareExportPolicy gets a reference to the given CreateShareExportPolicyResponseShareExportPolicy and assigns it to the ShareExportPolicy field. +func (o *CreateShareExportPolicyResponse) SetShareExportPolicy(v CreateShareExportPolicyResponseGetShareExportPolicyRetType) { + setCreateShareExportPolicyResponseGetShareExportPolicyAttributeType(&o.ShareExportPolicy, v) +} + +func (o CreateShareExportPolicyResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateShareExportPolicyResponseGetShareExportPolicyAttributeTypeOk(o.ShareExportPolicy); ok { + toSerialize["ShareExportPolicy"] = val + } + return toSerialize, nil +} + +type NullableCreateShareExportPolicyResponse struct { + value *CreateShareExportPolicyResponse + isSet bool +} + +func (v NullableCreateShareExportPolicyResponse) Get() *CreateShareExportPolicyResponse { + return v.value +} + +func (v *NullableCreateShareExportPolicyResponse) Set(val *CreateShareExportPolicyResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateShareExportPolicyResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateShareExportPolicyResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateShareExportPolicyResponse(val *CreateShareExportPolicyResponse) *NullableCreateShareExportPolicyResponse { + return &NullableCreateShareExportPolicyResponse{value: val, isSet: true} +} + +func (v NullableCreateShareExportPolicyResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateShareExportPolicyResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_share_export_policy_response_share_export_policy.go b/pkg/sfsbeta/model_create_share_export_policy_response_share_export_policy.go new file mode 100644 index 00000000..f7227ec4 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_export_policy_response_share_export_policy.go @@ -0,0 +1,371 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the CreateShareExportPolicyResponseShareExportPolicy type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateShareExportPolicyResponseShareExportPolicy{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType = *time.Time +type CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtArgType = time.Time +type CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType = time.Time + +func getCreateShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeTypeOk(arg CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType) (ret CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType(arg *CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType, val CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateShareExportPolicyResponseShareExportPolicyGetIdAttributeType = *string + +func getCreateShareExportPolicyResponseShareExportPolicyGetIdAttributeTypeOk(arg CreateShareExportPolicyResponseShareExportPolicyGetIdAttributeType) (ret CreateShareExportPolicyResponseShareExportPolicyGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyResponseShareExportPolicyGetIdAttributeType(arg *CreateShareExportPolicyResponseShareExportPolicyGetIdAttributeType, val CreateShareExportPolicyResponseShareExportPolicyGetIdRetType) { + *arg = &val +} + +type CreateShareExportPolicyResponseShareExportPolicyGetIdArgType = string +type CreateShareExportPolicyResponseShareExportPolicyGetIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type CreateShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType = *map[string]string +type CreateShareExportPolicyResponseShareExportPolicyGetLabelsArgType = map[string]string +type CreateShareExportPolicyResponseShareExportPolicyGetLabelsRetType = map[string]string + +func getCreateShareExportPolicyResponseShareExportPolicyGetLabelsAttributeTypeOk(arg CreateShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType) (ret CreateShareExportPolicyResponseShareExportPolicyGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType(arg *CreateShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType, val CreateShareExportPolicyResponseShareExportPolicyGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateShareExportPolicyResponseShareExportPolicyGetNameAttributeType = *string + +func getCreateShareExportPolicyResponseShareExportPolicyGetNameAttributeTypeOk(arg CreateShareExportPolicyResponseShareExportPolicyGetNameAttributeType) (ret CreateShareExportPolicyResponseShareExportPolicyGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyResponseShareExportPolicyGetNameAttributeType(arg *CreateShareExportPolicyResponseShareExportPolicyGetNameAttributeType, val CreateShareExportPolicyResponseShareExportPolicyGetNameRetType) { + *arg = &val +} + +type CreateShareExportPolicyResponseShareExportPolicyGetNameArgType = string +type CreateShareExportPolicyResponseShareExportPolicyGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type CreateShareExportPolicyResponseShareExportPolicyGetRulesAttributeType = *[]ShareExportPolicyRule +type CreateShareExportPolicyResponseShareExportPolicyGetRulesArgType = []ShareExportPolicyRule +type CreateShareExportPolicyResponseShareExportPolicyGetRulesRetType = []ShareExportPolicyRule + +func getCreateShareExportPolicyResponseShareExportPolicyGetRulesAttributeTypeOk(arg CreateShareExportPolicyResponseShareExportPolicyGetRulesAttributeType) (ret CreateShareExportPolicyResponseShareExportPolicyGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyResponseShareExportPolicyGetRulesAttributeType(arg *CreateShareExportPolicyResponseShareExportPolicyGetRulesAttributeType, val CreateShareExportPolicyResponseShareExportPolicyGetRulesRetType) { + *arg = &val +} + +/* + types and functions for sharesUsingExportPolicy +*/ + +// isInteger +type CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType = *int64 +type CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyArgType = int64 +type CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType = int64 + +func getCreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeTypeOk(arg CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType) (ret CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType(arg *CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType, val CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType) { + *arg = &val +} + +// CreateShareExportPolicyResponseShareExportPolicy Created Share Export Policy +type CreateShareExportPolicyResponseShareExportPolicy struct { + CreatedAt CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // ID of the Share Export Policy + Id CreateShareExportPolicyResponseShareExportPolicyGetIdAttributeType `json:"id,omitempty"` + // An optional object that represents the labels associated with the share export policy keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels CreateShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType `json:"labels,omitempty"` + // Name of the Share Export Policy + Name CreateShareExportPolicyResponseShareExportPolicyGetNameAttributeType `json:"name,omitempty"` + // List of rules of the Share Export Policy. The order of the rules within the array does not matter - what matters is the field \"order\" within each rule + Rules CreateShareExportPolicyResponseShareExportPolicyGetRulesAttributeType `json:"rules,omitempty"` + // Number of Shares using this Share Export Policy + // Can be cast to int32 without loss of precision. + SharesUsingExportPolicy CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType `json:"sharesUsingExportPolicy,omitempty"` +} + +// NewCreateShareExportPolicyResponseShareExportPolicy instantiates a new CreateShareExportPolicyResponseShareExportPolicy 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 NewCreateShareExportPolicyResponseShareExportPolicy() *CreateShareExportPolicyResponseShareExportPolicy { + this := CreateShareExportPolicyResponseShareExportPolicy{} + return &this +} + +// NewCreateShareExportPolicyResponseShareExportPolicyWithDefaults instantiates a new CreateShareExportPolicyResponseShareExportPolicy 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 NewCreateShareExportPolicyResponseShareExportPolicyWithDefaults() *CreateShareExportPolicyResponseShareExportPolicy { + this := CreateShareExportPolicyResponseShareExportPolicy{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetCreatedAt() (res CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetCreatedAtOk() (ret CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType, ok bool) { + return getCreateShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateShareExportPolicyResponseShareExportPolicy) SetCreatedAt(v CreateShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType) { + setCreateShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetId() (res CreateShareExportPolicyResponseShareExportPolicyGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetIdOk() (ret CreateShareExportPolicyResponseShareExportPolicyGetIdRetType, ok bool) { + return getCreateShareExportPolicyResponseShareExportPolicyGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateShareExportPolicyResponseShareExportPolicy) SetId(v CreateShareExportPolicyResponseShareExportPolicyGetIdRetType) { + setCreateShareExportPolicyResponseShareExportPolicyGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetLabels() (res CreateShareExportPolicyResponseShareExportPolicyGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetLabelsOk() (ret CreateShareExportPolicyResponseShareExportPolicyGetLabelsRetType, ok bool) { + return getCreateShareExportPolicyResponseShareExportPolicyGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateShareExportPolicyResponseShareExportPolicy) SetLabels(v CreateShareExportPolicyResponseShareExportPolicyGetLabelsRetType) { + setCreateShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetName() (res CreateShareExportPolicyResponseShareExportPolicyGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetNameOk() (ret CreateShareExportPolicyResponseShareExportPolicyGetNameRetType, ok bool) { + return getCreateShareExportPolicyResponseShareExportPolicyGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateShareExportPolicyResponseShareExportPolicy) SetName(v CreateShareExportPolicyResponseShareExportPolicyGetNameRetType) { + setCreateShareExportPolicyResponseShareExportPolicyGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetRules() (res CreateShareExportPolicyResponseShareExportPolicyGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetRulesOk() (ret CreateShareExportPolicyResponseShareExportPolicyGetRulesRetType, ok bool) { + return getCreateShareExportPolicyResponseShareExportPolicyGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given []ShareExportPolicyRule and assigns it to the Rules field. +func (o *CreateShareExportPolicyResponseShareExportPolicy) SetRules(v CreateShareExportPolicyResponseShareExportPolicyGetRulesRetType) { + setCreateShareExportPolicyResponseShareExportPolicyGetRulesAttributeType(&o.Rules, v) +} + +// GetSharesUsingExportPolicy returns the SharesUsingExportPolicy field value if set, zero value otherwise. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetSharesUsingExportPolicy() (res CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType) { + res, _ = o.GetSharesUsingExportPolicyOk() + return +} + +// GetSharesUsingExportPolicyOk returns a tuple with the SharesUsingExportPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) GetSharesUsingExportPolicyOk() (ret CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType, ok bool) { + return getCreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeTypeOk(o.SharesUsingExportPolicy) +} + +// HasSharesUsingExportPolicy returns a boolean if a field has been set. +func (o *CreateShareExportPolicyResponseShareExportPolicy) HasSharesUsingExportPolicy() bool { + _, ok := o.GetSharesUsingExportPolicyOk() + return ok +} + +// SetSharesUsingExportPolicy gets a reference to the given int64 and assigns it to the SharesUsingExportPolicy field. +func (o *CreateShareExportPolicyResponseShareExportPolicy) SetSharesUsingExportPolicy(v CreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType) { + setCreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType(&o.SharesUsingExportPolicy, v) +} + +func (o CreateShareExportPolicyResponseShareExportPolicy) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateShareExportPolicyResponseShareExportPolicyGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateShareExportPolicyResponseShareExportPolicyGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateShareExportPolicyResponseShareExportPolicyGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateShareExportPolicyResponseShareExportPolicyGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + if val, ok := getCreateShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeTypeOk(o.SharesUsingExportPolicy); ok { + toSerialize["SharesUsingExportPolicy"] = val + } + return toSerialize, nil +} + +type NullableCreateShareExportPolicyResponseShareExportPolicy struct { + value *CreateShareExportPolicyResponseShareExportPolicy + isSet bool +} + +func (v NullableCreateShareExportPolicyResponseShareExportPolicy) Get() *CreateShareExportPolicyResponseShareExportPolicy { + return v.value +} + +func (v *NullableCreateShareExportPolicyResponseShareExportPolicy) Set(val *CreateShareExportPolicyResponseShareExportPolicy) { + v.value = val + v.isSet = true +} + +func (v NullableCreateShareExportPolicyResponseShareExportPolicy) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateShareExportPolicyResponseShareExportPolicy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateShareExportPolicyResponseShareExportPolicy(val *CreateShareExportPolicyResponseShareExportPolicy) *NullableCreateShareExportPolicyResponseShareExportPolicy { + return &NullableCreateShareExportPolicyResponseShareExportPolicy{value: val, isSet: true} +} + +func (v NullableCreateShareExportPolicyResponseShareExportPolicy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateShareExportPolicyResponseShareExportPolicy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_share_export_policy_response_share_export_policy_test.go b/pkg/sfsbeta/model_create_share_export_policy_response_share_export_policy_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_export_policy_response_share_export_policy_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_share_export_policy_response_test.go b/pkg/sfsbeta/model_create_share_export_policy_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_export_policy_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_share_payload.go b/pkg/sfsbeta/model_create_share_payload.go new file mode 100644 index 00000000..a92d7e08 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_payload.go @@ -0,0 +1,290 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the CreateSharePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSharePayload{} + +/* + types and functions for exportPolicyName +*/ + +// isNullableString +type CreateSharePayloadGetExportPolicyNameAttributeType = *NullableString + +func getCreateSharePayloadGetExportPolicyNameAttributeTypeOk(arg CreateSharePayloadGetExportPolicyNameAttributeType) (ret CreateSharePayloadGetExportPolicyNameRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateSharePayloadGetExportPolicyNameAttributeType(arg *CreateSharePayloadGetExportPolicyNameAttributeType, val CreateSharePayloadGetExportPolicyNameRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateSharePayloadGetExportPolicyNameArgType = *string +type CreateSharePayloadGetExportPolicyNameRetType = *string + +/* + types and functions for labels +*/ + +// isContainer +type CreateSharePayloadGetLabelsAttributeType = *map[string]string +type CreateSharePayloadGetLabelsArgType = map[string]string +type CreateSharePayloadGetLabelsRetType = map[string]string + +func getCreateSharePayloadGetLabelsAttributeTypeOk(arg CreateSharePayloadGetLabelsAttributeType) (ret CreateSharePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSharePayloadGetLabelsAttributeType(arg *CreateSharePayloadGetLabelsAttributeType, val CreateSharePayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateSharePayloadGetNameAttributeType = *string + +func getCreateSharePayloadGetNameAttributeTypeOk(arg CreateSharePayloadGetNameAttributeType) (ret CreateSharePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSharePayloadGetNameAttributeType(arg *CreateSharePayloadGetNameAttributeType, val CreateSharePayloadGetNameRetType) { + *arg = &val +} + +type CreateSharePayloadGetNameArgType = string +type CreateSharePayloadGetNameRetType = string + +/* + types and functions for spaceHardLimitGigabytes +*/ + +// isInteger +type CreateSharePayloadGetSpaceHardLimitGigabytesAttributeType = *int64 +type CreateSharePayloadGetSpaceHardLimitGigabytesArgType = int64 +type CreateSharePayloadGetSpaceHardLimitGigabytesRetType = int64 + +func getCreateSharePayloadGetSpaceHardLimitGigabytesAttributeTypeOk(arg CreateSharePayloadGetSpaceHardLimitGigabytesAttributeType) (ret CreateSharePayloadGetSpaceHardLimitGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSharePayloadGetSpaceHardLimitGigabytesAttributeType(arg *CreateSharePayloadGetSpaceHardLimitGigabytesAttributeType, val CreateSharePayloadGetSpaceHardLimitGigabytesRetType) { + *arg = &val +} + +// CreateSharePayload struct for CreateSharePayload +type CreateSharePayload struct { + // Name of the Share Export Policy to use in the Share. Note that if this is not set, the Share can only be mounted in read only by clients with IPs matching the IP ACL of the Resource Pool hosting this Share. You can also assign a Share Export Policy after creating the Share + ExportPolicyName CreateSharePayloadGetExportPolicyNameAttributeType `json:"exportPolicyName,omitempty"` + // An optional object that represents the labels associated with the share keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels CreateSharePayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Name of the Share + Name CreateSharePayloadGetNameAttributeType `json:"name,omitempty"` + // Space hard limit for the Share. If zero, the Share will have access to the full space of the Resource Pool it lives in. (unit: gibibytes) + // Can be cast to int32 without loss of precision. + SpaceHardLimitGigabytes CreateSharePayloadGetSpaceHardLimitGigabytesAttributeType `json:"spaceHardLimitGigabytes,omitempty"` +} + +// NewCreateSharePayload instantiates a new CreateSharePayload 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 NewCreateSharePayload() *CreateSharePayload { + this := CreateSharePayload{} + return &this +} + +// NewCreateSharePayloadWithDefaults instantiates a new CreateSharePayload 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 NewCreateSharePayloadWithDefaults() *CreateSharePayload { + this := CreateSharePayload{} + return &this +} + +// GetExportPolicyName returns the ExportPolicyName field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateSharePayload) GetExportPolicyName() (res CreateSharePayloadGetExportPolicyNameRetType) { + res, _ = o.GetExportPolicyNameOk() + return +} + +// GetExportPolicyNameOk returns a tuple with the ExportPolicyName field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateSharePayload) GetExportPolicyNameOk() (ret CreateSharePayloadGetExportPolicyNameRetType, ok bool) { + return getCreateSharePayloadGetExportPolicyNameAttributeTypeOk(o.ExportPolicyName) +} + +// HasExportPolicyName returns a boolean if a field has been set. +func (o *CreateSharePayload) HasExportPolicyName() bool { + _, ok := o.GetExportPolicyNameOk() + return ok +} + +// SetExportPolicyName gets a reference to the given string and assigns it to the ExportPolicyName field. +func (o *CreateSharePayload) SetExportPolicyName(v CreateSharePayloadGetExportPolicyNameRetType) { + setCreateSharePayloadGetExportPolicyNameAttributeType(&o.ExportPolicyName, v) +} + +// SetExportPolicyNameNil sets the value for ExportPolicyName to be an explicit nil +func (o *CreateSharePayload) SetExportPolicyNameNil() { + o.ExportPolicyName = nil +} + +// UnsetExportPolicyName ensures that no value is present for ExportPolicyName, not even an explicit nil +func (o *CreateSharePayload) UnsetExportPolicyName() { + o.ExportPolicyName = nil +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateSharePayload) GetLabels() (res CreateSharePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSharePayload) GetLabelsOk() (ret CreateSharePayloadGetLabelsRetType, ok bool) { + return getCreateSharePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateSharePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateSharePayload) SetLabels(v CreateSharePayloadGetLabelsRetType) { + setCreateSharePayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateSharePayload) GetName() (res CreateSharePayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSharePayload) GetNameOk() (ret CreateSharePayloadGetNameRetType, ok bool) { + return getCreateSharePayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateSharePayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateSharePayload) SetName(v CreateSharePayloadGetNameRetType) { + setCreateSharePayloadGetNameAttributeType(&o.Name, v) +} + +// GetSpaceHardLimitGigabytes returns the SpaceHardLimitGigabytes field value if set, zero value otherwise. +func (o *CreateSharePayload) GetSpaceHardLimitGigabytes() (res CreateSharePayloadGetSpaceHardLimitGigabytesRetType) { + res, _ = o.GetSpaceHardLimitGigabytesOk() + return +} + +// GetSpaceHardLimitGigabytesOk returns a tuple with the SpaceHardLimitGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSharePayload) GetSpaceHardLimitGigabytesOk() (ret CreateSharePayloadGetSpaceHardLimitGigabytesRetType, ok bool) { + return getCreateSharePayloadGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes) +} + +// HasSpaceHardLimitGigabytes returns a boolean if a field has been set. +func (o *CreateSharePayload) HasSpaceHardLimitGigabytes() bool { + _, ok := o.GetSpaceHardLimitGigabytesOk() + return ok +} + +// SetSpaceHardLimitGigabytes gets a reference to the given int64 and assigns it to the SpaceHardLimitGigabytes field. +func (o *CreateSharePayload) SetSpaceHardLimitGigabytes(v CreateSharePayloadGetSpaceHardLimitGigabytesRetType) { + setCreateSharePayloadGetSpaceHardLimitGigabytesAttributeType(&o.SpaceHardLimitGigabytes, v) +} + +func (o CreateSharePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateSharePayloadGetExportPolicyNameAttributeTypeOk(o.ExportPolicyName); ok { + toSerialize["ExportPolicyName"] = val + } + if val, ok := getCreateSharePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateSharePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateSharePayloadGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes); ok { + toSerialize["SpaceHardLimitGigabytes"] = val + } + return toSerialize, nil +} + +type NullableCreateSharePayload struct { + value *CreateSharePayload + isSet bool +} + +func (v NullableCreateSharePayload) Get() *CreateSharePayload { + return v.value +} + +func (v *NullableCreateSharePayload) Set(val *CreateSharePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSharePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSharePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSharePayload(val *CreateSharePayload) *NullableCreateSharePayload { + return &NullableCreateSharePayload{value: val, isSet: true} +} + +func (v NullableCreateSharePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSharePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_share_payload_test.go b/pkg/sfsbeta/model_create_share_payload_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_share_response.go b/pkg/sfsbeta/model_create_share_response.go new file mode 100644 index 00000000..d54ddb7e --- /dev/null +++ b/pkg/sfsbeta/model_create_share_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the CreateShareResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateShareResponse{} + +/* + types and functions for share +*/ + +// isModel +type CreateShareResponseGetShareAttributeType = *CreateShareResponseShare +type CreateShareResponseGetShareArgType = CreateShareResponseShare +type CreateShareResponseGetShareRetType = CreateShareResponseShare + +func getCreateShareResponseGetShareAttributeTypeOk(arg CreateShareResponseGetShareAttributeType) (ret CreateShareResponseGetShareRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareResponseGetShareAttributeType(arg *CreateShareResponseGetShareAttributeType, val CreateShareResponseGetShareRetType) { + *arg = &val +} + +// CreateShareResponse struct for CreateShareResponse +type CreateShareResponse struct { + Share CreateShareResponseGetShareAttributeType `json:"share,omitempty"` +} + +// NewCreateShareResponse instantiates a new CreateShareResponse 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 NewCreateShareResponse() *CreateShareResponse { + this := CreateShareResponse{} + return &this +} + +// NewCreateShareResponseWithDefaults instantiates a new CreateShareResponse 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 NewCreateShareResponseWithDefaults() *CreateShareResponse { + this := CreateShareResponse{} + return &this +} + +// GetShare returns the Share field value if set, zero value otherwise. +func (o *CreateShareResponse) GetShare() (res CreateShareResponseGetShareRetType) { + res, _ = o.GetShareOk() + return +} + +// GetShareOk returns a tuple with the Share field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareResponse) GetShareOk() (ret CreateShareResponseGetShareRetType, ok bool) { + return getCreateShareResponseGetShareAttributeTypeOk(o.Share) +} + +// HasShare returns a boolean if a field has been set. +func (o *CreateShareResponse) HasShare() bool { + _, ok := o.GetShareOk() + return ok +} + +// SetShare gets a reference to the given CreateShareResponseShare and assigns it to the Share field. +func (o *CreateShareResponse) SetShare(v CreateShareResponseGetShareRetType) { + setCreateShareResponseGetShareAttributeType(&o.Share, v) +} + +func (o CreateShareResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateShareResponseGetShareAttributeTypeOk(o.Share); ok { + toSerialize["Share"] = val + } + return toSerialize, nil +} + +type NullableCreateShareResponse struct { + value *CreateShareResponse + isSet bool +} + +func (v NullableCreateShareResponse) Get() *CreateShareResponse { + return v.value +} + +func (v *NullableCreateShareResponse) Set(val *CreateShareResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateShareResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateShareResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateShareResponse(val *CreateShareResponse) *NullableCreateShareResponse { + return &NullableCreateShareResponse{value: val, isSet: true} +} + +func (v NullableCreateShareResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateShareResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_share_response_share.go b/pkg/sfsbeta/model_create_share_response_share.go new file mode 100644 index 00000000..bb6e2ce9 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_response_share.go @@ -0,0 +1,479 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the CreateShareResponseShare type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateShareResponseShare{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateShareResponseShareGetCreatedAtAttributeType = *time.Time +type CreateShareResponseShareGetCreatedAtArgType = time.Time +type CreateShareResponseShareGetCreatedAtRetType = time.Time + +func getCreateShareResponseShareGetCreatedAtAttributeTypeOk(arg CreateShareResponseShareGetCreatedAtAttributeType) (ret CreateShareResponseShareGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareResponseShareGetCreatedAtAttributeType(arg *CreateShareResponseShareGetCreatedAtAttributeType, val CreateShareResponseShareGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for exportPolicy +*/ + +// isModel +type CreateShareResponseShareGetExportPolicyAttributeType = *NullableShareExportPolicy +type CreateShareResponseShareGetExportPolicyArgType = *NullableShareExportPolicy +type CreateShareResponseShareGetExportPolicyRetType = *NullableShareExportPolicy + +func getCreateShareResponseShareGetExportPolicyAttributeTypeOk(arg CreateShareResponseShareGetExportPolicyAttributeType) (ret CreateShareResponseShareGetExportPolicyRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setCreateShareResponseShareGetExportPolicyAttributeType(arg *CreateShareResponseShareGetExportPolicyAttributeType, val CreateShareResponseShareGetExportPolicyRetType) { + *arg = val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateShareResponseShareGetIdAttributeType = *string + +func getCreateShareResponseShareGetIdAttributeTypeOk(arg CreateShareResponseShareGetIdAttributeType) (ret CreateShareResponseShareGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareResponseShareGetIdAttributeType(arg *CreateShareResponseShareGetIdAttributeType, val CreateShareResponseShareGetIdRetType) { + *arg = &val +} + +type CreateShareResponseShareGetIdArgType = string +type CreateShareResponseShareGetIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type CreateShareResponseShareGetLabelsAttributeType = *map[string]string +type CreateShareResponseShareGetLabelsArgType = map[string]string +type CreateShareResponseShareGetLabelsRetType = map[string]string + +func getCreateShareResponseShareGetLabelsAttributeTypeOk(arg CreateShareResponseShareGetLabelsAttributeType) (ret CreateShareResponseShareGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareResponseShareGetLabelsAttributeType(arg *CreateShareResponseShareGetLabelsAttributeType, val CreateShareResponseShareGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mountPath +*/ + +// isNotNullableString +type CreateShareResponseShareGetMountPathAttributeType = *string + +func getCreateShareResponseShareGetMountPathAttributeTypeOk(arg CreateShareResponseShareGetMountPathAttributeType) (ret CreateShareResponseShareGetMountPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareResponseShareGetMountPathAttributeType(arg *CreateShareResponseShareGetMountPathAttributeType, val CreateShareResponseShareGetMountPathRetType) { + *arg = &val +} + +type CreateShareResponseShareGetMountPathArgType = string +type CreateShareResponseShareGetMountPathRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateShareResponseShareGetNameAttributeType = *string + +func getCreateShareResponseShareGetNameAttributeTypeOk(arg CreateShareResponseShareGetNameAttributeType) (ret CreateShareResponseShareGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareResponseShareGetNameAttributeType(arg *CreateShareResponseShareGetNameAttributeType, val CreateShareResponseShareGetNameRetType) { + *arg = &val +} + +type CreateShareResponseShareGetNameArgType = string +type CreateShareResponseShareGetNameRetType = string + +/* + types and functions for spaceHardLimitGigabytes +*/ + +// isInteger +type CreateShareResponseShareGetSpaceHardLimitGigabytesAttributeType = *int64 +type CreateShareResponseShareGetSpaceHardLimitGigabytesArgType = int64 +type CreateShareResponseShareGetSpaceHardLimitGigabytesRetType = int64 + +func getCreateShareResponseShareGetSpaceHardLimitGigabytesAttributeTypeOk(arg CreateShareResponseShareGetSpaceHardLimitGigabytesAttributeType) (ret CreateShareResponseShareGetSpaceHardLimitGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareResponseShareGetSpaceHardLimitGigabytesAttributeType(arg *CreateShareResponseShareGetSpaceHardLimitGigabytesAttributeType, val CreateShareResponseShareGetSpaceHardLimitGigabytesRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isNotNullableString +type CreateShareResponseShareGetStateAttributeType = *string + +func getCreateShareResponseShareGetStateAttributeTypeOk(arg CreateShareResponseShareGetStateAttributeType) (ret CreateShareResponseShareGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateShareResponseShareGetStateAttributeType(arg *CreateShareResponseShareGetStateAttributeType, val CreateShareResponseShareGetStateRetType) { + *arg = &val +} + +type CreateShareResponseShareGetStateArgType = string +type CreateShareResponseShareGetStateRetType = string + +// CreateShareResponseShare Created Share +type CreateShareResponseShare struct { + CreatedAt CreateShareResponseShareGetCreatedAtAttributeType `json:"createdAt,omitempty"` + ExportPolicy CreateShareResponseShareGetExportPolicyAttributeType `json:"exportPolicy,omitempty"` + // ID of the Share + Id CreateShareResponseShareGetIdAttributeType `json:"id,omitempty"` + // An optional object that represents the labels associated with the share keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels CreateShareResponseShareGetLabelsAttributeType `json:"labels,omitempty"` + // Mount path of the Share, used to mount the Share + MountPath CreateShareResponseShareGetMountPathAttributeType `json:"mountPath,omitempty"` + // Name of the Share + Name CreateShareResponseShareGetNameAttributeType `json:"name,omitempty"` + // Space hard limit for the Share. If zero, the Share will have access to the full space of the Resource Pool it lives in. (unit: gibibytes) + // Can be cast to int32 without loss of precision. + SpaceHardLimitGigabytes CreateShareResponseShareGetSpaceHardLimitGigabytesAttributeType `json:"spaceHardLimitGigabytes,omitempty"` + // State of the Resource Pool Snapshot (possible values: [\"pending\", \"creating\", \"created\", \"error\", \"deleting\"]) + State CreateShareResponseShareGetStateAttributeType `json:"state,omitempty"` +} + +// NewCreateShareResponseShare instantiates a new CreateShareResponseShare 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 NewCreateShareResponseShare() *CreateShareResponseShare { + this := CreateShareResponseShare{} + return &this +} + +// NewCreateShareResponseShareWithDefaults instantiates a new CreateShareResponseShare 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 NewCreateShareResponseShareWithDefaults() *CreateShareResponseShare { + this := CreateShareResponseShare{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateShareResponseShare) GetCreatedAt() (res CreateShareResponseShareGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareResponseShare) GetCreatedAtOk() (ret CreateShareResponseShareGetCreatedAtRetType, ok bool) { + return getCreateShareResponseShareGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateShareResponseShare) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateShareResponseShare) SetCreatedAt(v CreateShareResponseShareGetCreatedAtRetType) { + setCreateShareResponseShareGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetExportPolicy returns the ExportPolicy field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateShareResponseShare) GetExportPolicy() (res CreateShareResponseShareGetExportPolicyRetType) { + res, _ = o.GetExportPolicyOk() + return +} + +// GetExportPolicyOk returns a tuple with the ExportPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateShareResponseShare) GetExportPolicyOk() (ret CreateShareResponseShareGetExportPolicyRetType, ok bool) { + return getCreateShareResponseShareGetExportPolicyAttributeTypeOk(o.ExportPolicy) +} + +// HasExportPolicy returns a boolean if a field has been set. +func (o *CreateShareResponseShare) HasExportPolicy() bool { + _, ok := o.GetExportPolicyOk() + return ok +} + +// SetExportPolicy gets a reference to the given ShareExportPolicy and assigns it to the ExportPolicy field. +func (o *CreateShareResponseShare) SetExportPolicy(v CreateShareResponseShareGetExportPolicyRetType) { + setCreateShareResponseShareGetExportPolicyAttributeType(&o.ExportPolicy, v) +} + +// SetExportPolicyNil sets the value for ExportPolicy to be an explicit nil +func (o *CreateShareResponseShare) SetExportPolicyNil() { + o.ExportPolicy = nil +} + +// UnsetExportPolicy ensures that no value is present for ExportPolicy, not even an explicit nil +func (o *CreateShareResponseShare) UnsetExportPolicy() { + o.ExportPolicy = nil +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateShareResponseShare) GetId() (res CreateShareResponseShareGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareResponseShare) GetIdOk() (ret CreateShareResponseShareGetIdRetType, ok bool) { + return getCreateShareResponseShareGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateShareResponseShare) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateShareResponseShare) SetId(v CreateShareResponseShareGetIdRetType) { + setCreateShareResponseShareGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateShareResponseShare) GetLabels() (res CreateShareResponseShareGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareResponseShare) GetLabelsOk() (ret CreateShareResponseShareGetLabelsRetType, ok bool) { + return getCreateShareResponseShareGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateShareResponseShare) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateShareResponseShare) SetLabels(v CreateShareResponseShareGetLabelsRetType) { + setCreateShareResponseShareGetLabelsAttributeType(&o.Labels, v) +} + +// GetMountPath returns the MountPath field value if set, zero value otherwise. +func (o *CreateShareResponseShare) GetMountPath() (res CreateShareResponseShareGetMountPathRetType) { + res, _ = o.GetMountPathOk() + return +} + +// GetMountPathOk returns a tuple with the MountPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareResponseShare) GetMountPathOk() (ret CreateShareResponseShareGetMountPathRetType, ok bool) { + return getCreateShareResponseShareGetMountPathAttributeTypeOk(o.MountPath) +} + +// HasMountPath returns a boolean if a field has been set. +func (o *CreateShareResponseShare) HasMountPath() bool { + _, ok := o.GetMountPathOk() + return ok +} + +// SetMountPath gets a reference to the given string and assigns it to the MountPath field. +func (o *CreateShareResponseShare) SetMountPath(v CreateShareResponseShareGetMountPathRetType) { + setCreateShareResponseShareGetMountPathAttributeType(&o.MountPath, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateShareResponseShare) GetName() (res CreateShareResponseShareGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareResponseShare) GetNameOk() (ret CreateShareResponseShareGetNameRetType, ok bool) { + return getCreateShareResponseShareGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateShareResponseShare) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateShareResponseShare) SetName(v CreateShareResponseShareGetNameRetType) { + setCreateShareResponseShareGetNameAttributeType(&o.Name, v) +} + +// GetSpaceHardLimitGigabytes returns the SpaceHardLimitGigabytes field value if set, zero value otherwise. +func (o *CreateShareResponseShare) GetSpaceHardLimitGigabytes() (res CreateShareResponseShareGetSpaceHardLimitGigabytesRetType) { + res, _ = o.GetSpaceHardLimitGigabytesOk() + return +} + +// GetSpaceHardLimitGigabytesOk returns a tuple with the SpaceHardLimitGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareResponseShare) GetSpaceHardLimitGigabytesOk() (ret CreateShareResponseShareGetSpaceHardLimitGigabytesRetType, ok bool) { + return getCreateShareResponseShareGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes) +} + +// HasSpaceHardLimitGigabytes returns a boolean if a field has been set. +func (o *CreateShareResponseShare) HasSpaceHardLimitGigabytes() bool { + _, ok := o.GetSpaceHardLimitGigabytesOk() + return ok +} + +// SetSpaceHardLimitGigabytes gets a reference to the given int64 and assigns it to the SpaceHardLimitGigabytes field. +func (o *CreateShareResponseShare) SetSpaceHardLimitGigabytes(v CreateShareResponseShareGetSpaceHardLimitGigabytesRetType) { + setCreateShareResponseShareGetSpaceHardLimitGigabytesAttributeType(&o.SpaceHardLimitGigabytes, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *CreateShareResponseShare) GetState() (res CreateShareResponseShareGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateShareResponseShare) GetStateOk() (ret CreateShareResponseShareGetStateRetType, ok bool) { + return getCreateShareResponseShareGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *CreateShareResponseShare) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *CreateShareResponseShare) SetState(v CreateShareResponseShareGetStateRetType) { + setCreateShareResponseShareGetStateAttributeType(&o.State, v) +} + +func (o CreateShareResponseShare) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateShareResponseShareGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateShareResponseShareGetExportPolicyAttributeTypeOk(o.ExportPolicy); ok { + toSerialize["ExportPolicy"] = val + } + if val, ok := getCreateShareResponseShareGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateShareResponseShareGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateShareResponseShareGetMountPathAttributeTypeOk(o.MountPath); ok { + toSerialize["MountPath"] = val + } + if val, ok := getCreateShareResponseShareGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateShareResponseShareGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes); ok { + toSerialize["SpaceHardLimitGigabytes"] = val + } + if val, ok := getCreateShareResponseShareGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableCreateShareResponseShare struct { + value *CreateShareResponseShare + isSet bool +} + +func (v NullableCreateShareResponseShare) Get() *CreateShareResponseShare { + return v.value +} + +func (v *NullableCreateShareResponseShare) Set(val *CreateShareResponseShare) { + v.value = val + v.isSet = true +} + +func (v NullableCreateShareResponseShare) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateShareResponseShare) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateShareResponseShare(val *CreateShareResponseShare) *NullableCreateShareResponseShare { + return &NullableCreateShareResponseShare{value: val, isSet: true} +} + +func (v NullableCreateShareResponseShare) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateShareResponseShare) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_create_share_response_share_test.go b/pkg/sfsbeta/model_create_share_response_share_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_response_share_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_create_share_response_test.go b/pkg/sfsbeta/model_create_share_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_create_share_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_error.go b/pkg/sfsbeta/model_error.go new file mode 100644 index 00000000..bbf2dd61 --- /dev/null +++ b/pkg/sfsbeta/model_error.go @@ -0,0 +1,224 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + +/* + types and functions for error_description +*/ + +// isAny +type ErrorGetErrorDescriptionAttributeType = any +type ErrorGetErrorDescriptionArgType = any +type ErrorGetErrorDescriptionRetType = any + +func getErrorGetErrorDescriptionAttributeTypeOk(arg ErrorGetErrorDescriptionAttributeType) (ret ErrorGetErrorDescriptionRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setErrorGetErrorDescriptionAttributeType(arg *ErrorGetErrorDescriptionAttributeType, val ErrorGetErrorDescriptionRetType) { + *arg = val +} + +/* + types and functions for title +*/ + +// isNotNullableString +type ErrorGetTitleAttributeType = *string + +func getErrorGetTitleAttributeTypeOk(arg ErrorGetTitleAttributeType) (ret ErrorGetTitleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorGetTitleAttributeType(arg *ErrorGetTitleAttributeType, val ErrorGetTitleRetType) { + *arg = &val +} + +type ErrorGetTitleArgType = string +type ErrorGetTitleRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type ErrorGetTypeAttributeType = *string + +func getErrorGetTypeAttributeTypeOk(arg ErrorGetTypeAttributeType) (ret ErrorGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorGetTypeAttributeType(arg *ErrorGetTypeAttributeType, val ErrorGetTypeRetType) { + *arg = &val +} + +type ErrorGetTypeArgType = string +type ErrorGetTypeRetType = string + +// Error struct for Error +type Error struct { + // Deprecated: Human-readable string of the error that occured + ErrorDescription ErrorGetErrorDescriptionAttributeType `json:"error_description,omitempty"` + // Human-readable description of the error that occurred. + // REQUIRED + Title ErrorGetTitleAttributeType `json:"title" required:"true"` + // URI Uniquely identifies the error type. It will be in the format of storage.stackit.cloud/ e.g. storage.stackit.cloud/validation-error + // REQUIRED + Type ErrorGetTypeAttributeType `json:"type" required:"true"` +} + +type _Error Error + +// NewError instantiates a new Error object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewError(title ErrorGetTitleArgType, types ErrorGetTypeArgType) *Error { + this := Error{} + setErrorGetTitleAttributeType(&this.Title, title) + setErrorGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewErrorWithDefaults instantiates a new Error object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetErrorDescription returns the ErrorDescription field value if set, zero value otherwise (both if not set or set to explicit null). +// Deprecated +func (o *Error) GetErrorDescription() (res ErrorGetErrorDescriptionRetType) { + res, _ = o.GetErrorDescriptionOk() + return +} + +// GetErrorDescriptionOk returns a tuple with the ErrorDescription field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +// Deprecated +func (o *Error) GetErrorDescriptionOk() (ret ErrorGetErrorDescriptionRetType, ok bool) { + return getErrorGetErrorDescriptionAttributeTypeOk(o.ErrorDescription) +} + +// HasErrorDescription returns a boolean if a field has been set. +func (o *Error) HasErrorDescription() bool { + _, ok := o.GetErrorDescriptionOk() + return ok +} + +// SetErrorDescription gets a reference to the given interface{} and assigns it to the ErrorDescription field. +// Deprecated +func (o *Error) SetErrorDescription(v ErrorGetErrorDescriptionRetType) { + setErrorGetErrorDescriptionAttributeType(&o.ErrorDescription, v) +} + +// GetTitle returns the Title field value +func (o *Error) GetTitle() (ret ErrorGetTitleRetType) { + ret, _ = o.GetTitleOk() + return ret +} + +// GetTitleOk returns a tuple with the Title field value +// and a boolean to check if the value has been set. +func (o *Error) GetTitleOk() (ret ErrorGetTitleRetType, ok bool) { + return getErrorGetTitleAttributeTypeOk(o.Title) +} + +// SetTitle sets field value +func (o *Error) SetTitle(v ErrorGetTitleRetType) { + setErrorGetTitleAttributeType(&o.Title, v) +} + +// GetType returns the Type field value +func (o *Error) GetType() (ret ErrorGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *Error) GetTypeOk() (ret ErrorGetTypeRetType, ok bool) { + return getErrorGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *Error) SetType(v ErrorGetTypeRetType) { + setErrorGetTypeAttributeType(&o.Type, v) +} + +func (o Error) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getErrorGetErrorDescriptionAttributeTypeOk(o.ErrorDescription); ok { + toSerialize["ErrorDescription"] = val + } + if val, ok := getErrorGetTitleAttributeTypeOk(o.Title); ok { + toSerialize["Title"] = val + } + if val, ok := getErrorGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_error_test.go b/pkg/sfsbeta/model_error_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_error_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_get_resource_pool_response.go b/pkg/sfsbeta/model_get_resource_pool_response.go new file mode 100644 index 00000000..df47cf76 --- /dev/null +++ b/pkg/sfsbeta/model_get_resource_pool_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the GetResourcePoolResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetResourcePoolResponse{} + +/* + types and functions for resourcePool +*/ + +// isModel +type GetResourcePoolResponseGetResourcePoolAttributeType = *GetResourcePoolResponseResourcePool +type GetResourcePoolResponseGetResourcePoolArgType = GetResourcePoolResponseResourcePool +type GetResourcePoolResponseGetResourcePoolRetType = GetResourcePoolResponseResourcePool + +func getGetResourcePoolResponseGetResourcePoolAttributeTypeOk(arg GetResourcePoolResponseGetResourcePoolAttributeType) (ret GetResourcePoolResponseGetResourcePoolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseGetResourcePoolAttributeType(arg *GetResourcePoolResponseGetResourcePoolAttributeType, val GetResourcePoolResponseGetResourcePoolRetType) { + *arg = &val +} + +// GetResourcePoolResponse struct for GetResourcePoolResponse +type GetResourcePoolResponse struct { + ResourcePool GetResourcePoolResponseGetResourcePoolAttributeType `json:"resourcePool,omitempty"` +} + +// NewGetResourcePoolResponse instantiates a new GetResourcePoolResponse 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 NewGetResourcePoolResponse() *GetResourcePoolResponse { + this := GetResourcePoolResponse{} + return &this +} + +// NewGetResourcePoolResponseWithDefaults instantiates a new GetResourcePoolResponse 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 NewGetResourcePoolResponseWithDefaults() *GetResourcePoolResponse { + this := GetResourcePoolResponse{} + return &this +} + +// GetResourcePool returns the ResourcePool field value if set, zero value otherwise. +func (o *GetResourcePoolResponse) GetResourcePool() (res GetResourcePoolResponseGetResourcePoolRetType) { + res, _ = o.GetResourcePoolOk() + return +} + +// GetResourcePoolOk returns a tuple with the ResourcePool field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponse) GetResourcePoolOk() (ret GetResourcePoolResponseGetResourcePoolRetType, ok bool) { + return getGetResourcePoolResponseGetResourcePoolAttributeTypeOk(o.ResourcePool) +} + +// HasResourcePool returns a boolean if a field has been set. +func (o *GetResourcePoolResponse) HasResourcePool() bool { + _, ok := o.GetResourcePoolOk() + return ok +} + +// SetResourcePool gets a reference to the given GetResourcePoolResponseResourcePool and assigns it to the ResourcePool field. +func (o *GetResourcePoolResponse) SetResourcePool(v GetResourcePoolResponseGetResourcePoolRetType) { + setGetResourcePoolResponseGetResourcePoolAttributeType(&o.ResourcePool, v) +} + +func (o GetResourcePoolResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetResourcePoolResponseGetResourcePoolAttributeTypeOk(o.ResourcePool); ok { + toSerialize["ResourcePool"] = val + } + return toSerialize, nil +} + +type NullableGetResourcePoolResponse struct { + value *GetResourcePoolResponse + isSet bool +} + +func (v NullableGetResourcePoolResponse) Get() *GetResourcePoolResponse { + return v.value +} + +func (v *NullableGetResourcePoolResponse) Set(val *GetResourcePoolResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetResourcePoolResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetResourcePoolResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetResourcePoolResponse(val *GetResourcePoolResponse) *NullableGetResourcePoolResponse { + return &NullableGetResourcePoolResponse{value: val, isSet: true} +} + +func (v NullableGetResourcePoolResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetResourcePoolResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_get_resource_pool_response_resource_pool.go b/pkg/sfsbeta/model_get_resource_pool_response_resource_pool.go new file mode 100644 index 00000000..eb84daf0 --- /dev/null +++ b/pkg/sfsbeta/model_get_resource_pool_response_resource_pool.go @@ -0,0 +1,802 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the GetResourcePoolResponseResourcePool type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetResourcePoolResponseResourcePool{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type GetResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType = *string + +func getGetResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType) (ret GetResourcePoolResponseResourcePoolGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType(arg *GetResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType, val GetResourcePoolResponseResourcePoolGetAvailabilityZoneRetType) { + *arg = &val +} + +type GetResourcePoolResponseResourcePoolGetAvailabilityZoneArgType = string +type GetResourcePoolResponseResourcePoolGetAvailabilityZoneRetType = string + +/* + types and functions for countShares +*/ + +// isInteger +type GetResourcePoolResponseResourcePoolGetCountSharesAttributeType = *int64 +type GetResourcePoolResponseResourcePoolGetCountSharesArgType = int64 +type GetResourcePoolResponseResourcePoolGetCountSharesRetType = int64 + +func getGetResourcePoolResponseResourcePoolGetCountSharesAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetCountSharesAttributeType) (ret GetResourcePoolResponseResourcePoolGetCountSharesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetCountSharesAttributeType(arg *GetResourcePoolResponseResourcePoolGetCountSharesAttributeType, val GetResourcePoolResponseResourcePoolGetCountSharesRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type GetResourcePoolResponseResourcePoolGetCreatedAtAttributeType = *time.Time +type GetResourcePoolResponseResourcePoolGetCreatedAtArgType = time.Time +type GetResourcePoolResponseResourcePoolGetCreatedAtRetType = time.Time + +func getGetResourcePoolResponseResourcePoolGetCreatedAtAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetCreatedAtAttributeType) (ret GetResourcePoolResponseResourcePoolGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetCreatedAtAttributeType(arg *GetResourcePoolResponseResourcePoolGetCreatedAtAttributeType, val GetResourcePoolResponseResourcePoolGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type GetResourcePoolResponseResourcePoolGetIdAttributeType = *string + +func getGetResourcePoolResponseResourcePoolGetIdAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetIdAttributeType) (ret GetResourcePoolResponseResourcePoolGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetIdAttributeType(arg *GetResourcePoolResponseResourcePoolGetIdAttributeType, val GetResourcePoolResponseResourcePoolGetIdRetType) { + *arg = &val +} + +type GetResourcePoolResponseResourcePoolGetIdArgType = string +type GetResourcePoolResponseResourcePoolGetIdRetType = string + +/* + types and functions for ipAcl +*/ + +// isArray +type GetResourcePoolResponseResourcePoolGetIpAclAttributeType = *[]string +type GetResourcePoolResponseResourcePoolGetIpAclArgType = []string +type GetResourcePoolResponseResourcePoolGetIpAclRetType = []string + +func getGetResourcePoolResponseResourcePoolGetIpAclAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetIpAclAttributeType) (ret GetResourcePoolResponseResourcePoolGetIpAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetIpAclAttributeType(arg *GetResourcePoolResponseResourcePoolGetIpAclAttributeType, val GetResourcePoolResponseResourcePoolGetIpAclRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type GetResourcePoolResponseResourcePoolGetLabelsAttributeType = *map[string]string +type GetResourcePoolResponseResourcePoolGetLabelsArgType = map[string]string +type GetResourcePoolResponseResourcePoolGetLabelsRetType = map[string]string + +func getGetResourcePoolResponseResourcePoolGetLabelsAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetLabelsAttributeType) (ret GetResourcePoolResponseResourcePoolGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetLabelsAttributeType(arg *GetResourcePoolResponseResourcePoolGetLabelsAttributeType, val GetResourcePoolResponseResourcePoolGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mountPath +*/ + +// isNotNullableString +type GetResourcePoolResponseResourcePoolGetMountPathAttributeType = *string + +func getGetResourcePoolResponseResourcePoolGetMountPathAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetMountPathAttributeType) (ret GetResourcePoolResponseResourcePoolGetMountPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetMountPathAttributeType(arg *GetResourcePoolResponseResourcePoolGetMountPathAttributeType, val GetResourcePoolResponseResourcePoolGetMountPathRetType) { + *arg = &val +} + +type GetResourcePoolResponseResourcePoolGetMountPathArgType = string +type GetResourcePoolResponseResourcePoolGetMountPathRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type GetResourcePoolResponseResourcePoolGetNameAttributeType = *string + +func getGetResourcePoolResponseResourcePoolGetNameAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetNameAttributeType) (ret GetResourcePoolResponseResourcePoolGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetNameAttributeType(arg *GetResourcePoolResponseResourcePoolGetNameAttributeType, val GetResourcePoolResponseResourcePoolGetNameRetType) { + *arg = &val +} + +type GetResourcePoolResponseResourcePoolGetNameArgType = string +type GetResourcePoolResponseResourcePoolGetNameRetType = string + +/* + types and functions for performanceClass +*/ + +// isModel +type GetResourcePoolResponseResourcePoolGetPerformanceClassAttributeType = *ResourcePoolPerformanceClass +type GetResourcePoolResponseResourcePoolGetPerformanceClassArgType = ResourcePoolPerformanceClass +type GetResourcePoolResponseResourcePoolGetPerformanceClassRetType = ResourcePoolPerformanceClass + +func getGetResourcePoolResponseResourcePoolGetPerformanceClassAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetPerformanceClassAttributeType) (ret GetResourcePoolResponseResourcePoolGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetPerformanceClassAttributeType(arg *GetResourcePoolResponseResourcePoolGetPerformanceClassAttributeType, val GetResourcePoolResponseResourcePoolGetPerformanceClassRetType) { + *arg = &val +} + +/* + types and functions for performanceClassDowngradableAt +*/ + +// isDateTime +type GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType = *time.Time +type GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtArgType = time.Time +type GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType = time.Time + +func getGetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType) (ret GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType(arg *GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType, val GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType) { + *arg = &val +} + +/* + types and functions for sizeReducibleAt +*/ + +// isDateTime +type GetResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType = *time.Time +type GetResourcePoolResponseResourcePoolGetSizeReducibleAtArgType = time.Time +type GetResourcePoolResponseResourcePoolGetSizeReducibleAtRetType = time.Time + +func getGetResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType) (ret GetResourcePoolResponseResourcePoolGetSizeReducibleAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType(arg *GetResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType, val GetResourcePoolResponseResourcePoolGetSizeReducibleAtRetType) { + *arg = &val +} + +/* + types and functions for snapshotSchedule +*/ + +// isModel +type GetResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType = *SnapshotSchedule +type GetResourcePoolResponseResourcePoolGetSnapshotScheduleArgType = SnapshotSchedule +type GetResourcePoolResponseResourcePoolGetSnapshotScheduleRetType = SnapshotSchedule + +func getGetResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType) (ret GetResourcePoolResponseResourcePoolGetSnapshotScheduleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType(arg *GetResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType, val GetResourcePoolResponseResourcePoolGetSnapshotScheduleRetType) { + *arg = &val +} + +/* + types and functions for snapshotsAreVisible +*/ + +// isBoolean +type GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType = *bool +type GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleArgType = bool +type GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType = bool + +func getGetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(arg GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType) (ret GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType(arg *GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType, val GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType) { + *arg = &val +} + +/* + types and functions for space +*/ + +// isModel +type GetResourcePoolResponseResourcePoolGetSpaceAttributeType = *ResourcePoolSpace +type GetResourcePoolResponseResourcePoolGetSpaceArgType = ResourcePoolSpace +type GetResourcePoolResponseResourcePoolGetSpaceRetType = ResourcePoolSpace + +func getGetResourcePoolResponseResourcePoolGetSpaceAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetSpaceAttributeType) (ret GetResourcePoolResponseResourcePoolGetSpaceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetSpaceAttributeType(arg *GetResourcePoolResponseResourcePoolGetSpaceAttributeType, val GetResourcePoolResponseResourcePoolGetSpaceRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isNotNullableString +type GetResourcePoolResponseResourcePoolGetStateAttributeType = *string + +func getGetResourcePoolResponseResourcePoolGetStateAttributeTypeOk(arg GetResourcePoolResponseResourcePoolGetStateAttributeType) (ret GetResourcePoolResponseResourcePoolGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolResponseResourcePoolGetStateAttributeType(arg *GetResourcePoolResponseResourcePoolGetStateAttributeType, val GetResourcePoolResponseResourcePoolGetStateRetType) { + *arg = &val +} + +type GetResourcePoolResponseResourcePoolGetStateArgType = string +type GetResourcePoolResponseResourcePoolGetStateRetType = string + +// GetResourcePoolResponseResourcePool Resource Pool +type GetResourcePoolResponseResourcePool struct { + // Name of the respective availability zone + AvailabilityZone GetResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + // Number of Shares in the Resource Pool + // Can be cast to int32 without loss of precision. + CountShares GetResourcePoolResponseResourcePoolGetCountSharesAttributeType `json:"countShares,omitempty"` + CreatedAt GetResourcePoolResponseResourcePoolGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // ID of the Resource Pool + Id GetResourcePoolResponseResourcePoolGetIdAttributeType `json:"id,omitempty"` + // List of IPs that can mount the Resource Pool in read-only; IPs must have a subnet mask (e.g. \"172.16.0.0/24\" for a range of IPs, or \"172.16.0.250/32\" for a specific IP) + IpAcl GetResourcePoolResponseResourcePoolGetIpAclAttributeType `json:"ipAcl,omitempty"` + Labels GetResourcePoolResponseResourcePoolGetLabelsAttributeType `json:"labels,omitempty"` + // Mount path of the Resource Pool, used to mount the Resource Pool Note that a Resource Pool can only be mounted in read-only + MountPath GetResourcePoolResponseResourcePoolGetMountPathAttributeType `json:"mountPath,omitempty"` + // Name of the Resource Pool + Name GetResourcePoolResponseResourcePoolGetNameAttributeType `json:"name,omitempty"` + PerformanceClass GetResourcePoolResponseResourcePoolGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Time when the performance class can be downgraded again. + PerformanceClassDowngradableAt GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType `json:"performanceClassDowngradableAt,omitempty"` + // Time when the size can be reduced again. + SizeReducibleAt GetResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType `json:"sizeReducibleAt,omitempty"` + SnapshotSchedule GetResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType `json:"snapshotSchedule,omitempty"` + // Whether the .snapshot directory is visible when mounting the resource pool. Setting this value to false might prevent you from accessing the snapshots (e.g. for security reasons). Additionally, the access to the snapshots is always controlled by the export policy of the resource pool. That means, if snapshots are visible and the export policy allows for reading the resource pool, then it also allows reading the snapshot of all shares. + SnapshotsAreVisible GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType `json:"snapshotsAreVisible,omitempty"` + Space GetResourcePoolResponseResourcePoolGetSpaceAttributeType `json:"space,omitempty"` + // State of the Resource Pool (possible values: [\"pending\", \"creating\", \"created\", \"updating\", \"error\", \"deleting\"]) + State GetResourcePoolResponseResourcePoolGetStateAttributeType `json:"state,omitempty"` +} + +// NewGetResourcePoolResponseResourcePool instantiates a new GetResourcePoolResponseResourcePool 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 NewGetResourcePoolResponseResourcePool() *GetResourcePoolResponseResourcePool { + this := GetResourcePoolResponseResourcePool{} + return &this +} + +// NewGetResourcePoolResponseResourcePoolWithDefaults instantiates a new GetResourcePoolResponseResourcePool 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 NewGetResourcePoolResponseResourcePoolWithDefaults() *GetResourcePoolResponseResourcePool { + this := GetResourcePoolResponseResourcePool{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetAvailabilityZone() (res GetResourcePoolResponseResourcePoolGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetAvailabilityZoneOk() (ret GetResourcePoolResponseResourcePoolGetAvailabilityZoneRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *GetResourcePoolResponseResourcePool) SetAvailabilityZone(v GetResourcePoolResponseResourcePoolGetAvailabilityZoneRetType) { + setGetResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetCountShares returns the CountShares field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetCountShares() (res GetResourcePoolResponseResourcePoolGetCountSharesRetType) { + res, _ = o.GetCountSharesOk() + return +} + +// GetCountSharesOk returns a tuple with the CountShares field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetCountSharesOk() (ret GetResourcePoolResponseResourcePoolGetCountSharesRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetCountSharesAttributeTypeOk(o.CountShares) +} + +// HasCountShares returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasCountShares() bool { + _, ok := o.GetCountSharesOk() + return ok +} + +// SetCountShares gets a reference to the given int64 and assigns it to the CountShares field. +func (o *GetResourcePoolResponseResourcePool) SetCountShares(v GetResourcePoolResponseResourcePoolGetCountSharesRetType) { + setGetResourcePoolResponseResourcePoolGetCountSharesAttributeType(&o.CountShares, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetCreatedAt() (res GetResourcePoolResponseResourcePoolGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetCreatedAtOk() (ret GetResourcePoolResponseResourcePoolGetCreatedAtRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *GetResourcePoolResponseResourcePool) SetCreatedAt(v GetResourcePoolResponseResourcePoolGetCreatedAtRetType) { + setGetResourcePoolResponseResourcePoolGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetId() (res GetResourcePoolResponseResourcePoolGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetIdOk() (ret GetResourcePoolResponseResourcePoolGetIdRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GetResourcePoolResponseResourcePool) SetId(v GetResourcePoolResponseResourcePoolGetIdRetType) { + setGetResourcePoolResponseResourcePoolGetIdAttributeType(&o.Id, v) +} + +// GetIpAcl returns the IpAcl field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetIpAcl() (res GetResourcePoolResponseResourcePoolGetIpAclRetType) { + res, _ = o.GetIpAclOk() + return +} + +// GetIpAclOk returns a tuple with the IpAcl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetIpAclOk() (ret GetResourcePoolResponseResourcePoolGetIpAclRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetIpAclAttributeTypeOk(o.IpAcl) +} + +// HasIpAcl returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasIpAcl() bool { + _, ok := o.GetIpAclOk() + return ok +} + +// SetIpAcl gets a reference to the given []string and assigns it to the IpAcl field. +func (o *GetResourcePoolResponseResourcePool) SetIpAcl(v GetResourcePoolResponseResourcePoolGetIpAclRetType) { + setGetResourcePoolResponseResourcePoolGetIpAclAttributeType(&o.IpAcl, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetLabels() (res GetResourcePoolResponseResourcePoolGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetLabelsOk() (ret GetResourcePoolResponseResourcePoolGetLabelsRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *GetResourcePoolResponseResourcePool) SetLabels(v GetResourcePoolResponseResourcePoolGetLabelsRetType) { + setGetResourcePoolResponseResourcePoolGetLabelsAttributeType(&o.Labels, v) +} + +// GetMountPath returns the MountPath field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetMountPath() (res GetResourcePoolResponseResourcePoolGetMountPathRetType) { + res, _ = o.GetMountPathOk() + return +} + +// GetMountPathOk returns a tuple with the MountPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetMountPathOk() (ret GetResourcePoolResponseResourcePoolGetMountPathRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetMountPathAttributeTypeOk(o.MountPath) +} + +// HasMountPath returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasMountPath() bool { + _, ok := o.GetMountPathOk() + return ok +} + +// SetMountPath gets a reference to the given string and assigns it to the MountPath field. +func (o *GetResourcePoolResponseResourcePool) SetMountPath(v GetResourcePoolResponseResourcePoolGetMountPathRetType) { + setGetResourcePoolResponseResourcePoolGetMountPathAttributeType(&o.MountPath, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetName() (res GetResourcePoolResponseResourcePoolGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetNameOk() (ret GetResourcePoolResponseResourcePoolGetNameRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *GetResourcePoolResponseResourcePool) SetName(v GetResourcePoolResponseResourcePoolGetNameRetType) { + setGetResourcePoolResponseResourcePoolGetNameAttributeType(&o.Name, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetPerformanceClass() (res GetResourcePoolResponseResourcePoolGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetPerformanceClassOk() (ret GetResourcePoolResponseResourcePoolGetPerformanceClassRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given ResourcePoolPerformanceClass and assigns it to the PerformanceClass field. +func (o *GetResourcePoolResponseResourcePool) SetPerformanceClass(v GetResourcePoolResponseResourcePoolGetPerformanceClassRetType) { + setGetResourcePoolResponseResourcePoolGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetPerformanceClassDowngradableAt returns the PerformanceClassDowngradableAt field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetPerformanceClassDowngradableAt() (res GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType) { + res, _ = o.GetPerformanceClassDowngradableAtOk() + return +} + +// GetPerformanceClassDowngradableAtOk returns a tuple with the PerformanceClassDowngradableAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetPerformanceClassDowngradableAtOk() (ret GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(o.PerformanceClassDowngradableAt) +} + +// HasPerformanceClassDowngradableAt returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasPerformanceClassDowngradableAt() bool { + _, ok := o.GetPerformanceClassDowngradableAtOk() + return ok +} + +// SetPerformanceClassDowngradableAt gets a reference to the given time.Time and assigns it to the PerformanceClassDowngradableAt field. +func (o *GetResourcePoolResponseResourcePool) SetPerformanceClassDowngradableAt(v GetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType) { + setGetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType(&o.PerformanceClassDowngradableAt, v) +} + +// GetSizeReducibleAt returns the SizeReducibleAt field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetSizeReducibleAt() (res GetResourcePoolResponseResourcePoolGetSizeReducibleAtRetType) { + res, _ = o.GetSizeReducibleAtOk() + return +} + +// GetSizeReducibleAtOk returns a tuple with the SizeReducibleAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetSizeReducibleAtOk() (ret GetResourcePoolResponseResourcePoolGetSizeReducibleAtRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeTypeOk(o.SizeReducibleAt) +} + +// HasSizeReducibleAt returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasSizeReducibleAt() bool { + _, ok := o.GetSizeReducibleAtOk() + return ok +} + +// SetSizeReducibleAt gets a reference to the given time.Time and assigns it to the SizeReducibleAt field. +func (o *GetResourcePoolResponseResourcePool) SetSizeReducibleAt(v GetResourcePoolResponseResourcePoolGetSizeReducibleAtRetType) { + setGetResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType(&o.SizeReducibleAt, v) +} + +// GetSnapshotSchedule returns the SnapshotSchedule field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetSnapshotSchedule() (res GetResourcePoolResponseResourcePoolGetSnapshotScheduleRetType) { + res, _ = o.GetSnapshotScheduleOk() + return +} + +// GetSnapshotScheduleOk returns a tuple with the SnapshotSchedule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetSnapshotScheduleOk() (ret GetResourcePoolResponseResourcePoolGetSnapshotScheduleRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeTypeOk(o.SnapshotSchedule) +} + +// HasSnapshotSchedule returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasSnapshotSchedule() bool { + _, ok := o.GetSnapshotScheduleOk() + return ok +} + +// SetSnapshotSchedule gets a reference to the given SnapshotSchedule and assigns it to the SnapshotSchedule field. +func (o *GetResourcePoolResponseResourcePool) SetSnapshotSchedule(v GetResourcePoolResponseResourcePoolGetSnapshotScheduleRetType) { + setGetResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType(&o.SnapshotSchedule, v) +} + +// GetSnapshotsAreVisible returns the SnapshotsAreVisible field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetSnapshotsAreVisible() (res GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType) { + res, _ = o.GetSnapshotsAreVisibleOk() + return +} + +// GetSnapshotsAreVisibleOk returns a tuple with the SnapshotsAreVisible field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetSnapshotsAreVisibleOk() (ret GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible) +} + +// HasSnapshotsAreVisible returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasSnapshotsAreVisible() bool { + _, ok := o.GetSnapshotsAreVisibleOk() + return ok +} + +// SetSnapshotsAreVisible gets a reference to the given bool and assigns it to the SnapshotsAreVisible field. +func (o *GetResourcePoolResponseResourcePool) SetSnapshotsAreVisible(v GetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType) { + setGetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType(&o.SnapshotsAreVisible, v) +} + +// GetSpace returns the Space field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetSpace() (res GetResourcePoolResponseResourcePoolGetSpaceRetType) { + res, _ = o.GetSpaceOk() + return +} + +// GetSpaceOk returns a tuple with the Space field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetSpaceOk() (ret GetResourcePoolResponseResourcePoolGetSpaceRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetSpaceAttributeTypeOk(o.Space) +} + +// HasSpace returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasSpace() bool { + _, ok := o.GetSpaceOk() + return ok +} + +// SetSpace gets a reference to the given ResourcePoolSpace and assigns it to the Space field. +func (o *GetResourcePoolResponseResourcePool) SetSpace(v GetResourcePoolResponseResourcePoolGetSpaceRetType) { + setGetResourcePoolResponseResourcePoolGetSpaceAttributeType(&o.Space, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *GetResourcePoolResponseResourcePool) GetState() (res GetResourcePoolResponseResourcePoolGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolResponseResourcePool) GetStateOk() (ret GetResourcePoolResponseResourcePoolGetStateRetType, ok bool) { + return getGetResourcePoolResponseResourcePoolGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *GetResourcePoolResponseResourcePool) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *GetResourcePoolResponseResourcePool) SetState(v GetResourcePoolResponseResourcePoolGetStateRetType) { + setGetResourcePoolResponseResourcePoolGetStateAttributeType(&o.State, v) +} + +func (o GetResourcePoolResponseResourcePool) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetCountSharesAttributeTypeOk(o.CountShares); ok { + toSerialize["CountShares"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetIpAclAttributeTypeOk(o.IpAcl); ok { + toSerialize["IpAcl"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetMountPathAttributeTypeOk(o.MountPath); ok { + toSerialize["MountPath"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(o.PerformanceClassDowngradableAt); ok { + toSerialize["PerformanceClassDowngradableAt"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeTypeOk(o.SizeReducibleAt); ok { + toSerialize["SizeReducibleAt"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeTypeOk(o.SnapshotSchedule); ok { + toSerialize["SnapshotSchedule"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible); ok { + toSerialize["SnapshotsAreVisible"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetSpaceAttributeTypeOk(o.Space); ok { + toSerialize["Space"] = val + } + if val, ok := getGetResourcePoolResponseResourcePoolGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableGetResourcePoolResponseResourcePool struct { + value *GetResourcePoolResponseResourcePool + isSet bool +} + +func (v NullableGetResourcePoolResponseResourcePool) Get() *GetResourcePoolResponseResourcePool { + return v.value +} + +func (v *NullableGetResourcePoolResponseResourcePool) Set(val *GetResourcePoolResponseResourcePool) { + v.value = val + v.isSet = true +} + +func (v NullableGetResourcePoolResponseResourcePool) IsSet() bool { + return v.isSet +} + +func (v *NullableGetResourcePoolResponseResourcePool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetResourcePoolResponseResourcePool(val *GetResourcePoolResponseResourcePool) *NullableGetResourcePoolResponseResourcePool { + return &NullableGetResourcePoolResponseResourcePool{value: val, isSet: true} +} + +func (v NullableGetResourcePoolResponseResourcePool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetResourcePoolResponseResourcePool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_get_resource_pool_response_resource_pool_test.go b/pkg/sfsbeta/model_get_resource_pool_response_resource_pool_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_get_resource_pool_response_resource_pool_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_get_resource_pool_response_test.go b/pkg/sfsbeta/model_get_resource_pool_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_get_resource_pool_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_get_resource_pool_snapshot_response.go b/pkg/sfsbeta/model_get_resource_pool_snapshot_response.go new file mode 100644 index 00000000..a03b9bfb --- /dev/null +++ b/pkg/sfsbeta/model_get_resource_pool_snapshot_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the GetResourcePoolSnapshotResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetResourcePoolSnapshotResponse{} + +/* + types and functions for resourcePoolSnapshot +*/ + +// isModel +type GetResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType = *GetResourcePoolSnapshotResponseResourcePoolSnapshot +type GetResourcePoolSnapshotResponseGetResourcePoolSnapshotArgType = GetResourcePoolSnapshotResponseResourcePoolSnapshot +type GetResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType = GetResourcePoolSnapshotResponseResourcePoolSnapshot + +func getGetResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeTypeOk(arg GetResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType) (ret GetResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType(arg *GetResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType, val GetResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType) { + *arg = &val +} + +// GetResourcePoolSnapshotResponse struct for GetResourcePoolSnapshotResponse +type GetResourcePoolSnapshotResponse struct { + ResourcePoolSnapshot GetResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType `json:"resourcePoolSnapshot,omitempty"` +} + +// NewGetResourcePoolSnapshotResponse instantiates a new GetResourcePoolSnapshotResponse 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 NewGetResourcePoolSnapshotResponse() *GetResourcePoolSnapshotResponse { + this := GetResourcePoolSnapshotResponse{} + return &this +} + +// NewGetResourcePoolSnapshotResponseWithDefaults instantiates a new GetResourcePoolSnapshotResponse 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 NewGetResourcePoolSnapshotResponseWithDefaults() *GetResourcePoolSnapshotResponse { + this := GetResourcePoolSnapshotResponse{} + return &this +} + +// GetResourcePoolSnapshot returns the ResourcePoolSnapshot field value if set, zero value otherwise. +func (o *GetResourcePoolSnapshotResponse) GetResourcePoolSnapshot() (res GetResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType) { + res, _ = o.GetResourcePoolSnapshotOk() + return +} + +// GetResourcePoolSnapshotOk returns a tuple with the ResourcePoolSnapshot field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolSnapshotResponse) GetResourcePoolSnapshotOk() (ret GetResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType, ok bool) { + return getGetResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeTypeOk(o.ResourcePoolSnapshot) +} + +// HasResourcePoolSnapshot returns a boolean if a field has been set. +func (o *GetResourcePoolSnapshotResponse) HasResourcePoolSnapshot() bool { + _, ok := o.GetResourcePoolSnapshotOk() + return ok +} + +// SetResourcePoolSnapshot gets a reference to the given GetResourcePoolSnapshotResponseResourcePoolSnapshot and assigns it to the ResourcePoolSnapshot field. +func (o *GetResourcePoolSnapshotResponse) SetResourcePoolSnapshot(v GetResourcePoolSnapshotResponseGetResourcePoolSnapshotRetType) { + setGetResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeType(&o.ResourcePoolSnapshot, v) +} + +func (o GetResourcePoolSnapshotResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetResourcePoolSnapshotResponseGetResourcePoolSnapshotAttributeTypeOk(o.ResourcePoolSnapshot); ok { + toSerialize["ResourcePoolSnapshot"] = val + } + return toSerialize, nil +} + +type NullableGetResourcePoolSnapshotResponse struct { + value *GetResourcePoolSnapshotResponse + isSet bool +} + +func (v NullableGetResourcePoolSnapshotResponse) Get() *GetResourcePoolSnapshotResponse { + return v.value +} + +func (v *NullableGetResourcePoolSnapshotResponse) Set(val *GetResourcePoolSnapshotResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetResourcePoolSnapshotResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetResourcePoolSnapshotResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetResourcePoolSnapshotResponse(val *GetResourcePoolSnapshotResponse) *NullableGetResourcePoolSnapshotResponse { + return &NullableGetResourcePoolSnapshotResponse{value: val, isSet: true} +} + +func (v NullableGetResourcePoolSnapshotResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetResourcePoolSnapshotResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_get_resource_pool_snapshot_response_resource_pool_snapshot.go b/pkg/sfsbeta/model_get_resource_pool_snapshot_response_resource_pool_snapshot.go new file mode 100644 index 00000000..baa13796 --- /dev/null +++ b/pkg/sfsbeta/model_get_resource_pool_snapshot_response_resource_pool_snapshot.go @@ -0,0 +1,388 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the GetResourcePoolSnapshotResponseResourcePoolSnapshot type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetResourcePoolSnapshotResponseResourcePoolSnapshot{} + +/* + types and functions for comment +*/ + +// isNullableString +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType = *NullableString + +func getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeTypeOk(arg GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType) (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType(arg *GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType, val GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentArgType = *string +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType = *string + +/* + types and functions for createdAt +*/ + +// isDateTime +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType = *time.Time +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtArgType = time.Time +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType = time.Time + +func getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeTypeOk(arg GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType) (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType(arg *GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType, val GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for logicalSizeGigabytes +*/ + +// isInteger +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType = *int64 +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesArgType = int64 +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType = int64 + +func getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeTypeOk(arg GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType) (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType(arg *GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType, val GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType) { + *arg = &val +} + +/* + types and functions for resourcePoolId +*/ + +// isNotNullableString +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType = *string + +func getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeTypeOk(arg GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType) (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType(arg *GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType, val GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType) { + *arg = &val +} + +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdArgType = string +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType = string + +/* + types and functions for sizeGigabytes +*/ + +// isInteger +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType = *int64 +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesArgType = int64 +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType = int64 + +func getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeTypeOk(arg GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType) (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType(arg *GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType, val GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType) { + *arg = &val +} + +/* + types and functions for snapshotName +*/ + +// isNotNullableString +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType = *string + +func getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeTypeOk(arg GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType) (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType(arg *GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType, val GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType) { + *arg = &val +} + +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameArgType = string +type GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType = string + +// GetResourcePoolSnapshotResponseResourcePoolSnapshot Resource Pool Snapshot +type GetResourcePoolSnapshotResponseResourcePoolSnapshot struct { + // (optional) A comment to add more information about a snapshot + Comment GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType `json:"comment,omitempty"` + CreatedAt GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Represents the user-visible data size at the time of the snapshot in Gibibytes (e.g. what’s in the snapshot) + // Can be cast to int32 without loss of precision. + LogicalSizeGigabytes GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType `json:"logicalSizeGigabytes,omitempty"` + // ID of the Resource Pool of the Snapshot + ResourcePoolId GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType `json:"resourcePoolId,omitempty"` + // Reflects the actual storage footprint in the backend at snapshot time in Gibibytes (e.g. how much storage from the Resource Pool does it use). + // Can be cast to int32 without loss of precision. + SizeGigabytes GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType `json:"sizeGigabytes,omitempty"` + // Name of the Resource Pool Snapshot + SnapshotName GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType `json:"snapshotName,omitempty"` +} + +// NewGetResourcePoolSnapshotResponseResourcePoolSnapshot instantiates a new GetResourcePoolSnapshotResponseResourcePoolSnapshot 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 NewGetResourcePoolSnapshotResponseResourcePoolSnapshot() *GetResourcePoolSnapshotResponseResourcePoolSnapshot { + this := GetResourcePoolSnapshotResponseResourcePoolSnapshot{} + return &this +} + +// NewGetResourcePoolSnapshotResponseResourcePoolSnapshotWithDefaults instantiates a new GetResourcePoolSnapshotResponseResourcePoolSnapshot 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 NewGetResourcePoolSnapshotResponseResourcePoolSnapshotWithDefaults() *GetResourcePoolSnapshotResponseResourcePoolSnapshot { + this := GetResourcePoolSnapshotResponseResourcePoolSnapshot{} + return &this +} + +// GetComment returns the Comment field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetComment() (res GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType) { + res, _ = o.GetCommentOk() + return +} + +// GetCommentOk returns a tuple with the Comment field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetCommentOk() (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType, ok bool) { + return getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeTypeOk(o.Comment) +} + +// HasComment returns a boolean if a field has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) HasComment() bool { + _, ok := o.GetCommentOk() + return ok +} + +// SetComment gets a reference to the given string and assigns it to the Comment field. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) SetComment(v GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentRetType) { + setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeType(&o.Comment, v) +} + +// SetCommentNil sets the value for Comment to be an explicit nil +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) SetCommentNil() { + o.Comment = nil +} + +// UnsetComment ensures that no value is present for Comment, not even an explicit nil +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) UnsetComment() { + o.Comment = nil +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetCreatedAt() (res GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetCreatedAtOk() (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType, ok bool) { + return getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) SetCreatedAt(v GetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtRetType) { + setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetLogicalSizeGigabytes returns the LogicalSizeGigabytes field value if set, zero value otherwise. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetLogicalSizeGigabytes() (res GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType) { + res, _ = o.GetLogicalSizeGigabytesOk() + return +} + +// GetLogicalSizeGigabytesOk returns a tuple with the LogicalSizeGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetLogicalSizeGigabytesOk() (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType, ok bool) { + return getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeTypeOk(o.LogicalSizeGigabytes) +} + +// HasLogicalSizeGigabytes returns a boolean if a field has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) HasLogicalSizeGigabytes() bool { + _, ok := o.GetLogicalSizeGigabytesOk() + return ok +} + +// SetLogicalSizeGigabytes gets a reference to the given int64 and assigns it to the LogicalSizeGigabytes field. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) SetLogicalSizeGigabytes(v GetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesRetType) { + setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType(&o.LogicalSizeGigabytes, v) +} + +// GetResourcePoolId returns the ResourcePoolId field value if set, zero value otherwise. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetResourcePoolId() (res GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType) { + res, _ = o.GetResourcePoolIdOk() + return +} + +// GetResourcePoolIdOk returns a tuple with the ResourcePoolId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetResourcePoolIdOk() (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType, ok bool) { + return getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeTypeOk(o.ResourcePoolId) +} + +// HasResourcePoolId returns a boolean if a field has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) HasResourcePoolId() bool { + _, ok := o.GetResourcePoolIdOk() + return ok +} + +// SetResourcePoolId gets a reference to the given string and assigns it to the ResourcePoolId field. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) SetResourcePoolId(v GetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdRetType) { + setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeType(&o.ResourcePoolId, v) +} + +// GetSizeGigabytes returns the SizeGigabytes field value if set, zero value otherwise. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetSizeGigabytes() (res GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType) { + res, _ = o.GetSizeGigabytesOk() + return +} + +// GetSizeGigabytesOk returns a tuple with the SizeGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetSizeGigabytesOk() (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType, ok bool) { + return getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes) +} + +// HasSizeGigabytes returns a boolean if a field has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) HasSizeGigabytes() bool { + _, ok := o.GetSizeGigabytesOk() + return ok +} + +// SetSizeGigabytes gets a reference to the given int64 and assigns it to the SizeGigabytes field. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) SetSizeGigabytes(v GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesRetType) { + setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeType(&o.SizeGigabytes, v) +} + +// GetSnapshotName returns the SnapshotName field value if set, zero value otherwise. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetSnapshotName() (res GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType) { + res, _ = o.GetSnapshotNameOk() + return +} + +// GetSnapshotNameOk returns a tuple with the SnapshotName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) GetSnapshotNameOk() (ret GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType, ok bool) { + return getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeTypeOk(o.SnapshotName) +} + +// HasSnapshotName returns a boolean if a field has been set. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) HasSnapshotName() bool { + _, ok := o.GetSnapshotNameOk() + return ok +} + +// SetSnapshotName gets a reference to the given string and assigns it to the SnapshotName field. +func (o *GetResourcePoolSnapshotResponseResourcePoolSnapshot) SetSnapshotName(v GetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameRetType) { + setGetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeType(&o.SnapshotName, v) +} + +func (o GetResourcePoolSnapshotResponseResourcePoolSnapshot) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetCommentAttributeTypeOk(o.Comment); ok { + toSerialize["Comment"] = val + } + if val, ok := getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetLogicalSizeGigabytesAttributeTypeOk(o.LogicalSizeGigabytes); ok { + toSerialize["LogicalSizeGigabytes"] = val + } + if val, ok := getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetResourcePoolIdAttributeTypeOk(o.ResourcePoolId); ok { + toSerialize["ResourcePoolId"] = val + } + if val, ok := getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes); ok { + toSerialize["SizeGigabytes"] = val + } + if val, ok := getGetResourcePoolSnapshotResponseResourcePoolSnapshotGetSnapshotNameAttributeTypeOk(o.SnapshotName); ok { + toSerialize["SnapshotName"] = val + } + return toSerialize, nil +} + +type NullableGetResourcePoolSnapshotResponseResourcePoolSnapshot struct { + value *GetResourcePoolSnapshotResponseResourcePoolSnapshot + isSet bool +} + +func (v NullableGetResourcePoolSnapshotResponseResourcePoolSnapshot) Get() *GetResourcePoolSnapshotResponseResourcePoolSnapshot { + return v.value +} + +func (v *NullableGetResourcePoolSnapshotResponseResourcePoolSnapshot) Set(val *GetResourcePoolSnapshotResponseResourcePoolSnapshot) { + v.value = val + v.isSet = true +} + +func (v NullableGetResourcePoolSnapshotResponseResourcePoolSnapshot) IsSet() bool { + return v.isSet +} + +func (v *NullableGetResourcePoolSnapshotResponseResourcePoolSnapshot) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetResourcePoolSnapshotResponseResourcePoolSnapshot(val *GetResourcePoolSnapshotResponseResourcePoolSnapshot) *NullableGetResourcePoolSnapshotResponseResourcePoolSnapshot { + return &NullableGetResourcePoolSnapshotResponseResourcePoolSnapshot{value: val, isSet: true} +} + +func (v NullableGetResourcePoolSnapshotResponseResourcePoolSnapshot) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetResourcePoolSnapshotResponseResourcePoolSnapshot) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_get_resource_pool_snapshot_response_resource_pool_snapshot_test.go b/pkg/sfsbeta/model_get_resource_pool_snapshot_response_resource_pool_snapshot_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_get_resource_pool_snapshot_response_resource_pool_snapshot_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_get_resource_pool_snapshot_response_test.go b/pkg/sfsbeta/model_get_resource_pool_snapshot_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_get_resource_pool_snapshot_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_get_share_export_policy_response.go b/pkg/sfsbeta/model_get_share_export_policy_response.go new file mode 100644 index 00000000..4e138faa --- /dev/null +++ b/pkg/sfsbeta/model_get_share_export_policy_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the GetShareExportPolicyResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetShareExportPolicyResponse{} + +/* + types and functions for shareExportPolicy +*/ + +// isModel +type GetShareExportPolicyResponseGetShareExportPolicyAttributeType = *GetShareExportPolicyResponseShareExportPolicy +type GetShareExportPolicyResponseGetShareExportPolicyArgType = GetShareExportPolicyResponseShareExportPolicy +type GetShareExportPolicyResponseGetShareExportPolicyRetType = GetShareExportPolicyResponseShareExportPolicy + +func getGetShareExportPolicyResponseGetShareExportPolicyAttributeTypeOk(arg GetShareExportPolicyResponseGetShareExportPolicyAttributeType) (ret GetShareExportPolicyResponseGetShareExportPolicyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareExportPolicyResponseGetShareExportPolicyAttributeType(arg *GetShareExportPolicyResponseGetShareExportPolicyAttributeType, val GetShareExportPolicyResponseGetShareExportPolicyRetType) { + *arg = &val +} + +// GetShareExportPolicyResponse struct for GetShareExportPolicyResponse +type GetShareExportPolicyResponse struct { + ShareExportPolicy GetShareExportPolicyResponseGetShareExportPolicyAttributeType `json:"shareExportPolicy,omitempty"` +} + +// NewGetShareExportPolicyResponse instantiates a new GetShareExportPolicyResponse 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 NewGetShareExportPolicyResponse() *GetShareExportPolicyResponse { + this := GetShareExportPolicyResponse{} + return &this +} + +// NewGetShareExportPolicyResponseWithDefaults instantiates a new GetShareExportPolicyResponse 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 NewGetShareExportPolicyResponseWithDefaults() *GetShareExportPolicyResponse { + this := GetShareExportPolicyResponse{} + return &this +} + +// GetShareExportPolicy returns the ShareExportPolicy field value if set, zero value otherwise. +func (o *GetShareExportPolicyResponse) GetShareExportPolicy() (res GetShareExportPolicyResponseGetShareExportPolicyRetType) { + res, _ = o.GetShareExportPolicyOk() + return +} + +// GetShareExportPolicyOk returns a tuple with the ShareExportPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareExportPolicyResponse) GetShareExportPolicyOk() (ret GetShareExportPolicyResponseGetShareExportPolicyRetType, ok bool) { + return getGetShareExportPolicyResponseGetShareExportPolicyAttributeTypeOk(o.ShareExportPolicy) +} + +// HasShareExportPolicy returns a boolean if a field has been set. +func (o *GetShareExportPolicyResponse) HasShareExportPolicy() bool { + _, ok := o.GetShareExportPolicyOk() + return ok +} + +// SetShareExportPolicy gets a reference to the given GetShareExportPolicyResponseShareExportPolicy and assigns it to the ShareExportPolicy field. +func (o *GetShareExportPolicyResponse) SetShareExportPolicy(v GetShareExportPolicyResponseGetShareExportPolicyRetType) { + setGetShareExportPolicyResponseGetShareExportPolicyAttributeType(&o.ShareExportPolicy, v) +} + +func (o GetShareExportPolicyResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetShareExportPolicyResponseGetShareExportPolicyAttributeTypeOk(o.ShareExportPolicy); ok { + toSerialize["ShareExportPolicy"] = val + } + return toSerialize, nil +} + +type NullableGetShareExportPolicyResponse struct { + value *GetShareExportPolicyResponse + isSet bool +} + +func (v NullableGetShareExportPolicyResponse) Get() *GetShareExportPolicyResponse { + return v.value +} + +func (v *NullableGetShareExportPolicyResponse) Set(val *GetShareExportPolicyResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetShareExportPolicyResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetShareExportPolicyResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetShareExportPolicyResponse(val *GetShareExportPolicyResponse) *NullableGetShareExportPolicyResponse { + return &NullableGetShareExportPolicyResponse{value: val, isSet: true} +} + +func (v NullableGetShareExportPolicyResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetShareExportPolicyResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_get_share_export_policy_response_share_export_policy.go b/pkg/sfsbeta/model_get_share_export_policy_response_share_export_policy.go new file mode 100644 index 00000000..f1abb8e6 --- /dev/null +++ b/pkg/sfsbeta/model_get_share_export_policy_response_share_export_policy.go @@ -0,0 +1,371 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the GetShareExportPolicyResponseShareExportPolicy type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetShareExportPolicyResponseShareExportPolicy{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type GetShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType = *time.Time +type GetShareExportPolicyResponseShareExportPolicyGetCreatedAtArgType = time.Time +type GetShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType = time.Time + +func getGetShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeTypeOk(arg GetShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType) (ret GetShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType(arg *GetShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType, val GetShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type GetShareExportPolicyResponseShareExportPolicyGetIdAttributeType = *string + +func getGetShareExportPolicyResponseShareExportPolicyGetIdAttributeTypeOk(arg GetShareExportPolicyResponseShareExportPolicyGetIdAttributeType) (ret GetShareExportPolicyResponseShareExportPolicyGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareExportPolicyResponseShareExportPolicyGetIdAttributeType(arg *GetShareExportPolicyResponseShareExportPolicyGetIdAttributeType, val GetShareExportPolicyResponseShareExportPolicyGetIdRetType) { + *arg = &val +} + +type GetShareExportPolicyResponseShareExportPolicyGetIdArgType = string +type GetShareExportPolicyResponseShareExportPolicyGetIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type GetShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType = *map[string]string +type GetShareExportPolicyResponseShareExportPolicyGetLabelsArgType = map[string]string +type GetShareExportPolicyResponseShareExportPolicyGetLabelsRetType = map[string]string + +func getGetShareExportPolicyResponseShareExportPolicyGetLabelsAttributeTypeOk(arg GetShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType) (ret GetShareExportPolicyResponseShareExportPolicyGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType(arg *GetShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType, val GetShareExportPolicyResponseShareExportPolicyGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type GetShareExportPolicyResponseShareExportPolicyGetNameAttributeType = *string + +func getGetShareExportPolicyResponseShareExportPolicyGetNameAttributeTypeOk(arg GetShareExportPolicyResponseShareExportPolicyGetNameAttributeType) (ret GetShareExportPolicyResponseShareExportPolicyGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareExportPolicyResponseShareExportPolicyGetNameAttributeType(arg *GetShareExportPolicyResponseShareExportPolicyGetNameAttributeType, val GetShareExportPolicyResponseShareExportPolicyGetNameRetType) { + *arg = &val +} + +type GetShareExportPolicyResponseShareExportPolicyGetNameArgType = string +type GetShareExportPolicyResponseShareExportPolicyGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type GetShareExportPolicyResponseShareExportPolicyGetRulesAttributeType = *[]ShareExportPolicyRule +type GetShareExportPolicyResponseShareExportPolicyGetRulesArgType = []ShareExportPolicyRule +type GetShareExportPolicyResponseShareExportPolicyGetRulesRetType = []ShareExportPolicyRule + +func getGetShareExportPolicyResponseShareExportPolicyGetRulesAttributeTypeOk(arg GetShareExportPolicyResponseShareExportPolicyGetRulesAttributeType) (ret GetShareExportPolicyResponseShareExportPolicyGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareExportPolicyResponseShareExportPolicyGetRulesAttributeType(arg *GetShareExportPolicyResponseShareExportPolicyGetRulesAttributeType, val GetShareExportPolicyResponseShareExportPolicyGetRulesRetType) { + *arg = &val +} + +/* + types and functions for sharesUsingExportPolicy +*/ + +// isInteger +type GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType = *int64 +type GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyArgType = int64 +type GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType = int64 + +func getGetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeTypeOk(arg GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType) (ret GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType(arg *GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType, val GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType) { + *arg = &val +} + +// GetShareExportPolicyResponseShareExportPolicy Share Export Policies +type GetShareExportPolicyResponseShareExportPolicy struct { + CreatedAt GetShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // ID of the Share Export Policy + Id GetShareExportPolicyResponseShareExportPolicyGetIdAttributeType `json:"id,omitempty"` + // An optional object that represents the labels associated with the share export policy keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels GetShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType `json:"labels,omitempty"` + // Name of the Share Export Policy + Name GetShareExportPolicyResponseShareExportPolicyGetNameAttributeType `json:"name,omitempty"` + // List of rules of the Share Export Policy. The order of the rules within the array does not matter - what matters is the field \"order\" within each rule + Rules GetShareExportPolicyResponseShareExportPolicyGetRulesAttributeType `json:"rules,omitempty"` + // Number of Shares using this Share Export Policy + // Can be cast to int32 without loss of precision. + SharesUsingExportPolicy GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType `json:"sharesUsingExportPolicy,omitempty"` +} + +// NewGetShareExportPolicyResponseShareExportPolicy instantiates a new GetShareExportPolicyResponseShareExportPolicy 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 NewGetShareExportPolicyResponseShareExportPolicy() *GetShareExportPolicyResponseShareExportPolicy { + this := GetShareExportPolicyResponseShareExportPolicy{} + return &this +} + +// NewGetShareExportPolicyResponseShareExportPolicyWithDefaults instantiates a new GetShareExportPolicyResponseShareExportPolicy 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 NewGetShareExportPolicyResponseShareExportPolicyWithDefaults() *GetShareExportPolicyResponseShareExportPolicy { + this := GetShareExportPolicyResponseShareExportPolicy{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetCreatedAt() (res GetShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetCreatedAtOk() (ret GetShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType, ok bool) { + return getGetShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *GetShareExportPolicyResponseShareExportPolicy) SetCreatedAt(v GetShareExportPolicyResponseShareExportPolicyGetCreatedAtRetType) { + setGetShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetId() (res GetShareExportPolicyResponseShareExportPolicyGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetIdOk() (ret GetShareExportPolicyResponseShareExportPolicyGetIdRetType, ok bool) { + return getGetShareExportPolicyResponseShareExportPolicyGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GetShareExportPolicyResponseShareExportPolicy) SetId(v GetShareExportPolicyResponseShareExportPolicyGetIdRetType) { + setGetShareExportPolicyResponseShareExportPolicyGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetLabels() (res GetShareExportPolicyResponseShareExportPolicyGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetLabelsOk() (ret GetShareExportPolicyResponseShareExportPolicyGetLabelsRetType, ok bool) { + return getGetShareExportPolicyResponseShareExportPolicyGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *GetShareExportPolicyResponseShareExportPolicy) SetLabels(v GetShareExportPolicyResponseShareExportPolicyGetLabelsRetType) { + setGetShareExportPolicyResponseShareExportPolicyGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetName() (res GetShareExportPolicyResponseShareExportPolicyGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetNameOk() (ret GetShareExportPolicyResponseShareExportPolicyGetNameRetType, ok bool) { + return getGetShareExportPolicyResponseShareExportPolicyGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *GetShareExportPolicyResponseShareExportPolicy) SetName(v GetShareExportPolicyResponseShareExportPolicyGetNameRetType) { + setGetShareExportPolicyResponseShareExportPolicyGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetRules() (res GetShareExportPolicyResponseShareExportPolicyGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetRulesOk() (ret GetShareExportPolicyResponseShareExportPolicyGetRulesRetType, ok bool) { + return getGetShareExportPolicyResponseShareExportPolicyGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given []ShareExportPolicyRule and assigns it to the Rules field. +func (o *GetShareExportPolicyResponseShareExportPolicy) SetRules(v GetShareExportPolicyResponseShareExportPolicyGetRulesRetType) { + setGetShareExportPolicyResponseShareExportPolicyGetRulesAttributeType(&o.Rules, v) +} + +// GetSharesUsingExportPolicy returns the SharesUsingExportPolicy field value if set, zero value otherwise. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetSharesUsingExportPolicy() (res GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType) { + res, _ = o.GetSharesUsingExportPolicyOk() + return +} + +// GetSharesUsingExportPolicyOk returns a tuple with the SharesUsingExportPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) GetSharesUsingExportPolicyOk() (ret GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType, ok bool) { + return getGetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeTypeOk(o.SharesUsingExportPolicy) +} + +// HasSharesUsingExportPolicy returns a boolean if a field has been set. +func (o *GetShareExportPolicyResponseShareExportPolicy) HasSharesUsingExportPolicy() bool { + _, ok := o.GetSharesUsingExportPolicyOk() + return ok +} + +// SetSharesUsingExportPolicy gets a reference to the given int64 and assigns it to the SharesUsingExportPolicy field. +func (o *GetShareExportPolicyResponseShareExportPolicy) SetSharesUsingExportPolicy(v GetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyRetType) { + setGetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeType(&o.SharesUsingExportPolicy, v) +} + +func (o GetShareExportPolicyResponseShareExportPolicy) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetShareExportPolicyResponseShareExportPolicyGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getGetShareExportPolicyResponseShareExportPolicyGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getGetShareExportPolicyResponseShareExportPolicyGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getGetShareExportPolicyResponseShareExportPolicyGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGetShareExportPolicyResponseShareExportPolicyGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + if val, ok := getGetShareExportPolicyResponseShareExportPolicyGetSharesUsingExportPolicyAttributeTypeOk(o.SharesUsingExportPolicy); ok { + toSerialize["SharesUsingExportPolicy"] = val + } + return toSerialize, nil +} + +type NullableGetShareExportPolicyResponseShareExportPolicy struct { + value *GetShareExportPolicyResponseShareExportPolicy + isSet bool +} + +func (v NullableGetShareExportPolicyResponseShareExportPolicy) Get() *GetShareExportPolicyResponseShareExportPolicy { + return v.value +} + +func (v *NullableGetShareExportPolicyResponseShareExportPolicy) Set(val *GetShareExportPolicyResponseShareExportPolicy) { + v.value = val + v.isSet = true +} + +func (v NullableGetShareExportPolicyResponseShareExportPolicy) IsSet() bool { + return v.isSet +} + +func (v *NullableGetShareExportPolicyResponseShareExportPolicy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetShareExportPolicyResponseShareExportPolicy(val *GetShareExportPolicyResponseShareExportPolicy) *NullableGetShareExportPolicyResponseShareExportPolicy { + return &NullableGetShareExportPolicyResponseShareExportPolicy{value: val, isSet: true} +} + +func (v NullableGetShareExportPolicyResponseShareExportPolicy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetShareExportPolicyResponseShareExportPolicy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_get_share_export_policy_response_share_export_policy_test.go b/pkg/sfsbeta/model_get_share_export_policy_response_share_export_policy_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_get_share_export_policy_response_share_export_policy_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_get_share_export_policy_response_test.go b/pkg/sfsbeta/model_get_share_export_policy_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_get_share_export_policy_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_get_share_response.go b/pkg/sfsbeta/model_get_share_response.go new file mode 100644 index 00000000..7842eb53 --- /dev/null +++ b/pkg/sfsbeta/model_get_share_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the GetShareResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetShareResponse{} + +/* + types and functions for share +*/ + +// isModel +type GetShareResponseGetShareAttributeType = *GetShareResponseShare +type GetShareResponseGetShareArgType = GetShareResponseShare +type GetShareResponseGetShareRetType = GetShareResponseShare + +func getGetShareResponseGetShareAttributeTypeOk(arg GetShareResponseGetShareAttributeType) (ret GetShareResponseGetShareRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareResponseGetShareAttributeType(arg *GetShareResponseGetShareAttributeType, val GetShareResponseGetShareRetType) { + *arg = &val +} + +// GetShareResponse struct for GetShareResponse +type GetShareResponse struct { + Share GetShareResponseGetShareAttributeType `json:"share,omitempty"` +} + +// NewGetShareResponse instantiates a new GetShareResponse 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 NewGetShareResponse() *GetShareResponse { + this := GetShareResponse{} + return &this +} + +// NewGetShareResponseWithDefaults instantiates a new GetShareResponse 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 NewGetShareResponseWithDefaults() *GetShareResponse { + this := GetShareResponse{} + return &this +} + +// GetShare returns the Share field value if set, zero value otherwise. +func (o *GetShareResponse) GetShare() (res GetShareResponseGetShareRetType) { + res, _ = o.GetShareOk() + return +} + +// GetShareOk returns a tuple with the Share field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareResponse) GetShareOk() (ret GetShareResponseGetShareRetType, ok bool) { + return getGetShareResponseGetShareAttributeTypeOk(o.Share) +} + +// HasShare returns a boolean if a field has been set. +func (o *GetShareResponse) HasShare() bool { + _, ok := o.GetShareOk() + return ok +} + +// SetShare gets a reference to the given GetShareResponseShare and assigns it to the Share field. +func (o *GetShareResponse) SetShare(v GetShareResponseGetShareRetType) { + setGetShareResponseGetShareAttributeType(&o.Share, v) +} + +func (o GetShareResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetShareResponseGetShareAttributeTypeOk(o.Share); ok { + toSerialize["Share"] = val + } + return toSerialize, nil +} + +type NullableGetShareResponse struct { + value *GetShareResponse + isSet bool +} + +func (v NullableGetShareResponse) Get() *GetShareResponse { + return v.value +} + +func (v *NullableGetShareResponse) Set(val *GetShareResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetShareResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetShareResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetShareResponse(val *GetShareResponse) *NullableGetShareResponse { + return &NullableGetShareResponse{value: val, isSet: true} +} + +func (v NullableGetShareResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetShareResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_get_share_response_share.go b/pkg/sfsbeta/model_get_share_response_share.go new file mode 100644 index 00000000..e054e005 --- /dev/null +++ b/pkg/sfsbeta/model_get_share_response_share.go @@ -0,0 +1,479 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the GetShareResponseShare type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetShareResponseShare{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type GetShareResponseShareGetCreatedAtAttributeType = *time.Time +type GetShareResponseShareGetCreatedAtArgType = time.Time +type GetShareResponseShareGetCreatedAtRetType = time.Time + +func getGetShareResponseShareGetCreatedAtAttributeTypeOk(arg GetShareResponseShareGetCreatedAtAttributeType) (ret GetShareResponseShareGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareResponseShareGetCreatedAtAttributeType(arg *GetShareResponseShareGetCreatedAtAttributeType, val GetShareResponseShareGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for exportPolicy +*/ + +// isModel +type GetShareResponseShareGetExportPolicyAttributeType = *NullableShareExportPolicy +type GetShareResponseShareGetExportPolicyArgType = *NullableShareExportPolicy +type GetShareResponseShareGetExportPolicyRetType = *NullableShareExportPolicy + +func getGetShareResponseShareGetExportPolicyAttributeTypeOk(arg GetShareResponseShareGetExportPolicyAttributeType) (ret GetShareResponseShareGetExportPolicyRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setGetShareResponseShareGetExportPolicyAttributeType(arg *GetShareResponseShareGetExportPolicyAttributeType, val GetShareResponseShareGetExportPolicyRetType) { + *arg = val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type GetShareResponseShareGetIdAttributeType = *string + +func getGetShareResponseShareGetIdAttributeTypeOk(arg GetShareResponseShareGetIdAttributeType) (ret GetShareResponseShareGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareResponseShareGetIdAttributeType(arg *GetShareResponseShareGetIdAttributeType, val GetShareResponseShareGetIdRetType) { + *arg = &val +} + +type GetShareResponseShareGetIdArgType = string +type GetShareResponseShareGetIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type GetShareResponseShareGetLabelsAttributeType = *map[string]string +type GetShareResponseShareGetLabelsArgType = map[string]string +type GetShareResponseShareGetLabelsRetType = map[string]string + +func getGetShareResponseShareGetLabelsAttributeTypeOk(arg GetShareResponseShareGetLabelsAttributeType) (ret GetShareResponseShareGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareResponseShareGetLabelsAttributeType(arg *GetShareResponseShareGetLabelsAttributeType, val GetShareResponseShareGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mountPath +*/ + +// isNotNullableString +type GetShareResponseShareGetMountPathAttributeType = *string + +func getGetShareResponseShareGetMountPathAttributeTypeOk(arg GetShareResponseShareGetMountPathAttributeType) (ret GetShareResponseShareGetMountPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareResponseShareGetMountPathAttributeType(arg *GetShareResponseShareGetMountPathAttributeType, val GetShareResponseShareGetMountPathRetType) { + *arg = &val +} + +type GetShareResponseShareGetMountPathArgType = string +type GetShareResponseShareGetMountPathRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type GetShareResponseShareGetNameAttributeType = *string + +func getGetShareResponseShareGetNameAttributeTypeOk(arg GetShareResponseShareGetNameAttributeType) (ret GetShareResponseShareGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareResponseShareGetNameAttributeType(arg *GetShareResponseShareGetNameAttributeType, val GetShareResponseShareGetNameRetType) { + *arg = &val +} + +type GetShareResponseShareGetNameArgType = string +type GetShareResponseShareGetNameRetType = string + +/* + types and functions for spaceHardLimitGigabytes +*/ + +// isInteger +type GetShareResponseShareGetSpaceHardLimitGigabytesAttributeType = *int64 +type GetShareResponseShareGetSpaceHardLimitGigabytesArgType = int64 +type GetShareResponseShareGetSpaceHardLimitGigabytesRetType = int64 + +func getGetShareResponseShareGetSpaceHardLimitGigabytesAttributeTypeOk(arg GetShareResponseShareGetSpaceHardLimitGigabytesAttributeType) (ret GetShareResponseShareGetSpaceHardLimitGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareResponseShareGetSpaceHardLimitGigabytesAttributeType(arg *GetShareResponseShareGetSpaceHardLimitGigabytesAttributeType, val GetShareResponseShareGetSpaceHardLimitGigabytesRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isNotNullableString +type GetShareResponseShareGetStateAttributeType = *string + +func getGetShareResponseShareGetStateAttributeTypeOk(arg GetShareResponseShareGetStateAttributeType) (ret GetShareResponseShareGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetShareResponseShareGetStateAttributeType(arg *GetShareResponseShareGetStateAttributeType, val GetShareResponseShareGetStateRetType) { + *arg = &val +} + +type GetShareResponseShareGetStateArgType = string +type GetShareResponseShareGetStateRetType = string + +// GetShareResponseShare Share +type GetShareResponseShare struct { + CreatedAt GetShareResponseShareGetCreatedAtAttributeType `json:"createdAt,omitempty"` + ExportPolicy GetShareResponseShareGetExportPolicyAttributeType `json:"exportPolicy,omitempty"` + // ID of the Share + Id GetShareResponseShareGetIdAttributeType `json:"id,omitempty"` + // An optional object that represents the labels associated with the share keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels GetShareResponseShareGetLabelsAttributeType `json:"labels,omitempty"` + // Mount path of the Share, used to mount the Share + MountPath GetShareResponseShareGetMountPathAttributeType `json:"mountPath,omitempty"` + // Name of the Share + Name GetShareResponseShareGetNameAttributeType `json:"name,omitempty"` + // Space hard limit for the Share. If zero, the Share will have access to the full space of the Resource Pool it lives in. (unit: gibibytes) + // Can be cast to int32 without loss of precision. + SpaceHardLimitGigabytes GetShareResponseShareGetSpaceHardLimitGigabytesAttributeType `json:"spaceHardLimitGigabytes,omitempty"` + // State of the Resource Pool Snapshot (possible values: [\"pending\", \"creating\", \"created\", \"error\", \"deleting\"]) + State GetShareResponseShareGetStateAttributeType `json:"state,omitempty"` +} + +// NewGetShareResponseShare instantiates a new GetShareResponseShare 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 NewGetShareResponseShare() *GetShareResponseShare { + this := GetShareResponseShare{} + return &this +} + +// NewGetShareResponseShareWithDefaults instantiates a new GetShareResponseShare 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 NewGetShareResponseShareWithDefaults() *GetShareResponseShare { + this := GetShareResponseShare{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *GetShareResponseShare) GetCreatedAt() (res GetShareResponseShareGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareResponseShare) GetCreatedAtOk() (ret GetShareResponseShareGetCreatedAtRetType, ok bool) { + return getGetShareResponseShareGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *GetShareResponseShare) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *GetShareResponseShare) SetCreatedAt(v GetShareResponseShareGetCreatedAtRetType) { + setGetShareResponseShareGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetExportPolicy returns the ExportPolicy field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *GetShareResponseShare) GetExportPolicy() (res GetShareResponseShareGetExportPolicyRetType) { + res, _ = o.GetExportPolicyOk() + return +} + +// GetExportPolicyOk returns a tuple with the ExportPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GetShareResponseShare) GetExportPolicyOk() (ret GetShareResponseShareGetExportPolicyRetType, ok bool) { + return getGetShareResponseShareGetExportPolicyAttributeTypeOk(o.ExportPolicy) +} + +// HasExportPolicy returns a boolean if a field has been set. +func (o *GetShareResponseShare) HasExportPolicy() bool { + _, ok := o.GetExportPolicyOk() + return ok +} + +// SetExportPolicy gets a reference to the given ShareExportPolicy and assigns it to the ExportPolicy field. +func (o *GetShareResponseShare) SetExportPolicy(v GetShareResponseShareGetExportPolicyRetType) { + setGetShareResponseShareGetExportPolicyAttributeType(&o.ExportPolicy, v) +} + +// SetExportPolicyNil sets the value for ExportPolicy to be an explicit nil +func (o *GetShareResponseShare) SetExportPolicyNil() { + o.ExportPolicy = nil +} + +// UnsetExportPolicy ensures that no value is present for ExportPolicy, not even an explicit nil +func (o *GetShareResponseShare) UnsetExportPolicy() { + o.ExportPolicy = nil +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *GetShareResponseShare) GetId() (res GetShareResponseShareGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareResponseShare) GetIdOk() (ret GetShareResponseShareGetIdRetType, ok bool) { + return getGetShareResponseShareGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *GetShareResponseShare) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GetShareResponseShare) SetId(v GetShareResponseShareGetIdRetType) { + setGetShareResponseShareGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *GetShareResponseShare) GetLabels() (res GetShareResponseShareGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareResponseShare) GetLabelsOk() (ret GetShareResponseShareGetLabelsRetType, ok bool) { + return getGetShareResponseShareGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *GetShareResponseShare) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *GetShareResponseShare) SetLabels(v GetShareResponseShareGetLabelsRetType) { + setGetShareResponseShareGetLabelsAttributeType(&o.Labels, v) +} + +// GetMountPath returns the MountPath field value if set, zero value otherwise. +func (o *GetShareResponseShare) GetMountPath() (res GetShareResponseShareGetMountPathRetType) { + res, _ = o.GetMountPathOk() + return +} + +// GetMountPathOk returns a tuple with the MountPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareResponseShare) GetMountPathOk() (ret GetShareResponseShareGetMountPathRetType, ok bool) { + return getGetShareResponseShareGetMountPathAttributeTypeOk(o.MountPath) +} + +// HasMountPath returns a boolean if a field has been set. +func (o *GetShareResponseShare) HasMountPath() bool { + _, ok := o.GetMountPathOk() + return ok +} + +// SetMountPath gets a reference to the given string and assigns it to the MountPath field. +func (o *GetShareResponseShare) SetMountPath(v GetShareResponseShareGetMountPathRetType) { + setGetShareResponseShareGetMountPathAttributeType(&o.MountPath, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *GetShareResponseShare) GetName() (res GetShareResponseShareGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareResponseShare) GetNameOk() (ret GetShareResponseShareGetNameRetType, ok bool) { + return getGetShareResponseShareGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *GetShareResponseShare) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *GetShareResponseShare) SetName(v GetShareResponseShareGetNameRetType) { + setGetShareResponseShareGetNameAttributeType(&o.Name, v) +} + +// GetSpaceHardLimitGigabytes returns the SpaceHardLimitGigabytes field value if set, zero value otherwise. +func (o *GetShareResponseShare) GetSpaceHardLimitGigabytes() (res GetShareResponseShareGetSpaceHardLimitGigabytesRetType) { + res, _ = o.GetSpaceHardLimitGigabytesOk() + return +} + +// GetSpaceHardLimitGigabytesOk returns a tuple with the SpaceHardLimitGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareResponseShare) GetSpaceHardLimitGigabytesOk() (ret GetShareResponseShareGetSpaceHardLimitGigabytesRetType, ok bool) { + return getGetShareResponseShareGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes) +} + +// HasSpaceHardLimitGigabytes returns a boolean if a field has been set. +func (o *GetShareResponseShare) HasSpaceHardLimitGigabytes() bool { + _, ok := o.GetSpaceHardLimitGigabytesOk() + return ok +} + +// SetSpaceHardLimitGigabytes gets a reference to the given int64 and assigns it to the SpaceHardLimitGigabytes field. +func (o *GetShareResponseShare) SetSpaceHardLimitGigabytes(v GetShareResponseShareGetSpaceHardLimitGigabytesRetType) { + setGetShareResponseShareGetSpaceHardLimitGigabytesAttributeType(&o.SpaceHardLimitGigabytes, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *GetShareResponseShare) GetState() (res GetShareResponseShareGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetShareResponseShare) GetStateOk() (ret GetShareResponseShareGetStateRetType, ok bool) { + return getGetShareResponseShareGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *GetShareResponseShare) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *GetShareResponseShare) SetState(v GetShareResponseShareGetStateRetType) { + setGetShareResponseShareGetStateAttributeType(&o.State, v) +} + +func (o GetShareResponseShare) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetShareResponseShareGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getGetShareResponseShareGetExportPolicyAttributeTypeOk(o.ExportPolicy); ok { + toSerialize["ExportPolicy"] = val + } + if val, ok := getGetShareResponseShareGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getGetShareResponseShareGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getGetShareResponseShareGetMountPathAttributeTypeOk(o.MountPath); ok { + toSerialize["MountPath"] = val + } + if val, ok := getGetShareResponseShareGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGetShareResponseShareGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes); ok { + toSerialize["SpaceHardLimitGigabytes"] = val + } + if val, ok := getGetShareResponseShareGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableGetShareResponseShare struct { + value *GetShareResponseShare + isSet bool +} + +func (v NullableGetShareResponseShare) Get() *GetShareResponseShare { + return v.value +} + +func (v *NullableGetShareResponseShare) Set(val *GetShareResponseShare) { + v.value = val + v.isSet = true +} + +func (v NullableGetShareResponseShare) IsSet() bool { + return v.isSet +} + +func (v *NullableGetShareResponseShare) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetShareResponseShare(val *GetShareResponseShare) *NullableGetShareResponseShare { + return &NullableGetShareResponseShare{value: val, isSet: true} +} + +func (v NullableGetShareResponseShare) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetShareResponseShare) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_get_share_response_share_test.go b/pkg/sfsbeta/model_get_share_response_share_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_get_share_response_share_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_get_share_response_test.go b/pkg/sfsbeta/model_get_share_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_get_share_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_google_protobuf_any.go b/pkg/sfsbeta/model_google_protobuf_any.go new file mode 100644 index 00000000..e222447c --- /dev/null +++ b/pkg/sfsbeta/model_google_protobuf_any.go @@ -0,0 +1,137 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the GoogleProtobufAny type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GoogleProtobufAny{} + +/* + types and functions for @type +*/ + +// isNotNullableString +type GoogleProtobufAnyGetTypeAttributeType = *string + +func getGoogleProtobufAnyGetTypeAttributeTypeOk(arg GoogleProtobufAnyGetTypeAttributeType) (ret GoogleProtobufAnyGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGoogleProtobufAnyGetTypeAttributeType(arg *GoogleProtobufAnyGetTypeAttributeType, val GoogleProtobufAnyGetTypeRetType) { + *arg = &val +} + +type GoogleProtobufAnyGetTypeArgType = string +type GoogleProtobufAnyGetTypeRetType = string + +// GoogleProtobufAny Contains an arbitrary serialized message along with a @type that describes the type of the serialized message. +type GoogleProtobufAny struct { + // The type of the serialized message. + Type GoogleProtobufAnyGetTypeAttributeType `json:"@type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GoogleProtobufAny GoogleProtobufAny + +// NewGoogleProtobufAny instantiates a new GoogleProtobufAny 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 NewGoogleProtobufAny() *GoogleProtobufAny { + this := GoogleProtobufAny{} + return &this +} + +// NewGoogleProtobufAnyWithDefaults instantiates a new GoogleProtobufAny 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 NewGoogleProtobufAnyWithDefaults() *GoogleProtobufAny { + this := GoogleProtobufAny{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *GoogleProtobufAny) GetType() (res GoogleProtobufAnyGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GoogleProtobufAny) GetTypeOk() (ret GoogleProtobufAnyGetTypeRetType, ok bool) { + return getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *GoogleProtobufAny) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *GoogleProtobufAny) SetType(v GoogleProtobufAnyGetTypeRetType) { + setGoogleProtobufAnyGetTypeAttributeType(&o.Type, v) +} + +func (o GoogleProtobufAny) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGoogleProtobufAnyGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +type NullableGoogleProtobufAny struct { + value *GoogleProtobufAny + isSet bool +} + +func (v NullableGoogleProtobufAny) Get() *GoogleProtobufAny { + return v.value +} + +func (v *NullableGoogleProtobufAny) Set(val *GoogleProtobufAny) { + v.value = val + v.isSet = true +} + +func (v NullableGoogleProtobufAny) IsSet() bool { + return v.isSet +} + +func (v *NullableGoogleProtobufAny) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGoogleProtobufAny(val *GoogleProtobufAny) *NullableGoogleProtobufAny { + return &NullableGoogleProtobufAny{value: val, isSet: true} +} + +func (v NullableGoogleProtobufAny) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGoogleProtobufAny) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_google_protobuf_any_test.go b/pkg/sfsbeta/model_google_protobuf_any_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_google_protobuf_any_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_list_performance_classes_response.go b/pkg/sfsbeta/model_list_performance_classes_response.go new file mode 100644 index 00000000..df48e331 --- /dev/null +++ b/pkg/sfsbeta/model_list_performance_classes_response.go @@ -0,0 +1,128 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ListPerformanceClassesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListPerformanceClassesResponse{} + +/* + types and functions for performanceClasses +*/ + +// isArray +type ListPerformanceClassesResponseGetPerformanceClassesAttributeType = *[]PerformanceClass +type ListPerformanceClassesResponseGetPerformanceClassesArgType = []PerformanceClass +type ListPerformanceClassesResponseGetPerformanceClassesRetType = []PerformanceClass + +func getListPerformanceClassesResponseGetPerformanceClassesAttributeTypeOk(arg ListPerformanceClassesResponseGetPerformanceClassesAttributeType) (ret ListPerformanceClassesResponseGetPerformanceClassesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListPerformanceClassesResponseGetPerformanceClassesAttributeType(arg *ListPerformanceClassesResponseGetPerformanceClassesAttributeType, val ListPerformanceClassesResponseGetPerformanceClassesRetType) { + *arg = &val +} + +// ListPerformanceClassesResponse struct for ListPerformanceClassesResponse +type ListPerformanceClassesResponse struct { + // List of Performance Classes + PerformanceClasses ListPerformanceClassesResponseGetPerformanceClassesAttributeType `json:"performanceClasses,omitempty"` +} + +// NewListPerformanceClassesResponse instantiates a new ListPerformanceClassesResponse 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 NewListPerformanceClassesResponse() *ListPerformanceClassesResponse { + this := ListPerformanceClassesResponse{} + return &this +} + +// NewListPerformanceClassesResponseWithDefaults instantiates a new ListPerformanceClassesResponse 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 NewListPerformanceClassesResponseWithDefaults() *ListPerformanceClassesResponse { + this := ListPerformanceClassesResponse{} + return &this +} + +// GetPerformanceClasses returns the PerformanceClasses field value if set, zero value otherwise. +func (o *ListPerformanceClassesResponse) GetPerformanceClasses() (res ListPerformanceClassesResponseGetPerformanceClassesRetType) { + res, _ = o.GetPerformanceClassesOk() + return +} + +// GetPerformanceClassesOk returns a tuple with the PerformanceClasses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListPerformanceClassesResponse) GetPerformanceClassesOk() (ret ListPerformanceClassesResponseGetPerformanceClassesRetType, ok bool) { + return getListPerformanceClassesResponseGetPerformanceClassesAttributeTypeOk(o.PerformanceClasses) +} + +// HasPerformanceClasses returns a boolean if a field has been set. +func (o *ListPerformanceClassesResponse) HasPerformanceClasses() bool { + _, ok := o.GetPerformanceClassesOk() + return ok +} + +// SetPerformanceClasses gets a reference to the given []PerformanceClass and assigns it to the PerformanceClasses field. +func (o *ListPerformanceClassesResponse) SetPerformanceClasses(v ListPerformanceClassesResponseGetPerformanceClassesRetType) { + setListPerformanceClassesResponseGetPerformanceClassesAttributeType(&o.PerformanceClasses, v) +} + +func (o ListPerformanceClassesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListPerformanceClassesResponseGetPerformanceClassesAttributeTypeOk(o.PerformanceClasses); ok { + toSerialize["PerformanceClasses"] = val + } + return toSerialize, nil +} + +type NullableListPerformanceClassesResponse struct { + value *ListPerformanceClassesResponse + isSet bool +} + +func (v NullableListPerformanceClassesResponse) Get() *ListPerformanceClassesResponse { + return v.value +} + +func (v *NullableListPerformanceClassesResponse) Set(val *ListPerformanceClassesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListPerformanceClassesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListPerformanceClassesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListPerformanceClassesResponse(val *ListPerformanceClassesResponse) *NullableListPerformanceClassesResponse { + return &NullableListPerformanceClassesResponse{value: val, isSet: true} +} + +func (v NullableListPerformanceClassesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListPerformanceClassesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_list_performance_classes_response_test.go b/pkg/sfsbeta/model_list_performance_classes_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_list_performance_classes_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_list_resource_pool_snapshots_response.go b/pkg/sfsbeta/model_list_resource_pool_snapshots_response.go new file mode 100644 index 00000000..4c905e0e --- /dev/null +++ b/pkg/sfsbeta/model_list_resource_pool_snapshots_response.go @@ -0,0 +1,128 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ListResourcePoolSnapshotsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListResourcePoolSnapshotsResponse{} + +/* + types and functions for resourcePoolSnapshots +*/ + +// isArray +type ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsAttributeType = *[]ResourcePoolSnapshot +type ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsArgType = []ResourcePoolSnapshot +type ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsRetType = []ResourcePoolSnapshot + +func getListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsAttributeTypeOk(arg ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsAttributeType) (ret ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsAttributeType(arg *ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsAttributeType, val ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsRetType) { + *arg = &val +} + +// ListResourcePoolSnapshotsResponse struct for ListResourcePoolSnapshotsResponse +type ListResourcePoolSnapshotsResponse struct { + // List of Resource Pool Snapshots + ResourcePoolSnapshots ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsAttributeType `json:"resourcePoolSnapshots,omitempty"` +} + +// NewListResourcePoolSnapshotsResponse instantiates a new ListResourcePoolSnapshotsResponse 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 NewListResourcePoolSnapshotsResponse() *ListResourcePoolSnapshotsResponse { + this := ListResourcePoolSnapshotsResponse{} + return &this +} + +// NewListResourcePoolSnapshotsResponseWithDefaults instantiates a new ListResourcePoolSnapshotsResponse 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 NewListResourcePoolSnapshotsResponseWithDefaults() *ListResourcePoolSnapshotsResponse { + this := ListResourcePoolSnapshotsResponse{} + return &this +} + +// GetResourcePoolSnapshots returns the ResourcePoolSnapshots field value if set, zero value otherwise. +func (o *ListResourcePoolSnapshotsResponse) GetResourcePoolSnapshots() (res ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsRetType) { + res, _ = o.GetResourcePoolSnapshotsOk() + return +} + +// GetResourcePoolSnapshotsOk returns a tuple with the ResourcePoolSnapshots field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListResourcePoolSnapshotsResponse) GetResourcePoolSnapshotsOk() (ret ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsRetType, ok bool) { + return getListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsAttributeTypeOk(o.ResourcePoolSnapshots) +} + +// HasResourcePoolSnapshots returns a boolean if a field has been set. +func (o *ListResourcePoolSnapshotsResponse) HasResourcePoolSnapshots() bool { + _, ok := o.GetResourcePoolSnapshotsOk() + return ok +} + +// SetResourcePoolSnapshots gets a reference to the given []ResourcePoolSnapshot and assigns it to the ResourcePoolSnapshots field. +func (o *ListResourcePoolSnapshotsResponse) SetResourcePoolSnapshots(v ListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsRetType) { + setListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsAttributeType(&o.ResourcePoolSnapshots, v) +} + +func (o ListResourcePoolSnapshotsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListResourcePoolSnapshotsResponseGetResourcePoolSnapshotsAttributeTypeOk(o.ResourcePoolSnapshots); ok { + toSerialize["ResourcePoolSnapshots"] = val + } + return toSerialize, nil +} + +type NullableListResourcePoolSnapshotsResponse struct { + value *ListResourcePoolSnapshotsResponse + isSet bool +} + +func (v NullableListResourcePoolSnapshotsResponse) Get() *ListResourcePoolSnapshotsResponse { + return v.value +} + +func (v *NullableListResourcePoolSnapshotsResponse) Set(val *ListResourcePoolSnapshotsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListResourcePoolSnapshotsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListResourcePoolSnapshotsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListResourcePoolSnapshotsResponse(val *ListResourcePoolSnapshotsResponse) *NullableListResourcePoolSnapshotsResponse { + return &NullableListResourcePoolSnapshotsResponse{value: val, isSet: true} +} + +func (v NullableListResourcePoolSnapshotsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListResourcePoolSnapshotsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_list_resource_pool_snapshots_response_test.go b/pkg/sfsbeta/model_list_resource_pool_snapshots_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_list_resource_pool_snapshots_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_list_resource_pools_response.go b/pkg/sfsbeta/model_list_resource_pools_response.go new file mode 100644 index 00000000..7242a7de --- /dev/null +++ b/pkg/sfsbeta/model_list_resource_pools_response.go @@ -0,0 +1,128 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ListResourcePoolsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListResourcePoolsResponse{} + +/* + types and functions for resourcePools +*/ + +// isArray +type ListResourcePoolsResponseGetResourcePoolsAttributeType = *[]ResourcePool +type ListResourcePoolsResponseGetResourcePoolsArgType = []ResourcePool +type ListResourcePoolsResponseGetResourcePoolsRetType = []ResourcePool + +func getListResourcePoolsResponseGetResourcePoolsAttributeTypeOk(arg ListResourcePoolsResponseGetResourcePoolsAttributeType) (ret ListResourcePoolsResponseGetResourcePoolsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListResourcePoolsResponseGetResourcePoolsAttributeType(arg *ListResourcePoolsResponseGetResourcePoolsAttributeType, val ListResourcePoolsResponseGetResourcePoolsRetType) { + *arg = &val +} + +// ListResourcePoolsResponse struct for ListResourcePoolsResponse +type ListResourcePoolsResponse struct { + // List of Resource Pools + ResourcePools ListResourcePoolsResponseGetResourcePoolsAttributeType `json:"resourcePools,omitempty"` +} + +// NewListResourcePoolsResponse instantiates a new ListResourcePoolsResponse 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 NewListResourcePoolsResponse() *ListResourcePoolsResponse { + this := ListResourcePoolsResponse{} + return &this +} + +// NewListResourcePoolsResponseWithDefaults instantiates a new ListResourcePoolsResponse 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 NewListResourcePoolsResponseWithDefaults() *ListResourcePoolsResponse { + this := ListResourcePoolsResponse{} + return &this +} + +// GetResourcePools returns the ResourcePools field value if set, zero value otherwise. +func (o *ListResourcePoolsResponse) GetResourcePools() (res ListResourcePoolsResponseGetResourcePoolsRetType) { + res, _ = o.GetResourcePoolsOk() + return +} + +// GetResourcePoolsOk returns a tuple with the ResourcePools field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListResourcePoolsResponse) GetResourcePoolsOk() (ret ListResourcePoolsResponseGetResourcePoolsRetType, ok bool) { + return getListResourcePoolsResponseGetResourcePoolsAttributeTypeOk(o.ResourcePools) +} + +// HasResourcePools returns a boolean if a field has been set. +func (o *ListResourcePoolsResponse) HasResourcePools() bool { + _, ok := o.GetResourcePoolsOk() + return ok +} + +// SetResourcePools gets a reference to the given []ResourcePool and assigns it to the ResourcePools field. +func (o *ListResourcePoolsResponse) SetResourcePools(v ListResourcePoolsResponseGetResourcePoolsRetType) { + setListResourcePoolsResponseGetResourcePoolsAttributeType(&o.ResourcePools, v) +} + +func (o ListResourcePoolsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListResourcePoolsResponseGetResourcePoolsAttributeTypeOk(o.ResourcePools); ok { + toSerialize["ResourcePools"] = val + } + return toSerialize, nil +} + +type NullableListResourcePoolsResponse struct { + value *ListResourcePoolsResponse + isSet bool +} + +func (v NullableListResourcePoolsResponse) Get() *ListResourcePoolsResponse { + return v.value +} + +func (v *NullableListResourcePoolsResponse) Set(val *ListResourcePoolsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListResourcePoolsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListResourcePoolsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListResourcePoolsResponse(val *ListResourcePoolsResponse) *NullableListResourcePoolsResponse { + return &NullableListResourcePoolsResponse{value: val, isSet: true} +} + +func (v NullableListResourcePoolsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListResourcePoolsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_list_resource_pools_response_test.go b/pkg/sfsbeta/model_list_resource_pools_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_list_resource_pools_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_list_share_export_policies_response.go b/pkg/sfsbeta/model_list_share_export_policies_response.go new file mode 100644 index 00000000..240a1e4f --- /dev/null +++ b/pkg/sfsbeta/model_list_share_export_policies_response.go @@ -0,0 +1,128 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ListShareExportPoliciesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListShareExportPoliciesResponse{} + +/* + types and functions for shareExportPolicies +*/ + +// isArray +type ListShareExportPoliciesResponseGetShareExportPoliciesAttributeType = *[]ShareExportPolicy +type ListShareExportPoliciesResponseGetShareExportPoliciesArgType = []ShareExportPolicy +type ListShareExportPoliciesResponseGetShareExportPoliciesRetType = []ShareExportPolicy + +func getListShareExportPoliciesResponseGetShareExportPoliciesAttributeTypeOk(arg ListShareExportPoliciesResponseGetShareExportPoliciesAttributeType) (ret ListShareExportPoliciesResponseGetShareExportPoliciesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListShareExportPoliciesResponseGetShareExportPoliciesAttributeType(arg *ListShareExportPoliciesResponseGetShareExportPoliciesAttributeType, val ListShareExportPoliciesResponseGetShareExportPoliciesRetType) { + *arg = &val +} + +// ListShareExportPoliciesResponse struct for ListShareExportPoliciesResponse +type ListShareExportPoliciesResponse struct { + // List of Share Export Policies + ShareExportPolicies ListShareExportPoliciesResponseGetShareExportPoliciesAttributeType `json:"shareExportPolicies,omitempty"` +} + +// NewListShareExportPoliciesResponse instantiates a new ListShareExportPoliciesResponse 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 NewListShareExportPoliciesResponse() *ListShareExportPoliciesResponse { + this := ListShareExportPoliciesResponse{} + return &this +} + +// NewListShareExportPoliciesResponseWithDefaults instantiates a new ListShareExportPoliciesResponse 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 NewListShareExportPoliciesResponseWithDefaults() *ListShareExportPoliciesResponse { + this := ListShareExportPoliciesResponse{} + return &this +} + +// GetShareExportPolicies returns the ShareExportPolicies field value if set, zero value otherwise. +func (o *ListShareExportPoliciesResponse) GetShareExportPolicies() (res ListShareExportPoliciesResponseGetShareExportPoliciesRetType) { + res, _ = o.GetShareExportPoliciesOk() + return +} + +// GetShareExportPoliciesOk returns a tuple with the ShareExportPolicies field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListShareExportPoliciesResponse) GetShareExportPoliciesOk() (ret ListShareExportPoliciesResponseGetShareExportPoliciesRetType, ok bool) { + return getListShareExportPoliciesResponseGetShareExportPoliciesAttributeTypeOk(o.ShareExportPolicies) +} + +// HasShareExportPolicies returns a boolean if a field has been set. +func (o *ListShareExportPoliciesResponse) HasShareExportPolicies() bool { + _, ok := o.GetShareExportPoliciesOk() + return ok +} + +// SetShareExportPolicies gets a reference to the given []ShareExportPolicy and assigns it to the ShareExportPolicies field. +func (o *ListShareExportPoliciesResponse) SetShareExportPolicies(v ListShareExportPoliciesResponseGetShareExportPoliciesRetType) { + setListShareExportPoliciesResponseGetShareExportPoliciesAttributeType(&o.ShareExportPolicies, v) +} + +func (o ListShareExportPoliciesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListShareExportPoliciesResponseGetShareExportPoliciesAttributeTypeOk(o.ShareExportPolicies); ok { + toSerialize["ShareExportPolicies"] = val + } + return toSerialize, nil +} + +type NullableListShareExportPoliciesResponse struct { + value *ListShareExportPoliciesResponse + isSet bool +} + +func (v NullableListShareExportPoliciesResponse) Get() *ListShareExportPoliciesResponse { + return v.value +} + +func (v *NullableListShareExportPoliciesResponse) Set(val *ListShareExportPoliciesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListShareExportPoliciesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListShareExportPoliciesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListShareExportPoliciesResponse(val *ListShareExportPoliciesResponse) *NullableListShareExportPoliciesResponse { + return &NullableListShareExportPoliciesResponse{value: val, isSet: true} +} + +func (v NullableListShareExportPoliciesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListShareExportPoliciesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_list_share_export_policies_response_test.go b/pkg/sfsbeta/model_list_share_export_policies_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_list_share_export_policies_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_list_shares_response.go b/pkg/sfsbeta/model_list_shares_response.go new file mode 100644 index 00000000..b317409d --- /dev/null +++ b/pkg/sfsbeta/model_list_shares_response.go @@ -0,0 +1,128 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ListSharesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListSharesResponse{} + +/* + types and functions for shares +*/ + +// isArray +type ListSharesResponseGetSharesAttributeType = *[]Share +type ListSharesResponseGetSharesArgType = []Share +type ListSharesResponseGetSharesRetType = []Share + +func getListSharesResponseGetSharesAttributeTypeOk(arg ListSharesResponseGetSharesAttributeType) (ret ListSharesResponseGetSharesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListSharesResponseGetSharesAttributeType(arg *ListSharesResponseGetSharesAttributeType, val ListSharesResponseGetSharesRetType) { + *arg = &val +} + +// ListSharesResponse struct for ListSharesResponse +type ListSharesResponse struct { + // List of Shares + Shares ListSharesResponseGetSharesAttributeType `json:"shares,omitempty"` +} + +// NewListSharesResponse instantiates a new ListSharesResponse 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 NewListSharesResponse() *ListSharesResponse { + this := ListSharesResponse{} + return &this +} + +// NewListSharesResponseWithDefaults instantiates a new ListSharesResponse 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 NewListSharesResponseWithDefaults() *ListSharesResponse { + this := ListSharesResponse{} + return &this +} + +// GetShares returns the Shares field value if set, zero value otherwise. +func (o *ListSharesResponse) GetShares() (res ListSharesResponseGetSharesRetType) { + res, _ = o.GetSharesOk() + return +} + +// GetSharesOk returns a tuple with the Shares field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListSharesResponse) GetSharesOk() (ret ListSharesResponseGetSharesRetType, ok bool) { + return getListSharesResponseGetSharesAttributeTypeOk(o.Shares) +} + +// HasShares returns a boolean if a field has been set. +func (o *ListSharesResponse) HasShares() bool { + _, ok := o.GetSharesOk() + return ok +} + +// SetShares gets a reference to the given []Share and assigns it to the Shares field. +func (o *ListSharesResponse) SetShares(v ListSharesResponseGetSharesRetType) { + setListSharesResponseGetSharesAttributeType(&o.Shares, v) +} + +func (o ListSharesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListSharesResponseGetSharesAttributeTypeOk(o.Shares); ok { + toSerialize["Shares"] = val + } + return toSerialize, nil +} + +type NullableListSharesResponse struct { + value *ListSharesResponse + isSet bool +} + +func (v NullableListSharesResponse) Get() *ListSharesResponse { + return v.value +} + +func (v *NullableListSharesResponse) Set(val *ListSharesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListSharesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListSharesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListSharesResponse(val *ListSharesResponse) *NullableListSharesResponse { + return &NullableListSharesResponse{value: val, isSet: true} +} + +func (v NullableListSharesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListSharesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_list_shares_response_test.go b/pkg/sfsbeta/model_list_shares_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_list_shares_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_list_snapshot_schedules_response.go b/pkg/sfsbeta/model_list_snapshot_schedules_response.go new file mode 100644 index 00000000..84b3ec61 --- /dev/null +++ b/pkg/sfsbeta/model_list_snapshot_schedules_response.go @@ -0,0 +1,128 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ListSnapshotSchedulesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListSnapshotSchedulesResponse{} + +/* + types and functions for snapshotSchedules +*/ + +// isArray +type ListSnapshotSchedulesResponseGetSnapshotSchedulesAttributeType = *[]SnapshotSchedule +type ListSnapshotSchedulesResponseGetSnapshotSchedulesArgType = []SnapshotSchedule +type ListSnapshotSchedulesResponseGetSnapshotSchedulesRetType = []SnapshotSchedule + +func getListSnapshotSchedulesResponseGetSnapshotSchedulesAttributeTypeOk(arg ListSnapshotSchedulesResponseGetSnapshotSchedulesAttributeType) (ret ListSnapshotSchedulesResponseGetSnapshotSchedulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListSnapshotSchedulesResponseGetSnapshotSchedulesAttributeType(arg *ListSnapshotSchedulesResponseGetSnapshotSchedulesAttributeType, val ListSnapshotSchedulesResponseGetSnapshotSchedulesRetType) { + *arg = &val +} + +// ListSnapshotSchedulesResponse struct for ListSnapshotSchedulesResponse +type ListSnapshotSchedulesResponse struct { + // List of Snapshot Schedules + SnapshotSchedules ListSnapshotSchedulesResponseGetSnapshotSchedulesAttributeType `json:"snapshotSchedules,omitempty"` +} + +// NewListSnapshotSchedulesResponse instantiates a new ListSnapshotSchedulesResponse 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 NewListSnapshotSchedulesResponse() *ListSnapshotSchedulesResponse { + this := ListSnapshotSchedulesResponse{} + return &this +} + +// NewListSnapshotSchedulesResponseWithDefaults instantiates a new ListSnapshotSchedulesResponse 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 NewListSnapshotSchedulesResponseWithDefaults() *ListSnapshotSchedulesResponse { + this := ListSnapshotSchedulesResponse{} + return &this +} + +// GetSnapshotSchedules returns the SnapshotSchedules field value if set, zero value otherwise. +func (o *ListSnapshotSchedulesResponse) GetSnapshotSchedules() (res ListSnapshotSchedulesResponseGetSnapshotSchedulesRetType) { + res, _ = o.GetSnapshotSchedulesOk() + return +} + +// GetSnapshotSchedulesOk returns a tuple with the SnapshotSchedules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListSnapshotSchedulesResponse) GetSnapshotSchedulesOk() (ret ListSnapshotSchedulesResponseGetSnapshotSchedulesRetType, ok bool) { + return getListSnapshotSchedulesResponseGetSnapshotSchedulesAttributeTypeOk(o.SnapshotSchedules) +} + +// HasSnapshotSchedules returns a boolean if a field has been set. +func (o *ListSnapshotSchedulesResponse) HasSnapshotSchedules() bool { + _, ok := o.GetSnapshotSchedulesOk() + return ok +} + +// SetSnapshotSchedules gets a reference to the given []SnapshotSchedule and assigns it to the SnapshotSchedules field. +func (o *ListSnapshotSchedulesResponse) SetSnapshotSchedules(v ListSnapshotSchedulesResponseGetSnapshotSchedulesRetType) { + setListSnapshotSchedulesResponseGetSnapshotSchedulesAttributeType(&o.SnapshotSchedules, v) +} + +func (o ListSnapshotSchedulesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListSnapshotSchedulesResponseGetSnapshotSchedulesAttributeTypeOk(o.SnapshotSchedules); ok { + toSerialize["SnapshotSchedules"] = val + } + return toSerialize, nil +} + +type NullableListSnapshotSchedulesResponse struct { + value *ListSnapshotSchedulesResponse + isSet bool +} + +func (v NullableListSnapshotSchedulesResponse) Get() *ListSnapshotSchedulesResponse { + return v.value +} + +func (v *NullableListSnapshotSchedulesResponse) Set(val *ListSnapshotSchedulesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListSnapshotSchedulesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListSnapshotSchedulesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListSnapshotSchedulesResponse(val *ListSnapshotSchedulesResponse) *NullableListSnapshotSchedulesResponse { + return &NullableListSnapshotSchedulesResponse{value: val, isSet: true} +} + +func (v NullableListSnapshotSchedulesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListSnapshotSchedulesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_list_snapshot_schedules_response_test.go b/pkg/sfsbeta/model_list_snapshot_schedules_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_list_snapshot_schedules_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_performance_class.go b/pkg/sfsbeta/model_performance_class.go new file mode 100644 index 00000000..5c2c9392 --- /dev/null +++ b/pkg/sfsbeta/model_performance_class.go @@ -0,0 +1,227 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the PerformanceClass type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PerformanceClass{} + +/* + types and functions for iops +*/ + +// isInteger +type PerformanceClassGetIopsAttributeType = *int64 +type PerformanceClassGetIopsArgType = int64 +type PerformanceClassGetIopsRetType = int64 + +func getPerformanceClassGetIopsAttributeTypeOk(arg PerformanceClassGetIopsAttributeType) (ret PerformanceClassGetIopsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPerformanceClassGetIopsAttributeType(arg *PerformanceClassGetIopsAttributeType, val PerformanceClassGetIopsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type PerformanceClassGetNameAttributeType = *string + +func getPerformanceClassGetNameAttributeTypeOk(arg PerformanceClassGetNameAttributeType) (ret PerformanceClassGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPerformanceClassGetNameAttributeType(arg *PerformanceClassGetNameAttributeType, val PerformanceClassGetNameRetType) { + *arg = &val +} + +type PerformanceClassGetNameArgType = string +type PerformanceClassGetNameRetType = string + +/* + types and functions for throughput +*/ + +// isInteger +type PerformanceClassGetThroughputAttributeType = *int64 +type PerformanceClassGetThroughputArgType = int64 +type PerformanceClassGetThroughputRetType = int64 + +func getPerformanceClassGetThroughputAttributeTypeOk(arg PerformanceClassGetThroughputAttributeType) (ret PerformanceClassGetThroughputRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPerformanceClassGetThroughputAttributeType(arg *PerformanceClassGetThroughputAttributeType, val PerformanceClassGetThroughputRetType) { + *arg = &val +} + +// PerformanceClass struct for PerformanceClass +type PerformanceClass struct { + // IOPS of the Performance Class + // Can be cast to int32 without loss of precision. + Iops PerformanceClassGetIopsAttributeType `json:"iops,omitempty"` + // Name of the Performance Class + Name PerformanceClassGetNameAttributeType `json:"name,omitempty"` + // Throughput of the Performance Class + // Can be cast to int32 without loss of precision. + Throughput PerformanceClassGetThroughputAttributeType `json:"throughput,omitempty"` +} + +// NewPerformanceClass instantiates a new PerformanceClass 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 NewPerformanceClass() *PerformanceClass { + this := PerformanceClass{} + return &this +} + +// NewPerformanceClassWithDefaults instantiates a new PerformanceClass 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 NewPerformanceClassWithDefaults() *PerformanceClass { + this := PerformanceClass{} + return &this +} + +// GetIops returns the Iops field value if set, zero value otherwise. +func (o *PerformanceClass) GetIops() (res PerformanceClassGetIopsRetType) { + res, _ = o.GetIopsOk() + return +} + +// GetIopsOk returns a tuple with the Iops field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PerformanceClass) GetIopsOk() (ret PerformanceClassGetIopsRetType, ok bool) { + return getPerformanceClassGetIopsAttributeTypeOk(o.Iops) +} + +// HasIops returns a boolean if a field has been set. +func (o *PerformanceClass) HasIops() bool { + _, ok := o.GetIopsOk() + return ok +} + +// SetIops gets a reference to the given int64 and assigns it to the Iops field. +func (o *PerformanceClass) SetIops(v PerformanceClassGetIopsRetType) { + setPerformanceClassGetIopsAttributeType(&o.Iops, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PerformanceClass) GetName() (res PerformanceClassGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PerformanceClass) GetNameOk() (ret PerformanceClassGetNameRetType, ok bool) { + return getPerformanceClassGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *PerformanceClass) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PerformanceClass) SetName(v PerformanceClassGetNameRetType) { + setPerformanceClassGetNameAttributeType(&o.Name, v) +} + +// GetThroughput returns the Throughput field value if set, zero value otherwise. +func (o *PerformanceClass) GetThroughput() (res PerformanceClassGetThroughputRetType) { + res, _ = o.GetThroughputOk() + return +} + +// GetThroughputOk returns a tuple with the Throughput field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PerformanceClass) GetThroughputOk() (ret PerformanceClassGetThroughputRetType, ok bool) { + return getPerformanceClassGetThroughputAttributeTypeOk(o.Throughput) +} + +// HasThroughput returns a boolean if a field has been set. +func (o *PerformanceClass) HasThroughput() bool { + _, ok := o.GetThroughputOk() + return ok +} + +// SetThroughput gets a reference to the given int64 and assigns it to the Throughput field. +func (o *PerformanceClass) SetThroughput(v PerformanceClassGetThroughputRetType) { + setPerformanceClassGetThroughputAttributeType(&o.Throughput, v) +} + +func (o PerformanceClass) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPerformanceClassGetIopsAttributeTypeOk(o.Iops); ok { + toSerialize["Iops"] = val + } + if val, ok := getPerformanceClassGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getPerformanceClassGetThroughputAttributeTypeOk(o.Throughput); ok { + toSerialize["Throughput"] = val + } + return toSerialize, nil +} + +type NullablePerformanceClass struct { + value *PerformanceClass + isSet bool +} + +func (v NullablePerformanceClass) Get() *PerformanceClass { + return v.value +} + +func (v *NullablePerformanceClass) Set(val *PerformanceClass) { + v.value = val + v.isSet = true +} + +func (v NullablePerformanceClass) IsSet() bool { + return v.isSet +} + +func (v *NullablePerformanceClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePerformanceClass(val *PerformanceClass) *NullablePerformanceClass { + return &NullablePerformanceClass{value: val, isSet: true} +} + +func (v NullablePerformanceClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePerformanceClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_performance_class_test.go b/pkg/sfsbeta/model_performance_class_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_performance_class_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_resource_pool.go b/pkg/sfsbeta/model_resource_pool.go new file mode 100644 index 00000000..c387f7a4 --- /dev/null +++ b/pkg/sfsbeta/model_resource_pool.go @@ -0,0 +1,802 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the ResourcePool type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourcePool{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type ResourcePoolGetAvailabilityZoneAttributeType = *string + +func getResourcePoolGetAvailabilityZoneAttributeTypeOk(arg ResourcePoolGetAvailabilityZoneAttributeType) (ret ResourcePoolGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetAvailabilityZoneAttributeType(arg *ResourcePoolGetAvailabilityZoneAttributeType, val ResourcePoolGetAvailabilityZoneRetType) { + *arg = &val +} + +type ResourcePoolGetAvailabilityZoneArgType = string +type ResourcePoolGetAvailabilityZoneRetType = string + +/* + types and functions for countShares +*/ + +// isInteger +type ResourcePoolGetCountSharesAttributeType = *int64 +type ResourcePoolGetCountSharesArgType = int64 +type ResourcePoolGetCountSharesRetType = int64 + +func getResourcePoolGetCountSharesAttributeTypeOk(arg ResourcePoolGetCountSharesAttributeType) (ret ResourcePoolGetCountSharesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetCountSharesAttributeType(arg *ResourcePoolGetCountSharesAttributeType, val ResourcePoolGetCountSharesRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type ResourcePoolGetCreatedAtAttributeType = *time.Time +type ResourcePoolGetCreatedAtArgType = time.Time +type ResourcePoolGetCreatedAtRetType = time.Time + +func getResourcePoolGetCreatedAtAttributeTypeOk(arg ResourcePoolGetCreatedAtAttributeType) (ret ResourcePoolGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetCreatedAtAttributeType(arg *ResourcePoolGetCreatedAtAttributeType, val ResourcePoolGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type ResourcePoolGetIdAttributeType = *string + +func getResourcePoolGetIdAttributeTypeOk(arg ResourcePoolGetIdAttributeType) (ret ResourcePoolGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetIdAttributeType(arg *ResourcePoolGetIdAttributeType, val ResourcePoolGetIdRetType) { + *arg = &val +} + +type ResourcePoolGetIdArgType = string +type ResourcePoolGetIdRetType = string + +/* + types and functions for ipAcl +*/ + +// isArray +type ResourcePoolGetIpAclAttributeType = *[]string +type ResourcePoolGetIpAclArgType = []string +type ResourcePoolGetIpAclRetType = []string + +func getResourcePoolGetIpAclAttributeTypeOk(arg ResourcePoolGetIpAclAttributeType) (ret ResourcePoolGetIpAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetIpAclAttributeType(arg *ResourcePoolGetIpAclAttributeType, val ResourcePoolGetIpAclRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type ResourcePoolGetLabelsAttributeType = *map[string]string +type ResourcePoolGetLabelsArgType = map[string]string +type ResourcePoolGetLabelsRetType = map[string]string + +func getResourcePoolGetLabelsAttributeTypeOk(arg ResourcePoolGetLabelsAttributeType) (ret ResourcePoolGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetLabelsAttributeType(arg *ResourcePoolGetLabelsAttributeType, val ResourcePoolGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mountPath +*/ + +// isNotNullableString +type ResourcePoolGetMountPathAttributeType = *string + +func getResourcePoolGetMountPathAttributeTypeOk(arg ResourcePoolGetMountPathAttributeType) (ret ResourcePoolGetMountPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetMountPathAttributeType(arg *ResourcePoolGetMountPathAttributeType, val ResourcePoolGetMountPathRetType) { + *arg = &val +} + +type ResourcePoolGetMountPathArgType = string +type ResourcePoolGetMountPathRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type ResourcePoolGetNameAttributeType = *string + +func getResourcePoolGetNameAttributeTypeOk(arg ResourcePoolGetNameAttributeType) (ret ResourcePoolGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetNameAttributeType(arg *ResourcePoolGetNameAttributeType, val ResourcePoolGetNameRetType) { + *arg = &val +} + +type ResourcePoolGetNameArgType = string +type ResourcePoolGetNameRetType = string + +/* + types and functions for performanceClass +*/ + +// isModel +type ResourcePoolGetPerformanceClassAttributeType = *ResourcePoolPerformanceClass +type ResourcePoolGetPerformanceClassArgType = ResourcePoolPerformanceClass +type ResourcePoolGetPerformanceClassRetType = ResourcePoolPerformanceClass + +func getResourcePoolGetPerformanceClassAttributeTypeOk(arg ResourcePoolGetPerformanceClassAttributeType) (ret ResourcePoolGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetPerformanceClassAttributeType(arg *ResourcePoolGetPerformanceClassAttributeType, val ResourcePoolGetPerformanceClassRetType) { + *arg = &val +} + +/* + types and functions for performanceClassDowngradableAt +*/ + +// isDateTime +type ResourcePoolGetPerformanceClassDowngradableAtAttributeType = *time.Time +type ResourcePoolGetPerformanceClassDowngradableAtArgType = time.Time +type ResourcePoolGetPerformanceClassDowngradableAtRetType = time.Time + +func getResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(arg ResourcePoolGetPerformanceClassDowngradableAtAttributeType) (ret ResourcePoolGetPerformanceClassDowngradableAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetPerformanceClassDowngradableAtAttributeType(arg *ResourcePoolGetPerformanceClassDowngradableAtAttributeType, val ResourcePoolGetPerformanceClassDowngradableAtRetType) { + *arg = &val +} + +/* + types and functions for sizeReducibleAt +*/ + +// isDateTime +type ResourcePoolGetSizeReducibleAtAttributeType = *time.Time +type ResourcePoolGetSizeReducibleAtArgType = time.Time +type ResourcePoolGetSizeReducibleAtRetType = time.Time + +func getResourcePoolGetSizeReducibleAtAttributeTypeOk(arg ResourcePoolGetSizeReducibleAtAttributeType) (ret ResourcePoolGetSizeReducibleAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetSizeReducibleAtAttributeType(arg *ResourcePoolGetSizeReducibleAtAttributeType, val ResourcePoolGetSizeReducibleAtRetType) { + *arg = &val +} + +/* + types and functions for snapshotSchedule +*/ + +// isModel +type ResourcePoolGetSnapshotScheduleAttributeType = *SnapshotSchedule +type ResourcePoolGetSnapshotScheduleArgType = SnapshotSchedule +type ResourcePoolGetSnapshotScheduleRetType = SnapshotSchedule + +func getResourcePoolGetSnapshotScheduleAttributeTypeOk(arg ResourcePoolGetSnapshotScheduleAttributeType) (ret ResourcePoolGetSnapshotScheduleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetSnapshotScheduleAttributeType(arg *ResourcePoolGetSnapshotScheduleAttributeType, val ResourcePoolGetSnapshotScheduleRetType) { + *arg = &val +} + +/* + types and functions for snapshotsAreVisible +*/ + +// isBoolean +type ResourcePoolgetSnapshotsAreVisibleAttributeType = *bool +type ResourcePoolgetSnapshotsAreVisibleArgType = bool +type ResourcePoolgetSnapshotsAreVisibleRetType = bool + +func getResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(arg ResourcePoolgetSnapshotsAreVisibleAttributeType) (ret ResourcePoolgetSnapshotsAreVisibleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolgetSnapshotsAreVisibleAttributeType(arg *ResourcePoolgetSnapshotsAreVisibleAttributeType, val ResourcePoolgetSnapshotsAreVisibleRetType) { + *arg = &val +} + +/* + types and functions for space +*/ + +// isModel +type ResourcePoolGetSpaceAttributeType = *ResourcePoolSpace +type ResourcePoolGetSpaceArgType = ResourcePoolSpace +type ResourcePoolGetSpaceRetType = ResourcePoolSpace + +func getResourcePoolGetSpaceAttributeTypeOk(arg ResourcePoolGetSpaceAttributeType) (ret ResourcePoolGetSpaceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetSpaceAttributeType(arg *ResourcePoolGetSpaceAttributeType, val ResourcePoolGetSpaceRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isNotNullableString +type ResourcePoolGetStateAttributeType = *string + +func getResourcePoolGetStateAttributeTypeOk(arg ResourcePoolGetStateAttributeType) (ret ResourcePoolGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolGetStateAttributeType(arg *ResourcePoolGetStateAttributeType, val ResourcePoolGetStateRetType) { + *arg = &val +} + +type ResourcePoolGetStateArgType = string +type ResourcePoolGetStateRetType = string + +// ResourcePool struct for ResourcePool +type ResourcePool struct { + // Name of the respective availability zone + AvailabilityZone ResourcePoolGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + // Number of Shares in the Resource Pool + // Can be cast to int32 without loss of precision. + CountShares ResourcePoolGetCountSharesAttributeType `json:"countShares,omitempty"` + CreatedAt ResourcePoolGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // ID of the Resource Pool + Id ResourcePoolGetIdAttributeType `json:"id,omitempty"` + // List of IPs that can mount the Resource Pool in read-only; IPs must have a subnet mask (e.g. \"172.16.0.0/24\" for a range of IPs, or \"172.16.0.250/32\" for a specific IP) + IpAcl ResourcePoolGetIpAclAttributeType `json:"ipAcl,omitempty"` + Labels ResourcePoolGetLabelsAttributeType `json:"labels,omitempty"` + // Mount path of the Resource Pool, used to mount the Resource Pool Note that a Resource Pool can only be mounted in read-only + MountPath ResourcePoolGetMountPathAttributeType `json:"mountPath,omitempty"` + // Name of the Resource Pool + Name ResourcePoolGetNameAttributeType `json:"name,omitempty"` + PerformanceClass ResourcePoolGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Time when the performance class can be downgraded again. + PerformanceClassDowngradableAt ResourcePoolGetPerformanceClassDowngradableAtAttributeType `json:"performanceClassDowngradableAt,omitempty"` + // Time when the size can be reduced again. + SizeReducibleAt ResourcePoolGetSizeReducibleAtAttributeType `json:"sizeReducibleAt,omitempty"` + SnapshotSchedule ResourcePoolGetSnapshotScheduleAttributeType `json:"snapshotSchedule,omitempty"` + // Whether the .snapshot directory is visible when mounting the resource pool. Setting this value to false might prevent you from accessing the snapshots (e.g. for security reasons). Additionally, the access to the snapshots is always controlled by the export policy of the resource pool. That means, if snapshots are visible and the export policy allows for reading the resource pool, then it also allows reading the snapshot of all shares. + SnapshotsAreVisible ResourcePoolgetSnapshotsAreVisibleAttributeType `json:"snapshotsAreVisible,omitempty"` + Space ResourcePoolGetSpaceAttributeType `json:"space,omitempty"` + // State of the Resource Pool (possible values: [\"pending\", \"creating\", \"created\", \"updating\", \"error\", \"deleting\"]) + State ResourcePoolGetStateAttributeType `json:"state,omitempty"` +} + +// NewResourcePool instantiates a new ResourcePool 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 NewResourcePool() *ResourcePool { + this := ResourcePool{} + return &this +} + +// NewResourcePoolWithDefaults instantiates a new ResourcePool 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 NewResourcePoolWithDefaults() *ResourcePool { + this := ResourcePool{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *ResourcePool) GetAvailabilityZone() (res ResourcePoolGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetAvailabilityZoneOk() (ret ResourcePoolGetAvailabilityZoneRetType, ok bool) { + return getResourcePoolGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *ResourcePool) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *ResourcePool) SetAvailabilityZone(v ResourcePoolGetAvailabilityZoneRetType) { + setResourcePoolGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetCountShares returns the CountShares field value if set, zero value otherwise. +func (o *ResourcePool) GetCountShares() (res ResourcePoolGetCountSharesRetType) { + res, _ = o.GetCountSharesOk() + return +} + +// GetCountSharesOk returns a tuple with the CountShares field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetCountSharesOk() (ret ResourcePoolGetCountSharesRetType, ok bool) { + return getResourcePoolGetCountSharesAttributeTypeOk(o.CountShares) +} + +// HasCountShares returns a boolean if a field has been set. +func (o *ResourcePool) HasCountShares() bool { + _, ok := o.GetCountSharesOk() + return ok +} + +// SetCountShares gets a reference to the given int64 and assigns it to the CountShares field. +func (o *ResourcePool) SetCountShares(v ResourcePoolGetCountSharesRetType) { + setResourcePoolGetCountSharesAttributeType(&o.CountShares, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *ResourcePool) GetCreatedAt() (res ResourcePoolGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetCreatedAtOk() (ret ResourcePoolGetCreatedAtRetType, ok bool) { + return getResourcePoolGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *ResourcePool) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *ResourcePool) SetCreatedAt(v ResourcePoolGetCreatedAtRetType) { + setResourcePoolGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ResourcePool) GetId() (res ResourcePoolGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetIdOk() (ret ResourcePoolGetIdRetType, ok bool) { + return getResourcePoolGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *ResourcePool) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ResourcePool) SetId(v ResourcePoolGetIdRetType) { + setResourcePoolGetIdAttributeType(&o.Id, v) +} + +// GetIpAcl returns the IpAcl field value if set, zero value otherwise. +func (o *ResourcePool) GetIpAcl() (res ResourcePoolGetIpAclRetType) { + res, _ = o.GetIpAclOk() + return +} + +// GetIpAclOk returns a tuple with the IpAcl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetIpAclOk() (ret ResourcePoolGetIpAclRetType, ok bool) { + return getResourcePoolGetIpAclAttributeTypeOk(o.IpAcl) +} + +// HasIpAcl returns a boolean if a field has been set. +func (o *ResourcePool) HasIpAcl() bool { + _, ok := o.GetIpAclOk() + return ok +} + +// SetIpAcl gets a reference to the given []string and assigns it to the IpAcl field. +func (o *ResourcePool) SetIpAcl(v ResourcePoolGetIpAclRetType) { + setResourcePoolGetIpAclAttributeType(&o.IpAcl, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *ResourcePool) GetLabels() (res ResourcePoolGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetLabelsOk() (ret ResourcePoolGetLabelsRetType, ok bool) { + return getResourcePoolGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *ResourcePool) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *ResourcePool) SetLabels(v ResourcePoolGetLabelsRetType) { + setResourcePoolGetLabelsAttributeType(&o.Labels, v) +} + +// GetMountPath returns the MountPath field value if set, zero value otherwise. +func (o *ResourcePool) GetMountPath() (res ResourcePoolGetMountPathRetType) { + res, _ = o.GetMountPathOk() + return +} + +// GetMountPathOk returns a tuple with the MountPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetMountPathOk() (ret ResourcePoolGetMountPathRetType, ok bool) { + return getResourcePoolGetMountPathAttributeTypeOk(o.MountPath) +} + +// HasMountPath returns a boolean if a field has been set. +func (o *ResourcePool) HasMountPath() bool { + _, ok := o.GetMountPathOk() + return ok +} + +// SetMountPath gets a reference to the given string and assigns it to the MountPath field. +func (o *ResourcePool) SetMountPath(v ResourcePoolGetMountPathRetType) { + setResourcePoolGetMountPathAttributeType(&o.MountPath, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ResourcePool) GetName() (res ResourcePoolGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetNameOk() (ret ResourcePoolGetNameRetType, ok bool) { + return getResourcePoolGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *ResourcePool) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ResourcePool) SetName(v ResourcePoolGetNameRetType) { + setResourcePoolGetNameAttributeType(&o.Name, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *ResourcePool) GetPerformanceClass() (res ResourcePoolGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetPerformanceClassOk() (ret ResourcePoolGetPerformanceClassRetType, ok bool) { + return getResourcePoolGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *ResourcePool) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given ResourcePoolPerformanceClass and assigns it to the PerformanceClass field. +func (o *ResourcePool) SetPerformanceClass(v ResourcePoolGetPerformanceClassRetType) { + setResourcePoolGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetPerformanceClassDowngradableAt returns the PerformanceClassDowngradableAt field value if set, zero value otherwise. +func (o *ResourcePool) GetPerformanceClassDowngradableAt() (res ResourcePoolGetPerformanceClassDowngradableAtRetType) { + res, _ = o.GetPerformanceClassDowngradableAtOk() + return +} + +// GetPerformanceClassDowngradableAtOk returns a tuple with the PerformanceClassDowngradableAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetPerformanceClassDowngradableAtOk() (ret ResourcePoolGetPerformanceClassDowngradableAtRetType, ok bool) { + return getResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(o.PerformanceClassDowngradableAt) +} + +// HasPerformanceClassDowngradableAt returns a boolean if a field has been set. +func (o *ResourcePool) HasPerformanceClassDowngradableAt() bool { + _, ok := o.GetPerformanceClassDowngradableAtOk() + return ok +} + +// SetPerformanceClassDowngradableAt gets a reference to the given time.Time and assigns it to the PerformanceClassDowngradableAt field. +func (o *ResourcePool) SetPerformanceClassDowngradableAt(v ResourcePoolGetPerformanceClassDowngradableAtRetType) { + setResourcePoolGetPerformanceClassDowngradableAtAttributeType(&o.PerformanceClassDowngradableAt, v) +} + +// GetSizeReducibleAt returns the SizeReducibleAt field value if set, zero value otherwise. +func (o *ResourcePool) GetSizeReducibleAt() (res ResourcePoolGetSizeReducibleAtRetType) { + res, _ = o.GetSizeReducibleAtOk() + return +} + +// GetSizeReducibleAtOk returns a tuple with the SizeReducibleAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetSizeReducibleAtOk() (ret ResourcePoolGetSizeReducibleAtRetType, ok bool) { + return getResourcePoolGetSizeReducibleAtAttributeTypeOk(o.SizeReducibleAt) +} + +// HasSizeReducibleAt returns a boolean if a field has been set. +func (o *ResourcePool) HasSizeReducibleAt() bool { + _, ok := o.GetSizeReducibleAtOk() + return ok +} + +// SetSizeReducibleAt gets a reference to the given time.Time and assigns it to the SizeReducibleAt field. +func (o *ResourcePool) SetSizeReducibleAt(v ResourcePoolGetSizeReducibleAtRetType) { + setResourcePoolGetSizeReducibleAtAttributeType(&o.SizeReducibleAt, v) +} + +// GetSnapshotSchedule returns the SnapshotSchedule field value if set, zero value otherwise. +func (o *ResourcePool) GetSnapshotSchedule() (res ResourcePoolGetSnapshotScheduleRetType) { + res, _ = o.GetSnapshotScheduleOk() + return +} + +// GetSnapshotScheduleOk returns a tuple with the SnapshotSchedule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetSnapshotScheduleOk() (ret ResourcePoolGetSnapshotScheduleRetType, ok bool) { + return getResourcePoolGetSnapshotScheduleAttributeTypeOk(o.SnapshotSchedule) +} + +// HasSnapshotSchedule returns a boolean if a field has been set. +func (o *ResourcePool) HasSnapshotSchedule() bool { + _, ok := o.GetSnapshotScheduleOk() + return ok +} + +// SetSnapshotSchedule gets a reference to the given SnapshotSchedule and assigns it to the SnapshotSchedule field. +func (o *ResourcePool) SetSnapshotSchedule(v ResourcePoolGetSnapshotScheduleRetType) { + setResourcePoolGetSnapshotScheduleAttributeType(&o.SnapshotSchedule, v) +} + +// GetSnapshotsAreVisible returns the SnapshotsAreVisible field value if set, zero value otherwise. +func (o *ResourcePool) GetSnapshotsAreVisible() (res ResourcePoolgetSnapshotsAreVisibleRetType) { + res, _ = o.GetSnapshotsAreVisibleOk() + return +} + +// GetSnapshotsAreVisibleOk returns a tuple with the SnapshotsAreVisible field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetSnapshotsAreVisibleOk() (ret ResourcePoolgetSnapshotsAreVisibleRetType, ok bool) { + return getResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible) +} + +// HasSnapshotsAreVisible returns a boolean if a field has been set. +func (o *ResourcePool) HasSnapshotsAreVisible() bool { + _, ok := o.GetSnapshotsAreVisibleOk() + return ok +} + +// SetSnapshotsAreVisible gets a reference to the given bool and assigns it to the SnapshotsAreVisible field. +func (o *ResourcePool) SetSnapshotsAreVisible(v ResourcePoolgetSnapshotsAreVisibleRetType) { + setResourcePoolgetSnapshotsAreVisibleAttributeType(&o.SnapshotsAreVisible, v) +} + +// GetSpace returns the Space field value if set, zero value otherwise. +func (o *ResourcePool) GetSpace() (res ResourcePoolGetSpaceRetType) { + res, _ = o.GetSpaceOk() + return +} + +// GetSpaceOk returns a tuple with the Space field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetSpaceOk() (ret ResourcePoolGetSpaceRetType, ok bool) { + return getResourcePoolGetSpaceAttributeTypeOk(o.Space) +} + +// HasSpace returns a boolean if a field has been set. +func (o *ResourcePool) HasSpace() bool { + _, ok := o.GetSpaceOk() + return ok +} + +// SetSpace gets a reference to the given ResourcePoolSpace and assigns it to the Space field. +func (o *ResourcePool) SetSpace(v ResourcePoolGetSpaceRetType) { + setResourcePoolGetSpaceAttributeType(&o.Space, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *ResourcePool) GetState() (res ResourcePoolGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePool) GetStateOk() (ret ResourcePoolGetStateRetType, ok bool) { + return getResourcePoolGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *ResourcePool) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *ResourcePool) SetState(v ResourcePoolGetStateRetType) { + setResourcePoolGetStateAttributeType(&o.State, v) +} + +func (o ResourcePool) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getResourcePoolGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getResourcePoolGetCountSharesAttributeTypeOk(o.CountShares); ok { + toSerialize["CountShares"] = val + } + if val, ok := getResourcePoolGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getResourcePoolGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getResourcePoolGetIpAclAttributeTypeOk(o.IpAcl); ok { + toSerialize["IpAcl"] = val + } + if val, ok := getResourcePoolGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getResourcePoolGetMountPathAttributeTypeOk(o.MountPath); ok { + toSerialize["MountPath"] = val + } + if val, ok := getResourcePoolGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getResourcePoolGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(o.PerformanceClassDowngradableAt); ok { + toSerialize["PerformanceClassDowngradableAt"] = val + } + if val, ok := getResourcePoolGetSizeReducibleAtAttributeTypeOk(o.SizeReducibleAt); ok { + toSerialize["SizeReducibleAt"] = val + } + if val, ok := getResourcePoolGetSnapshotScheduleAttributeTypeOk(o.SnapshotSchedule); ok { + toSerialize["SnapshotSchedule"] = val + } + if val, ok := getResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible); ok { + toSerialize["SnapshotsAreVisible"] = val + } + if val, ok := getResourcePoolGetSpaceAttributeTypeOk(o.Space); ok { + toSerialize["Space"] = val + } + if val, ok := getResourcePoolGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableResourcePool struct { + value *ResourcePool + isSet bool +} + +func (v NullableResourcePool) Get() *ResourcePool { + return v.value +} + +func (v *NullableResourcePool) Set(val *ResourcePool) { + v.value = val + v.isSet = true +} + +func (v NullableResourcePool) IsSet() bool { + return v.isSet +} + +func (v *NullableResourcePool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourcePool(val *ResourcePool) *NullableResourcePool { + return &NullableResourcePool{value: val, isSet: true} +} + +func (v NullableResourcePool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourcePool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_resource_pool_performance_class.go b/pkg/sfsbeta/model_resource_pool_performance_class.go new file mode 100644 index 00000000..5851df99 --- /dev/null +++ b/pkg/sfsbeta/model_resource_pool_performance_class.go @@ -0,0 +1,227 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ResourcePoolPerformanceClass type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourcePoolPerformanceClass{} + +/* + types and functions for name +*/ + +// isNotNullableString +type ResourcePoolPerformanceClassGetNameAttributeType = *string + +func getResourcePoolPerformanceClassGetNameAttributeTypeOk(arg ResourcePoolPerformanceClassGetNameAttributeType) (ret ResourcePoolPerformanceClassGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolPerformanceClassGetNameAttributeType(arg *ResourcePoolPerformanceClassGetNameAttributeType, val ResourcePoolPerformanceClassGetNameRetType) { + *arg = &val +} + +type ResourcePoolPerformanceClassGetNameArgType = string +type ResourcePoolPerformanceClassGetNameRetType = string + +/* + types and functions for peakIops +*/ + +// isInteger +type ResourcePoolPerformanceClassGetPeakIopsAttributeType = *int64 +type ResourcePoolPerformanceClassGetPeakIopsArgType = int64 +type ResourcePoolPerformanceClassGetPeakIopsRetType = int64 + +func getResourcePoolPerformanceClassGetPeakIopsAttributeTypeOk(arg ResourcePoolPerformanceClassGetPeakIopsAttributeType) (ret ResourcePoolPerformanceClassGetPeakIopsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolPerformanceClassGetPeakIopsAttributeType(arg *ResourcePoolPerformanceClassGetPeakIopsAttributeType, val ResourcePoolPerformanceClassGetPeakIopsRetType) { + *arg = &val +} + +/* + types and functions for throughput +*/ + +// isInteger +type ResourcePoolPerformanceClassGetThroughputAttributeType = *int64 +type ResourcePoolPerformanceClassGetThroughputArgType = int64 +type ResourcePoolPerformanceClassGetThroughputRetType = int64 + +func getResourcePoolPerformanceClassGetThroughputAttributeTypeOk(arg ResourcePoolPerformanceClassGetThroughputAttributeType) (ret ResourcePoolPerformanceClassGetThroughputRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolPerformanceClassGetThroughputAttributeType(arg *ResourcePoolPerformanceClassGetThroughputAttributeType, val ResourcePoolPerformanceClassGetThroughputRetType) { + *arg = &val +} + +// ResourcePoolPerformanceClass Information about the performance class +type ResourcePoolPerformanceClass struct { + // Name of the performance class + Name ResourcePoolPerformanceClassGetNameAttributeType `json:"name,omitempty"` + // Max. IOPS of the Resource Pool. This is shared between every Share in the Resource Pool. + // Can be cast to int32 without loss of precision. + PeakIops ResourcePoolPerformanceClassGetPeakIopsAttributeType `json:"peakIops,omitempty"` + // Throughput of the Resource Pool. + // Can be cast to int32 without loss of precision. + Throughput ResourcePoolPerformanceClassGetThroughputAttributeType `json:"throughput,omitempty"` +} + +// NewResourcePoolPerformanceClass instantiates a new ResourcePoolPerformanceClass 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 NewResourcePoolPerformanceClass() *ResourcePoolPerformanceClass { + this := ResourcePoolPerformanceClass{} + return &this +} + +// NewResourcePoolPerformanceClassWithDefaults instantiates a new ResourcePoolPerformanceClass 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 NewResourcePoolPerformanceClassWithDefaults() *ResourcePoolPerformanceClass { + this := ResourcePoolPerformanceClass{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ResourcePoolPerformanceClass) GetName() (res ResourcePoolPerformanceClassGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePoolPerformanceClass) GetNameOk() (ret ResourcePoolPerformanceClassGetNameRetType, ok bool) { + return getResourcePoolPerformanceClassGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *ResourcePoolPerformanceClass) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ResourcePoolPerformanceClass) SetName(v ResourcePoolPerformanceClassGetNameRetType) { + setResourcePoolPerformanceClassGetNameAttributeType(&o.Name, v) +} + +// GetPeakIops returns the PeakIops field value if set, zero value otherwise. +func (o *ResourcePoolPerformanceClass) GetPeakIops() (res ResourcePoolPerformanceClassGetPeakIopsRetType) { + res, _ = o.GetPeakIopsOk() + return +} + +// GetPeakIopsOk returns a tuple with the PeakIops field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePoolPerformanceClass) GetPeakIopsOk() (ret ResourcePoolPerformanceClassGetPeakIopsRetType, ok bool) { + return getResourcePoolPerformanceClassGetPeakIopsAttributeTypeOk(o.PeakIops) +} + +// HasPeakIops returns a boolean if a field has been set. +func (o *ResourcePoolPerformanceClass) HasPeakIops() bool { + _, ok := o.GetPeakIopsOk() + return ok +} + +// SetPeakIops gets a reference to the given int64 and assigns it to the PeakIops field. +func (o *ResourcePoolPerformanceClass) SetPeakIops(v ResourcePoolPerformanceClassGetPeakIopsRetType) { + setResourcePoolPerformanceClassGetPeakIopsAttributeType(&o.PeakIops, v) +} + +// GetThroughput returns the Throughput field value if set, zero value otherwise. +func (o *ResourcePoolPerformanceClass) GetThroughput() (res ResourcePoolPerformanceClassGetThroughputRetType) { + res, _ = o.GetThroughputOk() + return +} + +// GetThroughputOk returns a tuple with the Throughput field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePoolPerformanceClass) GetThroughputOk() (ret ResourcePoolPerformanceClassGetThroughputRetType, ok bool) { + return getResourcePoolPerformanceClassGetThroughputAttributeTypeOk(o.Throughput) +} + +// HasThroughput returns a boolean if a field has been set. +func (o *ResourcePoolPerformanceClass) HasThroughput() bool { + _, ok := o.GetThroughputOk() + return ok +} + +// SetThroughput gets a reference to the given int64 and assigns it to the Throughput field. +func (o *ResourcePoolPerformanceClass) SetThroughput(v ResourcePoolPerformanceClassGetThroughputRetType) { + setResourcePoolPerformanceClassGetThroughputAttributeType(&o.Throughput, v) +} + +func (o ResourcePoolPerformanceClass) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getResourcePoolPerformanceClassGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getResourcePoolPerformanceClassGetPeakIopsAttributeTypeOk(o.PeakIops); ok { + toSerialize["PeakIops"] = val + } + if val, ok := getResourcePoolPerformanceClassGetThroughputAttributeTypeOk(o.Throughput); ok { + toSerialize["Throughput"] = val + } + return toSerialize, nil +} + +type NullableResourcePoolPerformanceClass struct { + value *ResourcePoolPerformanceClass + isSet bool +} + +func (v NullableResourcePoolPerformanceClass) Get() *ResourcePoolPerformanceClass { + return v.value +} + +func (v *NullableResourcePoolPerformanceClass) Set(val *ResourcePoolPerformanceClass) { + v.value = val + v.isSet = true +} + +func (v NullableResourcePoolPerformanceClass) IsSet() bool { + return v.isSet +} + +func (v *NullableResourcePoolPerformanceClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourcePoolPerformanceClass(val *ResourcePoolPerformanceClass) *NullableResourcePoolPerformanceClass { + return &NullableResourcePoolPerformanceClass{value: val, isSet: true} +} + +func (v NullableResourcePoolPerformanceClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourcePoolPerformanceClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_resource_pool_performance_class_test.go b/pkg/sfsbeta/model_resource_pool_performance_class_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_resource_pool_performance_class_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_resource_pool_snapshot.go b/pkg/sfsbeta/model_resource_pool_snapshot.go new file mode 100644 index 00000000..a46d8ddf --- /dev/null +++ b/pkg/sfsbeta/model_resource_pool_snapshot.go @@ -0,0 +1,388 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the ResourcePoolSnapshot type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourcePoolSnapshot{} + +/* + types and functions for comment +*/ + +// isNullableString +type ResourcePoolSnapshotGetCommentAttributeType = *NullableString + +func getResourcePoolSnapshotGetCommentAttributeTypeOk(arg ResourcePoolSnapshotGetCommentAttributeType) (ret ResourcePoolSnapshotGetCommentRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setResourcePoolSnapshotGetCommentAttributeType(arg *ResourcePoolSnapshotGetCommentAttributeType, val ResourcePoolSnapshotGetCommentRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ResourcePoolSnapshotGetCommentArgType = *string +type ResourcePoolSnapshotGetCommentRetType = *string + +/* + types and functions for createdAt +*/ + +// isDateTime +type ResourcePoolSnapshotGetCreatedAtAttributeType = *time.Time +type ResourcePoolSnapshotGetCreatedAtArgType = time.Time +type ResourcePoolSnapshotGetCreatedAtRetType = time.Time + +func getResourcePoolSnapshotGetCreatedAtAttributeTypeOk(arg ResourcePoolSnapshotGetCreatedAtAttributeType) (ret ResourcePoolSnapshotGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolSnapshotGetCreatedAtAttributeType(arg *ResourcePoolSnapshotGetCreatedAtAttributeType, val ResourcePoolSnapshotGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for logicalSizeGigabytes +*/ + +// isInteger +type ResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType = *int64 +type ResourcePoolSnapshotGetLogicalSizeGigabytesArgType = int64 +type ResourcePoolSnapshotGetLogicalSizeGigabytesRetType = int64 + +func getResourcePoolSnapshotGetLogicalSizeGigabytesAttributeTypeOk(arg ResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType) (ret ResourcePoolSnapshotGetLogicalSizeGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType(arg *ResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType, val ResourcePoolSnapshotGetLogicalSizeGigabytesRetType) { + *arg = &val +} + +/* + types and functions for resourcePoolId +*/ + +// isNotNullableString +type ResourcePoolSnapshotGetResourcePoolIdAttributeType = *string + +func getResourcePoolSnapshotGetResourcePoolIdAttributeTypeOk(arg ResourcePoolSnapshotGetResourcePoolIdAttributeType) (ret ResourcePoolSnapshotGetResourcePoolIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolSnapshotGetResourcePoolIdAttributeType(arg *ResourcePoolSnapshotGetResourcePoolIdAttributeType, val ResourcePoolSnapshotGetResourcePoolIdRetType) { + *arg = &val +} + +type ResourcePoolSnapshotGetResourcePoolIdArgType = string +type ResourcePoolSnapshotGetResourcePoolIdRetType = string + +/* + types and functions for sizeGigabytes +*/ + +// isInteger +type ResourcePoolSnapshotGetSizeGigabytesAttributeType = *int64 +type ResourcePoolSnapshotGetSizeGigabytesArgType = int64 +type ResourcePoolSnapshotGetSizeGigabytesRetType = int64 + +func getResourcePoolSnapshotGetSizeGigabytesAttributeTypeOk(arg ResourcePoolSnapshotGetSizeGigabytesAttributeType) (ret ResourcePoolSnapshotGetSizeGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolSnapshotGetSizeGigabytesAttributeType(arg *ResourcePoolSnapshotGetSizeGigabytesAttributeType, val ResourcePoolSnapshotGetSizeGigabytesRetType) { + *arg = &val +} + +/* + types and functions for snapshotName +*/ + +// isNotNullableString +type ResourcePoolSnapshotGetSnapshotNameAttributeType = *string + +func getResourcePoolSnapshotGetSnapshotNameAttributeTypeOk(arg ResourcePoolSnapshotGetSnapshotNameAttributeType) (ret ResourcePoolSnapshotGetSnapshotNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolSnapshotGetSnapshotNameAttributeType(arg *ResourcePoolSnapshotGetSnapshotNameAttributeType, val ResourcePoolSnapshotGetSnapshotNameRetType) { + *arg = &val +} + +type ResourcePoolSnapshotGetSnapshotNameArgType = string +type ResourcePoolSnapshotGetSnapshotNameRetType = string + +// ResourcePoolSnapshot struct for ResourcePoolSnapshot +type ResourcePoolSnapshot struct { + // (optional) A comment to add more information about a snapshot + Comment ResourcePoolSnapshotGetCommentAttributeType `json:"comment,omitempty"` + CreatedAt ResourcePoolSnapshotGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Represents the user-visible data size at the time of the snapshot in Gibibytes (e.g. what’s in the snapshot) + // Can be cast to int32 without loss of precision. + LogicalSizeGigabytes ResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType `json:"logicalSizeGigabytes,omitempty"` + // ID of the Resource Pool of the Snapshot + ResourcePoolId ResourcePoolSnapshotGetResourcePoolIdAttributeType `json:"resourcePoolId,omitempty"` + // Reflects the actual storage footprint in the backend at snapshot time in Gibibytes (e.g. how much storage from the Resource Pool does it use). + // Can be cast to int32 without loss of precision. + SizeGigabytes ResourcePoolSnapshotGetSizeGigabytesAttributeType `json:"sizeGigabytes,omitempty"` + // Name of the Resource Pool Snapshot + SnapshotName ResourcePoolSnapshotGetSnapshotNameAttributeType `json:"snapshotName,omitempty"` +} + +// NewResourcePoolSnapshot instantiates a new ResourcePoolSnapshot 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 NewResourcePoolSnapshot() *ResourcePoolSnapshot { + this := ResourcePoolSnapshot{} + return &this +} + +// NewResourcePoolSnapshotWithDefaults instantiates a new ResourcePoolSnapshot 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 NewResourcePoolSnapshotWithDefaults() *ResourcePoolSnapshot { + this := ResourcePoolSnapshot{} + return &this +} + +// GetComment returns the Comment field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ResourcePoolSnapshot) GetComment() (res ResourcePoolSnapshotGetCommentRetType) { + res, _ = o.GetCommentOk() + return +} + +// GetCommentOk returns a tuple with the Comment field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourcePoolSnapshot) GetCommentOk() (ret ResourcePoolSnapshotGetCommentRetType, ok bool) { + return getResourcePoolSnapshotGetCommentAttributeTypeOk(o.Comment) +} + +// HasComment returns a boolean if a field has been set. +func (o *ResourcePoolSnapshot) HasComment() bool { + _, ok := o.GetCommentOk() + return ok +} + +// SetComment gets a reference to the given string and assigns it to the Comment field. +func (o *ResourcePoolSnapshot) SetComment(v ResourcePoolSnapshotGetCommentRetType) { + setResourcePoolSnapshotGetCommentAttributeType(&o.Comment, v) +} + +// SetCommentNil sets the value for Comment to be an explicit nil +func (o *ResourcePoolSnapshot) SetCommentNil() { + o.Comment = nil +} + +// UnsetComment ensures that no value is present for Comment, not even an explicit nil +func (o *ResourcePoolSnapshot) UnsetComment() { + o.Comment = nil +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *ResourcePoolSnapshot) GetCreatedAt() (res ResourcePoolSnapshotGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePoolSnapshot) GetCreatedAtOk() (ret ResourcePoolSnapshotGetCreatedAtRetType, ok bool) { + return getResourcePoolSnapshotGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *ResourcePoolSnapshot) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *ResourcePoolSnapshot) SetCreatedAt(v ResourcePoolSnapshotGetCreatedAtRetType) { + setResourcePoolSnapshotGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetLogicalSizeGigabytes returns the LogicalSizeGigabytes field value if set, zero value otherwise. +func (o *ResourcePoolSnapshot) GetLogicalSizeGigabytes() (res ResourcePoolSnapshotGetLogicalSizeGigabytesRetType) { + res, _ = o.GetLogicalSizeGigabytesOk() + return +} + +// GetLogicalSizeGigabytesOk returns a tuple with the LogicalSizeGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePoolSnapshot) GetLogicalSizeGigabytesOk() (ret ResourcePoolSnapshotGetLogicalSizeGigabytesRetType, ok bool) { + return getResourcePoolSnapshotGetLogicalSizeGigabytesAttributeTypeOk(o.LogicalSizeGigabytes) +} + +// HasLogicalSizeGigabytes returns a boolean if a field has been set. +func (o *ResourcePoolSnapshot) HasLogicalSizeGigabytes() bool { + _, ok := o.GetLogicalSizeGigabytesOk() + return ok +} + +// SetLogicalSizeGigabytes gets a reference to the given int64 and assigns it to the LogicalSizeGigabytes field. +func (o *ResourcePoolSnapshot) SetLogicalSizeGigabytes(v ResourcePoolSnapshotGetLogicalSizeGigabytesRetType) { + setResourcePoolSnapshotGetLogicalSizeGigabytesAttributeType(&o.LogicalSizeGigabytes, v) +} + +// GetResourcePoolId returns the ResourcePoolId field value if set, zero value otherwise. +func (o *ResourcePoolSnapshot) GetResourcePoolId() (res ResourcePoolSnapshotGetResourcePoolIdRetType) { + res, _ = o.GetResourcePoolIdOk() + return +} + +// GetResourcePoolIdOk returns a tuple with the ResourcePoolId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePoolSnapshot) GetResourcePoolIdOk() (ret ResourcePoolSnapshotGetResourcePoolIdRetType, ok bool) { + return getResourcePoolSnapshotGetResourcePoolIdAttributeTypeOk(o.ResourcePoolId) +} + +// HasResourcePoolId returns a boolean if a field has been set. +func (o *ResourcePoolSnapshot) HasResourcePoolId() bool { + _, ok := o.GetResourcePoolIdOk() + return ok +} + +// SetResourcePoolId gets a reference to the given string and assigns it to the ResourcePoolId field. +func (o *ResourcePoolSnapshot) SetResourcePoolId(v ResourcePoolSnapshotGetResourcePoolIdRetType) { + setResourcePoolSnapshotGetResourcePoolIdAttributeType(&o.ResourcePoolId, v) +} + +// GetSizeGigabytes returns the SizeGigabytes field value if set, zero value otherwise. +func (o *ResourcePoolSnapshot) GetSizeGigabytes() (res ResourcePoolSnapshotGetSizeGigabytesRetType) { + res, _ = o.GetSizeGigabytesOk() + return +} + +// GetSizeGigabytesOk returns a tuple with the SizeGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePoolSnapshot) GetSizeGigabytesOk() (ret ResourcePoolSnapshotGetSizeGigabytesRetType, ok bool) { + return getResourcePoolSnapshotGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes) +} + +// HasSizeGigabytes returns a boolean if a field has been set. +func (o *ResourcePoolSnapshot) HasSizeGigabytes() bool { + _, ok := o.GetSizeGigabytesOk() + return ok +} + +// SetSizeGigabytes gets a reference to the given int64 and assigns it to the SizeGigabytes field. +func (o *ResourcePoolSnapshot) SetSizeGigabytes(v ResourcePoolSnapshotGetSizeGigabytesRetType) { + setResourcePoolSnapshotGetSizeGigabytesAttributeType(&o.SizeGigabytes, v) +} + +// GetSnapshotName returns the SnapshotName field value if set, zero value otherwise. +func (o *ResourcePoolSnapshot) GetSnapshotName() (res ResourcePoolSnapshotGetSnapshotNameRetType) { + res, _ = o.GetSnapshotNameOk() + return +} + +// GetSnapshotNameOk returns a tuple with the SnapshotName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePoolSnapshot) GetSnapshotNameOk() (ret ResourcePoolSnapshotGetSnapshotNameRetType, ok bool) { + return getResourcePoolSnapshotGetSnapshotNameAttributeTypeOk(o.SnapshotName) +} + +// HasSnapshotName returns a boolean if a field has been set. +func (o *ResourcePoolSnapshot) HasSnapshotName() bool { + _, ok := o.GetSnapshotNameOk() + return ok +} + +// SetSnapshotName gets a reference to the given string and assigns it to the SnapshotName field. +func (o *ResourcePoolSnapshot) SetSnapshotName(v ResourcePoolSnapshotGetSnapshotNameRetType) { + setResourcePoolSnapshotGetSnapshotNameAttributeType(&o.SnapshotName, v) +} + +func (o ResourcePoolSnapshot) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getResourcePoolSnapshotGetCommentAttributeTypeOk(o.Comment); ok { + toSerialize["Comment"] = val + } + if val, ok := getResourcePoolSnapshotGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getResourcePoolSnapshotGetLogicalSizeGigabytesAttributeTypeOk(o.LogicalSizeGigabytes); ok { + toSerialize["LogicalSizeGigabytes"] = val + } + if val, ok := getResourcePoolSnapshotGetResourcePoolIdAttributeTypeOk(o.ResourcePoolId); ok { + toSerialize["ResourcePoolId"] = val + } + if val, ok := getResourcePoolSnapshotGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes); ok { + toSerialize["SizeGigabytes"] = val + } + if val, ok := getResourcePoolSnapshotGetSnapshotNameAttributeTypeOk(o.SnapshotName); ok { + toSerialize["SnapshotName"] = val + } + return toSerialize, nil +} + +type NullableResourcePoolSnapshot struct { + value *ResourcePoolSnapshot + isSet bool +} + +func (v NullableResourcePoolSnapshot) Get() *ResourcePoolSnapshot { + return v.value +} + +func (v *NullableResourcePoolSnapshot) Set(val *ResourcePoolSnapshot) { + v.value = val + v.isSet = true +} + +func (v NullableResourcePoolSnapshot) IsSet() bool { + return v.isSet +} + +func (v *NullableResourcePoolSnapshot) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourcePoolSnapshot(val *ResourcePoolSnapshot) *NullableResourcePoolSnapshot { + return &NullableResourcePoolSnapshot{value: val, isSet: true} +} + +func (v NullableResourcePoolSnapshot) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourcePoolSnapshot) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_resource_pool_snapshot_test.go b/pkg/sfsbeta/model_resource_pool_snapshot_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_resource_pool_snapshot_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_resource_pool_space.go b/pkg/sfsbeta/model_resource_pool_space.go new file mode 100644 index 00000000..c77a4ab8 --- /dev/null +++ b/pkg/sfsbeta/model_resource_pool_space.go @@ -0,0 +1,247 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ResourcePoolSpace type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourcePoolSpace{} + +/* + types and functions for availableGigabytes +*/ + +// isDouble +type ResourcePoolSpaceGetAvailableGigabytesAttributeType = *float64 +type ResourcePoolSpaceGetAvailableGigabytesArgType = *float64 +type ResourcePoolSpaceGetAvailableGigabytesRetType = *float64 + +func getResourcePoolSpaceGetAvailableGigabytesAttributeTypeOk(arg ResourcePoolSpaceGetAvailableGigabytesAttributeType) (ret ResourcePoolSpaceGetAvailableGigabytesRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setResourcePoolSpaceGetAvailableGigabytesAttributeType(arg *ResourcePoolSpaceGetAvailableGigabytesAttributeType, val ResourcePoolSpaceGetAvailableGigabytesRetType) { + *arg = val +} + +/* + types and functions for sizeGigabytes +*/ + +// isInteger +type ResourcePoolSpaceGetSizeGigabytesAttributeType = *int64 +type ResourcePoolSpaceGetSizeGigabytesArgType = int64 +type ResourcePoolSpaceGetSizeGigabytesRetType = int64 + +func getResourcePoolSpaceGetSizeGigabytesAttributeTypeOk(arg ResourcePoolSpaceGetSizeGigabytesAttributeType) (ret ResourcePoolSpaceGetSizeGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResourcePoolSpaceGetSizeGigabytesAttributeType(arg *ResourcePoolSpaceGetSizeGigabytesAttributeType, val ResourcePoolSpaceGetSizeGigabytesRetType) { + *arg = &val +} + +/* + types and functions for usedGigabytes +*/ + +// isDouble +type ResourcePoolSpaceGetUsedGigabytesAttributeType = *float64 +type ResourcePoolSpaceGetUsedGigabytesArgType = *float64 +type ResourcePoolSpaceGetUsedGigabytesRetType = *float64 + +func getResourcePoolSpaceGetUsedGigabytesAttributeTypeOk(arg ResourcePoolSpaceGetUsedGigabytesAttributeType) (ret ResourcePoolSpaceGetUsedGigabytesRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setResourcePoolSpaceGetUsedGigabytesAttributeType(arg *ResourcePoolSpaceGetUsedGigabytesAttributeType, val ResourcePoolSpaceGetUsedGigabytesRetType) { + *arg = val +} + +// ResourcePoolSpace Space information +type ResourcePoolSpace struct { + // Available space of the Resource Pool (only available when retrieving a single Resource Pool by ID) + AvailableGigabytes ResourcePoolSpaceGetAvailableGigabytesAttributeType `json:"availableGigabytes,omitempty"` + // Size of the Resource Pool in Gibibytes. + // Can be cast to int32 without loss of precision. + SizeGigabytes ResourcePoolSpaceGetSizeGigabytesAttributeType `json:"sizeGigabytes,omitempty"` + // Used space of the Resource Pool (only available when retrieving a single Resource Pool by ID) + UsedGigabytes ResourcePoolSpaceGetUsedGigabytesAttributeType `json:"usedGigabytes,omitempty"` +} + +// NewResourcePoolSpace instantiates a new ResourcePoolSpace 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 NewResourcePoolSpace() *ResourcePoolSpace { + this := ResourcePoolSpace{} + return &this +} + +// NewResourcePoolSpaceWithDefaults instantiates a new ResourcePoolSpace 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 NewResourcePoolSpaceWithDefaults() *ResourcePoolSpace { + this := ResourcePoolSpace{} + return &this +} + +// GetAvailableGigabytes returns the AvailableGigabytes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ResourcePoolSpace) GetAvailableGigabytes() (res ResourcePoolSpaceGetAvailableGigabytesRetType) { + res, _ = o.GetAvailableGigabytesOk() + return +} + +// GetAvailableGigabytesOk returns a tuple with the AvailableGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourcePoolSpace) GetAvailableGigabytesOk() (ret ResourcePoolSpaceGetAvailableGigabytesRetType, ok bool) { + return getResourcePoolSpaceGetAvailableGigabytesAttributeTypeOk(o.AvailableGigabytes) +} + +// HasAvailableGigabytes returns a boolean if a field has been set. +func (o *ResourcePoolSpace) HasAvailableGigabytes() bool { + _, ok := o.GetAvailableGigabytesOk() + return ok +} + +// SetAvailableGigabytes gets a reference to the given float64 and assigns it to the AvailableGigabytes field. +func (o *ResourcePoolSpace) SetAvailableGigabytes(v ResourcePoolSpaceGetAvailableGigabytesRetType) { + setResourcePoolSpaceGetAvailableGigabytesAttributeType(&o.AvailableGigabytes, v) +} + +// SetAvailableGigabytesNil sets the value for AvailableGigabytes to be an explicit nil +func (o *ResourcePoolSpace) SetAvailableGigabytesNil() { + o.AvailableGigabytes = nil +} + +// UnsetAvailableGigabytes ensures that no value is present for AvailableGigabytes, not even an explicit nil +func (o *ResourcePoolSpace) UnsetAvailableGigabytes() { + o.AvailableGigabytes = nil +} + +// GetSizeGigabytes returns the SizeGigabytes field value if set, zero value otherwise. +func (o *ResourcePoolSpace) GetSizeGigabytes() (res ResourcePoolSpaceGetSizeGigabytesRetType) { + res, _ = o.GetSizeGigabytesOk() + return +} + +// GetSizeGigabytesOk returns a tuple with the SizeGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ResourcePoolSpace) GetSizeGigabytesOk() (ret ResourcePoolSpaceGetSizeGigabytesRetType, ok bool) { + return getResourcePoolSpaceGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes) +} + +// HasSizeGigabytes returns a boolean if a field has been set. +func (o *ResourcePoolSpace) HasSizeGigabytes() bool { + _, ok := o.GetSizeGigabytesOk() + return ok +} + +// SetSizeGigabytes gets a reference to the given int64 and assigns it to the SizeGigabytes field. +func (o *ResourcePoolSpace) SetSizeGigabytes(v ResourcePoolSpaceGetSizeGigabytesRetType) { + setResourcePoolSpaceGetSizeGigabytesAttributeType(&o.SizeGigabytes, v) +} + +// GetUsedGigabytes returns the UsedGigabytes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ResourcePoolSpace) GetUsedGigabytes() (res ResourcePoolSpaceGetUsedGigabytesRetType) { + res, _ = o.GetUsedGigabytesOk() + return +} + +// GetUsedGigabytesOk returns a tuple with the UsedGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ResourcePoolSpace) GetUsedGigabytesOk() (ret ResourcePoolSpaceGetUsedGigabytesRetType, ok bool) { + return getResourcePoolSpaceGetUsedGigabytesAttributeTypeOk(o.UsedGigabytes) +} + +// HasUsedGigabytes returns a boolean if a field has been set. +func (o *ResourcePoolSpace) HasUsedGigabytes() bool { + _, ok := o.GetUsedGigabytesOk() + return ok +} + +// SetUsedGigabytes gets a reference to the given float64 and assigns it to the UsedGigabytes field. +func (o *ResourcePoolSpace) SetUsedGigabytes(v ResourcePoolSpaceGetUsedGigabytesRetType) { + setResourcePoolSpaceGetUsedGigabytesAttributeType(&o.UsedGigabytes, v) +} + +// SetUsedGigabytesNil sets the value for UsedGigabytes to be an explicit nil +func (o *ResourcePoolSpace) SetUsedGigabytesNil() { + o.UsedGigabytes = nil +} + +// UnsetUsedGigabytes ensures that no value is present for UsedGigabytes, not even an explicit nil +func (o *ResourcePoolSpace) UnsetUsedGigabytes() { + o.UsedGigabytes = nil +} + +func (o ResourcePoolSpace) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getResourcePoolSpaceGetAvailableGigabytesAttributeTypeOk(o.AvailableGigabytes); ok { + toSerialize["AvailableGigabytes"] = val + } + if val, ok := getResourcePoolSpaceGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes); ok { + toSerialize["SizeGigabytes"] = val + } + if val, ok := getResourcePoolSpaceGetUsedGigabytesAttributeTypeOk(o.UsedGigabytes); ok { + toSerialize["UsedGigabytes"] = val + } + return toSerialize, nil +} + +type NullableResourcePoolSpace struct { + value *ResourcePoolSpace + isSet bool +} + +func (v NullableResourcePoolSpace) Get() *ResourcePoolSpace { + return v.value +} + +func (v *NullableResourcePoolSpace) Set(val *ResourcePoolSpace) { + v.value = val + v.isSet = true +} + +func (v NullableResourcePoolSpace) IsSet() bool { + return v.isSet +} + +func (v *NullableResourcePoolSpace) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourcePoolSpace(val *ResourcePoolSpace) *NullableResourcePoolSpace { + return &NullableResourcePoolSpace{value: val, isSet: true} +} + +func (v NullableResourcePoolSpace) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourcePoolSpace) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_resource_pool_space_test.go b/pkg/sfsbeta/model_resource_pool_space_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_resource_pool_space_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_resource_pool_test.go b/pkg/sfsbeta/model_resource_pool_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_resource_pool_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_share.go b/pkg/sfsbeta/model_share.go new file mode 100644 index 00000000..98329fe9 --- /dev/null +++ b/pkg/sfsbeta/model_share.go @@ -0,0 +1,479 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the Share type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Share{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type ShareGetCreatedAtAttributeType = *time.Time +type ShareGetCreatedAtArgType = time.Time +type ShareGetCreatedAtRetType = time.Time + +func getShareGetCreatedAtAttributeTypeOk(arg ShareGetCreatedAtAttributeType) (ret ShareGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareGetCreatedAtAttributeType(arg *ShareGetCreatedAtAttributeType, val ShareGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for exportPolicy +*/ + +// isModel +type ShareGetExportPolicyAttributeType = *NullableShareExportPolicy +type ShareGetExportPolicyArgType = *NullableShareExportPolicy +type ShareGetExportPolicyRetType = *NullableShareExportPolicy + +func getShareGetExportPolicyAttributeTypeOk(arg ShareGetExportPolicyAttributeType) (ret ShareGetExportPolicyRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setShareGetExportPolicyAttributeType(arg *ShareGetExportPolicyAttributeType, val ShareGetExportPolicyRetType) { + *arg = val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type ShareGetIdAttributeType = *string + +func getShareGetIdAttributeTypeOk(arg ShareGetIdAttributeType) (ret ShareGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareGetIdAttributeType(arg *ShareGetIdAttributeType, val ShareGetIdRetType) { + *arg = &val +} + +type ShareGetIdArgType = string +type ShareGetIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type ShareGetLabelsAttributeType = *map[string]string +type ShareGetLabelsArgType = map[string]string +type ShareGetLabelsRetType = map[string]string + +func getShareGetLabelsAttributeTypeOk(arg ShareGetLabelsAttributeType) (ret ShareGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareGetLabelsAttributeType(arg *ShareGetLabelsAttributeType, val ShareGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mountPath +*/ + +// isNotNullableString +type ShareGetMountPathAttributeType = *string + +func getShareGetMountPathAttributeTypeOk(arg ShareGetMountPathAttributeType) (ret ShareGetMountPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareGetMountPathAttributeType(arg *ShareGetMountPathAttributeType, val ShareGetMountPathRetType) { + *arg = &val +} + +type ShareGetMountPathArgType = string +type ShareGetMountPathRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type ShareGetNameAttributeType = *string + +func getShareGetNameAttributeTypeOk(arg ShareGetNameAttributeType) (ret ShareGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareGetNameAttributeType(arg *ShareGetNameAttributeType, val ShareGetNameRetType) { + *arg = &val +} + +type ShareGetNameArgType = string +type ShareGetNameRetType = string + +/* + types and functions for spaceHardLimitGigabytes +*/ + +// isInteger +type ShareGetSpaceHardLimitGigabytesAttributeType = *int64 +type ShareGetSpaceHardLimitGigabytesArgType = int64 +type ShareGetSpaceHardLimitGigabytesRetType = int64 + +func getShareGetSpaceHardLimitGigabytesAttributeTypeOk(arg ShareGetSpaceHardLimitGigabytesAttributeType) (ret ShareGetSpaceHardLimitGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareGetSpaceHardLimitGigabytesAttributeType(arg *ShareGetSpaceHardLimitGigabytesAttributeType, val ShareGetSpaceHardLimitGigabytesRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isNotNullableString +type ShareGetStateAttributeType = *string + +func getShareGetStateAttributeTypeOk(arg ShareGetStateAttributeType) (ret ShareGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareGetStateAttributeType(arg *ShareGetStateAttributeType, val ShareGetStateRetType) { + *arg = &val +} + +type ShareGetStateArgType = string +type ShareGetStateRetType = string + +// Share struct for Share +type Share struct { + CreatedAt ShareGetCreatedAtAttributeType `json:"createdAt,omitempty"` + ExportPolicy ShareGetExportPolicyAttributeType `json:"exportPolicy,omitempty"` + // ID of the Share + Id ShareGetIdAttributeType `json:"id,omitempty"` + // An optional object that represents the labels associated with the share keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels ShareGetLabelsAttributeType `json:"labels,omitempty"` + // Mount path of the Share, used to mount the Share + MountPath ShareGetMountPathAttributeType `json:"mountPath,omitempty"` + // Name of the Share + Name ShareGetNameAttributeType `json:"name,omitempty"` + // Space hard limit for the Share. If zero, the Share will have access to the full space of the Resource Pool it lives in. (unit: gibibytes) + // Can be cast to int32 without loss of precision. + SpaceHardLimitGigabytes ShareGetSpaceHardLimitGigabytesAttributeType `json:"spaceHardLimitGigabytes,omitempty"` + // State of the Resource Pool Snapshot (possible values: [\"pending\", \"creating\", \"created\", \"error\", \"deleting\"]) + State ShareGetStateAttributeType `json:"state,omitempty"` +} + +// NewShare instantiates a new Share 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 NewShare() *Share { + this := Share{} + return &this +} + +// NewShareWithDefaults instantiates a new Share 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 NewShareWithDefaults() *Share { + this := Share{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Share) GetCreatedAt() (res ShareGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetCreatedAtOk() (ret ShareGetCreatedAtRetType, ok bool) { + return getShareGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Share) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Share) SetCreatedAt(v ShareGetCreatedAtRetType) { + setShareGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetExportPolicy returns the ExportPolicy field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Share) GetExportPolicy() (res ShareGetExportPolicyRetType) { + res, _ = o.GetExportPolicyOk() + return +} + +// GetExportPolicyOk returns a tuple with the ExportPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Share) GetExportPolicyOk() (ret ShareGetExportPolicyRetType, ok bool) { + return getShareGetExportPolicyAttributeTypeOk(o.ExportPolicy) +} + +// HasExportPolicy returns a boolean if a field has been set. +func (o *Share) HasExportPolicy() bool { + _, ok := o.GetExportPolicyOk() + return ok +} + +// SetExportPolicy gets a reference to the given ShareExportPolicy and assigns it to the ExportPolicy field. +func (o *Share) SetExportPolicy(v ShareGetExportPolicyRetType) { + setShareGetExportPolicyAttributeType(&o.ExportPolicy, v) +} + +// SetExportPolicyNil sets the value for ExportPolicy to be an explicit nil +func (o *Share) SetExportPolicyNil() { + o.ExportPolicy = nil +} + +// UnsetExportPolicy ensures that no value is present for ExportPolicy, not even an explicit nil +func (o *Share) UnsetExportPolicy() { + o.ExportPolicy = nil +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Share) GetId() (res ShareGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetIdOk() (ret ShareGetIdRetType, ok bool) { + return getShareGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Share) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Share) SetId(v ShareGetIdRetType) { + setShareGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Share) GetLabels() (res ShareGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetLabelsOk() (ret ShareGetLabelsRetType, ok bool) { + return getShareGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Share) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *Share) SetLabels(v ShareGetLabelsRetType) { + setShareGetLabelsAttributeType(&o.Labels, v) +} + +// GetMountPath returns the MountPath field value if set, zero value otherwise. +func (o *Share) GetMountPath() (res ShareGetMountPathRetType) { + res, _ = o.GetMountPathOk() + return +} + +// GetMountPathOk returns a tuple with the MountPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetMountPathOk() (ret ShareGetMountPathRetType, ok bool) { + return getShareGetMountPathAttributeTypeOk(o.MountPath) +} + +// HasMountPath returns a boolean if a field has been set. +func (o *Share) HasMountPath() bool { + _, ok := o.GetMountPathOk() + return ok +} + +// SetMountPath gets a reference to the given string and assigns it to the MountPath field. +func (o *Share) SetMountPath(v ShareGetMountPathRetType) { + setShareGetMountPathAttributeType(&o.MountPath, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Share) GetName() (res ShareGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetNameOk() (ret ShareGetNameRetType, ok bool) { + return getShareGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Share) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Share) SetName(v ShareGetNameRetType) { + setShareGetNameAttributeType(&o.Name, v) +} + +// GetSpaceHardLimitGigabytes returns the SpaceHardLimitGigabytes field value if set, zero value otherwise. +func (o *Share) GetSpaceHardLimitGigabytes() (res ShareGetSpaceHardLimitGigabytesRetType) { + res, _ = o.GetSpaceHardLimitGigabytesOk() + return +} + +// GetSpaceHardLimitGigabytesOk returns a tuple with the SpaceHardLimitGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetSpaceHardLimitGigabytesOk() (ret ShareGetSpaceHardLimitGigabytesRetType, ok bool) { + return getShareGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes) +} + +// HasSpaceHardLimitGigabytes returns a boolean if a field has been set. +func (o *Share) HasSpaceHardLimitGigabytes() bool { + _, ok := o.GetSpaceHardLimitGigabytesOk() + return ok +} + +// SetSpaceHardLimitGigabytes gets a reference to the given int64 and assigns it to the SpaceHardLimitGigabytes field. +func (o *Share) SetSpaceHardLimitGigabytes(v ShareGetSpaceHardLimitGigabytesRetType) { + setShareGetSpaceHardLimitGigabytesAttributeType(&o.SpaceHardLimitGigabytes, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Share) GetState() (res ShareGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Share) GetStateOk() (ret ShareGetStateRetType, ok bool) { + return getShareGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *Share) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *Share) SetState(v ShareGetStateRetType) { + setShareGetStateAttributeType(&o.State, v) +} + +func (o Share) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getShareGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getShareGetExportPolicyAttributeTypeOk(o.ExportPolicy); ok { + toSerialize["ExportPolicy"] = val + } + if val, ok := getShareGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getShareGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getShareGetMountPathAttributeTypeOk(o.MountPath); ok { + toSerialize["MountPath"] = val + } + if val, ok := getShareGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getShareGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes); ok { + toSerialize["SpaceHardLimitGigabytes"] = val + } + if val, ok := getShareGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableShare struct { + value *Share + isSet bool +} + +func (v NullableShare) Get() *Share { + return v.value +} + +func (v *NullableShare) Set(val *Share) { + v.value = val + v.isSet = true +} + +func (v NullableShare) IsSet() bool { + return v.isSet +} + +func (v *NullableShare) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShare(val *Share) *NullableShare { + return &NullableShare{value: val, isSet: true} +} + +func (v NullableShare) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShare) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_share_export_policy.go b/pkg/sfsbeta/model_share_export_policy.go new file mode 100644 index 00000000..8bbe2030 --- /dev/null +++ b/pkg/sfsbeta/model_share_export_policy.go @@ -0,0 +1,371 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the ShareExportPolicy type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ShareExportPolicy{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type ShareExportPolicyGetCreatedAtAttributeType = *time.Time +type ShareExportPolicyGetCreatedAtArgType = time.Time +type ShareExportPolicyGetCreatedAtRetType = time.Time + +func getShareExportPolicyGetCreatedAtAttributeTypeOk(arg ShareExportPolicyGetCreatedAtAttributeType) (ret ShareExportPolicyGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyGetCreatedAtAttributeType(arg *ShareExportPolicyGetCreatedAtAttributeType, val ShareExportPolicyGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type ShareExportPolicyGetIdAttributeType = *string + +func getShareExportPolicyGetIdAttributeTypeOk(arg ShareExportPolicyGetIdAttributeType) (ret ShareExportPolicyGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyGetIdAttributeType(arg *ShareExportPolicyGetIdAttributeType, val ShareExportPolicyGetIdRetType) { + *arg = &val +} + +type ShareExportPolicyGetIdArgType = string +type ShareExportPolicyGetIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type ShareExportPolicyGetLabelsAttributeType = *map[string]string +type ShareExportPolicyGetLabelsArgType = map[string]string +type ShareExportPolicyGetLabelsRetType = map[string]string + +func getShareExportPolicyGetLabelsAttributeTypeOk(arg ShareExportPolicyGetLabelsAttributeType) (ret ShareExportPolicyGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyGetLabelsAttributeType(arg *ShareExportPolicyGetLabelsAttributeType, val ShareExportPolicyGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type ShareExportPolicyGetNameAttributeType = *string + +func getShareExportPolicyGetNameAttributeTypeOk(arg ShareExportPolicyGetNameAttributeType) (ret ShareExportPolicyGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyGetNameAttributeType(arg *ShareExportPolicyGetNameAttributeType, val ShareExportPolicyGetNameRetType) { + *arg = &val +} + +type ShareExportPolicyGetNameArgType = string +type ShareExportPolicyGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type ShareExportPolicyGetRulesAttributeType = *[]ShareExportPolicyRule +type ShareExportPolicyGetRulesArgType = []ShareExportPolicyRule +type ShareExportPolicyGetRulesRetType = []ShareExportPolicyRule + +func getShareExportPolicyGetRulesAttributeTypeOk(arg ShareExportPolicyGetRulesAttributeType) (ret ShareExportPolicyGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyGetRulesAttributeType(arg *ShareExportPolicyGetRulesAttributeType, val ShareExportPolicyGetRulesRetType) { + *arg = &val +} + +/* + types and functions for sharesUsingExportPolicy +*/ + +// isInteger +type ShareExportPolicyGetSharesUsingExportPolicyAttributeType = *int64 +type ShareExportPolicyGetSharesUsingExportPolicyArgType = int64 +type ShareExportPolicyGetSharesUsingExportPolicyRetType = int64 + +func getShareExportPolicyGetSharesUsingExportPolicyAttributeTypeOk(arg ShareExportPolicyGetSharesUsingExportPolicyAttributeType) (ret ShareExportPolicyGetSharesUsingExportPolicyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyGetSharesUsingExportPolicyAttributeType(arg *ShareExportPolicyGetSharesUsingExportPolicyAttributeType, val ShareExportPolicyGetSharesUsingExportPolicyRetType) { + *arg = &val +} + +// ShareExportPolicy Details of the Share Export Policy to use in the Share. Note that if this is not set, the Share can only be mounted in read only by clients with IPs matching the IP ACL of the Resource Pool hosting this Share +type ShareExportPolicy struct { + CreatedAt ShareExportPolicyGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // ID of the Share Export Policy + Id ShareExportPolicyGetIdAttributeType `json:"id,omitempty"` + // An optional object that represents the labels associated with the share export policy keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels ShareExportPolicyGetLabelsAttributeType `json:"labels,omitempty"` + // Name of the Share Export Policy + Name ShareExportPolicyGetNameAttributeType `json:"name,omitempty"` + // List of rules of the Share Export Policy. The order of the rules within the array does not matter - what matters is the field \"order\" within each rule + Rules ShareExportPolicyGetRulesAttributeType `json:"rules,omitempty"` + // Number of Shares using this Share Export Policy + // Can be cast to int32 without loss of precision. + SharesUsingExportPolicy ShareExportPolicyGetSharesUsingExportPolicyAttributeType `json:"sharesUsingExportPolicy,omitempty"` +} + +// NewShareExportPolicy instantiates a new ShareExportPolicy 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 NewShareExportPolicy() *ShareExportPolicy { + this := ShareExportPolicy{} + return &this +} + +// NewShareExportPolicyWithDefaults instantiates a new ShareExportPolicy 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 NewShareExportPolicyWithDefaults() *ShareExportPolicy { + this := ShareExportPolicy{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *ShareExportPolicy) GetCreatedAt() (res ShareExportPolicyGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicy) GetCreatedAtOk() (ret ShareExportPolicyGetCreatedAtRetType, ok bool) { + return getShareExportPolicyGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *ShareExportPolicy) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *ShareExportPolicy) SetCreatedAt(v ShareExportPolicyGetCreatedAtRetType) { + setShareExportPolicyGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ShareExportPolicy) GetId() (res ShareExportPolicyGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicy) GetIdOk() (ret ShareExportPolicyGetIdRetType, ok bool) { + return getShareExportPolicyGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *ShareExportPolicy) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ShareExportPolicy) SetId(v ShareExportPolicyGetIdRetType) { + setShareExportPolicyGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *ShareExportPolicy) GetLabels() (res ShareExportPolicyGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicy) GetLabelsOk() (ret ShareExportPolicyGetLabelsRetType, ok bool) { + return getShareExportPolicyGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *ShareExportPolicy) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *ShareExportPolicy) SetLabels(v ShareExportPolicyGetLabelsRetType) { + setShareExportPolicyGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ShareExportPolicy) GetName() (res ShareExportPolicyGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicy) GetNameOk() (ret ShareExportPolicyGetNameRetType, ok bool) { + return getShareExportPolicyGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *ShareExportPolicy) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ShareExportPolicy) SetName(v ShareExportPolicyGetNameRetType) { + setShareExportPolicyGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *ShareExportPolicy) GetRules() (res ShareExportPolicyGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicy) GetRulesOk() (ret ShareExportPolicyGetRulesRetType, ok bool) { + return getShareExportPolicyGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *ShareExportPolicy) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given []ShareExportPolicyRule and assigns it to the Rules field. +func (o *ShareExportPolicy) SetRules(v ShareExportPolicyGetRulesRetType) { + setShareExportPolicyGetRulesAttributeType(&o.Rules, v) +} + +// GetSharesUsingExportPolicy returns the SharesUsingExportPolicy field value if set, zero value otherwise. +func (o *ShareExportPolicy) GetSharesUsingExportPolicy() (res ShareExportPolicyGetSharesUsingExportPolicyRetType) { + res, _ = o.GetSharesUsingExportPolicyOk() + return +} + +// GetSharesUsingExportPolicyOk returns a tuple with the SharesUsingExportPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicy) GetSharesUsingExportPolicyOk() (ret ShareExportPolicyGetSharesUsingExportPolicyRetType, ok bool) { + return getShareExportPolicyGetSharesUsingExportPolicyAttributeTypeOk(o.SharesUsingExportPolicy) +} + +// HasSharesUsingExportPolicy returns a boolean if a field has been set. +func (o *ShareExportPolicy) HasSharesUsingExportPolicy() bool { + _, ok := o.GetSharesUsingExportPolicyOk() + return ok +} + +// SetSharesUsingExportPolicy gets a reference to the given int64 and assigns it to the SharesUsingExportPolicy field. +func (o *ShareExportPolicy) SetSharesUsingExportPolicy(v ShareExportPolicyGetSharesUsingExportPolicyRetType) { + setShareExportPolicyGetSharesUsingExportPolicyAttributeType(&o.SharesUsingExportPolicy, v) +} + +func (o ShareExportPolicy) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getShareExportPolicyGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getShareExportPolicyGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getShareExportPolicyGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getShareExportPolicyGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getShareExportPolicyGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + if val, ok := getShareExportPolicyGetSharesUsingExportPolicyAttributeTypeOk(o.SharesUsingExportPolicy); ok { + toSerialize["SharesUsingExportPolicy"] = val + } + return toSerialize, nil +} + +type NullableShareExportPolicy struct { + value *ShareExportPolicy + isSet bool +} + +func (v NullableShareExportPolicy) Get() *ShareExportPolicy { + return v.value +} + +func (v *NullableShareExportPolicy) Set(val *ShareExportPolicy) { + v.value = val + v.isSet = true +} + +func (v NullableShareExportPolicy) IsSet() bool { + return v.isSet +} + +func (v *NullableShareExportPolicy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShareExportPolicy(val *ShareExportPolicy) *NullableShareExportPolicy { + return &NullableShareExportPolicy{value: val, isSet: true} +} + +func (v NullableShareExportPolicy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShareExportPolicy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_share_export_policy_rule.go b/pkg/sfsbeta/model_share_export_policy_rule.go new file mode 100644 index 00000000..a1a52102 --- /dev/null +++ b/pkg/sfsbeta/model_share_export_policy_rule.go @@ -0,0 +1,482 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the ShareExportPolicyRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ShareExportPolicyRule{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type ShareExportPolicyRuleGetCreatedAtAttributeType = *time.Time +type ShareExportPolicyRuleGetCreatedAtArgType = time.Time +type ShareExportPolicyRuleGetCreatedAtRetType = time.Time + +func getShareExportPolicyRuleGetCreatedAtAttributeTypeOk(arg ShareExportPolicyRuleGetCreatedAtAttributeType) (ret ShareExportPolicyRuleGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyRuleGetCreatedAtAttributeType(arg *ShareExportPolicyRuleGetCreatedAtAttributeType, val ShareExportPolicyRuleGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNullableString +type ShareExportPolicyRuleGetDescriptionAttributeType = *NullableString + +func getShareExportPolicyRuleGetDescriptionAttributeTypeOk(arg ShareExportPolicyRuleGetDescriptionAttributeType) (ret ShareExportPolicyRuleGetDescriptionRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setShareExportPolicyRuleGetDescriptionAttributeType(arg *ShareExportPolicyRuleGetDescriptionAttributeType, val ShareExportPolicyRuleGetDescriptionRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ShareExportPolicyRuleGetDescriptionArgType = *string +type ShareExportPolicyRuleGetDescriptionRetType = *string + +/* + types and functions for id +*/ + +// isNotNullableString +type ShareExportPolicyRuleGetIdAttributeType = *string + +func getShareExportPolicyRuleGetIdAttributeTypeOk(arg ShareExportPolicyRuleGetIdAttributeType) (ret ShareExportPolicyRuleGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyRuleGetIdAttributeType(arg *ShareExportPolicyRuleGetIdAttributeType, val ShareExportPolicyRuleGetIdRetType) { + *arg = &val +} + +type ShareExportPolicyRuleGetIdArgType = string +type ShareExportPolicyRuleGetIdRetType = string + +/* + types and functions for ipAcl +*/ + +// isArray +type ShareExportPolicyRuleGetIpAclAttributeType = *[]string +type ShareExportPolicyRuleGetIpAclArgType = []string +type ShareExportPolicyRuleGetIpAclRetType = []string + +func getShareExportPolicyRuleGetIpAclAttributeTypeOk(arg ShareExportPolicyRuleGetIpAclAttributeType) (ret ShareExportPolicyRuleGetIpAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyRuleGetIpAclAttributeType(arg *ShareExportPolicyRuleGetIpAclAttributeType, val ShareExportPolicyRuleGetIpAclRetType) { + *arg = &val +} + +/* + types and functions for order +*/ + +// isInteger +type ShareExportPolicyRuleGetOrderAttributeType = *int64 +type ShareExportPolicyRuleGetOrderArgType = int64 +type ShareExportPolicyRuleGetOrderRetType = int64 + +func getShareExportPolicyRuleGetOrderAttributeTypeOk(arg ShareExportPolicyRuleGetOrderAttributeType) (ret ShareExportPolicyRuleGetOrderRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyRuleGetOrderAttributeType(arg *ShareExportPolicyRuleGetOrderAttributeType, val ShareExportPolicyRuleGetOrderRetType) { + *arg = &val +} + +/* + types and functions for readOnly +*/ + +// isBoolean +type ShareExportPolicyRulegetReadOnlyAttributeType = *bool +type ShareExportPolicyRulegetReadOnlyArgType = bool +type ShareExportPolicyRulegetReadOnlyRetType = bool + +func getShareExportPolicyRulegetReadOnlyAttributeTypeOk(arg ShareExportPolicyRulegetReadOnlyAttributeType) (ret ShareExportPolicyRulegetReadOnlyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyRulegetReadOnlyAttributeType(arg *ShareExportPolicyRulegetReadOnlyAttributeType, val ShareExportPolicyRulegetReadOnlyRetType) { + *arg = &val +} + +/* + types and functions for setUuid +*/ + +// isBoolean +type ShareExportPolicyRulegetSetUuidAttributeType = *bool +type ShareExportPolicyRulegetSetUuidArgType = bool +type ShareExportPolicyRulegetSetUuidRetType = bool + +func getShareExportPolicyRulegetSetUuidAttributeTypeOk(arg ShareExportPolicyRulegetSetUuidAttributeType) (ret ShareExportPolicyRulegetSetUuidRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyRulegetSetUuidAttributeType(arg *ShareExportPolicyRulegetSetUuidAttributeType, val ShareExportPolicyRulegetSetUuidRetType) { + *arg = &val +} + +/* + types and functions for superUser +*/ + +// isBoolean +type ShareExportPolicyRulegetSuperUserAttributeType = *bool +type ShareExportPolicyRulegetSuperUserArgType = bool +type ShareExportPolicyRulegetSuperUserRetType = bool + +func getShareExportPolicyRulegetSuperUserAttributeTypeOk(arg ShareExportPolicyRulegetSuperUserAttributeType) (ret ShareExportPolicyRulegetSuperUserRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setShareExportPolicyRulegetSuperUserAttributeType(arg *ShareExportPolicyRulegetSuperUserAttributeType, val ShareExportPolicyRulegetSuperUserRetType) { + *arg = &val +} + +// ShareExportPolicyRule struct for ShareExportPolicyRule +type ShareExportPolicyRule struct { + CreatedAt ShareExportPolicyRuleGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description of the Rule (optional) + Description ShareExportPolicyRuleGetDescriptionAttributeType `json:"description,omitempty"` + // ID of the Share Export Policy Rule + Id ShareExportPolicyRuleGetIdAttributeType `json:"id,omitempty"` + // IP access control list, where IPs must have a subnet mask (e.g. \"172.16.0.0/24\" for a range of IPs, or \"172.16.0.251/32\" for a specific IP) This array cannot be empty + IpAcl ShareExportPolicyRuleGetIpAclAttributeType `json:"ipAcl,omitempty"` + // Order of the rule within a Share Export Policy. The order is used so that when a client IP matches multiple rules, the first rule is applied This field must be set + // Can be cast to int32 without loss of precision. + Order ShareExportPolicyRuleGetOrderAttributeType `json:"order,omitempty"` + // Flag to indicate if client IPs matching this rule can only mount the share in read only mode Default: false + ReadOnly ShareExportPolicyRulegetReadOnlyAttributeType `json:"readOnly,omitempty"` + // Flag to honor set UUID Default: false + SetUuid ShareExportPolicyRulegetSetUuidAttributeType `json:"setUuid,omitempty"` + // Flag to indicate if client IPs matching this rule have root access on the Share Default: true + SuperUser ShareExportPolicyRulegetSuperUserAttributeType `json:"superUser,omitempty"` +} + +// NewShareExportPolicyRule instantiates a new ShareExportPolicyRule 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 NewShareExportPolicyRule() *ShareExportPolicyRule { + this := ShareExportPolicyRule{} + return &this +} + +// NewShareExportPolicyRuleWithDefaults instantiates a new ShareExportPolicyRule 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 NewShareExportPolicyRuleWithDefaults() *ShareExportPolicyRule { + this := ShareExportPolicyRule{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *ShareExportPolicyRule) GetCreatedAt() (res ShareExportPolicyRuleGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicyRule) GetCreatedAtOk() (ret ShareExportPolicyRuleGetCreatedAtRetType, ok bool) { + return getShareExportPolicyRuleGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *ShareExportPolicyRule) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *ShareExportPolicyRule) SetCreatedAt(v ShareExportPolicyRuleGetCreatedAtRetType) { + setShareExportPolicyRuleGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ShareExportPolicyRule) GetDescription() (res ShareExportPolicyRuleGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// 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 *ShareExportPolicyRule) GetDescriptionOk() (ret ShareExportPolicyRuleGetDescriptionRetType, ok bool) { + return getShareExportPolicyRuleGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *ShareExportPolicyRule) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *ShareExportPolicyRule) SetDescription(v ShareExportPolicyRuleGetDescriptionRetType) { + setShareExportPolicyRuleGetDescriptionAttributeType(&o.Description, v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil +func (o *ShareExportPolicyRule) SetDescriptionNil() { + o.Description = nil +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil +func (o *ShareExportPolicyRule) UnsetDescription() { + o.Description = nil +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ShareExportPolicyRule) GetId() (res ShareExportPolicyRuleGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicyRule) GetIdOk() (ret ShareExportPolicyRuleGetIdRetType, ok bool) { + return getShareExportPolicyRuleGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *ShareExportPolicyRule) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ShareExportPolicyRule) SetId(v ShareExportPolicyRuleGetIdRetType) { + setShareExportPolicyRuleGetIdAttributeType(&o.Id, v) +} + +// GetIpAcl returns the IpAcl field value if set, zero value otherwise. +func (o *ShareExportPolicyRule) GetIpAcl() (res ShareExportPolicyRuleGetIpAclRetType) { + res, _ = o.GetIpAclOk() + return +} + +// GetIpAclOk returns a tuple with the IpAcl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicyRule) GetIpAclOk() (ret ShareExportPolicyRuleGetIpAclRetType, ok bool) { + return getShareExportPolicyRuleGetIpAclAttributeTypeOk(o.IpAcl) +} + +// HasIpAcl returns a boolean if a field has been set. +func (o *ShareExportPolicyRule) HasIpAcl() bool { + _, ok := o.GetIpAclOk() + return ok +} + +// SetIpAcl gets a reference to the given []string and assigns it to the IpAcl field. +func (o *ShareExportPolicyRule) SetIpAcl(v ShareExportPolicyRuleGetIpAclRetType) { + setShareExportPolicyRuleGetIpAclAttributeType(&o.IpAcl, v) +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *ShareExportPolicyRule) GetOrder() (res ShareExportPolicyRuleGetOrderRetType) { + res, _ = o.GetOrderOk() + return +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicyRule) GetOrderOk() (ret ShareExportPolicyRuleGetOrderRetType, ok bool) { + return getShareExportPolicyRuleGetOrderAttributeTypeOk(o.Order) +} + +// HasOrder returns a boolean if a field has been set. +func (o *ShareExportPolicyRule) HasOrder() bool { + _, ok := o.GetOrderOk() + return ok +} + +// SetOrder gets a reference to the given int64 and assigns it to the Order field. +func (o *ShareExportPolicyRule) SetOrder(v ShareExportPolicyRuleGetOrderRetType) { + setShareExportPolicyRuleGetOrderAttributeType(&o.Order, v) +} + +// GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +func (o *ShareExportPolicyRule) GetReadOnly() (res ShareExportPolicyRulegetReadOnlyRetType) { + res, _ = o.GetReadOnlyOk() + return +} + +// GetReadOnlyOk returns a tuple with the ReadOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicyRule) GetReadOnlyOk() (ret ShareExportPolicyRulegetReadOnlyRetType, ok bool) { + return getShareExportPolicyRulegetReadOnlyAttributeTypeOk(o.ReadOnly) +} + +// HasReadOnly returns a boolean if a field has been set. +func (o *ShareExportPolicyRule) HasReadOnly() bool { + _, ok := o.GetReadOnlyOk() + return ok +} + +// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +func (o *ShareExportPolicyRule) SetReadOnly(v ShareExportPolicyRulegetReadOnlyRetType) { + setShareExportPolicyRulegetReadOnlyAttributeType(&o.ReadOnly, v) +} + +// GetSetUuid returns the SetUuid field value if set, zero value otherwise. +func (o *ShareExportPolicyRule) GetSetUuid() (res ShareExportPolicyRulegetSetUuidRetType) { + res, _ = o.GetSetUuidOk() + return +} + +// GetSetUuidOk returns a tuple with the SetUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicyRule) GetSetUuidOk() (ret ShareExportPolicyRulegetSetUuidRetType, ok bool) { + return getShareExportPolicyRulegetSetUuidAttributeTypeOk(o.SetUuid) +} + +// HasSetUuid returns a boolean if a field has been set. +func (o *ShareExportPolicyRule) HasSetUuid() bool { + _, ok := o.GetSetUuidOk() + return ok +} + +// SetSetUuid gets a reference to the given bool and assigns it to the SetUuid field. +func (o *ShareExportPolicyRule) SetSetUuid(v ShareExportPolicyRulegetSetUuidRetType) { + setShareExportPolicyRulegetSetUuidAttributeType(&o.SetUuid, v) +} + +// GetSuperUser returns the SuperUser field value if set, zero value otherwise. +func (o *ShareExportPolicyRule) GetSuperUser() (res ShareExportPolicyRulegetSuperUserRetType) { + res, _ = o.GetSuperUserOk() + return +} + +// GetSuperUserOk returns a tuple with the SuperUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShareExportPolicyRule) GetSuperUserOk() (ret ShareExportPolicyRulegetSuperUserRetType, ok bool) { + return getShareExportPolicyRulegetSuperUserAttributeTypeOk(o.SuperUser) +} + +// HasSuperUser returns a boolean if a field has been set. +func (o *ShareExportPolicyRule) HasSuperUser() bool { + _, ok := o.GetSuperUserOk() + return ok +} + +// SetSuperUser gets a reference to the given bool and assigns it to the SuperUser field. +func (o *ShareExportPolicyRule) SetSuperUser(v ShareExportPolicyRulegetSuperUserRetType) { + setShareExportPolicyRulegetSuperUserAttributeType(&o.SuperUser, v) +} + +func (o ShareExportPolicyRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getShareExportPolicyRuleGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getShareExportPolicyRuleGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getShareExportPolicyRuleGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getShareExportPolicyRuleGetIpAclAttributeTypeOk(o.IpAcl); ok { + toSerialize["IpAcl"] = val + } + if val, ok := getShareExportPolicyRuleGetOrderAttributeTypeOk(o.Order); ok { + toSerialize["Order"] = val + } + if val, ok := getShareExportPolicyRulegetReadOnlyAttributeTypeOk(o.ReadOnly); ok { + toSerialize["ReadOnly"] = val + } + if val, ok := getShareExportPolicyRulegetSetUuidAttributeTypeOk(o.SetUuid); ok { + toSerialize["SetUuid"] = val + } + if val, ok := getShareExportPolicyRulegetSuperUserAttributeTypeOk(o.SuperUser); ok { + toSerialize["SuperUser"] = val + } + return toSerialize, nil +} + +type NullableShareExportPolicyRule struct { + value *ShareExportPolicyRule + isSet bool +} + +func (v NullableShareExportPolicyRule) Get() *ShareExportPolicyRule { + return v.value +} + +func (v *NullableShareExportPolicyRule) Set(val *ShareExportPolicyRule) { + v.value = val + v.isSet = true +} + +func (v NullableShareExportPolicyRule) IsSet() bool { + return v.isSet +} + +func (v *NullableShareExportPolicyRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShareExportPolicyRule(val *ShareExportPolicyRule) *NullableShareExportPolicyRule { + return &NullableShareExportPolicyRule{value: val, isSet: true} +} + +func (v NullableShareExportPolicyRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShareExportPolicyRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_share_export_policy_rule_test.go b/pkg/sfsbeta/model_share_export_policy_rule_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_share_export_policy_rule_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_share_export_policy_test.go b/pkg/sfsbeta/model_share_export_policy_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_share_export_policy_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_share_test.go b/pkg/sfsbeta/model_share_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_share_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_snapshot_schedule.go b/pkg/sfsbeta/model_snapshot_schedule.go new file mode 100644 index 00000000..8b2f8dc9 --- /dev/null +++ b/pkg/sfsbeta/model_snapshot_schedule.go @@ -0,0 +1,178 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the SnapshotSchedule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SnapshotSchedule{} + +/* + types and functions for cron +*/ + +// isNotNullableString +type SnapshotScheduleGetCronAttributeType = *string + +func getSnapshotScheduleGetCronAttributeTypeOk(arg SnapshotScheduleGetCronAttributeType) (ret SnapshotScheduleGetCronRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotScheduleGetCronAttributeType(arg *SnapshotScheduleGetCronAttributeType, val SnapshotScheduleGetCronRetType) { + *arg = &val +} + +type SnapshotScheduleGetCronArgType = string +type SnapshotScheduleGetCronRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type SnapshotScheduleGetNameAttributeType = *string + +func getSnapshotScheduleGetNameAttributeTypeOk(arg SnapshotScheduleGetNameAttributeType) (ret SnapshotScheduleGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotScheduleGetNameAttributeType(arg *SnapshotScheduleGetNameAttributeType, val SnapshotScheduleGetNameRetType) { + *arg = &val +} + +type SnapshotScheduleGetNameArgType = string +type SnapshotScheduleGetNameRetType = string + +// SnapshotSchedule struct for SnapshotSchedule +type SnapshotSchedule struct { + // Cron of the Snapshot Schedule (follows the cron schedule expression in Unix-like systems) + Cron SnapshotScheduleGetCronAttributeType `json:"cron,omitempty"` + // Name of the Snapshot Schedule + Name SnapshotScheduleGetNameAttributeType `json:"name,omitempty"` +} + +// NewSnapshotSchedule instantiates a new SnapshotSchedule 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 NewSnapshotSchedule() *SnapshotSchedule { + this := SnapshotSchedule{} + return &this +} + +// NewSnapshotScheduleWithDefaults instantiates a new SnapshotSchedule 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 NewSnapshotScheduleWithDefaults() *SnapshotSchedule { + this := SnapshotSchedule{} + return &this +} + +// GetCron returns the Cron field value if set, zero value otherwise. +func (o *SnapshotSchedule) GetCron() (res SnapshotScheduleGetCronRetType) { + res, _ = o.GetCronOk() + return +} + +// GetCronOk returns a tuple with the Cron field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SnapshotSchedule) GetCronOk() (ret SnapshotScheduleGetCronRetType, ok bool) { + return getSnapshotScheduleGetCronAttributeTypeOk(o.Cron) +} + +// HasCron returns a boolean if a field has been set. +func (o *SnapshotSchedule) HasCron() bool { + _, ok := o.GetCronOk() + return ok +} + +// SetCron gets a reference to the given string and assigns it to the Cron field. +func (o *SnapshotSchedule) SetCron(v SnapshotScheduleGetCronRetType) { + setSnapshotScheduleGetCronAttributeType(&o.Cron, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SnapshotSchedule) GetName() (res SnapshotScheduleGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SnapshotSchedule) GetNameOk() (ret SnapshotScheduleGetNameRetType, ok bool) { + return getSnapshotScheduleGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *SnapshotSchedule) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SnapshotSchedule) SetName(v SnapshotScheduleGetNameRetType) { + setSnapshotScheduleGetNameAttributeType(&o.Name, v) +} + +func (o SnapshotSchedule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSnapshotScheduleGetCronAttributeTypeOk(o.Cron); ok { + toSerialize["Cron"] = val + } + if val, ok := getSnapshotScheduleGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableSnapshotSchedule struct { + value *SnapshotSchedule + isSet bool +} + +func (v NullableSnapshotSchedule) Get() *SnapshotSchedule { + return v.value +} + +func (v *NullableSnapshotSchedule) Set(val *SnapshotSchedule) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotSchedule) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotSchedule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotSchedule(val *SnapshotSchedule) *NullableSnapshotSchedule { + return &NullableSnapshotSchedule{value: val, isSet: true} +} + +func (v NullableSnapshotSchedule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotSchedule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_snapshot_schedule_test.go b/pkg/sfsbeta/model_snapshot_schedule_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_snapshot_schedule_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_status.go b/pkg/sfsbeta/model_status.go new file mode 100644 index 00000000..28f5cce8 --- /dev/null +++ b/pkg/sfsbeta/model_status.go @@ -0,0 +1,226 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the Status type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Status{} + +/* + types and functions for code +*/ + +// isInteger +type StatusGetCodeAttributeType = *int64 +type StatusGetCodeArgType = int64 +type StatusGetCodeRetType = int64 + +func getStatusGetCodeAttributeTypeOk(arg StatusGetCodeAttributeType) (ret StatusGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetCodeAttributeType(arg *StatusGetCodeAttributeType, val StatusGetCodeRetType) { + *arg = &val +} + +/* + types and functions for details +*/ + +// isArray +type StatusGetDetailsAttributeType = *[]GoogleProtobufAny +type StatusGetDetailsArgType = []GoogleProtobufAny +type StatusGetDetailsRetType = []GoogleProtobufAny + +func getStatusGetDetailsAttributeTypeOk(arg StatusGetDetailsAttributeType) (ret StatusGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetDetailsAttributeType(arg *StatusGetDetailsAttributeType, val StatusGetDetailsRetType) { + *arg = &val +} + +/* + types and functions for message +*/ + +// isNotNullableString +type StatusGetMessageAttributeType = *string + +func getStatusGetMessageAttributeTypeOk(arg StatusGetMessageAttributeType) (ret StatusGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setStatusGetMessageAttributeType(arg *StatusGetMessageAttributeType, val StatusGetMessageRetType) { + *arg = &val +} + +type StatusGetMessageArgType = string +type StatusGetMessageRetType = string + +// Status The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). +type Status struct { + // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + // Can be cast to int32 without loss of precision. + Code StatusGetCodeAttributeType `json:"code,omitempty"` + // A list of messages that carry the error details. There is a common set of message types for APIs to use. + Details StatusGetDetailsAttributeType `json:"details,omitempty"` + // A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + Message StatusGetMessageAttributeType `json:"message,omitempty"` +} + +// NewStatus instantiates a new Status 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 NewStatus() *Status { + this := Status{} + return &this +} + +// NewStatusWithDefaults instantiates a new Status 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 NewStatusWithDefaults() *Status { + this := Status{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *Status) GetCode() (res StatusGetCodeRetType) { + res, _ = o.GetCodeOk() + return +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetCodeOk() (ret StatusGetCodeRetType, ok bool) { + return getStatusGetCodeAttributeTypeOk(o.Code) +} + +// HasCode returns a boolean if a field has been set. +func (o *Status) HasCode() bool { + _, ok := o.GetCodeOk() + return ok +} + +// SetCode gets a reference to the given int64 and assigns it to the Code field. +func (o *Status) SetCode(v StatusGetCodeRetType) { + setStatusGetCodeAttributeType(&o.Code, v) +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *Status) GetDetails() (res StatusGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetDetailsOk() (ret StatusGetDetailsRetType, ok bool) { + return getStatusGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *Status) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given []GoogleProtobufAny and assigns it to the Details field. +func (o *Status) SetDetails(v StatusGetDetailsRetType) { + setStatusGetDetailsAttributeType(&o.Details, v) +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *Status) GetMessage() (res StatusGetMessageRetType) { + res, _ = o.GetMessageOk() + return +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Status) GetMessageOk() (ret StatusGetMessageRetType, ok bool) { + return getStatusGetMessageAttributeTypeOk(o.Message) +} + +// HasMessage returns a boolean if a field has been set. +func (o *Status) HasMessage() bool { + _, ok := o.GetMessageOk() + return ok +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *Status) SetMessage(v StatusGetMessageRetType) { + setStatusGetMessageAttributeType(&o.Message, v) +} + +func (o Status) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getStatusGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getStatusGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getStatusGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableStatus struct { + value *Status + isSet bool +} + +func (v NullableStatus) Get() *Status { + return v.value +} + +func (v *NullableStatus) Set(val *Status) { + v.value = val + v.isSet = true +} + +func (v NullableStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStatus(val *Status) *NullableStatus { + return &NullableStatus{value: val, isSet: true} +} + +func (v NullableStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_status_test.go b/pkg/sfsbeta/model_status_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_status_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_update_resource_pool_payload.go b/pkg/sfsbeta/model_update_resource_pool_payload.go new file mode 100644 index 00000000..1b1f97bd --- /dev/null +++ b/pkg/sfsbeta/model_update_resource_pool_payload.go @@ -0,0 +1,382 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the UpdateResourcePoolPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateResourcePoolPayload{} + +/* + types and functions for ipAcl +*/ + +// isArray +type UpdateResourcePoolPayloadGetIpAclAttributeType = *[]string +type UpdateResourcePoolPayloadGetIpAclArgType = []string +type UpdateResourcePoolPayloadGetIpAclRetType = []string + +func getUpdateResourcePoolPayloadGetIpAclAttributeTypeOk(arg UpdateResourcePoolPayloadGetIpAclAttributeType) (ret UpdateResourcePoolPayloadGetIpAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolPayloadGetIpAclAttributeType(arg *UpdateResourcePoolPayloadGetIpAclAttributeType, val UpdateResourcePoolPayloadGetIpAclRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type UpdateResourcePoolPayloadGetLabelsAttributeType = *map[string]string +type UpdateResourcePoolPayloadGetLabelsArgType = map[string]string +type UpdateResourcePoolPayloadGetLabelsRetType = map[string]string + +func getUpdateResourcePoolPayloadGetLabelsAttributeTypeOk(arg UpdateResourcePoolPayloadGetLabelsAttributeType) (ret UpdateResourcePoolPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolPayloadGetLabelsAttributeType(arg *UpdateResourcePoolPayloadGetLabelsAttributeType, val UpdateResourcePoolPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type UpdateResourcePoolPayloadGetPerformanceClassAttributeType = *string + +func getUpdateResourcePoolPayloadGetPerformanceClassAttributeTypeOk(arg UpdateResourcePoolPayloadGetPerformanceClassAttributeType) (ret UpdateResourcePoolPayloadGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolPayloadGetPerformanceClassAttributeType(arg *UpdateResourcePoolPayloadGetPerformanceClassAttributeType, val UpdateResourcePoolPayloadGetPerformanceClassRetType) { + *arg = &val +} + +type UpdateResourcePoolPayloadGetPerformanceClassArgType = string +type UpdateResourcePoolPayloadGetPerformanceClassRetType = string + +/* + types and functions for sizeGigabytes +*/ + +// isInteger +type UpdateResourcePoolPayloadGetSizeGigabytesAttributeType = *int64 +type UpdateResourcePoolPayloadGetSizeGigabytesArgType = *int64 +type UpdateResourcePoolPayloadGetSizeGigabytesRetType = *int64 + +func getUpdateResourcePoolPayloadGetSizeGigabytesAttributeTypeOk(arg UpdateResourcePoolPayloadGetSizeGigabytesAttributeType) (ret UpdateResourcePoolPayloadGetSizeGigabytesRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setUpdateResourcePoolPayloadGetSizeGigabytesAttributeType(arg *UpdateResourcePoolPayloadGetSizeGigabytesAttributeType, val UpdateResourcePoolPayloadGetSizeGigabytesRetType) { + *arg = val +} + +/* + types and functions for snapshotScheduleName +*/ + +// isNotNullableString +type UpdateResourcePoolPayloadGetSnapshotScheduleNameAttributeType = *string + +func getUpdateResourcePoolPayloadGetSnapshotScheduleNameAttributeTypeOk(arg UpdateResourcePoolPayloadGetSnapshotScheduleNameAttributeType) (ret UpdateResourcePoolPayloadGetSnapshotScheduleNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolPayloadGetSnapshotScheduleNameAttributeType(arg *UpdateResourcePoolPayloadGetSnapshotScheduleNameAttributeType, val UpdateResourcePoolPayloadGetSnapshotScheduleNameRetType) { + *arg = &val +} + +type UpdateResourcePoolPayloadGetSnapshotScheduleNameArgType = string +type UpdateResourcePoolPayloadGetSnapshotScheduleNameRetType = string + +/* + types and functions for snapshotsAreVisible +*/ + +// isBoolean +type UpdateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType = *bool +type UpdateResourcePoolPayloadgetSnapshotsAreVisibleArgType = bool +type UpdateResourcePoolPayloadgetSnapshotsAreVisibleRetType = bool + +func getUpdateResourcePoolPayloadgetSnapshotsAreVisibleAttributeTypeOk(arg UpdateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType) (ret UpdateResourcePoolPayloadgetSnapshotsAreVisibleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType(arg *UpdateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType, val UpdateResourcePoolPayloadgetSnapshotsAreVisibleRetType) { + *arg = &val +} + +// UpdateResourcePoolPayload struct for UpdateResourcePoolPayload +type UpdateResourcePoolPayload struct { + // (optional) List of IPs that can mount the Resource Pool in read-only; IPs must have a subnet mask (e.g. \"172.16.0.0/24\" for a range of IPs, or \"172.16.0.250/32\" for a specific IP) + IpAcl UpdateResourcePoolPayloadGetIpAclAttributeType `json:"ipAcl,omitempty"` + // An optional object that represents the labels associated with the resource pool keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels UpdateResourcePoolPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // (optional) Name of the performance class + PerformanceClass UpdateResourcePoolPayloadGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // (optional) Size of the Resource Pool (unit: gigabytes) + // Can be cast to int32 without loss of precision. + SizeGigabytes UpdateResourcePoolPayloadGetSizeGigabytesAttributeType `json:"sizeGigabytes,omitempty"` + // (optional) Name of the Snapshot Schedule to use If not set, the Snapshot Schedule is not updated If set to an empty string, the Snapshot Schedule is removed + SnapshotScheduleName UpdateResourcePoolPayloadGetSnapshotScheduleNameAttributeType `json:"snapshotScheduleName,omitempty"` + // Whether the .snapshot directory is visible when mounting the resource pool. Setting this value to false might prevent you from accessing the snapshots (e.g. for security reasons). Additionally, the access to the snapshots is always controlled by the export policy of the resource pool. That means, if snapshots are visible and the export policy allows for reading the resource pool, then it also allows reading the snapshot of all shares. + SnapshotsAreVisible UpdateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType `json:"snapshotsAreVisible,omitempty"` +} + +// NewUpdateResourcePoolPayload instantiates a new UpdateResourcePoolPayload 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 NewUpdateResourcePoolPayload() *UpdateResourcePoolPayload { + this := UpdateResourcePoolPayload{} + return &this +} + +// NewUpdateResourcePoolPayloadWithDefaults instantiates a new UpdateResourcePoolPayload 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 NewUpdateResourcePoolPayloadWithDefaults() *UpdateResourcePoolPayload { + this := UpdateResourcePoolPayload{} + return &this +} + +// GetIpAcl returns the IpAcl field value if set, zero value otherwise. +func (o *UpdateResourcePoolPayload) GetIpAcl() (res UpdateResourcePoolPayloadGetIpAclRetType) { + res, _ = o.GetIpAclOk() + return +} + +// GetIpAclOk returns a tuple with the IpAcl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolPayload) GetIpAclOk() (ret UpdateResourcePoolPayloadGetIpAclRetType, ok bool) { + return getUpdateResourcePoolPayloadGetIpAclAttributeTypeOk(o.IpAcl) +} + +// HasIpAcl returns a boolean if a field has been set. +func (o *UpdateResourcePoolPayload) HasIpAcl() bool { + _, ok := o.GetIpAclOk() + return ok +} + +// SetIpAcl gets a reference to the given []string and assigns it to the IpAcl field. +func (o *UpdateResourcePoolPayload) SetIpAcl(v UpdateResourcePoolPayloadGetIpAclRetType) { + setUpdateResourcePoolPayloadGetIpAclAttributeType(&o.IpAcl, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateResourcePoolPayload) GetLabels() (res UpdateResourcePoolPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolPayload) GetLabelsOk() (ret UpdateResourcePoolPayloadGetLabelsRetType, ok bool) { + return getUpdateResourcePoolPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateResourcePoolPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateResourcePoolPayload) SetLabels(v UpdateResourcePoolPayloadGetLabelsRetType) { + setUpdateResourcePoolPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *UpdateResourcePoolPayload) GetPerformanceClass() (res UpdateResourcePoolPayloadGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolPayload) GetPerformanceClassOk() (ret UpdateResourcePoolPayloadGetPerformanceClassRetType, ok bool) { + return getUpdateResourcePoolPayloadGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *UpdateResourcePoolPayload) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *UpdateResourcePoolPayload) SetPerformanceClass(v UpdateResourcePoolPayloadGetPerformanceClassRetType) { + setUpdateResourcePoolPayloadGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetSizeGigabytes returns the SizeGigabytes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateResourcePoolPayload) GetSizeGigabytes() (res UpdateResourcePoolPayloadGetSizeGigabytesRetType) { + res, _ = o.GetSizeGigabytesOk() + return +} + +// GetSizeGigabytesOk returns a tuple with the SizeGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateResourcePoolPayload) GetSizeGigabytesOk() (ret UpdateResourcePoolPayloadGetSizeGigabytesRetType, ok bool) { + return getUpdateResourcePoolPayloadGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes) +} + +// HasSizeGigabytes returns a boolean if a field has been set. +func (o *UpdateResourcePoolPayload) HasSizeGigabytes() bool { + _, ok := o.GetSizeGigabytesOk() + return ok +} + +// SetSizeGigabytes gets a reference to the given int64 and assigns it to the SizeGigabytes field. +func (o *UpdateResourcePoolPayload) SetSizeGigabytes(v UpdateResourcePoolPayloadGetSizeGigabytesRetType) { + setUpdateResourcePoolPayloadGetSizeGigabytesAttributeType(&o.SizeGigabytes, v) +} + +// SetSizeGigabytesNil sets the value for SizeGigabytes to be an explicit nil +func (o *UpdateResourcePoolPayload) SetSizeGigabytesNil() { + o.SizeGigabytes = nil +} + +// UnsetSizeGigabytes ensures that no value is present for SizeGigabytes, not even an explicit nil +func (o *UpdateResourcePoolPayload) UnsetSizeGigabytes() { + o.SizeGigabytes = nil +} + +// GetSnapshotScheduleName returns the SnapshotScheduleName field value if set, zero value otherwise. +func (o *UpdateResourcePoolPayload) GetSnapshotScheduleName() (res UpdateResourcePoolPayloadGetSnapshotScheduleNameRetType) { + res, _ = o.GetSnapshotScheduleNameOk() + return +} + +// GetSnapshotScheduleNameOk returns a tuple with the SnapshotScheduleName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolPayload) GetSnapshotScheduleNameOk() (ret UpdateResourcePoolPayloadGetSnapshotScheduleNameRetType, ok bool) { + return getUpdateResourcePoolPayloadGetSnapshotScheduleNameAttributeTypeOk(o.SnapshotScheduleName) +} + +// HasSnapshotScheduleName returns a boolean if a field has been set. +func (o *UpdateResourcePoolPayload) HasSnapshotScheduleName() bool { + _, ok := o.GetSnapshotScheduleNameOk() + return ok +} + +// SetSnapshotScheduleName gets a reference to the given string and assigns it to the SnapshotScheduleName field. +func (o *UpdateResourcePoolPayload) SetSnapshotScheduleName(v UpdateResourcePoolPayloadGetSnapshotScheduleNameRetType) { + setUpdateResourcePoolPayloadGetSnapshotScheduleNameAttributeType(&o.SnapshotScheduleName, v) +} + +// GetSnapshotsAreVisible returns the SnapshotsAreVisible field value if set, zero value otherwise. +func (o *UpdateResourcePoolPayload) GetSnapshotsAreVisible() (res UpdateResourcePoolPayloadgetSnapshotsAreVisibleRetType) { + res, _ = o.GetSnapshotsAreVisibleOk() + return +} + +// GetSnapshotsAreVisibleOk returns a tuple with the SnapshotsAreVisible field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolPayload) GetSnapshotsAreVisibleOk() (ret UpdateResourcePoolPayloadgetSnapshotsAreVisibleRetType, ok bool) { + return getUpdateResourcePoolPayloadgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible) +} + +// HasSnapshotsAreVisible returns a boolean if a field has been set. +func (o *UpdateResourcePoolPayload) HasSnapshotsAreVisible() bool { + _, ok := o.GetSnapshotsAreVisibleOk() + return ok +} + +// SetSnapshotsAreVisible gets a reference to the given bool and assigns it to the SnapshotsAreVisible field. +func (o *UpdateResourcePoolPayload) SetSnapshotsAreVisible(v UpdateResourcePoolPayloadgetSnapshotsAreVisibleRetType) { + setUpdateResourcePoolPayloadgetSnapshotsAreVisibleAttributeType(&o.SnapshotsAreVisible, v) +} + +func (o UpdateResourcePoolPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateResourcePoolPayloadGetIpAclAttributeTypeOk(o.IpAcl); ok { + toSerialize["IpAcl"] = val + } + if val, ok := getUpdateResourcePoolPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateResourcePoolPayloadGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getUpdateResourcePoolPayloadGetSizeGigabytesAttributeTypeOk(o.SizeGigabytes); ok { + toSerialize["SizeGigabytes"] = val + } + if val, ok := getUpdateResourcePoolPayloadGetSnapshotScheduleNameAttributeTypeOk(o.SnapshotScheduleName); ok { + toSerialize["SnapshotScheduleName"] = val + } + if val, ok := getUpdateResourcePoolPayloadgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible); ok { + toSerialize["SnapshotsAreVisible"] = val + } + return toSerialize, nil +} + +type NullableUpdateResourcePoolPayload struct { + value *UpdateResourcePoolPayload + isSet bool +} + +func (v NullableUpdateResourcePoolPayload) Get() *UpdateResourcePoolPayload { + return v.value +} + +func (v *NullableUpdateResourcePoolPayload) Set(val *UpdateResourcePoolPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateResourcePoolPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateResourcePoolPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateResourcePoolPayload(val *UpdateResourcePoolPayload) *NullableUpdateResourcePoolPayload { + return &NullableUpdateResourcePoolPayload{value: val, isSet: true} +} + +func (v NullableUpdateResourcePoolPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateResourcePoolPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_update_resource_pool_payload_test.go b/pkg/sfsbeta/model_update_resource_pool_payload_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_update_resource_pool_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_update_resource_pool_response.go b/pkg/sfsbeta/model_update_resource_pool_response.go new file mode 100644 index 00000000..ae628b97 --- /dev/null +++ b/pkg/sfsbeta/model_update_resource_pool_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the UpdateResourcePoolResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateResourcePoolResponse{} + +/* + types and functions for resourcePool +*/ + +// isModel +type UpdateResourcePoolResponseGetResourcePoolAttributeType = *UpdateResourcePoolResponseResourcePool +type UpdateResourcePoolResponseGetResourcePoolArgType = UpdateResourcePoolResponseResourcePool +type UpdateResourcePoolResponseGetResourcePoolRetType = UpdateResourcePoolResponseResourcePool + +func getUpdateResourcePoolResponseGetResourcePoolAttributeTypeOk(arg UpdateResourcePoolResponseGetResourcePoolAttributeType) (ret UpdateResourcePoolResponseGetResourcePoolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseGetResourcePoolAttributeType(arg *UpdateResourcePoolResponseGetResourcePoolAttributeType, val UpdateResourcePoolResponseGetResourcePoolRetType) { + *arg = &val +} + +// UpdateResourcePoolResponse struct for UpdateResourcePoolResponse +type UpdateResourcePoolResponse struct { + ResourcePool UpdateResourcePoolResponseGetResourcePoolAttributeType `json:"resourcePool,omitempty"` +} + +// NewUpdateResourcePoolResponse instantiates a new UpdateResourcePoolResponse 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 NewUpdateResourcePoolResponse() *UpdateResourcePoolResponse { + this := UpdateResourcePoolResponse{} + return &this +} + +// NewUpdateResourcePoolResponseWithDefaults instantiates a new UpdateResourcePoolResponse 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 NewUpdateResourcePoolResponseWithDefaults() *UpdateResourcePoolResponse { + this := UpdateResourcePoolResponse{} + return &this +} + +// GetResourcePool returns the ResourcePool field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponse) GetResourcePool() (res UpdateResourcePoolResponseGetResourcePoolRetType) { + res, _ = o.GetResourcePoolOk() + return +} + +// GetResourcePoolOk returns a tuple with the ResourcePool field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponse) GetResourcePoolOk() (ret UpdateResourcePoolResponseGetResourcePoolRetType, ok bool) { + return getUpdateResourcePoolResponseGetResourcePoolAttributeTypeOk(o.ResourcePool) +} + +// HasResourcePool returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponse) HasResourcePool() bool { + _, ok := o.GetResourcePoolOk() + return ok +} + +// SetResourcePool gets a reference to the given UpdateResourcePoolResponseResourcePool and assigns it to the ResourcePool field. +func (o *UpdateResourcePoolResponse) SetResourcePool(v UpdateResourcePoolResponseGetResourcePoolRetType) { + setUpdateResourcePoolResponseGetResourcePoolAttributeType(&o.ResourcePool, v) +} + +func (o UpdateResourcePoolResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateResourcePoolResponseGetResourcePoolAttributeTypeOk(o.ResourcePool); ok { + toSerialize["ResourcePool"] = val + } + return toSerialize, nil +} + +type NullableUpdateResourcePoolResponse struct { + value *UpdateResourcePoolResponse + isSet bool +} + +func (v NullableUpdateResourcePoolResponse) Get() *UpdateResourcePoolResponse { + return v.value +} + +func (v *NullableUpdateResourcePoolResponse) Set(val *UpdateResourcePoolResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateResourcePoolResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateResourcePoolResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateResourcePoolResponse(val *UpdateResourcePoolResponse) *NullableUpdateResourcePoolResponse { + return &NullableUpdateResourcePoolResponse{value: val, isSet: true} +} + +func (v NullableUpdateResourcePoolResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateResourcePoolResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_update_resource_pool_response_resource_pool.go b/pkg/sfsbeta/model_update_resource_pool_response_resource_pool.go new file mode 100644 index 00000000..a0f4e865 --- /dev/null +++ b/pkg/sfsbeta/model_update_resource_pool_response_resource_pool.go @@ -0,0 +1,802 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the UpdateResourcePoolResponseResourcePool type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateResourcePoolResponseResourcePool{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType = *string + +func getUpdateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType, val UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType) { + *arg = &val +} + +type UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneArgType = string +type UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType = string + +/* + types and functions for countShares +*/ + +// isInteger +type UpdateResourcePoolResponseResourcePoolGetCountSharesAttributeType = *int64 +type UpdateResourcePoolResponseResourcePoolGetCountSharesArgType = int64 +type UpdateResourcePoolResponseResourcePoolGetCountSharesRetType = int64 + +func getUpdateResourcePoolResponseResourcePoolGetCountSharesAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetCountSharesAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetCountSharesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetCountSharesAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetCountSharesAttributeType, val UpdateResourcePoolResponseResourcePoolGetCountSharesRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type UpdateResourcePoolResponseResourcePoolGetCreatedAtAttributeType = *time.Time +type UpdateResourcePoolResponseResourcePoolGetCreatedAtArgType = time.Time +type UpdateResourcePoolResponseResourcePoolGetCreatedAtRetType = time.Time + +func getUpdateResourcePoolResponseResourcePoolGetCreatedAtAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetCreatedAtAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetCreatedAtAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetCreatedAtAttributeType, val UpdateResourcePoolResponseResourcePoolGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type UpdateResourcePoolResponseResourcePoolGetIdAttributeType = *string + +func getUpdateResourcePoolResponseResourcePoolGetIdAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetIdAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetIdAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetIdAttributeType, val UpdateResourcePoolResponseResourcePoolGetIdRetType) { + *arg = &val +} + +type UpdateResourcePoolResponseResourcePoolGetIdArgType = string +type UpdateResourcePoolResponseResourcePoolGetIdRetType = string + +/* + types and functions for ipAcl +*/ + +// isArray +type UpdateResourcePoolResponseResourcePoolGetIpAclAttributeType = *[]string +type UpdateResourcePoolResponseResourcePoolGetIpAclArgType = []string +type UpdateResourcePoolResponseResourcePoolGetIpAclRetType = []string + +func getUpdateResourcePoolResponseResourcePoolGetIpAclAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetIpAclAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetIpAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetIpAclAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetIpAclAttributeType, val UpdateResourcePoolResponseResourcePoolGetIpAclRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type UpdateResourcePoolResponseResourcePoolGetLabelsAttributeType = *map[string]string +type UpdateResourcePoolResponseResourcePoolGetLabelsArgType = map[string]string +type UpdateResourcePoolResponseResourcePoolGetLabelsRetType = map[string]string + +func getUpdateResourcePoolResponseResourcePoolGetLabelsAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetLabelsAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetLabelsAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetLabelsAttributeType, val UpdateResourcePoolResponseResourcePoolGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mountPath +*/ + +// isNotNullableString +type UpdateResourcePoolResponseResourcePoolGetMountPathAttributeType = *string + +func getUpdateResourcePoolResponseResourcePoolGetMountPathAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetMountPathAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetMountPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetMountPathAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetMountPathAttributeType, val UpdateResourcePoolResponseResourcePoolGetMountPathRetType) { + *arg = &val +} + +type UpdateResourcePoolResponseResourcePoolGetMountPathArgType = string +type UpdateResourcePoolResponseResourcePoolGetMountPathRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateResourcePoolResponseResourcePoolGetNameAttributeType = *string + +func getUpdateResourcePoolResponseResourcePoolGetNameAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetNameAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetNameAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetNameAttributeType, val UpdateResourcePoolResponseResourcePoolGetNameRetType) { + *arg = &val +} + +type UpdateResourcePoolResponseResourcePoolGetNameArgType = string +type UpdateResourcePoolResponseResourcePoolGetNameRetType = string + +/* + types and functions for performanceClass +*/ + +// isModel +type UpdateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType = *ResourcePoolPerformanceClass +type UpdateResourcePoolResponseResourcePoolGetPerformanceClassArgType = ResourcePoolPerformanceClass +type UpdateResourcePoolResponseResourcePoolGetPerformanceClassRetType = ResourcePoolPerformanceClass + +func getUpdateResourcePoolResponseResourcePoolGetPerformanceClassAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType, val UpdateResourcePoolResponseResourcePoolGetPerformanceClassRetType) { + *arg = &val +} + +/* + types and functions for performanceClassDowngradableAt +*/ + +// isDateTime +type UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType = *time.Time +type UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtArgType = time.Time +type UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType = time.Time + +func getUpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType, val UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType) { + *arg = &val +} + +/* + types and functions for sizeReducibleAt +*/ + +// isDateTime +type UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType = *time.Time +type UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtArgType = time.Time +type UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType = time.Time + +func getUpdateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType, val UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType) { + *arg = &val +} + +/* + types and functions for snapshotSchedule +*/ + +// isModel +type UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType = *SnapshotSchedule +type UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleArgType = SnapshotSchedule +type UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType = SnapshotSchedule + +func getUpdateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType, val UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType) { + *arg = &val +} + +/* + types and functions for snapshotsAreVisible +*/ + +// isBoolean +type UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType = *bool +type UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleArgType = bool +type UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType = bool + +func getUpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType) (ret UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType(arg *UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType, val UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType) { + *arg = &val +} + +/* + types and functions for space +*/ + +// isModel +type UpdateResourcePoolResponseResourcePoolGetSpaceAttributeType = *ResourcePoolSpace +type UpdateResourcePoolResponseResourcePoolGetSpaceArgType = ResourcePoolSpace +type UpdateResourcePoolResponseResourcePoolGetSpaceRetType = ResourcePoolSpace + +func getUpdateResourcePoolResponseResourcePoolGetSpaceAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetSpaceAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetSpaceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetSpaceAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetSpaceAttributeType, val UpdateResourcePoolResponseResourcePoolGetSpaceRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isNotNullableString +type UpdateResourcePoolResponseResourcePoolGetStateAttributeType = *string + +func getUpdateResourcePoolResponseResourcePoolGetStateAttributeTypeOk(arg UpdateResourcePoolResponseResourcePoolGetStateAttributeType) (ret UpdateResourcePoolResponseResourcePoolGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateResourcePoolResponseResourcePoolGetStateAttributeType(arg *UpdateResourcePoolResponseResourcePoolGetStateAttributeType, val UpdateResourcePoolResponseResourcePoolGetStateRetType) { + *arg = &val +} + +type UpdateResourcePoolResponseResourcePoolGetStateArgType = string +type UpdateResourcePoolResponseResourcePoolGetStateRetType = string + +// UpdateResourcePoolResponseResourcePool Updated Resource Pool +type UpdateResourcePoolResponseResourcePool struct { + // Name of the respective availability zone + AvailabilityZone UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + // Number of Shares in the Resource Pool + // Can be cast to int32 without loss of precision. + CountShares UpdateResourcePoolResponseResourcePoolGetCountSharesAttributeType `json:"countShares,omitempty"` + CreatedAt UpdateResourcePoolResponseResourcePoolGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // ID of the Resource Pool + Id UpdateResourcePoolResponseResourcePoolGetIdAttributeType `json:"id,omitempty"` + // List of IPs that can mount the Resource Pool in read-only; IPs must have a subnet mask (e.g. \"172.16.0.0/24\" for a range of IPs, or \"172.16.0.250/32\" for a specific IP) + IpAcl UpdateResourcePoolResponseResourcePoolGetIpAclAttributeType `json:"ipAcl,omitempty"` + Labels UpdateResourcePoolResponseResourcePoolGetLabelsAttributeType `json:"labels,omitempty"` + // Mount path of the Resource Pool, used to mount the Resource Pool Note that a Resource Pool can only be mounted in read-only + MountPath UpdateResourcePoolResponseResourcePoolGetMountPathAttributeType `json:"mountPath,omitempty"` + // Name of the Resource Pool + Name UpdateResourcePoolResponseResourcePoolGetNameAttributeType `json:"name,omitempty"` + PerformanceClass UpdateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Time when the performance class can be downgraded again. + PerformanceClassDowngradableAt UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType `json:"performanceClassDowngradableAt,omitempty"` + // Time when the size can be reduced again. + SizeReducibleAt UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType `json:"sizeReducibleAt,omitempty"` + SnapshotSchedule UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType `json:"snapshotSchedule,omitempty"` + // Whether the .snapshot directory is visible when mounting the resource pool. Setting this value to false might prevent you from accessing the snapshots (e.g. for security reasons). Additionally, the access to the snapshots is always controlled by the export policy of the resource pool. That means, if snapshots are visible and the export policy allows for reading the resource pool, then it also allows reading the snapshot of all shares. + SnapshotsAreVisible UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType `json:"snapshotsAreVisible,omitempty"` + Space UpdateResourcePoolResponseResourcePoolGetSpaceAttributeType `json:"space,omitempty"` + // State of the Resource Pool (possible values: [\"pending\", \"creating\", \"created\", \"updating\", \"error\", \"deleting\"]) + State UpdateResourcePoolResponseResourcePoolGetStateAttributeType `json:"state,omitempty"` +} + +// NewUpdateResourcePoolResponseResourcePool instantiates a new UpdateResourcePoolResponseResourcePool 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 NewUpdateResourcePoolResponseResourcePool() *UpdateResourcePoolResponseResourcePool { + this := UpdateResourcePoolResponseResourcePool{} + return &this +} + +// NewUpdateResourcePoolResponseResourcePoolWithDefaults instantiates a new UpdateResourcePoolResponseResourcePool 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 NewUpdateResourcePoolResponseResourcePoolWithDefaults() *UpdateResourcePoolResponseResourcePool { + this := UpdateResourcePoolResponseResourcePool{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetAvailabilityZone() (res UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetAvailabilityZoneOk() (ret UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *UpdateResourcePoolResponseResourcePool) SetAvailabilityZone(v UpdateResourcePoolResponseResourcePoolGetAvailabilityZoneRetType) { + setUpdateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetCountShares returns the CountShares field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetCountShares() (res UpdateResourcePoolResponseResourcePoolGetCountSharesRetType) { + res, _ = o.GetCountSharesOk() + return +} + +// GetCountSharesOk returns a tuple with the CountShares field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetCountSharesOk() (ret UpdateResourcePoolResponseResourcePoolGetCountSharesRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetCountSharesAttributeTypeOk(o.CountShares) +} + +// HasCountShares returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasCountShares() bool { + _, ok := o.GetCountSharesOk() + return ok +} + +// SetCountShares gets a reference to the given int64 and assigns it to the CountShares field. +func (o *UpdateResourcePoolResponseResourcePool) SetCountShares(v UpdateResourcePoolResponseResourcePoolGetCountSharesRetType) { + setUpdateResourcePoolResponseResourcePoolGetCountSharesAttributeType(&o.CountShares, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetCreatedAt() (res UpdateResourcePoolResponseResourcePoolGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetCreatedAtOk() (ret UpdateResourcePoolResponseResourcePoolGetCreatedAtRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UpdateResourcePoolResponseResourcePool) SetCreatedAt(v UpdateResourcePoolResponseResourcePoolGetCreatedAtRetType) { + setUpdateResourcePoolResponseResourcePoolGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetId() (res UpdateResourcePoolResponseResourcePoolGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetIdOk() (ret UpdateResourcePoolResponseResourcePoolGetIdRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdateResourcePoolResponseResourcePool) SetId(v UpdateResourcePoolResponseResourcePoolGetIdRetType) { + setUpdateResourcePoolResponseResourcePoolGetIdAttributeType(&o.Id, v) +} + +// GetIpAcl returns the IpAcl field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetIpAcl() (res UpdateResourcePoolResponseResourcePoolGetIpAclRetType) { + res, _ = o.GetIpAclOk() + return +} + +// GetIpAclOk returns a tuple with the IpAcl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetIpAclOk() (ret UpdateResourcePoolResponseResourcePoolGetIpAclRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetIpAclAttributeTypeOk(o.IpAcl) +} + +// HasIpAcl returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasIpAcl() bool { + _, ok := o.GetIpAclOk() + return ok +} + +// SetIpAcl gets a reference to the given []string and assigns it to the IpAcl field. +func (o *UpdateResourcePoolResponseResourcePool) SetIpAcl(v UpdateResourcePoolResponseResourcePoolGetIpAclRetType) { + setUpdateResourcePoolResponseResourcePoolGetIpAclAttributeType(&o.IpAcl, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetLabels() (res UpdateResourcePoolResponseResourcePoolGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetLabelsOk() (ret UpdateResourcePoolResponseResourcePoolGetLabelsRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateResourcePoolResponseResourcePool) SetLabels(v UpdateResourcePoolResponseResourcePoolGetLabelsRetType) { + setUpdateResourcePoolResponseResourcePoolGetLabelsAttributeType(&o.Labels, v) +} + +// GetMountPath returns the MountPath field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetMountPath() (res UpdateResourcePoolResponseResourcePoolGetMountPathRetType) { + res, _ = o.GetMountPathOk() + return +} + +// GetMountPathOk returns a tuple with the MountPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetMountPathOk() (ret UpdateResourcePoolResponseResourcePoolGetMountPathRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetMountPathAttributeTypeOk(o.MountPath) +} + +// HasMountPath returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasMountPath() bool { + _, ok := o.GetMountPathOk() + return ok +} + +// SetMountPath gets a reference to the given string and assigns it to the MountPath field. +func (o *UpdateResourcePoolResponseResourcePool) SetMountPath(v UpdateResourcePoolResponseResourcePoolGetMountPathRetType) { + setUpdateResourcePoolResponseResourcePoolGetMountPathAttributeType(&o.MountPath, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetName() (res UpdateResourcePoolResponseResourcePoolGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetNameOk() (ret UpdateResourcePoolResponseResourcePoolGetNameRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateResourcePoolResponseResourcePool) SetName(v UpdateResourcePoolResponseResourcePoolGetNameRetType) { + setUpdateResourcePoolResponseResourcePoolGetNameAttributeType(&o.Name, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetPerformanceClass() (res UpdateResourcePoolResponseResourcePoolGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetPerformanceClassOk() (ret UpdateResourcePoolResponseResourcePoolGetPerformanceClassRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given ResourcePoolPerformanceClass and assigns it to the PerformanceClass field. +func (o *UpdateResourcePoolResponseResourcePool) SetPerformanceClass(v UpdateResourcePoolResponseResourcePoolGetPerformanceClassRetType) { + setUpdateResourcePoolResponseResourcePoolGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetPerformanceClassDowngradableAt returns the PerformanceClassDowngradableAt field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetPerformanceClassDowngradableAt() (res UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType) { + res, _ = o.GetPerformanceClassDowngradableAtOk() + return +} + +// GetPerformanceClassDowngradableAtOk returns a tuple with the PerformanceClassDowngradableAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetPerformanceClassDowngradableAtOk() (ret UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(o.PerformanceClassDowngradableAt) +} + +// HasPerformanceClassDowngradableAt returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasPerformanceClassDowngradableAt() bool { + _, ok := o.GetPerformanceClassDowngradableAtOk() + return ok +} + +// SetPerformanceClassDowngradableAt gets a reference to the given time.Time and assigns it to the PerformanceClassDowngradableAt field. +func (o *UpdateResourcePoolResponseResourcePool) SetPerformanceClassDowngradableAt(v UpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtRetType) { + setUpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeType(&o.PerformanceClassDowngradableAt, v) +} + +// GetSizeReducibleAt returns the SizeReducibleAt field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetSizeReducibleAt() (res UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType) { + res, _ = o.GetSizeReducibleAtOk() + return +} + +// GetSizeReducibleAtOk returns a tuple with the SizeReducibleAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetSizeReducibleAtOk() (ret UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeTypeOk(o.SizeReducibleAt) +} + +// HasSizeReducibleAt returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasSizeReducibleAt() bool { + _, ok := o.GetSizeReducibleAtOk() + return ok +} + +// SetSizeReducibleAt gets a reference to the given time.Time and assigns it to the SizeReducibleAt field. +func (o *UpdateResourcePoolResponseResourcePool) SetSizeReducibleAt(v UpdateResourcePoolResponseResourcePoolGetSizeReducibleAtRetType) { + setUpdateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeType(&o.SizeReducibleAt, v) +} + +// GetSnapshotSchedule returns the SnapshotSchedule field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetSnapshotSchedule() (res UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType) { + res, _ = o.GetSnapshotScheduleOk() + return +} + +// GetSnapshotScheduleOk returns a tuple with the SnapshotSchedule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetSnapshotScheduleOk() (ret UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeTypeOk(o.SnapshotSchedule) +} + +// HasSnapshotSchedule returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasSnapshotSchedule() bool { + _, ok := o.GetSnapshotScheduleOk() + return ok +} + +// SetSnapshotSchedule gets a reference to the given SnapshotSchedule and assigns it to the SnapshotSchedule field. +func (o *UpdateResourcePoolResponseResourcePool) SetSnapshotSchedule(v UpdateResourcePoolResponseResourcePoolGetSnapshotScheduleRetType) { + setUpdateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeType(&o.SnapshotSchedule, v) +} + +// GetSnapshotsAreVisible returns the SnapshotsAreVisible field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetSnapshotsAreVisible() (res UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType) { + res, _ = o.GetSnapshotsAreVisibleOk() + return +} + +// GetSnapshotsAreVisibleOk returns a tuple with the SnapshotsAreVisible field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetSnapshotsAreVisibleOk() (ret UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible) +} + +// HasSnapshotsAreVisible returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasSnapshotsAreVisible() bool { + _, ok := o.GetSnapshotsAreVisibleOk() + return ok +} + +// SetSnapshotsAreVisible gets a reference to the given bool and assigns it to the SnapshotsAreVisible field. +func (o *UpdateResourcePoolResponseResourcePool) SetSnapshotsAreVisible(v UpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleRetType) { + setUpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeType(&o.SnapshotsAreVisible, v) +} + +// GetSpace returns the Space field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetSpace() (res UpdateResourcePoolResponseResourcePoolGetSpaceRetType) { + res, _ = o.GetSpaceOk() + return +} + +// GetSpaceOk returns a tuple with the Space field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetSpaceOk() (ret UpdateResourcePoolResponseResourcePoolGetSpaceRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetSpaceAttributeTypeOk(o.Space) +} + +// HasSpace returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasSpace() bool { + _, ok := o.GetSpaceOk() + return ok +} + +// SetSpace gets a reference to the given ResourcePoolSpace and assigns it to the Space field. +func (o *UpdateResourcePoolResponseResourcePool) SetSpace(v UpdateResourcePoolResponseResourcePoolGetSpaceRetType) { + setUpdateResourcePoolResponseResourcePoolGetSpaceAttributeType(&o.Space, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *UpdateResourcePoolResponseResourcePool) GetState() (res UpdateResourcePoolResponseResourcePoolGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateResourcePoolResponseResourcePool) GetStateOk() (ret UpdateResourcePoolResponseResourcePoolGetStateRetType, ok bool) { + return getUpdateResourcePoolResponseResourcePoolGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *UpdateResourcePoolResponseResourcePool) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *UpdateResourcePoolResponseResourcePool) SetState(v UpdateResourcePoolResponseResourcePoolGetStateRetType) { + setUpdateResourcePoolResponseResourcePoolGetStateAttributeType(&o.State, v) +} + +func (o UpdateResourcePoolResponseResourcePool) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateResourcePoolResponseResourcePoolGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetCountSharesAttributeTypeOk(o.CountShares); ok { + toSerialize["CountShares"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetIpAclAttributeTypeOk(o.IpAcl); ok { + toSerialize["IpAcl"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetMountPathAttributeTypeOk(o.MountPath); ok { + toSerialize["MountPath"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetPerformanceClassDowngradableAtAttributeTypeOk(o.PerformanceClassDowngradableAt); ok { + toSerialize["PerformanceClassDowngradableAt"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetSizeReducibleAtAttributeTypeOk(o.SizeReducibleAt); ok { + toSerialize["SizeReducibleAt"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetSnapshotScheduleAttributeTypeOk(o.SnapshotSchedule); ok { + toSerialize["SnapshotSchedule"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolgetSnapshotsAreVisibleAttributeTypeOk(o.SnapshotsAreVisible); ok { + toSerialize["SnapshotsAreVisible"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetSpaceAttributeTypeOk(o.Space); ok { + toSerialize["Space"] = val + } + if val, ok := getUpdateResourcePoolResponseResourcePoolGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableUpdateResourcePoolResponseResourcePool struct { + value *UpdateResourcePoolResponseResourcePool + isSet bool +} + +func (v NullableUpdateResourcePoolResponseResourcePool) Get() *UpdateResourcePoolResponseResourcePool { + return v.value +} + +func (v *NullableUpdateResourcePoolResponseResourcePool) Set(val *UpdateResourcePoolResponseResourcePool) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateResourcePoolResponseResourcePool) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateResourcePoolResponseResourcePool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateResourcePoolResponseResourcePool(val *UpdateResourcePoolResponseResourcePool) *NullableUpdateResourcePoolResponseResourcePool { + return &NullableUpdateResourcePoolResponseResourcePool{value: val, isSet: true} +} + +func (v NullableUpdateResourcePoolResponseResourcePool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateResourcePoolResponseResourcePool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_update_resource_pool_response_resource_pool_test.go b/pkg/sfsbeta/model_update_resource_pool_response_resource_pool_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_update_resource_pool_response_resource_pool_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_update_resource_pool_response_test.go b/pkg/sfsbeta/model_update_resource_pool_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_update_resource_pool_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_update_share_export_policy_body_rule.go b/pkg/sfsbeta/model_update_share_export_policy_body_rule.go new file mode 100644 index 00000000..0e0d392b --- /dev/null +++ b/pkg/sfsbeta/model_update_share_export_policy_body_rule.go @@ -0,0 +1,391 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the UpdateShareExportPolicyBodyRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateShareExportPolicyBodyRule{} + +/* + types and functions for description +*/ + +// isNullableString +type UpdateShareExportPolicyBodyRuleGetDescriptionAttributeType = *NullableString + +func getUpdateShareExportPolicyBodyRuleGetDescriptionAttributeTypeOk(arg UpdateShareExportPolicyBodyRuleGetDescriptionAttributeType) (ret UpdateShareExportPolicyBodyRuleGetDescriptionRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setUpdateShareExportPolicyBodyRuleGetDescriptionAttributeType(arg *UpdateShareExportPolicyBodyRuleGetDescriptionAttributeType, val UpdateShareExportPolicyBodyRuleGetDescriptionRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type UpdateShareExportPolicyBodyRuleGetDescriptionArgType = *string +type UpdateShareExportPolicyBodyRuleGetDescriptionRetType = *string + +/* + types and functions for ipAcl +*/ + +// isArray +type UpdateShareExportPolicyBodyRuleGetIpAclAttributeType = *[]string +type UpdateShareExportPolicyBodyRuleGetIpAclArgType = []string +type UpdateShareExportPolicyBodyRuleGetIpAclRetType = []string + +func getUpdateShareExportPolicyBodyRuleGetIpAclAttributeTypeOk(arg UpdateShareExportPolicyBodyRuleGetIpAclAttributeType) (ret UpdateShareExportPolicyBodyRuleGetIpAclRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareExportPolicyBodyRuleGetIpAclAttributeType(arg *UpdateShareExportPolicyBodyRuleGetIpAclAttributeType, val UpdateShareExportPolicyBodyRuleGetIpAclRetType) { + *arg = &val +} + +/* + types and functions for order +*/ + +// isInteger +type UpdateShareExportPolicyBodyRuleGetOrderAttributeType = *int64 +type UpdateShareExportPolicyBodyRuleGetOrderArgType = int64 +type UpdateShareExportPolicyBodyRuleGetOrderRetType = int64 + +func getUpdateShareExportPolicyBodyRuleGetOrderAttributeTypeOk(arg UpdateShareExportPolicyBodyRuleGetOrderAttributeType) (ret UpdateShareExportPolicyBodyRuleGetOrderRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareExportPolicyBodyRuleGetOrderAttributeType(arg *UpdateShareExportPolicyBodyRuleGetOrderAttributeType, val UpdateShareExportPolicyBodyRuleGetOrderRetType) { + *arg = &val +} + +/* + types and functions for readOnly +*/ + +// isBoolean +type UpdateShareExportPolicyBodyRulegetReadOnlyAttributeType = *bool +type UpdateShareExportPolicyBodyRulegetReadOnlyArgType = bool +type UpdateShareExportPolicyBodyRulegetReadOnlyRetType = bool + +func getUpdateShareExportPolicyBodyRulegetReadOnlyAttributeTypeOk(arg UpdateShareExportPolicyBodyRulegetReadOnlyAttributeType) (ret UpdateShareExportPolicyBodyRulegetReadOnlyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareExportPolicyBodyRulegetReadOnlyAttributeType(arg *UpdateShareExportPolicyBodyRulegetReadOnlyAttributeType, val UpdateShareExportPolicyBodyRulegetReadOnlyRetType) { + *arg = &val +} + +/* + types and functions for setUuid +*/ + +// isBoolean +type UpdateShareExportPolicyBodyRulegetSetUuidAttributeType = *bool +type UpdateShareExportPolicyBodyRulegetSetUuidArgType = bool +type UpdateShareExportPolicyBodyRulegetSetUuidRetType = bool + +func getUpdateShareExportPolicyBodyRulegetSetUuidAttributeTypeOk(arg UpdateShareExportPolicyBodyRulegetSetUuidAttributeType) (ret UpdateShareExportPolicyBodyRulegetSetUuidRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareExportPolicyBodyRulegetSetUuidAttributeType(arg *UpdateShareExportPolicyBodyRulegetSetUuidAttributeType, val UpdateShareExportPolicyBodyRulegetSetUuidRetType) { + *arg = &val +} + +/* + types and functions for superUser +*/ + +// isBoolean +type UpdateShareExportPolicyBodyRulegetSuperUserAttributeType = *bool +type UpdateShareExportPolicyBodyRulegetSuperUserArgType = bool +type UpdateShareExportPolicyBodyRulegetSuperUserRetType = bool + +func getUpdateShareExportPolicyBodyRulegetSuperUserAttributeTypeOk(arg UpdateShareExportPolicyBodyRulegetSuperUserAttributeType) (ret UpdateShareExportPolicyBodyRulegetSuperUserRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareExportPolicyBodyRulegetSuperUserAttributeType(arg *UpdateShareExportPolicyBodyRulegetSuperUserAttributeType, val UpdateShareExportPolicyBodyRulegetSuperUserRetType) { + *arg = &val +} + +// UpdateShareExportPolicyBodyRule struct for UpdateShareExportPolicyBodyRule +type UpdateShareExportPolicyBodyRule struct { + // Description of the Rule (optional) + Description UpdateShareExportPolicyBodyRuleGetDescriptionAttributeType `json:"description,omitempty"` + // IP access control list, where IPs must have a subnet mask (e.g. \"172.16.0.0/24\" for a range of IPs, or \"172.16.0.250/32\" for a specific IP) This array cannot be empty + IpAcl UpdateShareExportPolicyBodyRuleGetIpAclAttributeType `json:"ipAcl,omitempty"` + // Order of the rule within a Share Export Policy. The order is used so that when a client IP matches multiple rules, the first rule is applied This field must be set + // Can be cast to int32 without loss of precision. + Order UpdateShareExportPolicyBodyRuleGetOrderAttributeType `json:"order,omitempty"` + // Flag to indicate if client IPs matching this rule can only mount the share in read only mode Default: false + ReadOnly UpdateShareExportPolicyBodyRulegetReadOnlyAttributeType `json:"readOnly,omitempty"` + // Flag to honor set UUID Default: false + SetUuid UpdateShareExportPolicyBodyRulegetSetUuidAttributeType `json:"setUuid,omitempty"` + // Flag to indicate if client IPs matching this rule have root access on the Share Default: true + SuperUser UpdateShareExportPolicyBodyRulegetSuperUserAttributeType `json:"superUser,omitempty"` +} + +// NewUpdateShareExportPolicyBodyRule instantiates a new UpdateShareExportPolicyBodyRule 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 NewUpdateShareExportPolicyBodyRule() *UpdateShareExportPolicyBodyRule { + this := UpdateShareExportPolicyBodyRule{} + return &this +} + +// NewUpdateShareExportPolicyBodyRuleWithDefaults instantiates a new UpdateShareExportPolicyBodyRule 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 NewUpdateShareExportPolicyBodyRuleWithDefaults() *UpdateShareExportPolicyBodyRule { + this := UpdateShareExportPolicyBodyRule{} + var readOnly bool = false + this.ReadOnly = &readOnly + var setUuid bool = false + this.SetUuid = &setUuid + var superUser bool = true + this.SuperUser = &superUser + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateShareExportPolicyBodyRule) GetDescription() (res UpdateShareExportPolicyBodyRuleGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// 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 *UpdateShareExportPolicyBodyRule) GetDescriptionOk() (ret UpdateShareExportPolicyBodyRuleGetDescriptionRetType, ok bool) { + return getUpdateShareExportPolicyBodyRuleGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateShareExportPolicyBodyRule) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateShareExportPolicyBodyRule) SetDescription(v UpdateShareExportPolicyBodyRuleGetDescriptionRetType) { + setUpdateShareExportPolicyBodyRuleGetDescriptionAttributeType(&o.Description, v) +} + +// SetDescriptionNil sets the value for Description to be an explicit nil +func (o *UpdateShareExportPolicyBodyRule) SetDescriptionNil() { + o.Description = nil +} + +// UnsetDescription ensures that no value is present for Description, not even an explicit nil +func (o *UpdateShareExportPolicyBodyRule) UnsetDescription() { + o.Description = nil +} + +// GetIpAcl returns the IpAcl field value if set, zero value otherwise. +func (o *UpdateShareExportPolicyBodyRule) GetIpAcl() (res UpdateShareExportPolicyBodyRuleGetIpAclRetType) { + res, _ = o.GetIpAclOk() + return +} + +// GetIpAclOk returns a tuple with the IpAcl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareExportPolicyBodyRule) GetIpAclOk() (ret UpdateShareExportPolicyBodyRuleGetIpAclRetType, ok bool) { + return getUpdateShareExportPolicyBodyRuleGetIpAclAttributeTypeOk(o.IpAcl) +} + +// HasIpAcl returns a boolean if a field has been set. +func (o *UpdateShareExportPolicyBodyRule) HasIpAcl() bool { + _, ok := o.GetIpAclOk() + return ok +} + +// SetIpAcl gets a reference to the given []string and assigns it to the IpAcl field. +func (o *UpdateShareExportPolicyBodyRule) SetIpAcl(v UpdateShareExportPolicyBodyRuleGetIpAclRetType) { + setUpdateShareExportPolicyBodyRuleGetIpAclAttributeType(&o.IpAcl, v) +} + +// GetOrder returns the Order field value if set, zero value otherwise. +func (o *UpdateShareExportPolicyBodyRule) GetOrder() (res UpdateShareExportPolicyBodyRuleGetOrderRetType) { + res, _ = o.GetOrderOk() + return +} + +// GetOrderOk returns a tuple with the Order field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareExportPolicyBodyRule) GetOrderOk() (ret UpdateShareExportPolicyBodyRuleGetOrderRetType, ok bool) { + return getUpdateShareExportPolicyBodyRuleGetOrderAttributeTypeOk(o.Order) +} + +// HasOrder returns a boolean if a field has been set. +func (o *UpdateShareExportPolicyBodyRule) HasOrder() bool { + _, ok := o.GetOrderOk() + return ok +} + +// SetOrder gets a reference to the given int64 and assigns it to the Order field. +func (o *UpdateShareExportPolicyBodyRule) SetOrder(v UpdateShareExportPolicyBodyRuleGetOrderRetType) { + setUpdateShareExportPolicyBodyRuleGetOrderAttributeType(&o.Order, v) +} + +// GetReadOnly returns the ReadOnly field value if set, zero value otherwise. +func (o *UpdateShareExportPolicyBodyRule) GetReadOnly() (res UpdateShareExportPolicyBodyRulegetReadOnlyRetType) { + res, _ = o.GetReadOnlyOk() + return +} + +// GetReadOnlyOk returns a tuple with the ReadOnly field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareExportPolicyBodyRule) GetReadOnlyOk() (ret UpdateShareExportPolicyBodyRulegetReadOnlyRetType, ok bool) { + return getUpdateShareExportPolicyBodyRulegetReadOnlyAttributeTypeOk(o.ReadOnly) +} + +// HasReadOnly returns a boolean if a field has been set. +func (o *UpdateShareExportPolicyBodyRule) HasReadOnly() bool { + _, ok := o.GetReadOnlyOk() + return ok +} + +// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field. +func (o *UpdateShareExportPolicyBodyRule) SetReadOnly(v UpdateShareExportPolicyBodyRulegetReadOnlyRetType) { + setUpdateShareExportPolicyBodyRulegetReadOnlyAttributeType(&o.ReadOnly, v) +} + +// GetSetUuid returns the SetUuid field value if set, zero value otherwise. +func (o *UpdateShareExportPolicyBodyRule) GetSetUuid() (res UpdateShareExportPolicyBodyRulegetSetUuidRetType) { + res, _ = o.GetSetUuidOk() + return +} + +// GetSetUuidOk returns a tuple with the SetUuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareExportPolicyBodyRule) GetSetUuidOk() (ret UpdateShareExportPolicyBodyRulegetSetUuidRetType, ok bool) { + return getUpdateShareExportPolicyBodyRulegetSetUuidAttributeTypeOk(o.SetUuid) +} + +// HasSetUuid returns a boolean if a field has been set. +func (o *UpdateShareExportPolicyBodyRule) HasSetUuid() bool { + _, ok := o.GetSetUuidOk() + return ok +} + +// SetSetUuid gets a reference to the given bool and assigns it to the SetUuid field. +func (o *UpdateShareExportPolicyBodyRule) SetSetUuid(v UpdateShareExportPolicyBodyRulegetSetUuidRetType) { + setUpdateShareExportPolicyBodyRulegetSetUuidAttributeType(&o.SetUuid, v) +} + +// GetSuperUser returns the SuperUser field value if set, zero value otherwise. +func (o *UpdateShareExportPolicyBodyRule) GetSuperUser() (res UpdateShareExportPolicyBodyRulegetSuperUserRetType) { + res, _ = o.GetSuperUserOk() + return +} + +// GetSuperUserOk returns a tuple with the SuperUser field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareExportPolicyBodyRule) GetSuperUserOk() (ret UpdateShareExportPolicyBodyRulegetSuperUserRetType, ok bool) { + return getUpdateShareExportPolicyBodyRulegetSuperUserAttributeTypeOk(o.SuperUser) +} + +// HasSuperUser returns a boolean if a field has been set. +func (o *UpdateShareExportPolicyBodyRule) HasSuperUser() bool { + _, ok := o.GetSuperUserOk() + return ok +} + +// SetSuperUser gets a reference to the given bool and assigns it to the SuperUser field. +func (o *UpdateShareExportPolicyBodyRule) SetSuperUser(v UpdateShareExportPolicyBodyRulegetSuperUserRetType) { + setUpdateShareExportPolicyBodyRulegetSuperUserAttributeType(&o.SuperUser, v) +} + +func (o UpdateShareExportPolicyBodyRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateShareExportPolicyBodyRuleGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateShareExportPolicyBodyRuleGetIpAclAttributeTypeOk(o.IpAcl); ok { + toSerialize["IpAcl"] = val + } + if val, ok := getUpdateShareExportPolicyBodyRuleGetOrderAttributeTypeOk(o.Order); ok { + toSerialize["Order"] = val + } + if val, ok := getUpdateShareExportPolicyBodyRulegetReadOnlyAttributeTypeOk(o.ReadOnly); ok { + toSerialize["ReadOnly"] = val + } + if val, ok := getUpdateShareExportPolicyBodyRulegetSetUuidAttributeTypeOk(o.SetUuid); ok { + toSerialize["SetUuid"] = val + } + if val, ok := getUpdateShareExportPolicyBodyRulegetSuperUserAttributeTypeOk(o.SuperUser); ok { + toSerialize["SuperUser"] = val + } + return toSerialize, nil +} + +type NullableUpdateShareExportPolicyBodyRule struct { + value *UpdateShareExportPolicyBodyRule + isSet bool +} + +func (v NullableUpdateShareExportPolicyBodyRule) Get() *UpdateShareExportPolicyBodyRule { + return v.value +} + +func (v *NullableUpdateShareExportPolicyBodyRule) Set(val *UpdateShareExportPolicyBodyRule) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateShareExportPolicyBodyRule) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateShareExportPolicyBodyRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateShareExportPolicyBodyRule(val *UpdateShareExportPolicyBodyRule) *NullableUpdateShareExportPolicyBodyRule { + return &NullableUpdateShareExportPolicyBodyRule{value: val, isSet: true} +} + +func (v NullableUpdateShareExportPolicyBodyRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateShareExportPolicyBodyRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_update_share_export_policy_body_rule_test.go b/pkg/sfsbeta/model_update_share_export_policy_body_rule_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_update_share_export_policy_body_rule_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_update_share_export_policy_payload.go b/pkg/sfsbeta/model_update_share_export_policy_payload.go new file mode 100644 index 00000000..643df2da --- /dev/null +++ b/pkg/sfsbeta/model_update_share_export_policy_payload.go @@ -0,0 +1,177 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the UpdateShareExportPolicyPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateShareExportPolicyPayload{} + +/* + types and functions for labels +*/ + +// isContainer +type UpdateShareExportPolicyPayloadGetLabelsAttributeType = *map[string]string +type UpdateShareExportPolicyPayloadGetLabelsArgType = map[string]string +type UpdateShareExportPolicyPayloadGetLabelsRetType = map[string]string + +func getUpdateShareExportPolicyPayloadGetLabelsAttributeTypeOk(arg UpdateShareExportPolicyPayloadGetLabelsAttributeType) (ret UpdateShareExportPolicyPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareExportPolicyPayloadGetLabelsAttributeType(arg *UpdateShareExportPolicyPayloadGetLabelsAttributeType, val UpdateShareExportPolicyPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for rules +*/ + +// isArray +type UpdateShareExportPolicyPayloadGetRulesAttributeType = *[]UpdateShareExportPolicyBodyRule +type UpdateShareExportPolicyPayloadGetRulesArgType = *[]UpdateShareExportPolicyBodyRule +type UpdateShareExportPolicyPayloadGetRulesRetType = *[]UpdateShareExportPolicyBodyRule + +func getUpdateShareExportPolicyPayloadGetRulesAttributeTypeOk(arg UpdateShareExportPolicyPayloadGetRulesAttributeType) (ret UpdateShareExportPolicyPayloadGetRulesRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setUpdateShareExportPolicyPayloadGetRulesAttributeType(arg *UpdateShareExportPolicyPayloadGetRulesAttributeType, val UpdateShareExportPolicyPayloadGetRulesRetType) { + *arg = val +} + +// UpdateShareExportPolicyPayload struct for UpdateShareExportPolicyPayload +type UpdateShareExportPolicyPayload struct { + // An optional object that represents the labels associated with the share export policy keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels UpdateShareExportPolicyPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // List of rules of the Share Export Policy. The order of the rules within the array does not matter - what matters is the field \"order\" within each rule. The whole set of rules needs to be sent in the same request, e.g. if 1 rule is sent, the share export policy will have just that 1 rule, as opposed to extending the existing set of rules with the 1 rule that was sent Important note: the array of rules passed always overwrites the rule array (i.e. sending an empty array removes all rules) + Rules UpdateShareExportPolicyPayloadGetRulesAttributeType `json:"rules,omitempty"` +} + +// NewUpdateShareExportPolicyPayload instantiates a new UpdateShareExportPolicyPayload 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 NewUpdateShareExportPolicyPayload() *UpdateShareExportPolicyPayload { + this := UpdateShareExportPolicyPayload{} + return &this +} + +// NewUpdateShareExportPolicyPayloadWithDefaults instantiates a new UpdateShareExportPolicyPayload 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 NewUpdateShareExportPolicyPayloadWithDefaults() *UpdateShareExportPolicyPayload { + this := UpdateShareExportPolicyPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateShareExportPolicyPayload) GetLabels() (res UpdateShareExportPolicyPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareExportPolicyPayload) GetLabelsOk() (ret UpdateShareExportPolicyPayloadGetLabelsRetType, ok bool) { + return getUpdateShareExportPolicyPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateShareExportPolicyPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateShareExportPolicyPayload) SetLabels(v UpdateShareExportPolicyPayloadGetLabelsRetType) { + setUpdateShareExportPolicyPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateShareExportPolicyPayload) GetRules() (res UpdateShareExportPolicyPayloadGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// 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 *UpdateShareExportPolicyPayload) GetRulesOk() (ret UpdateShareExportPolicyPayloadGetRulesRetType, ok bool) { + return getUpdateShareExportPolicyPayloadGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *UpdateShareExportPolicyPayload) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given []UpdateShareExportPolicyBodyRule and assigns it to the Rules field. +func (o *UpdateShareExportPolicyPayload) SetRules(v UpdateShareExportPolicyPayloadGetRulesRetType) { + setUpdateShareExportPolicyPayloadGetRulesAttributeType(&o.Rules, v) +} + +func (o UpdateShareExportPolicyPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateShareExportPolicyPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateShareExportPolicyPayloadGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableUpdateShareExportPolicyPayload struct { + value *UpdateShareExportPolicyPayload + isSet bool +} + +func (v NullableUpdateShareExportPolicyPayload) Get() *UpdateShareExportPolicyPayload { + return v.value +} + +func (v *NullableUpdateShareExportPolicyPayload) Set(val *UpdateShareExportPolicyPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateShareExportPolicyPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateShareExportPolicyPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateShareExportPolicyPayload(val *UpdateShareExportPolicyPayload) *NullableUpdateShareExportPolicyPayload { + return &NullableUpdateShareExportPolicyPayload{value: val, isSet: true} +} + +func (v NullableUpdateShareExportPolicyPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateShareExportPolicyPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_update_share_export_policy_payload_test.go b/pkg/sfsbeta/model_update_share_export_policy_payload_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_update_share_export_policy_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_update_share_export_policy_response.go b/pkg/sfsbeta/model_update_share_export_policy_response.go new file mode 100644 index 00000000..e5814abf --- /dev/null +++ b/pkg/sfsbeta/model_update_share_export_policy_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the UpdateShareExportPolicyResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateShareExportPolicyResponse{} + +/* + types and functions for shareExportPolicy +*/ + +// isModel +type UpdateShareExportPolicyResponseGetShareExportPolicyAttributeType = *ShareExportPolicy +type UpdateShareExportPolicyResponseGetShareExportPolicyArgType = ShareExportPolicy +type UpdateShareExportPolicyResponseGetShareExportPolicyRetType = ShareExportPolicy + +func getUpdateShareExportPolicyResponseGetShareExportPolicyAttributeTypeOk(arg UpdateShareExportPolicyResponseGetShareExportPolicyAttributeType) (ret UpdateShareExportPolicyResponseGetShareExportPolicyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareExportPolicyResponseGetShareExportPolicyAttributeType(arg *UpdateShareExportPolicyResponseGetShareExportPolicyAttributeType, val UpdateShareExportPolicyResponseGetShareExportPolicyRetType) { + *arg = &val +} + +// UpdateShareExportPolicyResponse struct for UpdateShareExportPolicyResponse +type UpdateShareExportPolicyResponse struct { + ShareExportPolicy UpdateShareExportPolicyResponseGetShareExportPolicyAttributeType `json:"shareExportPolicy,omitempty"` +} + +// NewUpdateShareExportPolicyResponse instantiates a new UpdateShareExportPolicyResponse 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 NewUpdateShareExportPolicyResponse() *UpdateShareExportPolicyResponse { + this := UpdateShareExportPolicyResponse{} + return &this +} + +// NewUpdateShareExportPolicyResponseWithDefaults instantiates a new UpdateShareExportPolicyResponse 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 NewUpdateShareExportPolicyResponseWithDefaults() *UpdateShareExportPolicyResponse { + this := UpdateShareExportPolicyResponse{} + return &this +} + +// GetShareExportPolicy returns the ShareExportPolicy field value if set, zero value otherwise. +func (o *UpdateShareExportPolicyResponse) GetShareExportPolicy() (res UpdateShareExportPolicyResponseGetShareExportPolicyRetType) { + res, _ = o.GetShareExportPolicyOk() + return +} + +// GetShareExportPolicyOk returns a tuple with the ShareExportPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareExportPolicyResponse) GetShareExportPolicyOk() (ret UpdateShareExportPolicyResponseGetShareExportPolicyRetType, ok bool) { + return getUpdateShareExportPolicyResponseGetShareExportPolicyAttributeTypeOk(o.ShareExportPolicy) +} + +// HasShareExportPolicy returns a boolean if a field has been set. +func (o *UpdateShareExportPolicyResponse) HasShareExportPolicy() bool { + _, ok := o.GetShareExportPolicyOk() + return ok +} + +// SetShareExportPolicy gets a reference to the given ShareExportPolicy and assigns it to the ShareExportPolicy field. +func (o *UpdateShareExportPolicyResponse) SetShareExportPolicy(v UpdateShareExportPolicyResponseGetShareExportPolicyRetType) { + setUpdateShareExportPolicyResponseGetShareExportPolicyAttributeType(&o.ShareExportPolicy, v) +} + +func (o UpdateShareExportPolicyResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateShareExportPolicyResponseGetShareExportPolicyAttributeTypeOk(o.ShareExportPolicy); ok { + toSerialize["ShareExportPolicy"] = val + } + return toSerialize, nil +} + +type NullableUpdateShareExportPolicyResponse struct { + value *UpdateShareExportPolicyResponse + isSet bool +} + +func (v NullableUpdateShareExportPolicyResponse) Get() *UpdateShareExportPolicyResponse { + return v.value +} + +func (v *NullableUpdateShareExportPolicyResponse) Set(val *UpdateShareExportPolicyResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateShareExportPolicyResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateShareExportPolicyResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateShareExportPolicyResponse(val *UpdateShareExportPolicyResponse) *NullableUpdateShareExportPolicyResponse { + return &NullableUpdateShareExportPolicyResponse{value: val, isSet: true} +} + +func (v NullableUpdateShareExportPolicyResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateShareExportPolicyResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_update_share_export_policy_response_test.go b/pkg/sfsbeta/model_update_share_export_policy_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_update_share_export_policy_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_update_share_payload.go b/pkg/sfsbeta/model_update_share_payload.go new file mode 100644 index 00000000..39e2df62 --- /dev/null +++ b/pkg/sfsbeta/model_update_share_payload.go @@ -0,0 +1,252 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the UpdateSharePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSharePayload{} + +/* + types and functions for exportPolicyName +*/ + +// isNullableString +type UpdateSharePayloadGetExportPolicyNameAttributeType = *NullableString + +func getUpdateSharePayloadGetExportPolicyNameAttributeTypeOk(arg UpdateSharePayloadGetExportPolicyNameAttributeType) (ret UpdateSharePayloadGetExportPolicyNameRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setUpdateSharePayloadGetExportPolicyNameAttributeType(arg *UpdateSharePayloadGetExportPolicyNameAttributeType, val UpdateSharePayloadGetExportPolicyNameRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type UpdateSharePayloadGetExportPolicyNameArgType = *string +type UpdateSharePayloadGetExportPolicyNameRetType = *string + +/* + types and functions for labels +*/ + +// isContainer +type UpdateSharePayloadGetLabelsAttributeType = *map[string]string +type UpdateSharePayloadGetLabelsArgType = map[string]string +type UpdateSharePayloadGetLabelsRetType = map[string]string + +func getUpdateSharePayloadGetLabelsAttributeTypeOk(arg UpdateSharePayloadGetLabelsAttributeType) (ret UpdateSharePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateSharePayloadGetLabelsAttributeType(arg *UpdateSharePayloadGetLabelsAttributeType, val UpdateSharePayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for spaceHardLimitGigabytes +*/ + +// isInteger +type UpdateSharePayloadGetSpaceHardLimitGigabytesAttributeType = *int64 +type UpdateSharePayloadGetSpaceHardLimitGigabytesArgType = *int64 +type UpdateSharePayloadGetSpaceHardLimitGigabytesRetType = *int64 + +func getUpdateSharePayloadGetSpaceHardLimitGigabytesAttributeTypeOk(arg UpdateSharePayloadGetSpaceHardLimitGigabytesAttributeType) (ret UpdateSharePayloadGetSpaceHardLimitGigabytesRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setUpdateSharePayloadGetSpaceHardLimitGigabytesAttributeType(arg *UpdateSharePayloadGetSpaceHardLimitGigabytesAttributeType, val UpdateSharePayloadGetSpaceHardLimitGigabytesRetType) { + *arg = val +} + +// UpdateSharePayload struct for UpdateSharePayload +type UpdateSharePayload struct { + // Name of the Share Export Policy to use in the Share. The behavior depends on the value: - If not set (null): Keep the existing export policy (if any) - If set to empty string (\"\"): Remove the existing export policy - If set to a policy name: Update to use the specified policy, creating a new association if none exists + ExportPolicyName UpdateSharePayloadGetExportPolicyNameAttributeType `json:"exportPolicyName,omitempty"` + // An optional object that represents the labels associated with the share keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels UpdateSharePayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Space hard limit for the Share. If zero, the Share will have access to the full space of the Resource Pool it lives in. (unit: gibibytes) + // Can be cast to int32 without loss of precision. + SpaceHardLimitGigabytes UpdateSharePayloadGetSpaceHardLimitGigabytesAttributeType `json:"spaceHardLimitGigabytes,omitempty"` +} + +// NewUpdateSharePayload instantiates a new UpdateSharePayload 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 NewUpdateSharePayload() *UpdateSharePayload { + this := UpdateSharePayload{} + return &this +} + +// NewUpdateSharePayloadWithDefaults instantiates a new UpdateSharePayload 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 NewUpdateSharePayloadWithDefaults() *UpdateSharePayload { + this := UpdateSharePayload{} + return &this +} + +// GetExportPolicyName returns the ExportPolicyName field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateSharePayload) GetExportPolicyName() (res UpdateSharePayloadGetExportPolicyNameRetType) { + res, _ = o.GetExportPolicyNameOk() + return +} + +// GetExportPolicyNameOk returns a tuple with the ExportPolicyName field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateSharePayload) GetExportPolicyNameOk() (ret UpdateSharePayloadGetExportPolicyNameRetType, ok bool) { + return getUpdateSharePayloadGetExportPolicyNameAttributeTypeOk(o.ExportPolicyName) +} + +// HasExportPolicyName returns a boolean if a field has been set. +func (o *UpdateSharePayload) HasExportPolicyName() bool { + _, ok := o.GetExportPolicyNameOk() + return ok +} + +// SetExportPolicyName gets a reference to the given string and assigns it to the ExportPolicyName field. +func (o *UpdateSharePayload) SetExportPolicyName(v UpdateSharePayloadGetExportPolicyNameRetType) { + setUpdateSharePayloadGetExportPolicyNameAttributeType(&o.ExportPolicyName, v) +} + +// SetExportPolicyNameNil sets the value for ExportPolicyName to be an explicit nil +func (o *UpdateSharePayload) SetExportPolicyNameNil() { + o.ExportPolicyName = nil +} + +// UnsetExportPolicyName ensures that no value is present for ExportPolicyName, not even an explicit nil +func (o *UpdateSharePayload) UnsetExportPolicyName() { + o.ExportPolicyName = nil +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateSharePayload) GetLabels() (res UpdateSharePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateSharePayload) GetLabelsOk() (ret UpdateSharePayloadGetLabelsRetType, ok bool) { + return getUpdateSharePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateSharePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateSharePayload) SetLabels(v UpdateSharePayloadGetLabelsRetType) { + setUpdateSharePayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetSpaceHardLimitGigabytes returns the SpaceHardLimitGigabytes field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateSharePayload) GetSpaceHardLimitGigabytes() (res UpdateSharePayloadGetSpaceHardLimitGigabytesRetType) { + res, _ = o.GetSpaceHardLimitGigabytesOk() + return +} + +// GetSpaceHardLimitGigabytesOk returns a tuple with the SpaceHardLimitGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateSharePayload) GetSpaceHardLimitGigabytesOk() (ret UpdateSharePayloadGetSpaceHardLimitGigabytesRetType, ok bool) { + return getUpdateSharePayloadGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes) +} + +// HasSpaceHardLimitGigabytes returns a boolean if a field has been set. +func (o *UpdateSharePayload) HasSpaceHardLimitGigabytes() bool { + _, ok := o.GetSpaceHardLimitGigabytesOk() + return ok +} + +// SetSpaceHardLimitGigabytes gets a reference to the given int64 and assigns it to the SpaceHardLimitGigabytes field. +func (o *UpdateSharePayload) SetSpaceHardLimitGigabytes(v UpdateSharePayloadGetSpaceHardLimitGigabytesRetType) { + setUpdateSharePayloadGetSpaceHardLimitGigabytesAttributeType(&o.SpaceHardLimitGigabytes, v) +} + +// SetSpaceHardLimitGigabytesNil sets the value for SpaceHardLimitGigabytes to be an explicit nil +func (o *UpdateSharePayload) SetSpaceHardLimitGigabytesNil() { + o.SpaceHardLimitGigabytes = nil +} + +// UnsetSpaceHardLimitGigabytes ensures that no value is present for SpaceHardLimitGigabytes, not even an explicit nil +func (o *UpdateSharePayload) UnsetSpaceHardLimitGigabytes() { + o.SpaceHardLimitGigabytes = nil +} + +func (o UpdateSharePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateSharePayloadGetExportPolicyNameAttributeTypeOk(o.ExportPolicyName); ok { + toSerialize["ExportPolicyName"] = val + } + if val, ok := getUpdateSharePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateSharePayloadGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes); ok { + toSerialize["SpaceHardLimitGigabytes"] = val + } + return toSerialize, nil +} + +type NullableUpdateSharePayload struct { + value *UpdateSharePayload + isSet bool +} + +func (v NullableUpdateSharePayload) Get() *UpdateSharePayload { + return v.value +} + +func (v *NullableUpdateSharePayload) Set(val *UpdateSharePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateSharePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateSharePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateSharePayload(val *UpdateSharePayload) *NullableUpdateSharePayload { + return &NullableUpdateSharePayload{value: val, isSet: true} +} + +func (v NullableUpdateSharePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateSharePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_update_share_payload_test.go b/pkg/sfsbeta/model_update_share_payload_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_update_share_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_update_share_response.go b/pkg/sfsbeta/model_update_share_response.go new file mode 100644 index 00000000..83ffa726 --- /dev/null +++ b/pkg/sfsbeta/model_update_share_response.go @@ -0,0 +1,127 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the UpdateShareResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateShareResponse{} + +/* + types and functions for share +*/ + +// isModel +type UpdateShareResponseGetShareAttributeType = *UpdateShareResponseShare +type UpdateShareResponseGetShareArgType = UpdateShareResponseShare +type UpdateShareResponseGetShareRetType = UpdateShareResponseShare + +func getUpdateShareResponseGetShareAttributeTypeOk(arg UpdateShareResponseGetShareAttributeType) (ret UpdateShareResponseGetShareRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareResponseGetShareAttributeType(arg *UpdateShareResponseGetShareAttributeType, val UpdateShareResponseGetShareRetType) { + *arg = &val +} + +// UpdateShareResponse struct for UpdateShareResponse +type UpdateShareResponse struct { + Share UpdateShareResponseGetShareAttributeType `json:"share,omitempty"` +} + +// NewUpdateShareResponse instantiates a new UpdateShareResponse 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 NewUpdateShareResponse() *UpdateShareResponse { + this := UpdateShareResponse{} + return &this +} + +// NewUpdateShareResponseWithDefaults instantiates a new UpdateShareResponse 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 NewUpdateShareResponseWithDefaults() *UpdateShareResponse { + this := UpdateShareResponse{} + return &this +} + +// GetShare returns the Share field value if set, zero value otherwise. +func (o *UpdateShareResponse) GetShare() (res UpdateShareResponseGetShareRetType) { + res, _ = o.GetShareOk() + return +} + +// GetShareOk returns a tuple with the Share field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareResponse) GetShareOk() (ret UpdateShareResponseGetShareRetType, ok bool) { + return getUpdateShareResponseGetShareAttributeTypeOk(o.Share) +} + +// HasShare returns a boolean if a field has been set. +func (o *UpdateShareResponse) HasShare() bool { + _, ok := o.GetShareOk() + return ok +} + +// SetShare gets a reference to the given UpdateShareResponseShare and assigns it to the Share field. +func (o *UpdateShareResponse) SetShare(v UpdateShareResponseGetShareRetType) { + setUpdateShareResponseGetShareAttributeType(&o.Share, v) +} + +func (o UpdateShareResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateShareResponseGetShareAttributeTypeOk(o.Share); ok { + toSerialize["Share"] = val + } + return toSerialize, nil +} + +type NullableUpdateShareResponse struct { + value *UpdateShareResponse + isSet bool +} + +func (v NullableUpdateShareResponse) Get() *UpdateShareResponse { + return v.value +} + +func (v *NullableUpdateShareResponse) Set(val *UpdateShareResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateShareResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateShareResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateShareResponse(val *UpdateShareResponse) *NullableUpdateShareResponse { + return &NullableUpdateShareResponse{value: val, isSet: true} +} + +func (v NullableUpdateShareResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateShareResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_update_share_response_share.go b/pkg/sfsbeta/model_update_share_response_share.go new file mode 100644 index 00000000..796687bc --- /dev/null +++ b/pkg/sfsbeta/model_update_share_response_share.go @@ -0,0 +1,479 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "time" +) + +// checks if the UpdateShareResponseShare type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateShareResponseShare{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type UpdateShareResponseShareGetCreatedAtAttributeType = *time.Time +type UpdateShareResponseShareGetCreatedAtArgType = time.Time +type UpdateShareResponseShareGetCreatedAtRetType = time.Time + +func getUpdateShareResponseShareGetCreatedAtAttributeTypeOk(arg UpdateShareResponseShareGetCreatedAtAttributeType) (ret UpdateShareResponseShareGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareResponseShareGetCreatedAtAttributeType(arg *UpdateShareResponseShareGetCreatedAtAttributeType, val UpdateShareResponseShareGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for exportPolicy +*/ + +// isModel +type UpdateShareResponseShareGetExportPolicyAttributeType = *NullableShareExportPolicy +type UpdateShareResponseShareGetExportPolicyArgType = *NullableShareExportPolicy +type UpdateShareResponseShareGetExportPolicyRetType = *NullableShareExportPolicy + +func getUpdateShareResponseShareGetExportPolicyAttributeTypeOk(arg UpdateShareResponseShareGetExportPolicyAttributeType) (ret UpdateShareResponseShareGetExportPolicyRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setUpdateShareResponseShareGetExportPolicyAttributeType(arg *UpdateShareResponseShareGetExportPolicyAttributeType, val UpdateShareResponseShareGetExportPolicyRetType) { + *arg = val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type UpdateShareResponseShareGetIdAttributeType = *string + +func getUpdateShareResponseShareGetIdAttributeTypeOk(arg UpdateShareResponseShareGetIdAttributeType) (ret UpdateShareResponseShareGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareResponseShareGetIdAttributeType(arg *UpdateShareResponseShareGetIdAttributeType, val UpdateShareResponseShareGetIdRetType) { + *arg = &val +} + +type UpdateShareResponseShareGetIdArgType = string +type UpdateShareResponseShareGetIdRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type UpdateShareResponseShareGetLabelsAttributeType = *map[string]string +type UpdateShareResponseShareGetLabelsArgType = map[string]string +type UpdateShareResponseShareGetLabelsRetType = map[string]string + +func getUpdateShareResponseShareGetLabelsAttributeTypeOk(arg UpdateShareResponseShareGetLabelsAttributeType) (ret UpdateShareResponseShareGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareResponseShareGetLabelsAttributeType(arg *UpdateShareResponseShareGetLabelsAttributeType, val UpdateShareResponseShareGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mountPath +*/ + +// isNotNullableString +type UpdateShareResponseShareGetMountPathAttributeType = *string + +func getUpdateShareResponseShareGetMountPathAttributeTypeOk(arg UpdateShareResponseShareGetMountPathAttributeType) (ret UpdateShareResponseShareGetMountPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareResponseShareGetMountPathAttributeType(arg *UpdateShareResponseShareGetMountPathAttributeType, val UpdateShareResponseShareGetMountPathRetType) { + *arg = &val +} + +type UpdateShareResponseShareGetMountPathArgType = string +type UpdateShareResponseShareGetMountPathRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateShareResponseShareGetNameAttributeType = *string + +func getUpdateShareResponseShareGetNameAttributeTypeOk(arg UpdateShareResponseShareGetNameAttributeType) (ret UpdateShareResponseShareGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareResponseShareGetNameAttributeType(arg *UpdateShareResponseShareGetNameAttributeType, val UpdateShareResponseShareGetNameRetType) { + *arg = &val +} + +type UpdateShareResponseShareGetNameArgType = string +type UpdateShareResponseShareGetNameRetType = string + +/* + types and functions for spaceHardLimitGigabytes +*/ + +// isInteger +type UpdateShareResponseShareGetSpaceHardLimitGigabytesAttributeType = *int64 +type UpdateShareResponseShareGetSpaceHardLimitGigabytesArgType = int64 +type UpdateShareResponseShareGetSpaceHardLimitGigabytesRetType = int64 + +func getUpdateShareResponseShareGetSpaceHardLimitGigabytesAttributeTypeOk(arg UpdateShareResponseShareGetSpaceHardLimitGigabytesAttributeType) (ret UpdateShareResponseShareGetSpaceHardLimitGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareResponseShareGetSpaceHardLimitGigabytesAttributeType(arg *UpdateShareResponseShareGetSpaceHardLimitGigabytesAttributeType, val UpdateShareResponseShareGetSpaceHardLimitGigabytesRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isNotNullableString +type UpdateShareResponseShareGetStateAttributeType = *string + +func getUpdateShareResponseShareGetStateAttributeTypeOk(arg UpdateShareResponseShareGetStateAttributeType) (ret UpdateShareResponseShareGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateShareResponseShareGetStateAttributeType(arg *UpdateShareResponseShareGetStateAttributeType, val UpdateShareResponseShareGetStateRetType) { + *arg = &val +} + +type UpdateShareResponseShareGetStateArgType = string +type UpdateShareResponseShareGetStateRetType = string + +// UpdateShareResponseShare Updated Share +type UpdateShareResponseShare struct { + CreatedAt UpdateShareResponseShareGetCreatedAtAttributeType `json:"createdAt,omitempty"` + ExportPolicy UpdateShareResponseShareGetExportPolicyAttributeType `json:"exportPolicy,omitempty"` + // ID of the Share + Id UpdateShareResponseShareGetIdAttributeType `json:"id,omitempty"` + // An optional object that represents the labels associated with the share keys are validated using the following regex '^[\\\\p{Ll}][\\\\p{Ll}\\\\p{N}_-]*$' and cannot be empty values are validated using the following regex '^[\\\\p{Ll}\\\\p{N}_-]*$' + Labels UpdateShareResponseShareGetLabelsAttributeType `json:"labels,omitempty"` + // Mount path of the Share, used to mount the Share + MountPath UpdateShareResponseShareGetMountPathAttributeType `json:"mountPath,omitempty"` + // Name of the Share + Name UpdateShareResponseShareGetNameAttributeType `json:"name,omitempty"` + // Space hard limit for the Share. If zero, the Share will have access to the full space of the Resource Pool it lives in. (unit: gibibytes) + // Can be cast to int32 without loss of precision. + SpaceHardLimitGigabytes UpdateShareResponseShareGetSpaceHardLimitGigabytesAttributeType `json:"spaceHardLimitGigabytes,omitempty"` + // State of the Resource Pool Snapshot (possible values: [\"pending\", \"creating\", \"created\", \"error\", \"deleting\"]) + State UpdateShareResponseShareGetStateAttributeType `json:"state,omitempty"` +} + +// NewUpdateShareResponseShare instantiates a new UpdateShareResponseShare 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 NewUpdateShareResponseShare() *UpdateShareResponseShare { + this := UpdateShareResponseShare{} + return &this +} + +// NewUpdateShareResponseShareWithDefaults instantiates a new UpdateShareResponseShare 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 NewUpdateShareResponseShareWithDefaults() *UpdateShareResponseShare { + this := UpdateShareResponseShare{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UpdateShareResponseShare) GetCreatedAt() (res UpdateShareResponseShareGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareResponseShare) GetCreatedAtOk() (ret UpdateShareResponseShareGetCreatedAtRetType, ok bool) { + return getUpdateShareResponseShareGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UpdateShareResponseShare) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UpdateShareResponseShare) SetCreatedAt(v UpdateShareResponseShareGetCreatedAtRetType) { + setUpdateShareResponseShareGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetExportPolicy returns the ExportPolicy field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateShareResponseShare) GetExportPolicy() (res UpdateShareResponseShareGetExportPolicyRetType) { + res, _ = o.GetExportPolicyOk() + return +} + +// GetExportPolicyOk returns a tuple with the ExportPolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateShareResponseShare) GetExportPolicyOk() (ret UpdateShareResponseShareGetExportPolicyRetType, ok bool) { + return getUpdateShareResponseShareGetExportPolicyAttributeTypeOk(o.ExportPolicy) +} + +// HasExportPolicy returns a boolean if a field has been set. +func (o *UpdateShareResponseShare) HasExportPolicy() bool { + _, ok := o.GetExportPolicyOk() + return ok +} + +// SetExportPolicy gets a reference to the given ShareExportPolicy and assigns it to the ExportPolicy field. +func (o *UpdateShareResponseShare) SetExportPolicy(v UpdateShareResponseShareGetExportPolicyRetType) { + setUpdateShareResponseShareGetExportPolicyAttributeType(&o.ExportPolicy, v) +} + +// SetExportPolicyNil sets the value for ExportPolicy to be an explicit nil +func (o *UpdateShareResponseShare) SetExportPolicyNil() { + o.ExportPolicy = nil +} + +// UnsetExportPolicy ensures that no value is present for ExportPolicy, not even an explicit nil +func (o *UpdateShareResponseShare) UnsetExportPolicy() { + o.ExportPolicy = nil +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateShareResponseShare) GetId() (res UpdateShareResponseShareGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareResponseShare) GetIdOk() (ret UpdateShareResponseShareGetIdRetType, ok bool) { + return getUpdateShareResponseShareGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *UpdateShareResponseShare) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdateShareResponseShare) SetId(v UpdateShareResponseShareGetIdRetType) { + setUpdateShareResponseShareGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateShareResponseShare) GetLabels() (res UpdateShareResponseShareGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareResponseShare) GetLabelsOk() (ret UpdateShareResponseShareGetLabelsRetType, ok bool) { + return getUpdateShareResponseShareGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateShareResponseShare) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateShareResponseShare) SetLabels(v UpdateShareResponseShareGetLabelsRetType) { + setUpdateShareResponseShareGetLabelsAttributeType(&o.Labels, v) +} + +// GetMountPath returns the MountPath field value if set, zero value otherwise. +func (o *UpdateShareResponseShare) GetMountPath() (res UpdateShareResponseShareGetMountPathRetType) { + res, _ = o.GetMountPathOk() + return +} + +// GetMountPathOk returns a tuple with the MountPath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareResponseShare) GetMountPathOk() (ret UpdateShareResponseShareGetMountPathRetType, ok bool) { + return getUpdateShareResponseShareGetMountPathAttributeTypeOk(o.MountPath) +} + +// HasMountPath returns a boolean if a field has been set. +func (o *UpdateShareResponseShare) HasMountPath() bool { + _, ok := o.GetMountPathOk() + return ok +} + +// SetMountPath gets a reference to the given string and assigns it to the MountPath field. +func (o *UpdateShareResponseShare) SetMountPath(v UpdateShareResponseShareGetMountPathRetType) { + setUpdateShareResponseShareGetMountPathAttributeType(&o.MountPath, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateShareResponseShare) GetName() (res UpdateShareResponseShareGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareResponseShare) GetNameOk() (ret UpdateShareResponseShareGetNameRetType, ok bool) { + return getUpdateShareResponseShareGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateShareResponseShare) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateShareResponseShare) SetName(v UpdateShareResponseShareGetNameRetType) { + setUpdateShareResponseShareGetNameAttributeType(&o.Name, v) +} + +// GetSpaceHardLimitGigabytes returns the SpaceHardLimitGigabytes field value if set, zero value otherwise. +func (o *UpdateShareResponseShare) GetSpaceHardLimitGigabytes() (res UpdateShareResponseShareGetSpaceHardLimitGigabytesRetType) { + res, _ = o.GetSpaceHardLimitGigabytesOk() + return +} + +// GetSpaceHardLimitGigabytesOk returns a tuple with the SpaceHardLimitGigabytes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareResponseShare) GetSpaceHardLimitGigabytesOk() (ret UpdateShareResponseShareGetSpaceHardLimitGigabytesRetType, ok bool) { + return getUpdateShareResponseShareGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes) +} + +// HasSpaceHardLimitGigabytes returns a boolean if a field has been set. +func (o *UpdateShareResponseShare) HasSpaceHardLimitGigabytes() bool { + _, ok := o.GetSpaceHardLimitGigabytesOk() + return ok +} + +// SetSpaceHardLimitGigabytes gets a reference to the given int64 and assigns it to the SpaceHardLimitGigabytes field. +func (o *UpdateShareResponseShare) SetSpaceHardLimitGigabytes(v UpdateShareResponseShareGetSpaceHardLimitGigabytesRetType) { + setUpdateShareResponseShareGetSpaceHardLimitGigabytesAttributeType(&o.SpaceHardLimitGigabytes, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *UpdateShareResponseShare) GetState() (res UpdateShareResponseShareGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateShareResponseShare) GetStateOk() (ret UpdateShareResponseShareGetStateRetType, ok bool) { + return getUpdateShareResponseShareGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *UpdateShareResponseShare) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *UpdateShareResponseShare) SetState(v UpdateShareResponseShareGetStateRetType) { + setUpdateShareResponseShareGetStateAttributeType(&o.State, v) +} + +func (o UpdateShareResponseShare) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateShareResponseShareGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getUpdateShareResponseShareGetExportPolicyAttributeTypeOk(o.ExportPolicy); ok { + toSerialize["ExportPolicy"] = val + } + if val, ok := getUpdateShareResponseShareGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getUpdateShareResponseShareGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateShareResponseShareGetMountPathAttributeTypeOk(o.MountPath); ok { + toSerialize["MountPath"] = val + } + if val, ok := getUpdateShareResponseShareGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateShareResponseShareGetSpaceHardLimitGigabytesAttributeTypeOk(o.SpaceHardLimitGigabytes); ok { + toSerialize["SpaceHardLimitGigabytes"] = val + } + if val, ok := getUpdateShareResponseShareGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableUpdateShareResponseShare struct { + value *UpdateShareResponseShare + isSet bool +} + +func (v NullableUpdateShareResponseShare) Get() *UpdateShareResponseShare { + return v.value +} + +func (v *NullableUpdateShareResponseShare) Set(val *UpdateShareResponseShare) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateShareResponseShare) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateShareResponseShare) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateShareResponseShare(val *UpdateShareResponseShare) *NullableUpdateShareResponseShare { + return &NullableUpdateShareResponseShare{value: val, isSet: true} +} + +func (v NullableUpdateShareResponseShare) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateShareResponseShare) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_update_share_response_share_test.go b/pkg/sfsbeta/model_update_share_response_share_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_update_share_response_share_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_update_share_response_test.go b/pkg/sfsbeta/model_update_share_response_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_update_share_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_validation_error.go b/pkg/sfsbeta/model_validation_error.go new file mode 100644 index 00000000..49091bc8 --- /dev/null +++ b/pkg/sfsbeta/model_validation_error.go @@ -0,0 +1,267 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ValidationError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ValidationError{} + +/* + types and functions for error_description +*/ + +// isAny +type ValidationErrorGetErrorDescriptionAttributeType = any +type ValidationErrorGetErrorDescriptionArgType = any +type ValidationErrorGetErrorDescriptionRetType = any + +func getValidationErrorGetErrorDescriptionAttributeTypeOk(arg ValidationErrorGetErrorDescriptionAttributeType) (ret ValidationErrorGetErrorDescriptionRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setValidationErrorGetErrorDescriptionAttributeType(arg *ValidationErrorGetErrorDescriptionAttributeType, val ValidationErrorGetErrorDescriptionRetType) { + *arg = val +} + +/* + types and functions for title +*/ + +// isNotNullableString +type ValidationErrorGetTitleAttributeType = *string + +func getValidationErrorGetTitleAttributeTypeOk(arg ValidationErrorGetTitleAttributeType) (ret ValidationErrorGetTitleRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setValidationErrorGetTitleAttributeType(arg *ValidationErrorGetTitleAttributeType, val ValidationErrorGetTitleRetType) { + *arg = &val +} + +type ValidationErrorGetTitleArgType = string +type ValidationErrorGetTitleRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type ValidationErrorGetTypeAttributeType = *string + +func getValidationErrorGetTypeAttributeTypeOk(arg ValidationErrorGetTypeAttributeType) (ret ValidationErrorGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setValidationErrorGetTypeAttributeType(arg *ValidationErrorGetTypeAttributeType, val ValidationErrorGetTypeRetType) { + *arg = &val +} + +type ValidationErrorGetTypeArgType = string +type ValidationErrorGetTypeRetType = string + +/* + types and functions for fields +*/ + +// isArray +type ValidationErrorGetFieldsAttributeType = *[]ValidationErrorField +type ValidationErrorGetFieldsArgType = []ValidationErrorField +type ValidationErrorGetFieldsRetType = []ValidationErrorField + +func getValidationErrorGetFieldsAttributeTypeOk(arg ValidationErrorGetFieldsAttributeType) (ret ValidationErrorGetFieldsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setValidationErrorGetFieldsAttributeType(arg *ValidationErrorGetFieldsAttributeType, val ValidationErrorGetFieldsRetType) { + *arg = &val +} + +// ValidationError struct for ValidationError +type ValidationError struct { + // Deprecated: Human-readable string of the error that occured + ErrorDescription ValidationErrorGetErrorDescriptionAttributeType `json:"error_description,omitempty"` + // Human-readable description of the error that occurred. + // REQUIRED + Title ValidationErrorGetTitleAttributeType `json:"title" required:"true"` + // URI Uniquely identifies the error type. It will be in the format of storage.stackit.cloud/ e.g. storage.stackit.cloud/validation-error + // REQUIRED + Type ValidationErrorGetTypeAttributeType `json:"type" required:"true"` + // REQUIRED + Fields ValidationErrorGetFieldsAttributeType `json:"fields" required:"true"` +} + +type _ValidationError ValidationError + +// NewValidationError instantiates a new ValidationError 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 NewValidationError(title ValidationErrorGetTitleArgType, types ValidationErrorGetTypeArgType, fields ValidationErrorGetFieldsArgType) *ValidationError { + this := ValidationError{} + setValidationErrorGetTitleAttributeType(&this.Title, title) + setValidationErrorGetTypeAttributeType(&this.Type, types) + setValidationErrorGetFieldsAttributeType(&this.Fields, fields) + return &this +} + +// NewValidationErrorWithDefaults instantiates a new ValidationError 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 NewValidationErrorWithDefaults() *ValidationError { + this := ValidationError{} + return &this +} + +// GetErrorDescription returns the ErrorDescription field value if set, zero value otherwise (both if not set or set to explicit null). +// Deprecated +func (o *ValidationError) GetErrorDescription() (res ValidationErrorGetErrorDescriptionRetType) { + res, _ = o.GetErrorDescriptionOk() + return +} + +// GetErrorDescriptionOk returns a tuple with the ErrorDescription field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +// Deprecated +func (o *ValidationError) GetErrorDescriptionOk() (ret ValidationErrorGetErrorDescriptionRetType, ok bool) { + return getValidationErrorGetErrorDescriptionAttributeTypeOk(o.ErrorDescription) +} + +// HasErrorDescription returns a boolean if a field has been set. +func (o *ValidationError) HasErrorDescription() bool { + _, ok := o.GetErrorDescriptionOk() + return ok +} + +// SetErrorDescription gets a reference to the given interface{} and assigns it to the ErrorDescription field. +// Deprecated +func (o *ValidationError) SetErrorDescription(v ValidationErrorGetErrorDescriptionRetType) { + setValidationErrorGetErrorDescriptionAttributeType(&o.ErrorDescription, v) +} + +// GetTitle returns the Title field value +func (o *ValidationError) GetTitle() (ret ValidationErrorGetTitleRetType) { + ret, _ = o.GetTitleOk() + return ret +} + +// GetTitleOk returns a tuple with the Title field value +// and a boolean to check if the value has been set. +func (o *ValidationError) GetTitleOk() (ret ValidationErrorGetTitleRetType, ok bool) { + return getValidationErrorGetTitleAttributeTypeOk(o.Title) +} + +// SetTitle sets field value +func (o *ValidationError) SetTitle(v ValidationErrorGetTitleRetType) { + setValidationErrorGetTitleAttributeType(&o.Title, v) +} + +// GetType returns the Type field value +func (o *ValidationError) GetType() (ret ValidationErrorGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ValidationError) GetTypeOk() (ret ValidationErrorGetTypeRetType, ok bool) { + return getValidationErrorGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *ValidationError) SetType(v ValidationErrorGetTypeRetType) { + setValidationErrorGetTypeAttributeType(&o.Type, v) +} + +// GetFields returns the Fields field value +func (o *ValidationError) GetFields() (ret ValidationErrorGetFieldsRetType) { + ret, _ = o.GetFieldsOk() + return ret +} + +// GetFieldsOk returns a tuple with the Fields field value +// and a boolean to check if the value has been set. +func (o *ValidationError) GetFieldsOk() (ret ValidationErrorGetFieldsRetType, ok bool) { + return getValidationErrorGetFieldsAttributeTypeOk(o.Fields) +} + +// SetFields sets field value +func (o *ValidationError) SetFields(v ValidationErrorGetFieldsRetType) { + setValidationErrorGetFieldsAttributeType(&o.Fields, v) +} + +func (o ValidationError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getValidationErrorGetErrorDescriptionAttributeTypeOk(o.ErrorDescription); ok { + toSerialize["ErrorDescription"] = val + } + if val, ok := getValidationErrorGetTitleAttributeTypeOk(o.Title); ok { + toSerialize["Title"] = val + } + if val, ok := getValidationErrorGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getValidationErrorGetFieldsAttributeTypeOk(o.Fields); ok { + toSerialize["Fields"] = val + } + return toSerialize, nil +} + +type NullableValidationError struct { + value *ValidationError + isSet bool +} + +func (v NullableValidationError) Get() *ValidationError { + return v.value +} + +func (v *NullableValidationError) Set(val *ValidationError) { + v.value = val + v.isSet = true +} + +func (v NullableValidationError) IsSet() bool { + return v.isSet +} + +func (v *NullableValidationError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableValidationError(val *ValidationError) *NullableValidationError { + return &NullableValidationError{value: val, isSet: true} +} + +func (v NullableValidationError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableValidationError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_validation_error_all_of.go b/pkg/sfsbeta/model_validation_error_all_of.go new file mode 100644 index 00000000..e2fedf94 --- /dev/null +++ b/pkg/sfsbeta/model_validation_error_all_of.go @@ -0,0 +1,125 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ValidationErrorAllOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ValidationErrorAllOf{} + +/* + types and functions for fields +*/ + +// isArray +type ValidationErrorAllOfGetFieldsAttributeType = *[]ValidationErrorField +type ValidationErrorAllOfGetFieldsArgType = []ValidationErrorField +type ValidationErrorAllOfGetFieldsRetType = []ValidationErrorField + +func getValidationErrorAllOfGetFieldsAttributeTypeOk(arg ValidationErrorAllOfGetFieldsAttributeType) (ret ValidationErrorAllOfGetFieldsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setValidationErrorAllOfGetFieldsAttributeType(arg *ValidationErrorAllOfGetFieldsAttributeType, val ValidationErrorAllOfGetFieldsRetType) { + *arg = &val +} + +// ValidationErrorAllOf struct for ValidationErrorAllOf +type ValidationErrorAllOf struct { + // REQUIRED + Fields ValidationErrorAllOfGetFieldsAttributeType `json:"fields" required:"true"` +} + +type _ValidationErrorAllOf ValidationErrorAllOf + +// NewValidationErrorAllOf instantiates a new ValidationErrorAllOf 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 NewValidationErrorAllOf(fields ValidationErrorAllOfGetFieldsArgType) *ValidationErrorAllOf { + this := ValidationErrorAllOf{} + setValidationErrorAllOfGetFieldsAttributeType(&this.Fields, fields) + return &this +} + +// NewValidationErrorAllOfWithDefaults instantiates a new ValidationErrorAllOf 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 NewValidationErrorAllOfWithDefaults() *ValidationErrorAllOf { + this := ValidationErrorAllOf{} + return &this +} + +// GetFields returns the Fields field value +func (o *ValidationErrorAllOf) GetFields() (ret ValidationErrorAllOfGetFieldsRetType) { + ret, _ = o.GetFieldsOk() + return ret +} + +// GetFieldsOk returns a tuple with the Fields field value +// and a boolean to check if the value has been set. +func (o *ValidationErrorAllOf) GetFieldsOk() (ret ValidationErrorAllOfGetFieldsRetType, ok bool) { + return getValidationErrorAllOfGetFieldsAttributeTypeOk(o.Fields) +} + +// SetFields sets field value +func (o *ValidationErrorAllOf) SetFields(v ValidationErrorAllOfGetFieldsRetType) { + setValidationErrorAllOfGetFieldsAttributeType(&o.Fields, v) +} + +func (o ValidationErrorAllOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getValidationErrorAllOfGetFieldsAttributeTypeOk(o.Fields); ok { + toSerialize["Fields"] = val + } + return toSerialize, nil +} + +type NullableValidationErrorAllOf struct { + value *ValidationErrorAllOf + isSet bool +} + +func (v NullableValidationErrorAllOf) Get() *ValidationErrorAllOf { + return v.value +} + +func (v *NullableValidationErrorAllOf) Set(val *ValidationErrorAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableValidationErrorAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableValidationErrorAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableValidationErrorAllOf(val *ValidationErrorAllOf) *NullableValidationErrorAllOf { + return &NullableValidationErrorAllOf{value: val, isSet: true} +} + +func (v NullableValidationErrorAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableValidationErrorAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_validation_error_all_of_test.go b/pkg/sfsbeta/model_validation_error_all_of_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_validation_error_all_of_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_validation_error_field.go b/pkg/sfsbeta/model_validation_error_field.go new file mode 100644 index 00000000..c5fcf19d --- /dev/null +++ b/pkg/sfsbeta/model_validation_error_field.go @@ -0,0 +1,172 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" +) + +// checks if the ValidationErrorField type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ValidationErrorField{} + +/* + types and functions for field +*/ + +// isNotNullableString +type ValidationErrorFieldGetFieldAttributeType = *string + +func getValidationErrorFieldGetFieldAttributeTypeOk(arg ValidationErrorFieldGetFieldAttributeType) (ret ValidationErrorFieldGetFieldRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setValidationErrorFieldGetFieldAttributeType(arg *ValidationErrorFieldGetFieldAttributeType, val ValidationErrorFieldGetFieldRetType) { + *arg = &val +} + +type ValidationErrorFieldGetFieldArgType = string +type ValidationErrorFieldGetFieldRetType = string + +/* + types and functions for reason +*/ + +// isNotNullableString +type ValidationErrorFieldGetReasonAttributeType = *string + +func getValidationErrorFieldGetReasonAttributeTypeOk(arg ValidationErrorFieldGetReasonAttributeType) (ret ValidationErrorFieldGetReasonRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setValidationErrorFieldGetReasonAttributeType(arg *ValidationErrorFieldGetReasonAttributeType, val ValidationErrorFieldGetReasonRetType) { + *arg = &val +} + +type ValidationErrorFieldGetReasonArgType = string +type ValidationErrorFieldGetReasonRetType = string + +// ValidationErrorField struct for ValidationErrorField +type ValidationErrorField struct { + // The name of the field in the request that has failed the validation + // REQUIRED + Field ValidationErrorFieldGetFieldAttributeType `json:"field" required:"true"` + // The reason why the validation failed + // REQUIRED + Reason ValidationErrorFieldGetReasonAttributeType `json:"reason" required:"true"` +} + +type _ValidationErrorField ValidationErrorField + +// NewValidationErrorField instantiates a new ValidationErrorField 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 NewValidationErrorField(field ValidationErrorFieldGetFieldArgType, reason ValidationErrorFieldGetReasonArgType) *ValidationErrorField { + this := ValidationErrorField{} + setValidationErrorFieldGetFieldAttributeType(&this.Field, field) + setValidationErrorFieldGetReasonAttributeType(&this.Reason, reason) + return &this +} + +// NewValidationErrorFieldWithDefaults instantiates a new ValidationErrorField 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 NewValidationErrorFieldWithDefaults() *ValidationErrorField { + this := ValidationErrorField{} + return &this +} + +// GetField returns the Field field value +func (o *ValidationErrorField) GetField() (ret ValidationErrorFieldGetFieldRetType) { + ret, _ = o.GetFieldOk() + return ret +} + +// GetFieldOk returns a tuple with the Field field value +// and a boolean to check if the value has been set. +func (o *ValidationErrorField) GetFieldOk() (ret ValidationErrorFieldGetFieldRetType, ok bool) { + return getValidationErrorFieldGetFieldAttributeTypeOk(o.Field) +} + +// SetField sets field value +func (o *ValidationErrorField) SetField(v ValidationErrorFieldGetFieldRetType) { + setValidationErrorFieldGetFieldAttributeType(&o.Field, v) +} + +// GetReason returns the Reason field value +func (o *ValidationErrorField) GetReason() (ret ValidationErrorFieldGetReasonRetType) { + ret, _ = o.GetReasonOk() + return ret +} + +// GetReasonOk returns a tuple with the Reason field value +// and a boolean to check if the value has been set. +func (o *ValidationErrorField) GetReasonOk() (ret ValidationErrorFieldGetReasonRetType, ok bool) { + return getValidationErrorFieldGetReasonAttributeTypeOk(o.Reason) +} + +// SetReason sets field value +func (o *ValidationErrorField) SetReason(v ValidationErrorFieldGetReasonRetType) { + setValidationErrorFieldGetReasonAttributeType(&o.Reason, v) +} + +func (o ValidationErrorField) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getValidationErrorFieldGetFieldAttributeTypeOk(o.Field); ok { + toSerialize["Field"] = val + } + if val, ok := getValidationErrorFieldGetReasonAttributeTypeOk(o.Reason); ok { + toSerialize["Reason"] = val + } + return toSerialize, nil +} + +type NullableValidationErrorField struct { + value *ValidationErrorField + isSet bool +} + +func (v NullableValidationErrorField) Get() *ValidationErrorField { + return v.value +} + +func (v *NullableValidationErrorField) Set(val *ValidationErrorField) { + v.value = val + v.isSet = true +} + +func (v NullableValidationErrorField) IsSet() bool { + return v.isSet +} + +func (v *NullableValidationErrorField) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableValidationErrorField(val *ValidationErrorField) *NullableValidationErrorField { + return &NullableValidationErrorField{value: val, isSet: true} +} + +func (v NullableValidationErrorField) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableValidationErrorField) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sfsbeta/model_validation_error_field_test.go b/pkg/sfsbeta/model_validation_error_field_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_validation_error_field_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/model_validation_error_test.go b/pkg/sfsbeta/model_validation_error_test.go new file mode 100644 index 00000000..7860fae3 --- /dev/null +++ b/pkg/sfsbeta/model_validation_error_test.go @@ -0,0 +1,11 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta diff --git a/pkg/sfsbeta/utils.go b/pkg/sfsbeta/utils.go new file mode 100644 index 00000000..facf7318 --- /dev/null +++ b/pkg/sfsbeta/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT File Storage (SFS) + +API used to create and manage NFS Shares. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sfsbeta + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/pkg/sqlserverflexalpha/api_default.go b/pkg/sqlserverflexalpha/api_default.go index 3f9f620f..3d86cfe5 100644 --- a/pkg/sqlserverflexalpha/api_default.go +++ b/pkg/sqlserverflexalpha/api_default.go @@ -217,7 +217,7 @@ type DefaultApi interface { @param region The region which should be addressed @return ApiGetFlavorsRequestRequest */ - GetFlavorsRequest(ctx context.Context, projectId string, region string, page, size *int64, sort *FlavorSort) ApiGetFlavorsRequestRequest + GetFlavorsRequest(ctx context.Context, projectId string, region string) ApiGetFlavorsRequestRequest /* GetFlavorsRequestExecute executes the request @@ -227,7 +227,7 @@ type DefaultApi interface { @return GetFlavorsResponse */ - GetFlavorsRequestExecute(ctx context.Context, projectId string, region string, page, size *int64, sort *FlavorSort) (*GetFlavorsResponse, error) + GetFlavorsRequestExecute(ctx context.Context, projectId string, region string) (*GetFlavorsResponse, error) /* GetInstanceRequest Get Specific Instance Get information about a specific available instance @@ -514,6 +514,25 @@ type DefaultApi interface { */ ResetUserRequestExecute(ctx context.Context, projectId string, region string, instanceId string, userId int64) (*ResetUserResponse, error) + /* + RestoreDatabaseFromBackup Create a Restore Operation + Triggers a new restore operation for the specified instance. + The request body defines the source + (e.g., internal backup, external S3) and the target database. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiRestoreDatabaseFromBackupRequest + */ + RestoreDatabaseFromBackup(ctx context.Context, projectId string, region string, instanceId string) ApiRestoreDatabaseFromBackupRequest + /* + RestoreDatabaseFromBackupExecute executes the request + + */ + RestoreDatabaseFromBackupExecute(ctx context.Context, projectId string, region string, instanceId string) error /* TriggerBackupRequest Trigger backup for a specific Database Trigger backup for a specific database @@ -718,6 +737,12 @@ type ApiResetUserRequestRequest interface { Execute() (*ResetUserResponse, error) } +type ApiRestoreDatabaseFromBackupRequest interface { + // The restore operation payload. + RestoreDatabaseFromBackupPayload(restoreDatabaseFromBackupPayload RestoreDatabaseFromBackupPayload) ApiRestoreDatabaseFromBackupRequest + Execute() error +} + type ApiTriggerBackupRequestRequest interface { Execute() error } @@ -2700,27 +2725,21 @@ Get all available flavors for a project. @param region The region which should be addressed @return ApiGetFlavorsRequestRequest */ -func (a *APIClient) GetFlavorsRequest(ctx context.Context, projectId string, region string, page, size *int64, sort *FlavorSort) ApiGetFlavorsRequestRequest { +func (a *APIClient) GetFlavorsRequest(ctx context.Context, projectId string, region string) ApiGetFlavorsRequestRequest { return GetFlavorsRequestRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, region: region, - page: page, - size: size, - sort: sort, } } -func (a *APIClient) GetFlavorsRequestExecute(ctx context.Context, projectId string, region string, page, size *int64, sort *FlavorSort) (*GetFlavorsResponse, error) { +func (a *APIClient) GetFlavorsRequestExecute(ctx context.Context, projectId string, region string) (*GetFlavorsResponse, error) { r := GetFlavorsRequestRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, region: region, - page: page, - size: size, - sort: sort, } return r.Execute() } @@ -5363,6 +5382,206 @@ func (a *APIClient) ResetUserRequestExecute(ctx context.Context, projectId strin return r.Execute() } +type RestoreDatabaseFromBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + instanceId string + restoreDatabaseFromBackupPayload *RestoreDatabaseFromBackupPayload +} + +// The restore operation payload. + +func (r RestoreDatabaseFromBackupRequest) RestoreDatabaseFromBackupPayload(restoreDatabaseFromBackupPayload RestoreDatabaseFromBackupPayload) ApiRestoreDatabaseFromBackupRequest { + r.restoreDatabaseFromBackupPayload = &restoreDatabaseFromBackupPayload + return r +} + +func (r RestoreDatabaseFromBackupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RestoreDatabaseFromBackup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/restores" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.restoreDatabaseFromBackupPayload == nil { + return fmt.Errorf("restoreDatabaseFromBackupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.restoreDatabaseFromBackupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RestoreDatabaseFromBackup: Create a Restore Operation + +Triggers a new restore operation for the specified instance. +The request body defines the source +(e.g., internal backup, external S3) and the target database. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiRestoreDatabaseFromBackupRequest +*/ +func (a *APIClient) RestoreDatabaseFromBackup(ctx context.Context, projectId string, region string, instanceId string) ApiRestoreDatabaseFromBackupRequest { + return RestoreDatabaseFromBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +func (a *APIClient) RestoreDatabaseFromBackupExecute(ctx context.Context, projectId string, region string, instanceId string) error { + r := RestoreDatabaseFromBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } + return r.Execute() +} + type TriggerBackupRequestRequest struct { ctx context.Context apiService *DefaultApiService diff --git a/pkg/sqlserverflexalpha/api_default_test.go b/pkg/sqlserverflexalpha/api_default_test.go index f1707e61..bfa0f83c 100644 --- a/pkg/sqlserverflexalpha/api_default_test.go +++ b/pkg/sqlserverflexalpha/api_default_test.go @@ -26,20 +26,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateDatabaseRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := CreateDatabaseResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -88,18 +85,15 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateInstanceRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := CreateInstanceResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -147,20 +141,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService CreateUserRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := CreateUserResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -209,13 +200,13 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteDatabaseRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseName}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) databaseNameValue := "databaseName-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { @@ -264,11 +255,11 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteInstanceRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { @@ -316,13 +307,13 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService DeleteUserRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) userIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { @@ -371,22 +362,19 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetBackupRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/{backupId}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) backupIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(backupIdValue, "backupId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetBackupResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -435,20 +423,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetCollationsRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/collations" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetCollationsResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -496,22 +481,19 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetDatabaseRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseName}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) databaseNameValue := "databaseName-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetDatabaseResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -560,18 +542,15 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetFlavorsRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/flavors" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetFlavorsResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -605,10 +584,7 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { projectId := projectIdValue region := regionValue - page := int64(1) - size := int64(10) - sort := FLAVORSORT_ID_DESC - resp, reqErr := apiClient.GetFlavorsRequest(context.Background(), projectId, region, &page, &size, &sort).Execute() + resp, reqErr := apiClient.GetFlavorsRequest(context.Background(), projectId, region).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -621,20 +597,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetInstanceRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetInstanceResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -682,20 +655,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetStoragesRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/storages/{flavorId}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) flavorIdValue := "flavorId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"flavorId"+"}", url.PathEscape(ParameterValueToString(flavorIdValue, "flavorId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"flavorId"+"}", url.PathEscape(ParameterValueToString(flavorIdValue, "flavorId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetStoragesResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -743,22 +713,19 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetUserRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) userIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetUserResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -807,18 +774,15 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService GetVersionsRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/versions" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := GetVersionsResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -865,20 +829,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListBackupsRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := ListBackupResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -926,20 +887,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCompatibilitiesRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/compatibility" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := ListCompatibilityResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -987,20 +945,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListCurrentRunningRestoreJobs", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/restore-jobs" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := ListCurrentRunningRestoreJobs{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1048,20 +1003,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListDatabasesRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := ListDatabasesResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1109,18 +1061,15 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListInstancesRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := ListInstancesResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1167,20 +1116,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListRolesRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/roles" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := ListRolesResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1228,20 +1174,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ListUsersRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := ListUserResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1289,20 +1232,17 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ProtectInstanceRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/protections" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := ProtectInstanceResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1351,22 +1291,19 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService ResetUserRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}/reset" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) userIdValue := int64(123) - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"userId"+"}", url.PathEscape(ParameterValueToString(userIdValue, "userId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { data := ResetUserResponse{} w.Header().Add("Content-Type", "application/json") - err := json.NewEncoder(w).Encode(data) - if err != nil { - return - } + json.NewEncoder(w).Encode(data) }) testServer := httptest.NewServer(testDefaultApiServeMux) defer testServer.Close() @@ -1412,16 +1349,69 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService RestoreDatabaseFromBackup", func(t *testing.T) { + _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/restores" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := "region-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + instanceIdValue := "instanceId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for sqlserverflexalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + instanceId := instanceIdValue + restoreDatabaseFromBackupPayload := RestoreDatabaseFromBackupPayload{} + + reqErr := apiClient.RestoreDatabaseFromBackup(context.Background(), projectId, region, instanceId).RestoreDatabaseFromBackupPayload(restoreDatabaseFromBackupPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + t.Run("Test DefaultApiService TriggerBackupRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/databases/{databaseName}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) databaseNameValue := "databaseName-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { @@ -1470,13 +1460,13 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService TriggerRestoreRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/databases/{databaseName}/restores" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) databaseNameValue := "databaseName-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"databaseName"+"}", url.PathEscape(ParameterValueToString(databaseNameValue, "databaseName")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { @@ -1525,11 +1515,11 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateInstancePartiallyRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { @@ -1578,11 +1568,11 @@ func Test_sqlserverflexalpha_DefaultApiService(t *testing.T) { t.Run("Test DefaultApiService UpdateInstanceRequest", func(t *testing.T) { _apiUrlPath := "/v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}" projectIdValue := "projectId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) regionValue := "region-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) instanceIdValue := "instanceId-value" - _apiUrlPath = strings.ReplaceAll(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId"))) + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { diff --git a/pkg/sqlserverflexalpha/client.go b/pkg/sqlserverflexalpha/client.go index f8a9ddbe..50dcb452 100644 --- a/pkg/sqlserverflexalpha/client.go +++ b/pkg/sqlserverflexalpha/client.go @@ -501,10 +501,7 @@ func addFile(w *multipart.Writer, fieldName, path string) error { if err != nil { return err } - err = file.Close() - if err != nil { - return err - } + defer file.Close() part, err := w.CreateFormFile(fieldName, filepath.Base(path)) if err != nil { diff --git a/pkg/sqlserverflexalpha/model_external_s3.go b/pkg/sqlserverflexalpha/model_external_s3.go new file mode 100644 index 00000000..98da75fb --- /dev/null +++ b/pkg/sqlserverflexalpha/model_external_s3.go @@ -0,0 +1,261 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "encoding/json" +) + +// checks if the ExternalS3 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ExternalS3{} + +/* + types and functions for s3_access_key +*/ + +// isNotNullableString +type ExternalS3GetS3AccessKeyAttributeType = *string + +func getExternalS3GetS3AccessKeyAttributeTypeOk(arg ExternalS3GetS3AccessKeyAttributeType) (ret ExternalS3GetS3AccessKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setExternalS3GetS3AccessKeyAttributeType(arg *ExternalS3GetS3AccessKeyAttributeType, val ExternalS3GetS3AccessKeyRetType) { + *arg = &val +} + +type ExternalS3GetS3AccessKeyArgType = string +type ExternalS3GetS3AccessKeyRetType = string + +/* + types and functions for s3_access_secret +*/ + +// isNotNullableString +type ExternalS3GetS3AccessSecretAttributeType = *string + +func getExternalS3GetS3AccessSecretAttributeTypeOk(arg ExternalS3GetS3AccessSecretAttributeType) (ret ExternalS3GetS3AccessSecretRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setExternalS3GetS3AccessSecretAttributeType(arg *ExternalS3GetS3AccessSecretAttributeType, val ExternalS3GetS3AccessSecretRetType) { + *arg = &val +} + +type ExternalS3GetS3AccessSecretArgType = string +type ExternalS3GetS3AccessSecretRetType = string + +/* + types and functions for s3_bucket +*/ + +// isNotNullableString +type ExternalS3GetS3BucketAttributeType = *string + +func getExternalS3GetS3BucketAttributeTypeOk(arg ExternalS3GetS3BucketAttributeType) (ret ExternalS3GetS3BucketRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setExternalS3GetS3BucketAttributeType(arg *ExternalS3GetS3BucketAttributeType, val ExternalS3GetS3BucketRetType) { + *arg = &val +} + +type ExternalS3GetS3BucketArgType = string +type ExternalS3GetS3BucketRetType = string + +/* + types and functions for s3_files +*/ + +// isArray +type ExternalS3GetS3FilesAttributeType = *[]S3fileInfo +type ExternalS3GetS3FilesArgType = []S3fileInfo +type ExternalS3GetS3FilesRetType = []S3fileInfo + +func getExternalS3GetS3FilesAttributeTypeOk(arg ExternalS3GetS3FilesAttributeType) (ret ExternalS3GetS3FilesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setExternalS3GetS3FilesAttributeType(arg *ExternalS3GetS3FilesAttributeType, val ExternalS3GetS3FilesRetType) { + *arg = &val +} + +// ExternalS3 The external S3 information +type ExternalS3 struct { + // The s3 access key id + // REQUIRED + S3AccessKey ExternalS3GetS3AccessKeyAttributeType `json:"s3_access_key" required:"true"` + // The s3 access secret + // REQUIRED + S3AccessSecret ExternalS3GetS3AccessSecretAttributeType `json:"s3_access_secret" required:"true"` + // The s3 bucket address + // REQUIRED + S3Bucket ExternalS3GetS3BucketAttributeType `json:"s3_bucket" required:"true"` + // The backup files from which the database should be restored + // REQUIRED + S3Files ExternalS3GetS3FilesAttributeType `json:"s3_files" required:"true"` +} + +type _ExternalS3 ExternalS3 + +// NewExternalS3 instantiates a new ExternalS3 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 NewExternalS3(s3AccessKey ExternalS3GetS3AccessKeyArgType, s3AccessSecret ExternalS3GetS3AccessSecretArgType, s3Bucket ExternalS3GetS3BucketArgType, s3Files ExternalS3GetS3FilesArgType) *ExternalS3 { + this := ExternalS3{} + setExternalS3GetS3AccessKeyAttributeType(&this.S3AccessKey, s3AccessKey) + setExternalS3GetS3AccessSecretAttributeType(&this.S3AccessSecret, s3AccessSecret) + setExternalS3GetS3BucketAttributeType(&this.S3Bucket, s3Bucket) + setExternalS3GetS3FilesAttributeType(&this.S3Files, s3Files) + return &this +} + +// NewExternalS3WithDefaults instantiates a new ExternalS3 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 NewExternalS3WithDefaults() *ExternalS3 { + this := ExternalS3{} + return &this +} + +// GetS3AccessKey returns the S3AccessKey field value +func (o *ExternalS3) GetS3AccessKey() (ret ExternalS3GetS3AccessKeyRetType) { + ret, _ = o.GetS3AccessKeyOk() + return ret +} + +// GetS3AccessKeyOk returns a tuple with the S3AccessKey field value +// and a boolean to check if the value has been set. +func (o *ExternalS3) GetS3AccessKeyOk() (ret ExternalS3GetS3AccessKeyRetType, ok bool) { + return getExternalS3GetS3AccessKeyAttributeTypeOk(o.S3AccessKey) +} + +// SetS3AccessKey sets field value +func (o *ExternalS3) SetS3AccessKey(v ExternalS3GetS3AccessKeyRetType) { + setExternalS3GetS3AccessKeyAttributeType(&o.S3AccessKey, v) +} + +// GetS3AccessSecret returns the S3AccessSecret field value +func (o *ExternalS3) GetS3AccessSecret() (ret ExternalS3GetS3AccessSecretRetType) { + ret, _ = o.GetS3AccessSecretOk() + return ret +} + +// GetS3AccessSecretOk returns a tuple with the S3AccessSecret field value +// and a boolean to check if the value has been set. +func (o *ExternalS3) GetS3AccessSecretOk() (ret ExternalS3GetS3AccessSecretRetType, ok bool) { + return getExternalS3GetS3AccessSecretAttributeTypeOk(o.S3AccessSecret) +} + +// SetS3AccessSecret sets field value +func (o *ExternalS3) SetS3AccessSecret(v ExternalS3GetS3AccessSecretRetType) { + setExternalS3GetS3AccessSecretAttributeType(&o.S3AccessSecret, v) +} + +// GetS3Bucket returns the S3Bucket field value +func (o *ExternalS3) GetS3Bucket() (ret ExternalS3GetS3BucketRetType) { + ret, _ = o.GetS3BucketOk() + return ret +} + +// GetS3BucketOk returns a tuple with the S3Bucket field value +// and a boolean to check if the value has been set. +func (o *ExternalS3) GetS3BucketOk() (ret ExternalS3GetS3BucketRetType, ok bool) { + return getExternalS3GetS3BucketAttributeTypeOk(o.S3Bucket) +} + +// SetS3Bucket sets field value +func (o *ExternalS3) SetS3Bucket(v ExternalS3GetS3BucketRetType) { + setExternalS3GetS3BucketAttributeType(&o.S3Bucket, v) +} + +// GetS3Files returns the S3Files field value +func (o *ExternalS3) GetS3Files() (ret ExternalS3GetS3FilesRetType) { + ret, _ = o.GetS3FilesOk() + return ret +} + +// GetS3FilesOk returns a tuple with the S3Files field value +// and a boolean to check if the value has been set. +func (o *ExternalS3) GetS3FilesOk() (ret ExternalS3GetS3FilesRetType, ok bool) { + return getExternalS3GetS3FilesAttributeTypeOk(o.S3Files) +} + +// SetS3Files sets field value +func (o *ExternalS3) SetS3Files(v ExternalS3GetS3FilesRetType) { + setExternalS3GetS3FilesAttributeType(&o.S3Files, v) +} + +func (o ExternalS3) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getExternalS3GetS3AccessKeyAttributeTypeOk(o.S3AccessKey); ok { + toSerialize["S3AccessKey"] = val + } + if val, ok := getExternalS3GetS3AccessSecretAttributeTypeOk(o.S3AccessSecret); ok { + toSerialize["S3AccessSecret"] = val + } + if val, ok := getExternalS3GetS3BucketAttributeTypeOk(o.S3Bucket); ok { + toSerialize["S3Bucket"] = val + } + if val, ok := getExternalS3GetS3FilesAttributeTypeOk(o.S3Files); ok { + toSerialize["S3Files"] = val + } + return toSerialize, nil +} + +type NullableExternalS3 struct { + value *ExternalS3 + isSet bool +} + +func (v NullableExternalS3) Get() *ExternalS3 { + return v.value +} + +func (v *NullableExternalS3) Set(val *ExternalS3) { + v.value = val + v.isSet = true +} + +func (v NullableExternalS3) IsSet() bool { + return v.isSet +} + +func (v *NullableExternalS3) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableExternalS3(val *ExternalS3) *NullableExternalS3 { + return &NullableExternalS3{value: val, isSet: true} +} + +func (v NullableExternalS3) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableExternalS3) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sqlserverflexalpha/model_external_s3_test.go b/pkg/sqlserverflexalpha/model_external_s3_test.go new file mode 100644 index 00000000..f551e1f0 --- /dev/null +++ b/pkg/sqlserverflexalpha/model_external_s3_test.go @@ -0,0 +1,11 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha diff --git a/pkg/sqlserverflexalpha/model_get_backup_response.go b/pkg/sqlserverflexalpha/model_get_backup_response.go index 7875d04e..ca42e708 100644 --- a/pkg/sqlserverflexalpha/model_get_backup_response.go +++ b/pkg/sqlserverflexalpha/model_get_backup_response.go @@ -21,26 +21,8 @@ var _ MappedNullable = &GetBackupResponse{} types and functions for completionTime */ -//// isAny -//type GetBackupResponseGetCompletionTimeAttributeType = any -//type GetBackupResponseGetCompletionTimeArgType = any -//type GetBackupResponseGetCompletionTimeRetType = any -// -//func getGetBackupResponseGetCompletionTimeAttributeTypeOk(arg GetBackupResponseGetCompletionTimeAttributeType) (ret GetBackupResponseGetCompletionTimeRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setGetBackupResponseGetCompletionTimeAttributeType(arg *GetBackupResponseGetCompletionTimeAttributeType, val GetBackupResponseGetCompletionTimeRetType) { -// *arg = &val -//} - -// isModel +// isNotNullableString type GetBackupResponseGetCompletionTimeAttributeType = *string -type GetBackupResponseGetCompletionTimeArgType = string -type GetBackupResponseGetCompletionTimeRetType = string func getGetBackupResponseGetCompletionTimeAttributeTypeOk(arg GetBackupResponseGetCompletionTimeAttributeType) (ret GetBackupResponseGetCompletionTimeRetType, ok bool) { if arg == nil { @@ -53,27 +35,14 @@ func setGetBackupResponseGetCompletionTimeAttributeType(arg *GetBackupResponseGe *arg = &val } +type GetBackupResponseGetCompletionTimeArgType = string +type GetBackupResponseGetCompletionTimeRetType = string + /* types and functions for id */ -//// isAny -//type GetBackupResponseGetIdAttributeType = any -//type GetBackupResponseGetIdArgType = any -//type GetBackupResponseGetIdRetType = any -// -//func getGetBackupResponseGetIdAttributeTypeOk(arg GetBackupResponseGetIdAttributeType) (ret GetBackupResponseGetIdRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setGetBackupResponseGetIdAttributeType(arg *GetBackupResponseGetIdAttributeType, val GetBackupResponseGetIdRetType) { -// *arg = &val -//} - -// isModel +// isLong type GetBackupResponseGetIdAttributeType = *int64 type GetBackupResponseGetIdArgType = int64 type GetBackupResponseGetIdRetType = int64 @@ -93,26 +62,8 @@ func setGetBackupResponseGetIdAttributeType(arg *GetBackupResponseGetIdAttribute types and functions for name */ -//// isAny -//type GetBackupResponseGetNameAttributeType = any -//type GetBackupResponseGetNameArgType = any -//type GetBackupResponseGetNameRetType = any -// -//func getGetBackupResponseGetNameAttributeTypeOk(arg GetBackupResponseGetNameAttributeType) (ret GetBackupResponseGetNameRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setGetBackupResponseGetNameAttributeType(arg *GetBackupResponseGetNameAttributeType, val GetBackupResponseGetNameRetType) { -// *arg = &val -//} - -// isModel +// isNotNullableString type GetBackupResponseGetNameAttributeType = *string -type GetBackupResponseGetNameArgType = string -type GetBackupResponseGetNameRetType = string func getGetBackupResponseGetNameAttributeTypeOk(arg GetBackupResponseGetNameAttributeType) (ret GetBackupResponseGetNameRetType, ok bool) { if arg == nil { @@ -125,30 +76,15 @@ func setGetBackupResponseGetNameAttributeType(arg *GetBackupResponseGetNameAttri *arg = &val } +type GetBackupResponseGetNameArgType = string +type GetBackupResponseGetNameRetType = string + /* types and functions for retainedUntil */ -//// isAny -//type GetBackupResponseGetRetainedUntilAttributeType = any -//type GetBackupResponseGetRetainedUntilArgType = any -//type GetBackupResponseGetRetainedUntilRetType = any -// -//func getGetBackupResponseGetRetainedUntilAttributeTypeOk(arg GetBackupResponseGetRetainedUntilAttributeType) (ret GetBackupResponseGetRetainedUntilRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setGetBackupResponseGetRetainedUntilAttributeType(arg *GetBackupResponseGetRetainedUntilAttributeType, val GetBackupResponseGetRetainedUntilRetType) { -// *arg = &val -//} - -// isModel +// isNotNullableString type GetBackupResponseGetRetainedUntilAttributeType = *string -type GetBackupResponseGetRetainedUntilArgType = string -type GetBackupResponseGetRetainedUntilRetType = string func getGetBackupResponseGetRetainedUntilAttributeTypeOk(arg GetBackupResponseGetRetainedUntilAttributeType) (ret GetBackupResponseGetRetainedUntilRetType, ok bool) { if arg == nil { @@ -161,27 +97,14 @@ func setGetBackupResponseGetRetainedUntilAttributeType(arg *GetBackupResponseGet *arg = &val } +type GetBackupResponseGetRetainedUntilArgType = string +type GetBackupResponseGetRetainedUntilRetType = string + /* types and functions for size */ -//// isAny -//type GetBackupResponseGetSizeAttributeType = any -//type GetBackupResponseGetSizeArgType = any -//type GetBackupResponseGetSizeRetType = any -// -//func getGetBackupResponseGetSizeAttributeTypeOk(arg GetBackupResponseGetSizeAttributeType) (ret GetBackupResponseGetSizeRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setGetBackupResponseGetSizeAttributeType(arg *GetBackupResponseGetSizeAttributeType, val GetBackupResponseGetSizeRetType) { -// *arg = &val -//} - -// isModel +// isLong type GetBackupResponseGetSizeAttributeType = *int64 type GetBackupResponseGetSizeArgType = int64 type GetBackupResponseGetSizeRetType = int64 @@ -201,26 +124,8 @@ func setGetBackupResponseGetSizeAttributeType(arg *GetBackupResponseGetSizeAttri types and functions for type */ -//// isAny -//type GetBackupResponseGetTypeAttributeType = any -//type GetBackupResponseGetTypeArgType = any -//type GetBackupResponseGetTypeRetType = any -// -//func getGetBackupResponseGetTypeAttributeTypeOk(arg GetBackupResponseGetTypeAttributeType) (ret GetBackupResponseGetTypeRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setGetBackupResponseGetTypeAttributeType(arg *GetBackupResponseGetTypeAttributeType, val GetBackupResponseGetTypeRetType) { -// *arg = &val -//} - -// isModel +// isNotNullableString type GetBackupResponseGetTypeAttributeType = *string -type GetBackupResponseGetTypeArgType = string -type GetBackupResponseGetTypeRetType = string func getGetBackupResponseGetTypeAttributeTypeOk(arg GetBackupResponseGetTypeAttributeType) (ret GetBackupResponseGetTypeRetType, ok bool) { if arg == nil { @@ -233,18 +138,27 @@ func setGetBackupResponseGetTypeAttributeType(arg *GetBackupResponseGetTypeAttri *arg = &val } +type GetBackupResponseGetTypeArgType = string +type GetBackupResponseGetTypeRetType = string + // GetBackupResponse struct for GetBackupResponse type GetBackupResponse struct { + // The time when the backup was completed in RFC3339 format. // REQUIRED CompletionTime GetBackupResponseGetCompletionTimeAttributeType `json:"completionTime" required:"true"` + // The ID of the backup. // REQUIRED Id GetBackupResponseGetIdAttributeType `json:"id" required:"true"` + // The name of the backup. // REQUIRED Name GetBackupResponseGetNameAttributeType `json:"name" required:"true"` + // The time until the backup will be retained. // REQUIRED RetainedUntil GetBackupResponseGetRetainedUntilAttributeType `json:"retainedUntil" required:"true"` + // The size of the backup in bytes. // REQUIRED Size GetBackupResponseGetSizeAttributeType `json:"size" required:"true"` + // The type of the backup, which can be automated or manual triggered. // REQUIRED Type GetBackupResponseGetTypeAttributeType `json:"type" required:"true"` } diff --git a/pkg/sqlserverflexalpha/model_list_backup.go b/pkg/sqlserverflexalpha/model_list_backup.go index 7f883f7f..639ea88c 100644 --- a/pkg/sqlserverflexalpha/model_list_backup.go +++ b/pkg/sqlserverflexalpha/model_list_backup.go @@ -21,26 +21,8 @@ var _ MappedNullable = &ListBackup{} types and functions for completionTime */ -//// isAny -//type ListBackupGetCompletionTimeAttributeType = any -//type ListBackupGetCompletionTimeArgType = any -//type ListBackupGetCompletionTimeRetType = any -// -//func getListBackupGetCompletionTimeAttributeTypeOk(arg ListBackupGetCompletionTimeAttributeType) (ret ListBackupGetCompletionTimeRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setListBackupGetCompletionTimeAttributeType(arg *ListBackupGetCompletionTimeAttributeType, val ListBackupGetCompletionTimeRetType) { -// *arg = &val -//} - -// isModel +// isNotNullableString type ListBackupGetCompletionTimeAttributeType = *string -type ListBackupGetCompletionTimeArgType = string -type ListBackupGetCompletionTimeRetType = string func getListBackupGetCompletionTimeAttributeTypeOk(arg ListBackupGetCompletionTimeAttributeType) (ret ListBackupGetCompletionTimeRetType, ok bool) { if arg == nil { @@ -53,27 +35,14 @@ func setListBackupGetCompletionTimeAttributeType(arg *ListBackupGetCompletionTim *arg = &val } +type ListBackupGetCompletionTimeArgType = string +type ListBackupGetCompletionTimeRetType = string + /* types and functions for id */ -//// isAny -//type ListBackupGetIdAttributeType = any -//type ListBackupGetIdArgType = any -//type ListBackupGetIdRetType = any -// -//func getListBackupGetIdAttributeTypeOk(arg ListBackupGetIdAttributeType) (ret ListBackupGetIdRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setListBackupGetIdAttributeType(arg *ListBackupGetIdAttributeType, val ListBackupGetIdRetType) { -// *arg = &val -//} - -// isModel +// isLong type ListBackupGetIdAttributeType = *int64 type ListBackupGetIdArgType = int64 type ListBackupGetIdRetType = int64 @@ -93,26 +62,8 @@ func setListBackupGetIdAttributeType(arg *ListBackupGetIdAttributeType, val List types and functions for name */ -//// isAny -//type ListBackupGetNameAttributeType = any -//type ListBackupGetNameArgType = any -//type ListBackupGetNameRetType = any -// -//func getListBackupGetNameAttributeTypeOk(arg ListBackupGetNameAttributeType) (ret ListBackupGetNameRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setListBackupGetNameAttributeType(arg *ListBackupGetNameAttributeType, val ListBackupGetNameRetType) { -// *arg = &val -//} - -// isModel +// isNotNullableString type ListBackupGetNameAttributeType = *string -type ListBackupGetNameArgType = string -type ListBackupGetNameRetType = string func getListBackupGetNameAttributeTypeOk(arg ListBackupGetNameAttributeType) (ret ListBackupGetNameRetType, ok bool) { if arg == nil { @@ -125,30 +76,15 @@ func setListBackupGetNameAttributeType(arg *ListBackupGetNameAttributeType, val *arg = &val } +type ListBackupGetNameArgType = string +type ListBackupGetNameRetType = string + /* types and functions for retainedUntil */ -//// isAny -//type ListBackupGetRetainedUntilAttributeType = any -//type ListBackupGetRetainedUntilArgType = any -//type ListBackupGetRetainedUntilRetType = any -// -//func getListBackupGetRetainedUntilAttributeTypeOk(arg ListBackupGetRetainedUntilAttributeType) (ret ListBackupGetRetainedUntilRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setListBackupGetRetainedUntilAttributeType(arg *ListBackupGetRetainedUntilAttributeType, val ListBackupGetRetainedUntilRetType) { -// *arg = &val -//} - -// isModel +// isNotNullableString type ListBackupGetRetainedUntilAttributeType = *string -type ListBackupGetRetainedUntilArgType = string -type ListBackupGetRetainedUntilRetType = string func getListBackupGetRetainedUntilAttributeTypeOk(arg ListBackupGetRetainedUntilAttributeType) (ret ListBackupGetRetainedUntilRetType, ok bool) { if arg == nil { @@ -161,27 +97,14 @@ func setListBackupGetRetainedUntilAttributeType(arg *ListBackupGetRetainedUntilA *arg = &val } +type ListBackupGetRetainedUntilArgType = string +type ListBackupGetRetainedUntilRetType = string + /* types and functions for size */ -//// isAny -//type ListBackupGetSizeAttributeType = any -//type ListBackupGetSizeArgType = any -//type ListBackupGetSizeRetType = any -// -//func getListBackupGetSizeAttributeTypeOk(arg ListBackupGetSizeAttributeType) (ret ListBackupGetSizeRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setListBackupGetSizeAttributeType(arg *ListBackupGetSizeAttributeType, val ListBackupGetSizeRetType) { -// *arg = &val -//} - -// isModel +// isLong type ListBackupGetSizeAttributeType = *int64 type ListBackupGetSizeArgType = int64 type ListBackupGetSizeRetType = int64 @@ -201,26 +124,8 @@ func setListBackupGetSizeAttributeType(arg *ListBackupGetSizeAttributeType, val types and functions for type */ -//// isAny -//type ListBackupGetTypeAttributeType = any -//type ListBackupGetTypeArgType = any -//type ListBackupGetTypeRetType = any -// -//func getListBackupGetTypeAttributeTypeOk(arg ListBackupGetTypeAttributeType) (ret ListBackupGetTypeRetType, ok bool) { -// if arg == nil { -// return ret, false -// } -// return *arg, true -//} -// -//func setListBackupGetTypeAttributeType(arg *ListBackupGetTypeAttributeType, val ListBackupGetTypeRetType) { -// *arg = &val -//} - -// isModel +// isNotNullableString type ListBackupGetTypeAttributeType = *string -type ListBackupGetTypeArgType = string -type ListBackupGetTypeRetType = string func getListBackupGetTypeAttributeTypeOk(arg ListBackupGetTypeAttributeType) (ret ListBackupGetTypeRetType, ok bool) { if arg == nil { @@ -233,18 +138,27 @@ func setListBackupGetTypeAttributeType(arg *ListBackupGetTypeAttributeType, val *arg = &val } +type ListBackupGetTypeArgType = string +type ListBackupGetTypeRetType = string + // ListBackup struct for ListBackup type ListBackup struct { + // The time when the backup was completed in RFC3339 format. // REQUIRED CompletionTime ListBackupGetCompletionTimeAttributeType `json:"completionTime" required:"true"` + // The ID of the backup. // REQUIRED Id ListBackupGetIdAttributeType `json:"id" required:"true"` + // The name of the backup. // REQUIRED Name ListBackupGetNameAttributeType `json:"name" required:"true"` + // The time until the backup will be retained. // REQUIRED RetainedUntil ListBackupGetRetainedUntilAttributeType `json:"retainedUntil" required:"true"` + // The size of the backup in bytes. // REQUIRED Size ListBackupGetSizeAttributeType `json:"size" required:"true"` + // The type of the backup, which can be automated or manual triggered. // REQUIRED Type ListBackupGetTypeAttributeType `json:"type" required:"true"` } diff --git a/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload.go b/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload.go new file mode 100644 index 00000000..84c18d24 --- /dev/null +++ b/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload.go @@ -0,0 +1,170 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "encoding/json" +) + +// checks if the RestoreDatabaseFromBackupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RestoreDatabaseFromBackupPayload{} + +/* + types and functions for database_name +*/ + +// isNotNullableString +type RestoreDatabaseFromBackupPayloadGetDatabaseNameAttributeType = *string + +func getRestoreDatabaseFromBackupPayloadGetDatabaseNameAttributeTypeOk(arg RestoreDatabaseFromBackupPayloadGetDatabaseNameAttributeType) (ret RestoreDatabaseFromBackupPayloadGetDatabaseNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRestoreDatabaseFromBackupPayloadGetDatabaseNameAttributeType(arg *RestoreDatabaseFromBackupPayloadGetDatabaseNameAttributeType, val RestoreDatabaseFromBackupPayloadGetDatabaseNameRetType) { + *arg = &val +} + +type RestoreDatabaseFromBackupPayloadGetDatabaseNameArgType = string +type RestoreDatabaseFromBackupPayloadGetDatabaseNameRetType = string + +/* + types and functions for source +*/ + +// isModel +type RestoreDatabaseFromBackupPayloadGetSourceAttributeType = *RestoreDatabaseFromBackupPayloadSource +type RestoreDatabaseFromBackupPayloadGetSourceArgType = RestoreDatabaseFromBackupPayloadSource +type RestoreDatabaseFromBackupPayloadGetSourceRetType = RestoreDatabaseFromBackupPayloadSource + +func getRestoreDatabaseFromBackupPayloadGetSourceAttributeTypeOk(arg RestoreDatabaseFromBackupPayloadGetSourceAttributeType) (ret RestoreDatabaseFromBackupPayloadGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRestoreDatabaseFromBackupPayloadGetSourceAttributeType(arg *RestoreDatabaseFromBackupPayloadGetSourceAttributeType, val RestoreDatabaseFromBackupPayloadGetSourceRetType) { + *arg = &val +} + +// RestoreDatabaseFromBackupPayload Request to restore a database. +type RestoreDatabaseFromBackupPayload struct { + // The name of the database on the instance to be restore. + // REQUIRED + DatabaseName RestoreDatabaseFromBackupPayloadGetDatabaseNameAttributeType `json:"database_name" required:"true"` + // REQUIRED + Source RestoreDatabaseFromBackupPayloadGetSourceAttributeType `json:"source" required:"true"` +} + +type _RestoreDatabaseFromBackupPayload RestoreDatabaseFromBackupPayload + +// NewRestoreDatabaseFromBackupPayload instantiates a new RestoreDatabaseFromBackupPayload 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 NewRestoreDatabaseFromBackupPayload(databaseName RestoreDatabaseFromBackupPayloadGetDatabaseNameArgType, source RestoreDatabaseFromBackupPayloadGetSourceArgType) *RestoreDatabaseFromBackupPayload { + this := RestoreDatabaseFromBackupPayload{} + setRestoreDatabaseFromBackupPayloadGetDatabaseNameAttributeType(&this.DatabaseName, databaseName) + setRestoreDatabaseFromBackupPayloadGetSourceAttributeType(&this.Source, source) + return &this +} + +// NewRestoreDatabaseFromBackupPayloadWithDefaults instantiates a new RestoreDatabaseFromBackupPayload 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 NewRestoreDatabaseFromBackupPayloadWithDefaults() *RestoreDatabaseFromBackupPayload { + this := RestoreDatabaseFromBackupPayload{} + return &this +} + +// GetDatabaseName returns the DatabaseName field value +func (o *RestoreDatabaseFromBackupPayload) GetDatabaseName() (ret RestoreDatabaseFromBackupPayloadGetDatabaseNameRetType) { + ret, _ = o.GetDatabaseNameOk() + return ret +} + +// GetDatabaseNameOk returns a tuple with the DatabaseName field value +// and a boolean to check if the value has been set. +func (o *RestoreDatabaseFromBackupPayload) GetDatabaseNameOk() (ret RestoreDatabaseFromBackupPayloadGetDatabaseNameRetType, ok bool) { + return getRestoreDatabaseFromBackupPayloadGetDatabaseNameAttributeTypeOk(o.DatabaseName) +} + +// SetDatabaseName sets field value +func (o *RestoreDatabaseFromBackupPayload) SetDatabaseName(v RestoreDatabaseFromBackupPayloadGetDatabaseNameRetType) { + setRestoreDatabaseFromBackupPayloadGetDatabaseNameAttributeType(&o.DatabaseName, v) +} + +// GetSource returns the Source field value +func (o *RestoreDatabaseFromBackupPayload) GetSource() (ret RestoreDatabaseFromBackupPayloadGetSourceRetType) { + ret, _ = o.GetSourceOk() + return ret +} + +// GetSourceOk returns a tuple with the Source field value +// and a boolean to check if the value has been set. +func (o *RestoreDatabaseFromBackupPayload) GetSourceOk() (ret RestoreDatabaseFromBackupPayloadGetSourceRetType, ok bool) { + return getRestoreDatabaseFromBackupPayloadGetSourceAttributeTypeOk(o.Source) +} + +// SetSource sets field value +func (o *RestoreDatabaseFromBackupPayload) SetSource(v RestoreDatabaseFromBackupPayloadGetSourceRetType) { + setRestoreDatabaseFromBackupPayloadGetSourceAttributeType(&o.Source, v) +} + +func (o RestoreDatabaseFromBackupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRestoreDatabaseFromBackupPayloadGetDatabaseNameAttributeTypeOk(o.DatabaseName); ok { + toSerialize["DatabaseName"] = val + } + if val, ok := getRestoreDatabaseFromBackupPayloadGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + return toSerialize, nil +} + +type NullableRestoreDatabaseFromBackupPayload struct { + value *RestoreDatabaseFromBackupPayload + isSet bool +} + +func (v NullableRestoreDatabaseFromBackupPayload) Get() *RestoreDatabaseFromBackupPayload { + return v.value +} + +func (v *NullableRestoreDatabaseFromBackupPayload) Set(val *RestoreDatabaseFromBackupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableRestoreDatabaseFromBackupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableRestoreDatabaseFromBackupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRestoreDatabaseFromBackupPayload(val *RestoreDatabaseFromBackupPayload) *NullableRestoreDatabaseFromBackupPayload { + return &NullableRestoreDatabaseFromBackupPayload{value: val, isSet: true} +} + +func (v NullableRestoreDatabaseFromBackupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRestoreDatabaseFromBackupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_source.go b/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_source.go new file mode 100644 index 00000000..42abd9b8 --- /dev/null +++ b/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_source.go @@ -0,0 +1,163 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "encoding/json" + "fmt" +) + +// RestoreDatabaseFromBackupPayloadSource - The source of the restore. +type RestoreDatabaseFromBackupPayloadSource struct { + SourceBackup *SourceBackup + SourceExternalS3 *SourceExternalS3 +} + +// SourceBackupAsRestoreDatabaseFromBackupPayloadSource is a convenience function that returns SourceBackup wrapped in RestoreDatabaseFromBackupPayloadSource +func SourceBackupAsRestoreDatabaseFromBackupPayloadSource(v *SourceBackup) RestoreDatabaseFromBackupPayloadSource { + return RestoreDatabaseFromBackupPayloadSource{ + SourceBackup: v, + } +} + +// SourceExternalS3AsRestoreDatabaseFromBackupPayloadSource is a convenience function that returns SourceExternalS3 wrapped in RestoreDatabaseFromBackupPayloadSource +func SourceExternalS3AsRestoreDatabaseFromBackupPayloadSource(v *SourceExternalS3) RestoreDatabaseFromBackupPayloadSource { + return RestoreDatabaseFromBackupPayloadSource{ + SourceExternalS3: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *RestoreDatabaseFromBackupPayloadSource) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'BACKUP' + if jsonDict["type"] == "BACKUP" { + // try to unmarshal JSON data into SourceBackup + err = json.Unmarshal(data, &dst.SourceBackup) + if err == nil { + return nil // data stored in dst.SourceBackup, return on the first match + } else { + dst.SourceBackup = nil + return fmt.Errorf("failed to unmarshal RestoreDatabaseFromBackupPayloadSource as SourceBackup: %s", err.Error()) + } + } + + // check if the discriminator value is 'EXTERNAL_S3' + if jsonDict["type"] == "EXTERNAL_S3" { + // try to unmarshal JSON data into SourceExternalS3 + err = json.Unmarshal(data, &dst.SourceExternalS3) + if err == nil { + return nil // data stored in dst.SourceExternalS3, return on the first match + } else { + dst.SourceExternalS3 = nil + return fmt.Errorf("failed to unmarshal RestoreDatabaseFromBackupPayloadSource as SourceExternalS3: %s", err.Error()) + } + } + + // check if the discriminator value is 'source.backup' + if jsonDict["type"] == "source.backup" { + // try to unmarshal JSON data into SourceBackup + err = json.Unmarshal(data, &dst.SourceBackup) + if err == nil { + return nil // data stored in dst.SourceBackup, return on the first match + } else { + dst.SourceBackup = nil + return fmt.Errorf("failed to unmarshal RestoreDatabaseFromBackupPayloadSource as SourceBackup: %s", err.Error()) + } + } + + // check if the discriminator value is 'source.externalS3' + if jsonDict["type"] == "source.externalS3" { + // try to unmarshal JSON data into SourceExternalS3 + err = json.Unmarshal(data, &dst.SourceExternalS3) + if err == nil { + return nil // data stored in dst.SourceExternalS3, return on the first match + } else { + dst.SourceExternalS3 = nil + return fmt.Errorf("failed to unmarshal RestoreDatabaseFromBackupPayloadSource as SourceExternalS3: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src RestoreDatabaseFromBackupPayloadSource) MarshalJSON() ([]byte, error) { + if src.SourceBackup != nil { + return json.Marshal(&src.SourceBackup) + } + + if src.SourceExternalS3 != nil { + return json.Marshal(&src.SourceExternalS3) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *RestoreDatabaseFromBackupPayloadSource) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.SourceBackup != nil { + return obj.SourceBackup + } + + if obj.SourceExternalS3 != nil { + return obj.SourceExternalS3 + } + + // all schemas are nil + return nil +} + +type NullableRestoreDatabaseFromBackupPayloadSource struct { + value *RestoreDatabaseFromBackupPayloadSource + isSet bool +} + +func (v NullableRestoreDatabaseFromBackupPayloadSource) Get() *RestoreDatabaseFromBackupPayloadSource { + return v.value +} + +func (v *NullableRestoreDatabaseFromBackupPayloadSource) Set(val *RestoreDatabaseFromBackupPayloadSource) { + v.value = val + v.isSet = true +} + +func (v NullableRestoreDatabaseFromBackupPayloadSource) IsSet() bool { + return v.isSet +} + +func (v *NullableRestoreDatabaseFromBackupPayloadSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRestoreDatabaseFromBackupPayloadSource(val *RestoreDatabaseFromBackupPayloadSource) *NullableRestoreDatabaseFromBackupPayloadSource { + return &NullableRestoreDatabaseFromBackupPayloadSource{value: val, isSet: true} +} + +func (v NullableRestoreDatabaseFromBackupPayloadSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRestoreDatabaseFromBackupPayloadSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_source_test.go b/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_source_test.go new file mode 100644 index 00000000..f551e1f0 --- /dev/null +++ b/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_source_test.go @@ -0,0 +1,11 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha diff --git a/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_test.go b/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_test.go new file mode 100644 index 00000000..f551e1f0 --- /dev/null +++ b/pkg/sqlserverflexalpha/model_restore_database_from_backup_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha diff --git a/pkg/sqlserverflexalpha/model_s3file_info.go b/pkg/sqlserverflexalpha/model_s3file_info.go new file mode 100644 index 00000000..f04de020 --- /dev/null +++ b/pkg/sqlserverflexalpha/model_s3file_info.go @@ -0,0 +1,178 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "encoding/json" +) + +// checks if the S3fileInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3fileInfo{} + +/* + types and functions for file_number +*/ + +// isInteger +type S3fileInfoGetFileNumberAttributeType = *int64 +type S3fileInfoGetFileNumberArgType = int64 +type S3fileInfoGetFileNumberRetType = int64 + +func getS3fileInfoGetFileNumberAttributeTypeOk(arg S3fileInfoGetFileNumberAttributeType) (ret S3fileInfoGetFileNumberRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setS3fileInfoGetFileNumberAttributeType(arg *S3fileInfoGetFileNumberAttributeType, val S3fileInfoGetFileNumberRetType) { + *arg = &val +} + +/* + types and functions for file_path +*/ + +// isNotNullableString +type S3fileInfoGetFilePathAttributeType = *string + +func getS3fileInfoGetFilePathAttributeTypeOk(arg S3fileInfoGetFilePathAttributeType) (ret S3fileInfoGetFilePathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setS3fileInfoGetFilePathAttributeType(arg *S3fileInfoGetFilePathAttributeType, val S3fileInfoGetFilePathRetType) { + *arg = &val +} + +type S3fileInfoGetFilePathArgType = string +type S3fileInfoGetFilePathRetType = string + +// S3fileInfo struct for S3fileInfo +type S3fileInfo struct { + // The sequence number of the file + // Can be cast to int32 without loss of precision. + FileNumber S3fileInfoGetFileNumberAttributeType `json:"file_number,omitempty"` + // The path to the file on the S3 bucket + FilePath S3fileInfoGetFilePathAttributeType `json:"file_path,omitempty"` +} + +// NewS3fileInfo instantiates a new S3fileInfo 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 NewS3fileInfo() *S3fileInfo { + this := S3fileInfo{} + return &this +} + +// NewS3fileInfoWithDefaults instantiates a new S3fileInfo 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 NewS3fileInfoWithDefaults() *S3fileInfo { + this := S3fileInfo{} + return &this +} + +// GetFileNumber returns the FileNumber field value if set, zero value otherwise. +func (o *S3fileInfo) GetFileNumber() (res S3fileInfoGetFileNumberRetType) { + res, _ = o.GetFileNumberOk() + return +} + +// GetFileNumberOk returns a tuple with the FileNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3fileInfo) GetFileNumberOk() (ret S3fileInfoGetFileNumberRetType, ok bool) { + return getS3fileInfoGetFileNumberAttributeTypeOk(o.FileNumber) +} + +// HasFileNumber returns a boolean if a field has been set. +func (o *S3fileInfo) HasFileNumber() bool { + _, ok := o.GetFileNumberOk() + return ok +} + +// SetFileNumber gets a reference to the given int64 and assigns it to the FileNumber field. +func (o *S3fileInfo) SetFileNumber(v S3fileInfoGetFileNumberRetType) { + setS3fileInfoGetFileNumberAttributeType(&o.FileNumber, v) +} + +// GetFilePath returns the FilePath field value if set, zero value otherwise. +func (o *S3fileInfo) GetFilePath() (res S3fileInfoGetFilePathRetType) { + res, _ = o.GetFilePathOk() + return +} + +// GetFilePathOk returns a tuple with the FilePath field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *S3fileInfo) GetFilePathOk() (ret S3fileInfoGetFilePathRetType, ok bool) { + return getS3fileInfoGetFilePathAttributeTypeOk(o.FilePath) +} + +// HasFilePath returns a boolean if a field has been set. +func (o *S3fileInfo) HasFilePath() bool { + _, ok := o.GetFilePathOk() + return ok +} + +// SetFilePath gets a reference to the given string and assigns it to the FilePath field. +func (o *S3fileInfo) SetFilePath(v S3fileInfoGetFilePathRetType) { + setS3fileInfoGetFilePathAttributeType(&o.FilePath, v) +} + +func (o S3fileInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getS3fileInfoGetFileNumberAttributeTypeOk(o.FileNumber); ok { + toSerialize["FileNumber"] = val + } + if val, ok := getS3fileInfoGetFilePathAttributeTypeOk(o.FilePath); ok { + toSerialize["FilePath"] = val + } + return toSerialize, nil +} + +type NullableS3fileInfo struct { + value *S3fileInfo + isSet bool +} + +func (v NullableS3fileInfo) Get() *S3fileInfo { + return v.value +} + +func (v *NullableS3fileInfo) Set(val *S3fileInfo) { + v.value = val + v.isSet = true +} + +func (v NullableS3fileInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableS3fileInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableS3fileInfo(val *S3fileInfo) *NullableS3fileInfo { + return &NullableS3fileInfo{value: val, isSet: true} +} + +func (v NullableS3fileInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableS3fileInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sqlserverflexalpha/model_s3file_info_test.go b/pkg/sqlserverflexalpha/model_s3file_info_test.go new file mode 100644 index 00000000..f551e1f0 --- /dev/null +++ b/pkg/sqlserverflexalpha/model_s3file_info_test.go @@ -0,0 +1,11 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha diff --git a/pkg/sqlserverflexalpha/model_source_backup.go b/pkg/sqlserverflexalpha/model_source_backup.go new file mode 100644 index 00000000..dd62cbbb --- /dev/null +++ b/pkg/sqlserverflexalpha/model_source_backup.go @@ -0,0 +1,228 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "encoding/json" + "fmt" +) + +// checks if the SourceBackup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SourceBackup{} + +/* + types and functions for type +*/ + +// isEnum + +// SourceBackupTypes the model 'SourceBackup' +// value type for enums +type SourceBackupTypes string + +// List of Type +const ( + SOURCEBACKUPTYPE_BACKUP SourceBackupTypes = "BACKUP" +) + +// All allowed values of SourceBackup enum +var AllowedSourceBackupTypesEnumValues = []SourceBackupTypes{ + "BACKUP", +} + +func (v *SourceBackupTypes) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson SourceBackupTypes + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := SourceBackupTypes(value) + for _, existing := range AllowedSourceBackupTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SourceBackup", value) +} + +// NewSourceBackupTypesFromValue returns a pointer to a valid SourceBackupTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSourceBackupTypesFromValue(v SourceBackupTypes) (*SourceBackupTypes, error) { + ev := SourceBackupTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SourceBackupTypes: valid values are %v", v, AllowedSourceBackupTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SourceBackupTypes) IsValid() bool { + for _, existing := range AllowedSourceBackupTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v SourceBackupTypes) Ptr() *SourceBackupTypes { + return &v +} + +type NullableSourceBackupTypes struct { + value *SourceBackupTypes + isSet bool +} + +func (v NullableSourceBackupTypes) Get() *SourceBackupTypes { + return v.value +} + +func (v *NullableSourceBackupTypes) Set(val *SourceBackupTypes) { + v.value = val + v.isSet = true +} + +func (v NullableSourceBackupTypes) IsSet() bool { + return v.isSet +} + +func (v *NullableSourceBackupTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSourceBackupTypes(val *SourceBackupTypes) *NullableSourceBackupTypes { + return &NullableSourceBackupTypes{value: val, isSet: true} +} + +func (v NullableSourceBackupTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSourceBackupTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type SourceBackupGetTypeAttributeType = *SourceBackupTypes +type SourceBackupGetTypeArgType = SourceBackupTypes +type SourceBackupGetTypeRetType = SourceBackupTypes + +func getSourceBackupGetTypeAttributeTypeOk(arg SourceBackupGetTypeAttributeType) (ret SourceBackupGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSourceBackupGetTypeAttributeType(arg *SourceBackupGetTypeAttributeType, val SourceBackupGetTypeRetType) { + *arg = &val +} + +// SourceBackup Restore from an existing managed backup. +type SourceBackup struct { + // REQUIRED + Type SourceBackupGetTypeAttributeType `json:"type" required:"true"` +} + +type _SourceBackup SourceBackup + +// NewSourceBackup instantiates a new SourceBackup 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 NewSourceBackup(types SourceBackupGetTypeArgType) *SourceBackup { + this := SourceBackup{} + setSourceBackupGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewSourceBackupWithDefaults instantiates a new SourceBackup 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 NewSourceBackupWithDefaults() *SourceBackup { + this := SourceBackup{} + return &this +} + +// GetType returns the Type field value +func (o *SourceBackup) GetType() (ret SourceBackupGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SourceBackup) GetTypeOk() (ret SourceBackupGetTypeRetType, ok bool) { + return getSourceBackupGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *SourceBackup) SetType(v SourceBackupGetTypeRetType) { + setSourceBackupGetTypeAttributeType(&o.Type, v) +} + +func (o SourceBackup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSourceBackupGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableSourceBackup struct { + value *SourceBackup + isSet bool +} + +func (v NullableSourceBackup) Get() *SourceBackup { + return v.value +} + +func (v *NullableSourceBackup) Set(val *SourceBackup) { + v.value = val + v.isSet = true +} + +func (v NullableSourceBackup) IsSet() bool { + return v.isSet +} + +func (v *NullableSourceBackup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSourceBackup(val *SourceBackup) *NullableSourceBackup { + return &NullableSourceBackup{value: val, isSet: true} +} + +func (v NullableSourceBackup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSourceBackup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sqlserverflexalpha/model_source_backup_test.go b/pkg/sqlserverflexalpha/model_source_backup_test.go new file mode 100644 index 00000000..1162d38c --- /dev/null +++ b/pkg/sqlserverflexalpha/model_source_backup_test.go @@ -0,0 +1,51 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "testing" +) + +// isEnum + +func TestSourceBackupTypes_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"BACKUP"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := SourceBackupTypes("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/sqlserverflexalpha/model_source_external_s3.go b/pkg/sqlserverflexalpha/model_source_external_s3.go new file mode 100644 index 00000000..e12b8146 --- /dev/null +++ b/pkg/sqlserverflexalpha/model_source_external_s3.go @@ -0,0 +1,365 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "encoding/json" + "fmt" +) + +// checks if the SourceExternalS3 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SourceExternalS3{} + +/* + types and functions for database_owner +*/ + +// isNotNullableString +type SourceExternalS3GetDatabaseOwnerAttributeType = *string + +func getSourceExternalS3GetDatabaseOwnerAttributeTypeOk(arg SourceExternalS3GetDatabaseOwnerAttributeType) (ret SourceExternalS3GetDatabaseOwnerRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSourceExternalS3GetDatabaseOwnerAttributeType(arg *SourceExternalS3GetDatabaseOwnerAttributeType, val SourceExternalS3GetDatabaseOwnerRetType) { + *arg = &val +} + +type SourceExternalS3GetDatabaseOwnerArgType = string +type SourceExternalS3GetDatabaseOwnerRetType = string + +/* + types and functions for logging_guid +*/ + +// isNotNullableString +type SourceExternalS3GetLoggingGuidAttributeType = *string + +func getSourceExternalS3GetLoggingGuidAttributeTypeOk(arg SourceExternalS3GetLoggingGuidAttributeType) (ret SourceExternalS3GetLoggingGuidRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSourceExternalS3GetLoggingGuidAttributeType(arg *SourceExternalS3GetLoggingGuidAttributeType, val SourceExternalS3GetLoggingGuidRetType) { + *arg = &val +} + +type SourceExternalS3GetLoggingGuidArgType = string +type SourceExternalS3GetLoggingGuidRetType = string + +/* + types and functions for s3_details +*/ + +// isModel +type SourceExternalS3GetS3DetailsAttributeType = *ExternalS3 +type SourceExternalS3GetS3DetailsArgType = ExternalS3 +type SourceExternalS3GetS3DetailsRetType = ExternalS3 + +func getSourceExternalS3GetS3DetailsAttributeTypeOk(arg SourceExternalS3GetS3DetailsAttributeType) (ret SourceExternalS3GetS3DetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSourceExternalS3GetS3DetailsAttributeType(arg *SourceExternalS3GetS3DetailsAttributeType, val SourceExternalS3GetS3DetailsRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isEnum + +// SourceExternalS3Types the model 'SourceExternalS3' +// value type for enums +type SourceExternalS3Types string + +// List of Type +const ( + SOURCEEXTERNALS3TYPE_EXTERNAL_S3 SourceExternalS3Types = "EXTERNAL_S3" +) + +// All allowed values of SourceExternalS3 enum +var AllowedSourceExternalS3TypesEnumValues = []SourceExternalS3Types{ + "EXTERNAL_S3", +} + +func (v *SourceExternalS3Types) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson SourceExternalS3Types + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := SourceExternalS3Types(value) + for _, existing := range AllowedSourceExternalS3TypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid SourceExternalS3", value) +} + +// NewSourceExternalS3TypesFromValue returns a pointer to a valid SourceExternalS3Types +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewSourceExternalS3TypesFromValue(v SourceExternalS3Types) (*SourceExternalS3Types, error) { + ev := SourceExternalS3Types(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for SourceExternalS3Types: valid values are %v", v, AllowedSourceExternalS3TypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v SourceExternalS3Types) IsValid() bool { + for _, existing := range AllowedSourceExternalS3TypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v SourceExternalS3Types) Ptr() *SourceExternalS3Types { + return &v +} + +type NullableSourceExternalS3Types struct { + value *SourceExternalS3Types + isSet bool +} + +func (v NullableSourceExternalS3Types) Get() *SourceExternalS3Types { + return v.value +} + +func (v *NullableSourceExternalS3Types) Set(val *SourceExternalS3Types) { + v.value = val + v.isSet = true +} + +func (v NullableSourceExternalS3Types) IsSet() bool { + return v.isSet +} + +func (v *NullableSourceExternalS3Types) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSourceExternalS3Types(val *SourceExternalS3Types) *NullableSourceExternalS3Types { + return &NullableSourceExternalS3Types{value: val, isSet: true} +} + +func (v NullableSourceExternalS3Types) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSourceExternalS3Types) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type SourceExternalS3GetTypeAttributeType = *SourceExternalS3Types +type SourceExternalS3GetTypeArgType = SourceExternalS3Types +type SourceExternalS3GetTypeRetType = SourceExternalS3Types + +func getSourceExternalS3GetTypeAttributeTypeOk(arg SourceExternalS3GetTypeAttributeType) (ret SourceExternalS3GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSourceExternalS3GetTypeAttributeType(arg *SourceExternalS3GetTypeAttributeType, val SourceExternalS3GetTypeRetType) { + *arg = &val +} + +// SourceExternalS3 Restore from an external S3 backup file. +type SourceExternalS3 struct { + // The owner of the database. + // REQUIRED + DatabaseOwner SourceExternalS3GetDatabaseOwnerAttributeType `json:"database_owner" required:"true"` + // Logging guid to have a complete activity log over all sub stored procedures. + LoggingGuid SourceExternalS3GetLoggingGuidAttributeType `json:"logging_guid,omitempty"` + // REQUIRED + S3Details SourceExternalS3GetS3DetailsAttributeType `json:"s3_details" required:"true"` + // REQUIRED + Type SourceExternalS3GetTypeAttributeType `json:"type" required:"true"` +} + +type _SourceExternalS3 SourceExternalS3 + +// NewSourceExternalS3 instantiates a new SourceExternalS3 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 NewSourceExternalS3(databaseOwner SourceExternalS3GetDatabaseOwnerArgType, s3Details SourceExternalS3GetS3DetailsArgType, types SourceExternalS3GetTypeArgType) *SourceExternalS3 { + this := SourceExternalS3{} + setSourceExternalS3GetDatabaseOwnerAttributeType(&this.DatabaseOwner, databaseOwner) + setSourceExternalS3GetS3DetailsAttributeType(&this.S3Details, s3Details) + setSourceExternalS3GetTypeAttributeType(&this.Type, types) + return &this +} + +// NewSourceExternalS3WithDefaults instantiates a new SourceExternalS3 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 NewSourceExternalS3WithDefaults() *SourceExternalS3 { + this := SourceExternalS3{} + return &this +} + +// GetDatabaseOwner returns the DatabaseOwner field value +func (o *SourceExternalS3) GetDatabaseOwner() (ret SourceExternalS3GetDatabaseOwnerRetType) { + ret, _ = o.GetDatabaseOwnerOk() + return ret +} + +// GetDatabaseOwnerOk returns a tuple with the DatabaseOwner field value +// and a boolean to check if the value has been set. +func (o *SourceExternalS3) GetDatabaseOwnerOk() (ret SourceExternalS3GetDatabaseOwnerRetType, ok bool) { + return getSourceExternalS3GetDatabaseOwnerAttributeTypeOk(o.DatabaseOwner) +} + +// SetDatabaseOwner sets field value +func (o *SourceExternalS3) SetDatabaseOwner(v SourceExternalS3GetDatabaseOwnerRetType) { + setSourceExternalS3GetDatabaseOwnerAttributeType(&o.DatabaseOwner, v) +} + +// GetLoggingGuid returns the LoggingGuid field value if set, zero value otherwise. +func (o *SourceExternalS3) GetLoggingGuid() (res SourceExternalS3GetLoggingGuidRetType) { + res, _ = o.GetLoggingGuidOk() + return +} + +// GetLoggingGuidOk returns a tuple with the LoggingGuid field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SourceExternalS3) GetLoggingGuidOk() (ret SourceExternalS3GetLoggingGuidRetType, ok bool) { + return getSourceExternalS3GetLoggingGuidAttributeTypeOk(o.LoggingGuid) +} + +// HasLoggingGuid returns a boolean if a field has been set. +func (o *SourceExternalS3) HasLoggingGuid() bool { + _, ok := o.GetLoggingGuidOk() + return ok +} + +// SetLoggingGuid gets a reference to the given string and assigns it to the LoggingGuid field. +func (o *SourceExternalS3) SetLoggingGuid(v SourceExternalS3GetLoggingGuidRetType) { + setSourceExternalS3GetLoggingGuidAttributeType(&o.LoggingGuid, v) +} + +// GetS3Details returns the S3Details field value +func (o *SourceExternalS3) GetS3Details() (ret SourceExternalS3GetS3DetailsRetType) { + ret, _ = o.GetS3DetailsOk() + return ret +} + +// GetS3DetailsOk returns a tuple with the S3Details field value +// and a boolean to check if the value has been set. +func (o *SourceExternalS3) GetS3DetailsOk() (ret SourceExternalS3GetS3DetailsRetType, ok bool) { + return getSourceExternalS3GetS3DetailsAttributeTypeOk(o.S3Details) +} + +// SetS3Details sets field value +func (o *SourceExternalS3) SetS3Details(v SourceExternalS3GetS3DetailsRetType) { + setSourceExternalS3GetS3DetailsAttributeType(&o.S3Details, v) +} + +// GetType returns the Type field value +func (o *SourceExternalS3) GetType() (ret SourceExternalS3GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SourceExternalS3) GetTypeOk() (ret SourceExternalS3GetTypeRetType, ok bool) { + return getSourceExternalS3GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *SourceExternalS3) SetType(v SourceExternalS3GetTypeRetType) { + setSourceExternalS3GetTypeAttributeType(&o.Type, v) +} + +func (o SourceExternalS3) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSourceExternalS3GetDatabaseOwnerAttributeTypeOk(o.DatabaseOwner); ok { + toSerialize["DatabaseOwner"] = val + } + if val, ok := getSourceExternalS3GetLoggingGuidAttributeTypeOk(o.LoggingGuid); ok { + toSerialize["LoggingGuid"] = val + } + if val, ok := getSourceExternalS3GetS3DetailsAttributeTypeOk(o.S3Details); ok { + toSerialize["S3Details"] = val + } + if val, ok := getSourceExternalS3GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableSourceExternalS3 struct { + value *SourceExternalS3 + isSet bool +} + +func (v NullableSourceExternalS3) Get() *SourceExternalS3 { + return v.value +} + +func (v *NullableSourceExternalS3) Set(val *SourceExternalS3) { + v.value = val + v.isSet = true +} + +func (v NullableSourceExternalS3) IsSet() bool { + return v.isSet +} + +func (v *NullableSourceExternalS3) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSourceExternalS3(val *SourceExternalS3) *NullableSourceExternalS3 { + return &NullableSourceExternalS3{value: val, isSet: true} +} + +func (v NullableSourceExternalS3) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSourceExternalS3) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/sqlserverflexalpha/model_source_external_s3_test.go b/pkg/sqlserverflexalpha/model_source_external_s3_test.go new file mode 100644 index 00000000..0189999a --- /dev/null +++ b/pkg/sqlserverflexalpha/model_source_external_s3_test.go @@ -0,0 +1,51 @@ +/* +STACKIT MSSQL Service API + +This is the documentation for the STACKIT MSSQL service + +API version: 3alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "testing" +) + +// isEnum + +func TestSourceExternalS3Types_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"EXTERNAL_S3"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := SourceExternalS3Types("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/vpnalpha/.openapi-generator/VERSION b/pkg/vpnalpha/.openapi-generator/VERSION new file mode 100644 index 00000000..cd802a1e --- /dev/null +++ b/pkg/vpnalpha/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/pkg/vpnalpha/api_default.go b/pkg/vpnalpha/api_default.go new file mode 100644 index 00000000..4fca6326 --- /dev/null +++ b/pkg/vpnalpha/api_default.go @@ -0,0 +1,2916 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + CreateGatewayConnection Create a connection for an existing VPN gateway. + Create a connection for an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiCreateGatewayConnectionRequest + */ + CreateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string) ApiCreateGatewayConnectionRequest + /* + CreateGatewayConnectionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return Connection + + */ + CreateGatewayConnectionExecute(ctx context.Context, projectId string, region Region, gatewayName string) (*Connection, error) + /* + CreateVPNGateway Create a VPN gateway in a project. + Create a VPN gateway in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateVPNGatewayRequest + */ + CreateVPNGateway(ctx context.Context, projectId string, region Region) ApiCreateVPNGatewayRequest + /* + CreateVPNGatewayExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return Gateway + + */ + CreateVPNGatewayExecute(ctx context.Context, projectId string, region Region) (*Gateway, error) + /* + DeleteGatewayConnection Delete a certain connection from an existing VPN gateway. + Delete a certain connection from an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return ApiDeleteGatewayConnectionRequest + */ + DeleteGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiDeleteGatewayConnectionRequest + /* + DeleteGatewayConnectionExecute executes the request + + */ + DeleteGatewayConnectionExecute(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) error + /* + DeleteVPNGateway Delete a existing VPN gateway in a project. + Delete a existing VPN gateway and all it's connections in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiDeleteVPNGatewayRequest + */ + DeleteVPNGateway(ctx context.Context, projectId string, region Region, gatewayName string) ApiDeleteVPNGatewayRequest + /* + DeleteVPNGatewayExecute executes the request + + */ + DeleteVPNGatewayExecute(ctx context.Context, projectId string, region Region, gatewayName string) error + /* + GetGatewayConnection Get a certain connection for an existing VPN gateway. + Get a certain connection for an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return ApiGetGatewayConnectionRequest + */ + GetGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiGetGatewayConnectionRequest + /* + GetGatewayConnectionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return Connection + + */ + GetGatewayConnectionExecute(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) (*Connection, error) + /* + GetGatewayConnectionStatus Gets the status for a specific connection in an existing VPN gateway. + Gets the status for a specific connection in an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return ApiGetGatewayConnectionStatusRequest + */ + GetGatewayConnectionStatus(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiGetGatewayConnectionStatusRequest + /* + GetGatewayConnectionStatusExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return ConnectionStatusResponse + + */ + GetGatewayConnectionStatusExecute(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) (*ConnectionStatusResponse, error) + /* + GetVPNGateway Get details of a VPN Gateway in a project. + Get details of a VPN Gateway in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiGetVPNGatewayRequest + */ + GetVPNGateway(ctx context.Context, projectId string, region Region, gatewayName string) ApiGetVPNGatewayRequest + /* + GetVPNGatewayExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return Gateway + + */ + GetVPNGatewayExecute(ctx context.Context, projectId string, region Region, gatewayName string) (*Gateway, error) + /* + GetVPNGatewayStatus Get the status of a VPN gateway in a project. + Get the status of a VPN gateway in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiGetVPNGatewayStatusRequest + */ + GetVPNGatewayStatus(ctx context.Context, projectId string, region Region, gatewayName string) ApiGetVPNGatewayStatusRequest + /* + GetVPNGatewayStatusExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return GatewayStatusResponse + + */ + GetVPNGatewayStatusExecute(ctx context.Context, projectId string, region Region, gatewayName string) (*GatewayStatusResponse, error) + /* + ListGatewayConnections List connections for an existing VPN gateway. + List connections for an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiListGatewayConnectionsRequest + */ + ListGatewayConnections(ctx context.Context, projectId string, region Region, gatewayName string) ApiListGatewayConnectionsRequest + /* + ListGatewayConnectionsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ConnectionList + + */ + ListGatewayConnectionsExecute(ctx context.Context, projectId string, region Region, gatewayName string) (*ConnectionList, error) + /* + ListPlans List available service plans for a project. + List available service plans for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return ApiListPlansRequest + */ + ListPlans(ctx context.Context, region Region) ApiListPlansRequest + /* + ListPlansExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return PlanList + + */ + ListPlansExecute(ctx context.Context, region Region) (*PlanList, error) + /* + ListQuotas List project quotas. + List project quotas. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListQuotasRequest + */ + ListQuotas(ctx context.Context, projectId string, region Region) ApiListQuotasRequest + /* + ListQuotasExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return QuotaListResponse + + */ + ListQuotasExecute(ctx context.Context, projectId string, region Region) (*QuotaListResponse, error) + /* + ListVPNGateways List VPN gateways in a project with label filtering + Retrieve VPN gateways in a project filtered by a custom label selector format. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListVPNGatewaysRequest + */ + ListVPNGateways(ctx context.Context, projectId string, region Region) ApiListVPNGatewaysRequest + /* + ListVPNGatewaysExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return GatewayList + + */ + ListVPNGatewaysExecute(ctx context.Context, projectId string, region Region) (*GatewayList, error) + /* + UpdateGatewayConnection Update a connection for an existing VPN gateway. + Update a connection for an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return ApiUpdateGatewayConnectionRequest + */ + UpdateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiUpdateGatewayConnectionRequest + /* + UpdateGatewayConnectionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return Connection + + */ + UpdateGatewayConnectionExecute(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) (*Connection, error) + /* + UpdateVPNGateway Update a VPN gateway in a project. + Update a VPN gateway in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiUpdateVPNGatewayRequest + */ + UpdateVPNGateway(ctx context.Context, projectId string, region Region, gatewayName string) ApiUpdateVPNGatewayRequest + /* + UpdateVPNGatewayExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return Gateway + + */ + UpdateVPNGatewayExecute(ctx context.Context, projectId string, region Region, gatewayName string) (*Gateway, error) +} + +type ApiCreateGatewayConnectionRequest interface { + CreateGatewayConnectionPayload(createGatewayConnectionPayload CreateGatewayConnectionPayload) ApiCreateGatewayConnectionRequest + Execute() (*Connection, error) +} + +type ApiCreateVPNGatewayRequest interface { + CreateVPNGatewayPayload(createVPNGatewayPayload CreateVPNGatewayPayload) ApiCreateVPNGatewayRequest + Execute() (*Gateway, error) +} + +type ApiDeleteGatewayConnectionRequest interface { + Execute() error +} + +type ApiDeleteVPNGatewayRequest interface { + Execute() error +} + +type ApiGetGatewayConnectionRequest interface { + Execute() (*Connection, error) +} + +type ApiGetGatewayConnectionStatusRequest interface { + Execute() (*ConnectionStatusResponse, error) +} + +type ApiGetVPNGatewayRequest interface { + Execute() (*Gateway, error) +} + +type ApiGetVPNGatewayStatusRequest interface { + Execute() (*GatewayStatusResponse, error) +} + +type ApiListGatewayConnectionsRequest interface { + LabelSelector(labelSelector map[string]string) ApiListGatewayConnectionsRequest + Execute() (*ConnectionList, error) +} + +type ApiListPlansRequest interface { + Execute() (*PlanList, error) +} + +type ApiListQuotasRequest interface { + Execute() (*QuotaListResponse, error) +} + +type ApiListVPNGatewaysRequest interface { + LabelSelector(labelSelector map[string]string) ApiListVPNGatewaysRequest + Execute() (*GatewayList, error) +} + +type ApiUpdateGatewayConnectionRequest interface { + UpdateGatewayConnectionPayload(updateGatewayConnectionPayload UpdateGatewayConnectionPayload) ApiUpdateGatewayConnectionRequest + Execute() (*Connection, error) +} + +type ApiUpdateVPNGatewayRequest interface { + UpdateVPNGatewayPayload(updateVPNGatewayPayload UpdateVPNGatewayPayload) ApiUpdateVPNGatewayRequest + Execute() (*Gateway, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type CreateGatewayConnectionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + gatewayName string + createGatewayConnectionPayload *CreateGatewayConnectionPayload +} + +func (r CreateGatewayConnectionRequest) CreateGatewayConnectionPayload(createGatewayConnectionPayload CreateGatewayConnectionPayload) ApiCreateGatewayConnectionRequest { + r.createGatewayConnectionPayload = &createGatewayConnectionPayload + return r +} + +func (r CreateGatewayConnectionRequest) Execute() (*Connection, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Connection + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateGatewayConnection") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(r.gatewayName, "gatewayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createGatewayConnectionPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateGatewayConnection: Create a connection for an existing VPN gateway. + +Create a connection for an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiCreateGatewayConnectionRequest +*/ +func (a *APIClient) CreateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string) ApiCreateGatewayConnectionRequest { + return CreateGatewayConnectionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +func (a *APIClient) CreateGatewayConnectionExecute(ctx context.Context, projectId string, region Region, gatewayName string) (*Connection, error) { + r := CreateGatewayConnectionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } + return r.Execute() +} + +type CreateVPNGatewayRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + createVPNGatewayPayload *CreateVPNGatewayPayload +} + +func (r CreateVPNGatewayRequest) CreateVPNGatewayPayload(createVPNGatewayPayload CreateVPNGatewayPayload) ApiCreateVPNGatewayRequest { + r.createVPNGatewayPayload = &createVPNGatewayPayload + return r +} + +func (r CreateVPNGatewayRequest) Execute() (*Gateway, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Gateway + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateVPNGateway") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createVPNGatewayPayload == nil { + return localVarReturnValue, fmt.Errorf("createVPNGatewayPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createVPNGatewayPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateVPNGateway: Create a VPN gateway in a project. + +Create a VPN gateway in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiCreateVPNGatewayRequest +*/ +func (a *APIClient) CreateVPNGateway(ctx context.Context, projectId string, region Region) ApiCreateVPNGatewayRequest { + return CreateVPNGatewayRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateVPNGatewayExecute(ctx context.Context, projectId string, region Region) (*Gateway, error) { + r := CreateVPNGatewayRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type DeleteGatewayConnectionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + gatewayName string + connectionName string +} + +func (r DeleteGatewayConnectionRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteGatewayConnection") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(r.gatewayName, "gatewayName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionName"+"}", url.PathEscape(ParameterValueToString(r.connectionName, "connectionName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteGatewayConnection: Delete a certain connection from an existing VPN gateway. + +Delete a certain connection from an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return ApiDeleteGatewayConnectionRequest +*/ +func (a *APIClient) DeleteGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiDeleteGatewayConnectionRequest { + return DeleteGatewayConnectionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +func (a *APIClient) DeleteGatewayConnectionExecute(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) error { + r := DeleteGatewayConnectionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } + return r.Execute() +} + +type DeleteVPNGatewayRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + gatewayName string +} + +func (r DeleteVPNGatewayRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteVPNGateway") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(r.gatewayName, "gatewayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteVPNGateway: Delete a existing VPN gateway in a project. + +Delete a existing VPN gateway and all it's connections in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiDeleteVPNGatewayRequest +*/ +func (a *APIClient) DeleteVPNGateway(ctx context.Context, projectId string, region Region, gatewayName string) ApiDeleteVPNGatewayRequest { + return DeleteVPNGatewayRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +func (a *APIClient) DeleteVPNGatewayExecute(ctx context.Context, projectId string, region Region, gatewayName string) error { + r := DeleteVPNGatewayRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } + return r.Execute() +} + +type GetGatewayConnectionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + gatewayName string + connectionName string +} + +func (r GetGatewayConnectionRequest) Execute() (*Connection, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Connection + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetGatewayConnection") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(r.gatewayName, "gatewayName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionName"+"}", url.PathEscape(ParameterValueToString(r.connectionName, "connectionName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetGatewayConnection: Get a certain connection for an existing VPN gateway. + +Get a certain connection for an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return ApiGetGatewayConnectionRequest +*/ +func (a *APIClient) GetGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiGetGatewayConnectionRequest { + return GetGatewayConnectionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +func (a *APIClient) GetGatewayConnectionExecute(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) (*Connection, error) { + r := GetGatewayConnectionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } + return r.Execute() +} + +type GetGatewayConnectionStatusRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + gatewayName string + connectionName string +} + +func (r GetGatewayConnectionStatusRequest) Execute() (*ConnectionStatusResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ConnectionStatusResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetGatewayConnectionStatus") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}/status" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(r.gatewayName, "gatewayName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionName"+"}", url.PathEscape(ParameterValueToString(r.connectionName, "connectionName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetGatewayConnectionStatus: Gets the status for a specific connection in an existing VPN gateway. + +Gets the status for a specific connection in an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return ApiGetGatewayConnectionStatusRequest +*/ +func (a *APIClient) GetGatewayConnectionStatus(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiGetGatewayConnectionStatusRequest { + return GetGatewayConnectionStatusRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +func (a *APIClient) GetGatewayConnectionStatusExecute(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) (*ConnectionStatusResponse, error) { + r := GetGatewayConnectionStatusRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } + return r.Execute() +} + +type GetVPNGatewayRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + gatewayName string +} + +func (r GetVPNGatewayRequest) Execute() (*Gateway, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Gateway + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVPNGateway") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(r.gatewayName, "gatewayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetVPNGateway: Get details of a VPN Gateway in a project. + +Get details of a VPN Gateway in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiGetVPNGatewayRequest +*/ +func (a *APIClient) GetVPNGateway(ctx context.Context, projectId string, region Region, gatewayName string) ApiGetVPNGatewayRequest { + return GetVPNGatewayRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +func (a *APIClient) GetVPNGatewayExecute(ctx context.Context, projectId string, region Region, gatewayName string) (*Gateway, error) { + r := GetVPNGatewayRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } + return r.Execute() +} + +type GetVPNGatewayStatusRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + gatewayName string +} + +func (r GetVPNGatewayStatusRequest) Execute() (*GatewayStatusResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GatewayStatusResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVPNGatewayStatus") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/status" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(r.gatewayName, "gatewayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetVPNGatewayStatus: Get the status of a VPN gateway in a project. + +Get the status of a VPN gateway in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiGetVPNGatewayStatusRequest +*/ +func (a *APIClient) GetVPNGatewayStatus(ctx context.Context, projectId string, region Region, gatewayName string) ApiGetVPNGatewayStatusRequest { + return GetVPNGatewayStatusRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +func (a *APIClient) GetVPNGatewayStatusExecute(ctx context.Context, projectId string, region Region, gatewayName string) (*GatewayStatusResponse, error) { + r := GetVPNGatewayStatusRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } + return r.Execute() +} + +type ListGatewayConnectionsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + gatewayName string + labelSelector *map[string]string +} + +func (r ListGatewayConnectionsRequest) LabelSelector(labelSelector map[string]string) ApiListGatewayConnectionsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListGatewayConnectionsRequest) Execute() (*ConnectionList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ConnectionList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListGatewayConnections") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(r.gatewayName, "gatewayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListGatewayConnections: List connections for an existing VPN gateway. + +List connections for an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiListGatewayConnectionsRequest +*/ +func (a *APIClient) ListGatewayConnections(ctx context.Context, projectId string, region Region, gatewayName string) ApiListGatewayConnectionsRequest { + return ListGatewayConnectionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +func (a *APIClient) ListGatewayConnectionsExecute(ctx context.Context, projectId string, region Region, gatewayName string) (*ConnectionList, error) { + r := ListGatewayConnectionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } + return r.Execute() +} + +type ListPlansRequest struct { + ctx context.Context + apiService *DefaultApiService + region Region +} + +func (r ListPlansRequest) Execute() (*PlanList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PlanList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPlans") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/regions/{region}/plans" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListPlans: List available service plans for a project. + +List available service plans for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @return ApiListPlansRequest +*/ +func (a *APIClient) ListPlans(ctx context.Context, region Region) ApiListPlansRequest { + return ListPlansRequest{ + apiService: a.defaultApi, + ctx: ctx, + region: region, + } +} + +func (a *APIClient) ListPlansExecute(ctx context.Context, region Region) (*PlanList, error) { + r := ListPlansRequest{ + apiService: a.defaultApi, + ctx: ctx, + region: region, + } + return r.Execute() +} + +type ListQuotasRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region +} + +func (r ListQuotasRequest) Execute() (*QuotaListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *QuotaListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListQuotas") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/quotas" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListQuotas: List project quotas. + +List project quotas. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListQuotasRequest +*/ +func (a *APIClient) ListQuotas(ctx context.Context, projectId string, region Region) ApiListQuotasRequest { + return ListQuotasRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListQuotasExecute(ctx context.Context, projectId string, region Region) (*QuotaListResponse, error) { + r := ListQuotasRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListVPNGatewaysRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + labelSelector *map[string]string +} + +func (r ListVPNGatewaysRequest) LabelSelector(labelSelector map[string]string) ApiListVPNGatewaysRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListVPNGatewaysRequest) Execute() (*GatewayList, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GatewayList + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVPNGateways") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListVPNGateways: List VPN gateways in a project with label filtering + +Retrieve VPN gateways in a project filtered by a custom label selector format. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @return ApiListVPNGatewaysRequest +*/ +func (a *APIClient) ListVPNGateways(ctx context.Context, projectId string, region Region) ApiListVPNGatewaysRequest { + return ListVPNGatewaysRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListVPNGatewaysExecute(ctx context.Context, projectId string, region Region) (*GatewayList, error) { + r := ListVPNGatewaysRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type UpdateGatewayConnectionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + gatewayName string + connectionName string + updateGatewayConnectionPayload *UpdateGatewayConnectionPayload +} + +func (r UpdateGatewayConnectionRequest) UpdateGatewayConnectionPayload(updateGatewayConnectionPayload UpdateGatewayConnectionPayload) ApiUpdateGatewayConnectionRequest { + r.updateGatewayConnectionPayload = &updateGatewayConnectionPayload + return r +} + +func (r UpdateGatewayConnectionRequest) Execute() (*Connection, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Connection + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateGatewayConnection") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(r.gatewayName, "gatewayName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connectionName"+"}", url.PathEscape(ParameterValueToString(r.connectionName, "connectionName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateGatewayConnectionPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateGatewayConnection: Update a connection for an existing VPN gateway. + +Update a connection for an existing VPN gateway. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @param connectionName + @return ApiUpdateGatewayConnectionRequest +*/ +func (a *APIClient) UpdateGatewayConnection(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) ApiUpdateGatewayConnectionRequest { + return UpdateGatewayConnectionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } +} + +func (a *APIClient) UpdateGatewayConnectionExecute(ctx context.Context, projectId string, region Region, gatewayName string, connectionName string) (*Connection, error) { + r := UpdateGatewayConnectionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + connectionName: connectionName, + } + return r.Execute() +} + +type UpdateVPNGatewayRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region Region + gatewayName string + updateVPNGatewayPayload *UpdateVPNGatewayPayload +} + +func (r UpdateVPNGatewayRequest) UpdateVPNGatewayPayload(updateVPNGatewayPayload UpdateVPNGatewayPayload) ApiUpdateVPNGatewayRequest { + r.updateVPNGatewayPayload = &updateVPNGatewayPayload + return r +} + +func (r UpdateVPNGatewayRequest) Execute() (*Gateway, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Gateway + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateVPNGateway") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(r.gatewayName, "gatewayName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateVPNGatewayPayload == nil { + return localVarReturnValue, fmt.Errorf("updateVPNGatewayPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateVPNGatewayPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v APIErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateVPNGateway: Update a VPN gateway in a project. + +Update a VPN gateway in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @param region + @param gatewayName + @return ApiUpdateVPNGatewayRequest +*/ +func (a *APIClient) UpdateVPNGateway(ctx context.Context, projectId string, region Region, gatewayName string) ApiUpdateVPNGatewayRequest { + return UpdateVPNGatewayRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } +} + +func (a *APIClient) UpdateVPNGatewayExecute(ctx context.Context, projectId string, region Region, gatewayName string) (*Gateway, error) { + r := UpdateVPNGatewayRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + gatewayName: gatewayName, + } + return r.Execute() +} diff --git a/pkg/vpnalpha/api_default_test.go b/pkg/vpnalpha/api_default_test.go new file mode 100644 index 00000000..ba7159be --- /dev/null +++ b/pkg/vpnalpha/api_default_test.go @@ -0,0 +1,825 @@ +/* +STACKIT VPN API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package vpnalpha + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_vpnalpha_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateGatewayConnection", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + gatewayNameValue := "gatewayName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(gatewayNameValue, "gatewayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Connection{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + gatewayName := gatewayNameValue + + resp, reqErr := apiClient.CreateGatewayConnection(context.Background(), projectId, region, gatewayName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateVPNGateway", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Gateway{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + createVPNGatewayPayload := CreateVPNGatewayPayload{} + + resp, reqErr := apiClient.CreateVPNGateway(context.Background(), projectId, region).CreateVPNGatewayPayload(createVPNGatewayPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteGatewayConnection", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + gatewayNameValue := "gatewayName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(gatewayNameValue, "gatewayName")), -1) + connectionNameValue := "connectionName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"connectionName"+"}", url.PathEscape(ParameterValueToString(connectionNameValue, "connectionName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + gatewayName := gatewayNameValue + connectionName := connectionNameValue + + reqErr := apiClient.DeleteGatewayConnection(context.Background(), projectId, region, gatewayName, connectionName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService DeleteVPNGateway", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + gatewayNameValue := "gatewayName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(gatewayNameValue, "gatewayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + gatewayName := gatewayNameValue + + reqErr := apiClient.DeleteVPNGateway(context.Background(), projectId, region, gatewayName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + }) + + t.Run("Test DefaultApiService GetGatewayConnection", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + gatewayNameValue := "gatewayName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(gatewayNameValue, "gatewayName")), -1) + connectionNameValue := "connectionName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"connectionName"+"}", url.PathEscape(ParameterValueToString(connectionNameValue, "connectionName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Connection{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + gatewayName := gatewayNameValue + connectionName := connectionNameValue + + resp, reqErr := apiClient.GetGatewayConnection(context.Background(), projectId, region, gatewayName, connectionName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetGatewayConnectionStatus", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}/status" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + gatewayNameValue := "gatewayName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(gatewayNameValue, "gatewayName")), -1) + connectionNameValue := "connectionName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"connectionName"+"}", url.PathEscape(ParameterValueToString(connectionNameValue, "connectionName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ConnectionStatusResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + gatewayName := gatewayNameValue + connectionName := connectionNameValue + + resp, reqErr := apiClient.GetGatewayConnectionStatus(context.Background(), projectId, region, gatewayName, connectionName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetVPNGateway", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + gatewayNameValue := "gatewayName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(gatewayNameValue, "gatewayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Gateway{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + gatewayName := gatewayNameValue + + resp, reqErr := apiClient.GetVPNGateway(context.Background(), projectId, region, gatewayName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetVPNGatewayStatus", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/status" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + gatewayNameValue := "gatewayName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(gatewayNameValue, "gatewayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GatewayStatusResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + gatewayName := gatewayNameValue + + resp, reqErr := apiClient.GetVPNGatewayStatus(context.Background(), projectId, region, gatewayName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListGatewayConnections", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + gatewayNameValue := "gatewayName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(gatewayNameValue, "gatewayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ConnectionList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + gatewayName := gatewayNameValue + + resp, reqErr := apiClient.ListGatewayConnections(context.Background(), projectId, region, gatewayName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListPlans", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/regions/{region}/plans" + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := PlanList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + region := regionValue + + resp, reqErr := apiClient.ListPlans(context.Background(), region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListQuotas", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/quotas" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := QuotaListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListQuotas(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListVPNGateways", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := GatewayList{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + + resp, reqErr := apiClient.ListVPNGateways(context.Background(), projectId, region).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateGatewayConnection", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}/connections/{connectionName}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + gatewayNameValue := "gatewayName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(gatewayNameValue, "gatewayName")), -1) + connectionNameValue := "connectionName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"connectionName"+"}", url.PathEscape(ParameterValueToString(connectionNameValue, "connectionName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Connection{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + gatewayName := gatewayNameValue + connectionName := connectionNameValue + + resp, reqErr := apiClient.UpdateGatewayConnection(context.Background(), projectId, region, gatewayName, connectionName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService UpdateVPNGateway", func(t *testing.T) { + _apiUrlPath := "/v1alpha1/projects/{projectId}/regions/{region}/gateways/{gatewayName}" + projectIdValue := "projectId-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + regionValue := Region("eu01") + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(regionValue, "region")), -1) + gatewayNameValue := "gatewayName-value" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"gatewayName"+"}", url.PathEscape(ParameterValueToString(gatewayNameValue, "gatewayName")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Gateway{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for vpnalpha_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := projectIdValue + region := regionValue + gatewayName := gatewayNameValue + updateVPNGatewayPayload := UpdateVPNGatewayPayload{} + + resp, reqErr := apiClient.UpdateVPNGateway(context.Background(), projectId, region, gatewayName).UpdateVPNGatewayPayload(updateVPNGatewayPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/pkg/vpnalpha/client.go b/pkg/vpnalpha/client.go new file mode 100644 index 00000000..3ad32f07 --- /dev/null +++ b/pkg/vpnalpha/client.go @@ -0,0 +1,628 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT VPN API API v1alpha1 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/pkg/vpnalpha/configuration.go b/pkg/vpnalpha/configuration.go new file mode 100644 index 00000000..8106888a --- /dev/null +++ b/pkg/vpnalpha/configuration.go @@ -0,0 +1,41 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/vpnalpha", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://vpn.api.{region}stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "eu01.", + EnumValues: []string{ + "eu01.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/pkg/vpnalpha/model_api_error.go b/pkg/vpnalpha/model_api_error.go new file mode 100644 index 00000000..65356431 --- /dev/null +++ b/pkg/vpnalpha/model_api_error.go @@ -0,0 +1,269 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the APIError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &APIError{} + +/* + types and functions for code +*/ + +// isInteger +type APIErrorGetCodeAttributeType = *int64 +type APIErrorGetCodeArgType = int64 +type APIErrorGetCodeRetType = int64 + +func getAPIErrorGetCodeAttributeTypeOk(arg APIErrorGetCodeAttributeType) (ret APIErrorGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAPIErrorGetCodeAttributeType(arg *APIErrorGetCodeAttributeType, val APIErrorGetCodeRetType) { + *arg = &val +} + +/* + types and functions for details +*/ + +// isArray +type APIErrorGetDetailsAttributeType = *[]APIErrorDetail +type APIErrorGetDetailsArgType = []APIErrorDetail +type APIErrorGetDetailsRetType = []APIErrorDetail + +func getAPIErrorGetDetailsAttributeTypeOk(arg APIErrorGetDetailsAttributeType) (ret APIErrorGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAPIErrorGetDetailsAttributeType(arg *APIErrorGetDetailsAttributeType, val APIErrorGetDetailsRetType) { + *arg = &val +} + +/* + types and functions for message +*/ + +// isNotNullableString +type APIErrorGetMessageAttributeType = *string + +func getAPIErrorGetMessageAttributeTypeOk(arg APIErrorGetMessageAttributeType) (ret APIErrorGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAPIErrorGetMessageAttributeType(arg *APIErrorGetMessageAttributeType, val APIErrorGetMessageRetType) { + *arg = &val +} + +type APIErrorGetMessageArgType = string +type APIErrorGetMessageRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type APIErrorGetStatusAttributeType = *string + +func getAPIErrorGetStatusAttributeTypeOk(arg APIErrorGetStatusAttributeType) (ret APIErrorGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAPIErrorGetStatusAttributeType(arg *APIErrorGetStatusAttributeType, val APIErrorGetStatusRetType) { + *arg = &val +} + +type APIErrorGetStatusArgType = string +type APIErrorGetStatusRetType = string + +// APIError struct for APIError +type APIError struct { + // The HTTP status code. + // Can be cast to int32 without loss of precision. + // REQUIRED + Code APIErrorGetCodeAttributeType `json:"code" required:"true"` + // Can contain more details on the error. + Details APIErrorGetDetailsAttributeType `json:"details,omitempty"` + // A message describing the error. + // REQUIRED + Message APIErrorGetMessageAttributeType `json:"message" required:"true"` + // The HTTP status code text. + Status APIErrorGetStatusAttributeType `json:"status,omitempty"` +} + +type _APIError APIError + +// NewAPIError instantiates a new APIError 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 NewAPIError(code APIErrorGetCodeArgType, message APIErrorGetMessageArgType) *APIError { + this := APIError{} + setAPIErrorGetCodeAttributeType(&this.Code, code) + setAPIErrorGetMessageAttributeType(&this.Message, message) + return &this +} + +// NewAPIErrorWithDefaults instantiates a new APIError 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 NewAPIErrorWithDefaults() *APIError { + this := APIError{} + return &this +} + +// GetCode returns the Code field value +func (o *APIError) GetCode() (ret APIErrorGetCodeRetType) { + ret, _ = o.GetCodeOk() + return ret +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *APIError) GetCodeOk() (ret APIErrorGetCodeRetType, ok bool) { + return getAPIErrorGetCodeAttributeTypeOk(o.Code) +} + +// SetCode sets field value +func (o *APIError) SetCode(v APIErrorGetCodeRetType) { + setAPIErrorGetCodeAttributeType(&o.Code, v) +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *APIError) GetDetails() (res APIErrorGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIError) GetDetailsOk() (ret APIErrorGetDetailsRetType, ok bool) { + return getAPIErrorGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *APIError) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given []APIErrorDetail and assigns it to the Details field. +func (o *APIError) SetDetails(v APIErrorGetDetailsRetType) { + setAPIErrorGetDetailsAttributeType(&o.Details, v) +} + +// GetMessage returns the Message field value +func (o *APIError) GetMessage() (ret APIErrorGetMessageRetType) { + ret, _ = o.GetMessageOk() + return ret +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *APIError) GetMessageOk() (ret APIErrorGetMessageRetType, ok bool) { + return getAPIErrorGetMessageAttributeTypeOk(o.Message) +} + +// SetMessage sets field value +func (o *APIError) SetMessage(v APIErrorGetMessageRetType) { + setAPIErrorGetMessageAttributeType(&o.Message, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *APIError) GetStatus() (res APIErrorGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIError) GetStatusOk() (ret APIErrorGetStatusRetType, ok bool) { + return getAPIErrorGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *APIError) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *APIError) SetStatus(v APIErrorGetStatusRetType) { + setAPIErrorGetStatusAttributeType(&o.Status, v) +} + +func (o APIError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAPIErrorGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getAPIErrorGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getAPIErrorGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + if val, ok := getAPIErrorGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableAPIError struct { + value *APIError + isSet bool +} + +func (v NullableAPIError) Get() *APIError { + return v.value +} + +func (v *NullableAPIError) Set(val *APIError) { + v.value = val + v.isSet = true +} + +func (v NullableAPIError) IsSet() bool { + return v.isSet +} + +func (v *NullableAPIError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAPIError(val *APIError) *NullableAPIError { + return &NullableAPIError{value: val, isSet: true} +} + +func (v NullableAPIError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAPIError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_api_error_detail.go b/pkg/vpnalpha/model_api_error_detail.go new file mode 100644 index 00000000..056f4d3a --- /dev/null +++ b/pkg/vpnalpha/model_api_error_detail.go @@ -0,0 +1,326 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" + "fmt" +) + +// checks if the APIErrorDetail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &APIErrorDetail{} + +/* + types and functions for domain +*/ + +// isNotNullableString +type APIErrorDetailGetDomainAttributeType = *string + +func getAPIErrorDetailGetDomainAttributeTypeOk(arg APIErrorDetailGetDomainAttributeType) (ret APIErrorDetailGetDomainRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAPIErrorDetailGetDomainAttributeType(arg *APIErrorDetailGetDomainAttributeType, val APIErrorDetailGetDomainRetType) { + *arg = &val +} + +type APIErrorDetailGetDomainArgType = string +type APIErrorDetailGetDomainRetType = string + +/* + types and functions for metadata +*/ + +// isFreeform +type APIErrorDetailGetMetadataAttributeType = *map[string]interface{} +type APIErrorDetailGetMetadataArgType = map[string]interface{} +type APIErrorDetailGetMetadataRetType = map[string]interface{} + +func getAPIErrorDetailGetMetadataAttributeTypeOk(arg APIErrorDetailGetMetadataAttributeType) (ret APIErrorDetailGetMetadataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAPIErrorDetailGetMetadataAttributeType(arg *APIErrorDetailGetMetadataAttributeType, val APIErrorDetailGetMetadataRetType) { + *arg = &val +} + +/* + types and functions for reason +*/ + +// isEnum + +// APIErrorDetailReason The reason why the error occurs. +// value type for enums +type APIErrorDetailReason string + +// List of Reason +const ( + APIERRORDETAILREASON_FIELD APIErrorDetailReason = "INVALID_FIELD" + APIERRORDETAILREASON_PATH_PARAMETER APIErrorDetailReason = "INVALID_PATH_PARAMETER" +) + +// All allowed values of APIErrorDetail enum +var AllowedAPIErrorDetailReasonEnumValues = []APIErrorDetailReason{ + "INVALID_FIELD", + "INVALID_PATH_PARAMETER", +} + +func (v *APIErrorDetailReason) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson APIErrorDetailReason + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := APIErrorDetailReason(value) + for _, existing := range AllowedAPIErrorDetailReasonEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid APIErrorDetail", value) +} + +// NewAPIErrorDetailReasonFromValue returns a pointer to a valid APIErrorDetailReason +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAPIErrorDetailReasonFromValue(v APIErrorDetailReason) (*APIErrorDetailReason, error) { + ev := APIErrorDetailReason(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for APIErrorDetailReason: valid values are %v", v, AllowedAPIErrorDetailReasonEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v APIErrorDetailReason) IsValid() bool { + for _, existing := range AllowedAPIErrorDetailReasonEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ReasonReason value +func (v APIErrorDetailReason) Ptr() *APIErrorDetailReason { + return &v +} + +type NullableAPIErrorDetailReason struct { + value *APIErrorDetailReason + isSet bool +} + +func (v NullableAPIErrorDetailReason) Get() *APIErrorDetailReason { + return v.value +} + +func (v *NullableAPIErrorDetailReason) Set(val *APIErrorDetailReason) { + v.value = val + v.isSet = true +} + +func (v NullableAPIErrorDetailReason) IsSet() bool { + return v.isSet +} + +func (v *NullableAPIErrorDetailReason) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAPIErrorDetailReason(val *APIErrorDetailReason) *NullableAPIErrorDetailReason { + return &NullableAPIErrorDetailReason{value: val, isSet: true} +} + +func (v NullableAPIErrorDetailReason) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAPIErrorDetailReason) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type APIErrorDetailGetReasonAttributeType = *APIErrorDetailReason +type APIErrorDetailGetReasonArgType = APIErrorDetailReason +type APIErrorDetailGetReasonRetType = APIErrorDetailReason + +func getAPIErrorDetailGetReasonAttributeTypeOk(arg APIErrorDetailGetReasonAttributeType) (ret APIErrorDetailGetReasonRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAPIErrorDetailGetReasonAttributeType(arg *APIErrorDetailGetReasonAttributeType, val APIErrorDetailGetReasonRetType) { + *arg = &val +} + +// APIErrorDetail struct for APIErrorDetail +type APIErrorDetail struct { + // The domain of the error source. + // REQUIRED + Domain APIErrorDetailGetDomainAttributeType `json:"domain" required:"true"` + // Metadata contains more information. For bad requests this would be field information. + Metadata APIErrorDetailGetMetadataAttributeType `json:"metadata,omitempty"` + // The reason why the error occurs. + // REQUIRED + Reason APIErrorDetailGetReasonAttributeType `json:"reason" required:"true"` +} + +type _APIErrorDetail APIErrorDetail + +// NewAPIErrorDetail instantiates a new APIErrorDetail 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 NewAPIErrorDetail(domain APIErrorDetailGetDomainArgType, reason APIErrorDetailGetReasonArgType) *APIErrorDetail { + this := APIErrorDetail{} + setAPIErrorDetailGetDomainAttributeType(&this.Domain, domain) + setAPIErrorDetailGetReasonAttributeType(&this.Reason, reason) + return &this +} + +// NewAPIErrorDetailWithDefaults instantiates a new APIErrorDetail 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 NewAPIErrorDetailWithDefaults() *APIErrorDetail { + this := APIErrorDetail{} + var domain string = "vpn.access.stackit.cloud" + this.Domain = &domain + return &this +} + +// GetDomain returns the Domain field value +func (o *APIErrorDetail) GetDomain() (ret APIErrorDetailGetDomainRetType) { + ret, _ = o.GetDomainOk() + return ret +} + +// GetDomainOk returns a tuple with the Domain field value +// and a boolean to check if the value has been set. +func (o *APIErrorDetail) GetDomainOk() (ret APIErrorDetailGetDomainRetType, ok bool) { + return getAPIErrorDetailGetDomainAttributeTypeOk(o.Domain) +} + +// SetDomain sets field value +func (o *APIErrorDetail) SetDomain(v APIErrorDetailGetDomainRetType) { + setAPIErrorDetailGetDomainAttributeType(&o.Domain, v) +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *APIErrorDetail) GetMetadata() (res APIErrorDetailGetMetadataRetType) { + res, _ = o.GetMetadataOk() + return +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *APIErrorDetail) GetMetadataOk() (ret APIErrorDetailGetMetadataRetType, ok bool) { + return getAPIErrorDetailGetMetadataAttributeTypeOk(o.Metadata) +} + +// HasMetadata returns a boolean if a field has been set. +func (o *APIErrorDetail) HasMetadata() bool { + _, ok := o.GetMetadataOk() + return ok +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *APIErrorDetail) SetMetadata(v APIErrorDetailGetMetadataRetType) { + setAPIErrorDetailGetMetadataAttributeType(&o.Metadata, v) +} + +// GetReason returns the Reason field value +func (o *APIErrorDetail) GetReason() (ret APIErrorDetailGetReasonRetType) { + ret, _ = o.GetReasonOk() + return ret +} + +// GetReasonOk returns a tuple with the Reason field value +// and a boolean to check if the value has been set. +func (o *APIErrorDetail) GetReasonOk() (ret APIErrorDetailGetReasonRetType, ok bool) { + return getAPIErrorDetailGetReasonAttributeTypeOk(o.Reason) +} + +// SetReason sets field value +func (o *APIErrorDetail) SetReason(v APIErrorDetailGetReasonRetType) { + setAPIErrorDetailGetReasonAttributeType(&o.Reason, v) +} + +func (o APIErrorDetail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAPIErrorDetailGetDomainAttributeTypeOk(o.Domain); ok { + toSerialize["Domain"] = val + } + if val, ok := getAPIErrorDetailGetMetadataAttributeTypeOk(o.Metadata); ok { + toSerialize["Metadata"] = val + } + if val, ok := getAPIErrorDetailGetReasonAttributeTypeOk(o.Reason); ok { + toSerialize["Reason"] = val + } + return toSerialize, nil +} + +type NullableAPIErrorDetail struct { + value *APIErrorDetail + isSet bool +} + +func (v NullableAPIErrorDetail) Get() *APIErrorDetail { + return v.value +} + +func (v *NullableAPIErrorDetail) Set(val *APIErrorDetail) { + v.value = val + v.isSet = true +} + +func (v NullableAPIErrorDetail) IsSet() bool { + return v.isSet +} + +func (v *NullableAPIErrorDetail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAPIErrorDetail(val *APIErrorDetail) *NullableAPIErrorDetail { + return &NullableAPIErrorDetail{value: val, isSet: true} +} + +func (v NullableAPIErrorDetail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAPIErrorDetail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_api_error_detail_test.go b/pkg/vpnalpha/model_api_error_detail_test.go new file mode 100644 index 00000000..aee660c0 --- /dev/null +++ b/pkg/vpnalpha/model_api_error_detail_test.go @@ -0,0 +1,58 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "testing" +) + +// isEnum + +func TestAPIErrorDetailReason_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"INVALID_FIELD"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"INVALID_PATH_PARAMETER"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := APIErrorDetailReason("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/vpnalpha/model_api_error_response.go b/pkg/vpnalpha/model_api_error_response.go new file mode 100644 index 00000000..fc744c66 --- /dev/null +++ b/pkg/vpnalpha/model_api_error_response.go @@ -0,0 +1,125 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the APIErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &APIErrorResponse{} + +/* + types and functions for error +*/ + +// isModel +type APIErrorResponseGetErrorAttributeType = *APIError +type APIErrorResponseGetErrorArgType = APIError +type APIErrorResponseGetErrorRetType = APIError + +func getAPIErrorResponseGetErrorAttributeTypeOk(arg APIErrorResponseGetErrorAttributeType) (ret APIErrorResponseGetErrorRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAPIErrorResponseGetErrorAttributeType(arg *APIErrorResponseGetErrorAttributeType, val APIErrorResponseGetErrorRetType) { + *arg = &val +} + +// APIErrorResponse struct for APIErrorResponse +type APIErrorResponse struct { + // REQUIRED + Error APIErrorResponseGetErrorAttributeType `json:"error" required:"true"` +} + +type _APIErrorResponse APIErrorResponse + +// NewAPIErrorResponse instantiates a new APIErrorResponse 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 NewAPIErrorResponse(error_ APIErrorResponseGetErrorArgType) *APIErrorResponse { + this := APIErrorResponse{} + setAPIErrorResponseGetErrorAttributeType(&this.Error, error_) + return &this +} + +// NewAPIErrorResponseWithDefaults instantiates a new APIErrorResponse 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 NewAPIErrorResponseWithDefaults() *APIErrorResponse { + this := APIErrorResponse{} + return &this +} + +// GetError returns the Error field value +func (o *APIErrorResponse) GetError() (ret APIErrorResponseGetErrorRetType) { + ret, _ = o.GetErrorOk() + return ret +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *APIErrorResponse) GetErrorOk() (ret APIErrorResponseGetErrorRetType, ok bool) { + return getAPIErrorResponseGetErrorAttributeTypeOk(o.Error) +} + +// SetError sets field value +func (o *APIErrorResponse) SetError(v APIErrorResponseGetErrorRetType) { + setAPIErrorResponseGetErrorAttributeType(&o.Error, v) +} + +func (o APIErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAPIErrorResponseGetErrorAttributeTypeOk(o.Error); ok { + toSerialize["Error"] = val + } + return toSerialize, nil +} + +type NullableAPIErrorResponse struct { + value *APIErrorResponse + isSet bool +} + +func (v NullableAPIErrorResponse) Get() *APIErrorResponse { + return v.value +} + +func (v *NullableAPIErrorResponse) Set(val *APIErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAPIErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAPIErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAPIErrorResponse(val *APIErrorResponse) *NullableAPIErrorResponse { + return &NullableAPIErrorResponse{value: val, isSet: true} +} + +func (v NullableAPIErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAPIErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_api_error_response_test.go b/pkg/vpnalpha/model_api_error_response_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_api_error_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_api_error_test.go b/pkg/vpnalpha/model_api_error_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_api_error_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_bgp_gateway_config.go b/pkg/vpnalpha/model_bgp_gateway_config.go new file mode 100644 index 00000000..28d699aa --- /dev/null +++ b/pkg/vpnalpha/model_bgp_gateway_config.go @@ -0,0 +1,177 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the BGPGatewayConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPGatewayConfig{} + +/* + types and functions for localAsn +*/ + +// isInteger +type BGPGatewayConfigGetLocalAsnAttributeType = *int64 +type BGPGatewayConfigGetLocalAsnArgType = int64 +type BGPGatewayConfigGetLocalAsnRetType = int64 + +func getBGPGatewayConfigGetLocalAsnAttributeTypeOk(arg BGPGatewayConfigGetLocalAsnAttributeType) (ret BGPGatewayConfigGetLocalAsnRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPGatewayConfigGetLocalAsnAttributeType(arg *BGPGatewayConfigGetLocalAsnAttributeType, val BGPGatewayConfigGetLocalAsnRetType) { + *arg = &val +} + +/* + types and functions for overrideAdvertisedRoutes +*/ + +// isArray +type BGPGatewayConfigGetOverrideAdvertisedRoutesAttributeType = *[]string +type BGPGatewayConfigGetOverrideAdvertisedRoutesArgType = []string +type BGPGatewayConfigGetOverrideAdvertisedRoutesRetType = []string + +func getBGPGatewayConfigGetOverrideAdvertisedRoutesAttributeTypeOk(arg BGPGatewayConfigGetOverrideAdvertisedRoutesAttributeType) (ret BGPGatewayConfigGetOverrideAdvertisedRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPGatewayConfigGetOverrideAdvertisedRoutesAttributeType(arg *BGPGatewayConfigGetOverrideAdvertisedRoutesAttributeType, val BGPGatewayConfigGetOverrideAdvertisedRoutesRetType) { + *arg = &val +} + +// BGPGatewayConfig BGP configuration effects all connections. (only if bgpEnabled=true) +type BGPGatewayConfig struct { + // Local ASN for Private Use (reserved by IANA). + // Can be cast to int32 without loss of precision. + LocalAsn BGPGatewayConfigGetLocalAsnAttributeType `json:"localAsn,omitempty"` + // List of routes (IPv4 CIDR). + OverrideAdvertisedRoutes BGPGatewayConfigGetOverrideAdvertisedRoutesAttributeType `json:"overrideAdvertisedRoutes,omitempty"` +} + +// NewBGPGatewayConfig instantiates a new BGPGatewayConfig 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 NewBGPGatewayConfig() *BGPGatewayConfig { + this := BGPGatewayConfig{} + return &this +} + +// NewBGPGatewayConfigWithDefaults instantiates a new BGPGatewayConfig 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 NewBGPGatewayConfigWithDefaults() *BGPGatewayConfig { + this := BGPGatewayConfig{} + return &this +} + +// GetLocalAsn returns the LocalAsn field value if set, zero value otherwise. +func (o *BGPGatewayConfig) GetLocalAsn() (res BGPGatewayConfigGetLocalAsnRetType) { + res, _ = o.GetLocalAsnOk() + return +} + +// GetLocalAsnOk returns a tuple with the LocalAsn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPGatewayConfig) GetLocalAsnOk() (ret BGPGatewayConfigGetLocalAsnRetType, ok bool) { + return getBGPGatewayConfigGetLocalAsnAttributeTypeOk(o.LocalAsn) +} + +// HasLocalAsn returns a boolean if a field has been set. +func (o *BGPGatewayConfig) HasLocalAsn() bool { + _, ok := o.GetLocalAsnOk() + return ok +} + +// SetLocalAsn gets a reference to the given int64 and assigns it to the LocalAsn field. +func (o *BGPGatewayConfig) SetLocalAsn(v BGPGatewayConfigGetLocalAsnRetType) { + setBGPGatewayConfigGetLocalAsnAttributeType(&o.LocalAsn, v) +} + +// GetOverrideAdvertisedRoutes returns the OverrideAdvertisedRoutes field value if set, zero value otherwise. +func (o *BGPGatewayConfig) GetOverrideAdvertisedRoutes() (res BGPGatewayConfigGetOverrideAdvertisedRoutesRetType) { + res, _ = o.GetOverrideAdvertisedRoutesOk() + return +} + +// GetOverrideAdvertisedRoutesOk returns a tuple with the OverrideAdvertisedRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPGatewayConfig) GetOverrideAdvertisedRoutesOk() (ret BGPGatewayConfigGetOverrideAdvertisedRoutesRetType, ok bool) { + return getBGPGatewayConfigGetOverrideAdvertisedRoutesAttributeTypeOk(o.OverrideAdvertisedRoutes) +} + +// HasOverrideAdvertisedRoutes returns a boolean if a field has been set. +func (o *BGPGatewayConfig) HasOverrideAdvertisedRoutes() bool { + _, ok := o.GetOverrideAdvertisedRoutesOk() + return ok +} + +// SetOverrideAdvertisedRoutes gets a reference to the given []string and assigns it to the OverrideAdvertisedRoutes field. +func (o *BGPGatewayConfig) SetOverrideAdvertisedRoutes(v BGPGatewayConfigGetOverrideAdvertisedRoutesRetType) { + setBGPGatewayConfigGetOverrideAdvertisedRoutesAttributeType(&o.OverrideAdvertisedRoutes, v) +} + +func (o BGPGatewayConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBGPGatewayConfigGetLocalAsnAttributeTypeOk(o.LocalAsn); ok { + toSerialize["LocalAsn"] = val + } + if val, ok := getBGPGatewayConfigGetOverrideAdvertisedRoutesAttributeTypeOk(o.OverrideAdvertisedRoutes); ok { + toSerialize["OverrideAdvertisedRoutes"] = val + } + return toSerialize, nil +} + +type NullableBGPGatewayConfig struct { + value *BGPGatewayConfig + isSet bool +} + +func (v NullableBGPGatewayConfig) Get() *BGPGatewayConfig { + return v.value +} + +func (v *NullableBGPGatewayConfig) Set(val *BGPGatewayConfig) { + v.value = val + v.isSet = true +} + +func (v NullableBGPGatewayConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPGatewayConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPGatewayConfig(val *BGPGatewayConfig) *NullableBGPGatewayConfig { + return &NullableBGPGatewayConfig{value: val, isSet: true} +} + +func (v NullableBGPGatewayConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPGatewayConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_bgp_gateway_config_test.go b/pkg/vpnalpha/model_bgp_gateway_config_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_bgp_gateway_config_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_bgp_status.go b/pkg/vpnalpha/model_bgp_status.go new file mode 100644 index 00000000..4ce896a8 --- /dev/null +++ b/pkg/vpnalpha/model_bgp_status.go @@ -0,0 +1,174 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the BGPStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPStatus{} + +/* + types and functions for peers +*/ + +// isArray +type BGPStatusGetPeersAttributeType = *[]BGPStatusPeers +type BGPStatusGetPeersArgType = []BGPStatusPeers +type BGPStatusGetPeersRetType = []BGPStatusPeers + +func getBGPStatusGetPeersAttributeTypeOk(arg BGPStatusGetPeersAttributeType) (ret BGPStatusGetPeersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusGetPeersAttributeType(arg *BGPStatusGetPeersAttributeType, val BGPStatusGetPeersRetType) { + *arg = &val +} + +/* + types and functions for routes +*/ + +// isArray +type BGPStatusGetRoutesAttributeType = *[]BGPStatusRoutes +type BGPStatusGetRoutesArgType = []BGPStatusRoutes +type BGPStatusGetRoutesRetType = []BGPStatusRoutes + +func getBGPStatusGetRoutesAttributeTypeOk(arg BGPStatusGetRoutesAttributeType) (ret BGPStatusGetRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusGetRoutesAttributeType(arg *BGPStatusGetRoutesAttributeType, val BGPStatusGetRoutesRetType) { + *arg = &val +} + +// BGPStatus struct for BGPStatus +type BGPStatus struct { + Peers BGPStatusGetPeersAttributeType `json:"peers,omitempty"` + Routes BGPStatusGetRoutesAttributeType `json:"routes,omitempty"` +} + +// NewBGPStatus instantiates a new BGPStatus 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 NewBGPStatus() *BGPStatus { + this := BGPStatus{} + return &this +} + +// NewBGPStatusWithDefaults instantiates a new BGPStatus 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 NewBGPStatusWithDefaults() *BGPStatus { + this := BGPStatus{} + return &this +} + +// GetPeers returns the Peers field value if set, zero value otherwise. +func (o *BGPStatus) GetPeers() (res BGPStatusGetPeersRetType) { + res, _ = o.GetPeersOk() + return +} + +// GetPeersOk returns a tuple with the Peers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPStatus) GetPeersOk() (ret BGPStatusGetPeersRetType, ok bool) { + return getBGPStatusGetPeersAttributeTypeOk(o.Peers) +} + +// HasPeers returns a boolean if a field has been set. +func (o *BGPStatus) HasPeers() bool { + _, ok := o.GetPeersOk() + return ok +} + +// SetPeers gets a reference to the given []BGPStatusPeers and assigns it to the Peers field. +func (o *BGPStatus) SetPeers(v BGPStatusGetPeersRetType) { + setBGPStatusGetPeersAttributeType(&o.Peers, v) +} + +// GetRoutes returns the Routes field value if set, zero value otherwise. +func (o *BGPStatus) GetRoutes() (res BGPStatusGetRoutesRetType) { + res, _ = o.GetRoutesOk() + return +} + +// GetRoutesOk returns a tuple with the Routes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPStatus) GetRoutesOk() (ret BGPStatusGetRoutesRetType, ok bool) { + return getBGPStatusGetRoutesAttributeTypeOk(o.Routes) +} + +// HasRoutes returns a boolean if a field has been set. +func (o *BGPStatus) HasRoutes() bool { + _, ok := o.GetRoutesOk() + return ok +} + +// SetRoutes gets a reference to the given []BGPStatusRoutes and assigns it to the Routes field. +func (o *BGPStatus) SetRoutes(v BGPStatusGetRoutesRetType) { + setBGPStatusGetRoutesAttributeType(&o.Routes, v) +} + +func (o BGPStatus) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBGPStatusGetPeersAttributeTypeOk(o.Peers); ok { + toSerialize["Peers"] = val + } + if val, ok := getBGPStatusGetRoutesAttributeTypeOk(o.Routes); ok { + toSerialize["Routes"] = val + } + return toSerialize, nil +} + +type NullableBGPStatus struct { + value *BGPStatus + isSet bool +} + +func (v NullableBGPStatus) Get() *BGPStatus { + return v.value +} + +func (v *NullableBGPStatus) Set(val *BGPStatus) { + v.value = val + v.isSet = true +} + +func (v NullableBGPStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPStatus(val *BGPStatus) *NullableBGPStatus { + return &NullableBGPStatus{value: val, isSet: true} +} + +func (v NullableBGPStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_bgp_status_peers.go b/pkg/vpnalpha/model_bgp_status_peers.go new file mode 100644 index 00000000..84ffabbc --- /dev/null +++ b/pkg/vpnalpha/model_bgp_status_peers.go @@ -0,0 +1,386 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the BGPStatusPeers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPStatusPeers{} + +/* + types and functions for localAs +*/ + +// isNumber +type BGPStatusPeersGetLocalAsAttributeType = *float64 +type BGPStatusPeersGetLocalAsArgType = float64 +type BGPStatusPeersGetLocalAsRetType = float64 + +func getBGPStatusPeersGetLocalAsAttributeTypeOk(arg BGPStatusPeersGetLocalAsAttributeType) (ret BGPStatusPeersGetLocalAsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusPeersGetLocalAsAttributeType(arg *BGPStatusPeersGetLocalAsAttributeType, val BGPStatusPeersGetLocalAsRetType) { + *arg = &val +} + +/* + types and functions for peerUptime +*/ + +// isNotNullableString +type BGPStatusPeersGetPeerUptimeAttributeType = *string + +func getBGPStatusPeersGetPeerUptimeAttributeTypeOk(arg BGPStatusPeersGetPeerUptimeAttributeType) (ret BGPStatusPeersGetPeerUptimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusPeersGetPeerUptimeAttributeType(arg *BGPStatusPeersGetPeerUptimeAttributeType, val BGPStatusPeersGetPeerUptimeRetType) { + *arg = &val +} + +type BGPStatusPeersGetPeerUptimeArgType = string +type BGPStatusPeersGetPeerUptimeRetType = string + +/* + types and functions for pfxRcd +*/ + +// isNumber +type BGPStatusPeersGetPfxRcdAttributeType = *float64 +type BGPStatusPeersGetPfxRcdArgType = float64 +type BGPStatusPeersGetPfxRcdRetType = float64 + +func getBGPStatusPeersGetPfxRcdAttributeTypeOk(arg BGPStatusPeersGetPfxRcdAttributeType) (ret BGPStatusPeersGetPfxRcdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusPeersGetPfxRcdAttributeType(arg *BGPStatusPeersGetPfxRcdAttributeType, val BGPStatusPeersGetPfxRcdRetType) { + *arg = &val +} + +/* + types and functions for pfxSnt +*/ + +// isNumber +type BGPStatusPeersGetPfxSntAttributeType = *float64 +type BGPStatusPeersGetPfxSntArgType = float64 +type BGPStatusPeersGetPfxSntRetType = float64 + +func getBGPStatusPeersGetPfxSntAttributeTypeOk(arg BGPStatusPeersGetPfxSntAttributeType) (ret BGPStatusPeersGetPfxSntRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusPeersGetPfxSntAttributeType(arg *BGPStatusPeersGetPfxSntAttributeType, val BGPStatusPeersGetPfxSntRetType) { + *arg = &val +} + +/* + types and functions for remoteAs +*/ + +// isNumber +type BGPStatusPeersGetRemoteAsAttributeType = *float64 +type BGPStatusPeersGetRemoteAsArgType = float64 +type BGPStatusPeersGetRemoteAsRetType = float64 + +func getBGPStatusPeersGetRemoteAsAttributeTypeOk(arg BGPStatusPeersGetRemoteAsAttributeType) (ret BGPStatusPeersGetRemoteAsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusPeersGetRemoteAsAttributeType(arg *BGPStatusPeersGetRemoteAsAttributeType, val BGPStatusPeersGetRemoteAsRetType) { + *arg = &val +} + +/* + types and functions for remoteIP +*/ + +// isNotNullableString +type BGPStatusPeersGetRemoteIPAttributeType = *string + +func getBGPStatusPeersGetRemoteIPAttributeTypeOk(arg BGPStatusPeersGetRemoteIPAttributeType) (ret BGPStatusPeersGetRemoteIPRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusPeersGetRemoteIPAttributeType(arg *BGPStatusPeersGetRemoteIPAttributeType, val BGPStatusPeersGetRemoteIPRetType) { + *arg = &val +} + +type BGPStatusPeersGetRemoteIPArgType = string +type BGPStatusPeersGetRemoteIPRetType = string + +/* + types and functions for state +*/ + +// isNotNullableString +type BGPStatusPeersGetStateAttributeType = *string + +func getBGPStatusPeersGetStateAttributeTypeOk(arg BGPStatusPeersGetStateAttributeType) (ret BGPStatusPeersGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusPeersGetStateAttributeType(arg *BGPStatusPeersGetStateAttributeType, val BGPStatusPeersGetStateRetType) { + *arg = &val +} + +type BGPStatusPeersGetStateArgType = string +type BGPStatusPeersGetStateRetType = string + +// BGPStatusPeers struct for BGPStatusPeers +type BGPStatusPeers struct { + // REQUIRED + LocalAs BGPStatusPeersGetLocalAsAttributeType `json:"localAs" required:"true"` + // REQUIRED + PeerUptime BGPStatusPeersGetPeerUptimeAttributeType `json:"peerUptime" required:"true"` + // REQUIRED + PfxRcd BGPStatusPeersGetPfxRcdAttributeType `json:"pfxRcd" required:"true"` + // REQUIRED + PfxSnt BGPStatusPeersGetPfxSntAttributeType `json:"pfxSnt" required:"true"` + // REQUIRED + RemoteAs BGPStatusPeersGetRemoteAsAttributeType `json:"remoteAs" required:"true"` + // REQUIRED + RemoteIP BGPStatusPeersGetRemoteIPAttributeType `json:"remoteIP" required:"true"` + // REQUIRED + State BGPStatusPeersGetStateAttributeType `json:"state" required:"true"` +} + +type _BGPStatusPeers BGPStatusPeers + +// NewBGPStatusPeers instantiates a new BGPStatusPeers 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 NewBGPStatusPeers(localAs BGPStatusPeersGetLocalAsArgType, peerUptime BGPStatusPeersGetPeerUptimeArgType, pfxRcd BGPStatusPeersGetPfxRcdArgType, pfxSnt BGPStatusPeersGetPfxSntArgType, remoteAs BGPStatusPeersGetRemoteAsArgType, remoteIP BGPStatusPeersGetRemoteIPArgType, state BGPStatusPeersGetStateArgType) *BGPStatusPeers { + this := BGPStatusPeers{} + setBGPStatusPeersGetLocalAsAttributeType(&this.LocalAs, localAs) + setBGPStatusPeersGetPeerUptimeAttributeType(&this.PeerUptime, peerUptime) + setBGPStatusPeersGetPfxRcdAttributeType(&this.PfxRcd, pfxRcd) + setBGPStatusPeersGetPfxSntAttributeType(&this.PfxSnt, pfxSnt) + setBGPStatusPeersGetRemoteAsAttributeType(&this.RemoteAs, remoteAs) + setBGPStatusPeersGetRemoteIPAttributeType(&this.RemoteIP, remoteIP) + setBGPStatusPeersGetStateAttributeType(&this.State, state) + return &this +} + +// NewBGPStatusPeersWithDefaults instantiates a new BGPStatusPeers 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 NewBGPStatusPeersWithDefaults() *BGPStatusPeers { + this := BGPStatusPeers{} + return &this +} + +// GetLocalAs returns the LocalAs field value +func (o *BGPStatusPeers) GetLocalAs() (ret BGPStatusPeersGetLocalAsRetType) { + ret, _ = o.GetLocalAsOk() + return ret +} + +// GetLocalAsOk returns a tuple with the LocalAs field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetLocalAsOk() (ret BGPStatusPeersGetLocalAsRetType, ok bool) { + return getBGPStatusPeersGetLocalAsAttributeTypeOk(o.LocalAs) +} + +// SetLocalAs sets field value +func (o *BGPStatusPeers) SetLocalAs(v BGPStatusPeersGetLocalAsRetType) { + setBGPStatusPeersGetLocalAsAttributeType(&o.LocalAs, v) +} + +// GetPeerUptime returns the PeerUptime field value +func (o *BGPStatusPeers) GetPeerUptime() (ret BGPStatusPeersGetPeerUptimeRetType) { + ret, _ = o.GetPeerUptimeOk() + return ret +} + +// GetPeerUptimeOk returns a tuple with the PeerUptime field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetPeerUptimeOk() (ret BGPStatusPeersGetPeerUptimeRetType, ok bool) { + return getBGPStatusPeersGetPeerUptimeAttributeTypeOk(o.PeerUptime) +} + +// SetPeerUptime sets field value +func (o *BGPStatusPeers) SetPeerUptime(v BGPStatusPeersGetPeerUptimeRetType) { + setBGPStatusPeersGetPeerUptimeAttributeType(&o.PeerUptime, v) +} + +// GetPfxRcd returns the PfxRcd field value +func (o *BGPStatusPeers) GetPfxRcd() (ret BGPStatusPeersGetPfxRcdRetType) { + ret, _ = o.GetPfxRcdOk() + return ret +} + +// GetPfxRcdOk returns a tuple with the PfxRcd field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetPfxRcdOk() (ret BGPStatusPeersGetPfxRcdRetType, ok bool) { + return getBGPStatusPeersGetPfxRcdAttributeTypeOk(o.PfxRcd) +} + +// SetPfxRcd sets field value +func (o *BGPStatusPeers) SetPfxRcd(v BGPStatusPeersGetPfxRcdRetType) { + setBGPStatusPeersGetPfxRcdAttributeType(&o.PfxRcd, v) +} + +// GetPfxSnt returns the PfxSnt field value +func (o *BGPStatusPeers) GetPfxSnt() (ret BGPStatusPeersGetPfxSntRetType) { + ret, _ = o.GetPfxSntOk() + return ret +} + +// GetPfxSntOk returns a tuple with the PfxSnt field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetPfxSntOk() (ret BGPStatusPeersGetPfxSntRetType, ok bool) { + return getBGPStatusPeersGetPfxSntAttributeTypeOk(o.PfxSnt) +} + +// SetPfxSnt sets field value +func (o *BGPStatusPeers) SetPfxSnt(v BGPStatusPeersGetPfxSntRetType) { + setBGPStatusPeersGetPfxSntAttributeType(&o.PfxSnt, v) +} + +// GetRemoteAs returns the RemoteAs field value +func (o *BGPStatusPeers) GetRemoteAs() (ret BGPStatusPeersGetRemoteAsRetType) { + ret, _ = o.GetRemoteAsOk() + return ret +} + +// GetRemoteAsOk returns a tuple with the RemoteAs field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetRemoteAsOk() (ret BGPStatusPeersGetRemoteAsRetType, ok bool) { + return getBGPStatusPeersGetRemoteAsAttributeTypeOk(o.RemoteAs) +} + +// SetRemoteAs sets field value +func (o *BGPStatusPeers) SetRemoteAs(v BGPStatusPeersGetRemoteAsRetType) { + setBGPStatusPeersGetRemoteAsAttributeType(&o.RemoteAs, v) +} + +// GetRemoteIP returns the RemoteIP field value +func (o *BGPStatusPeers) GetRemoteIP() (ret BGPStatusPeersGetRemoteIPRetType) { + ret, _ = o.GetRemoteIPOk() + return ret +} + +// GetRemoteIPOk returns a tuple with the RemoteIP field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetRemoteIPOk() (ret BGPStatusPeersGetRemoteIPRetType, ok bool) { + return getBGPStatusPeersGetRemoteIPAttributeTypeOk(o.RemoteIP) +} + +// SetRemoteIP sets field value +func (o *BGPStatusPeers) SetRemoteIP(v BGPStatusPeersGetRemoteIPRetType) { + setBGPStatusPeersGetRemoteIPAttributeType(&o.RemoteIP, v) +} + +// GetState returns the State field value +func (o *BGPStatusPeers) GetState() (ret BGPStatusPeersGetStateRetType) { + ret, _ = o.GetStateOk() + return ret +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *BGPStatusPeers) GetStateOk() (ret BGPStatusPeersGetStateRetType, ok bool) { + return getBGPStatusPeersGetStateAttributeTypeOk(o.State) +} + +// SetState sets field value +func (o *BGPStatusPeers) SetState(v BGPStatusPeersGetStateRetType) { + setBGPStatusPeersGetStateAttributeType(&o.State, v) +} + +func (o BGPStatusPeers) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBGPStatusPeersGetLocalAsAttributeTypeOk(o.LocalAs); ok { + toSerialize["LocalAs"] = val + } + if val, ok := getBGPStatusPeersGetPeerUptimeAttributeTypeOk(o.PeerUptime); ok { + toSerialize["PeerUptime"] = val + } + if val, ok := getBGPStatusPeersGetPfxRcdAttributeTypeOk(o.PfxRcd); ok { + toSerialize["PfxRcd"] = val + } + if val, ok := getBGPStatusPeersGetPfxSntAttributeTypeOk(o.PfxSnt); ok { + toSerialize["PfxSnt"] = val + } + if val, ok := getBGPStatusPeersGetRemoteAsAttributeTypeOk(o.RemoteAs); ok { + toSerialize["RemoteAs"] = val + } + if val, ok := getBGPStatusPeersGetRemoteIPAttributeTypeOk(o.RemoteIP); ok { + toSerialize["RemoteIP"] = val + } + if val, ok := getBGPStatusPeersGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullableBGPStatusPeers struct { + value *BGPStatusPeers + isSet bool +} + +func (v NullableBGPStatusPeers) Get() *BGPStatusPeers { + return v.value +} + +func (v *NullableBGPStatusPeers) Set(val *BGPStatusPeers) { + v.value = val + v.isSet = true +} + +func (v NullableBGPStatusPeers) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPStatusPeers) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPStatusPeers(val *BGPStatusPeers) *NullableBGPStatusPeers { + return &NullableBGPStatusPeers{value: val, isSet: true} +} + +func (v NullableBGPStatusPeers) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPStatusPeers) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_bgp_status_peers_test.go b/pkg/vpnalpha/model_bgp_status_peers_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_bgp_status_peers_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_bgp_status_routes.go b/pkg/vpnalpha/model_bgp_status_routes.go new file mode 100644 index 00000000..d9a97ada --- /dev/null +++ b/pkg/vpnalpha/model_bgp_status_routes.go @@ -0,0 +1,301 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the BGPStatusRoutes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPStatusRoutes{} + +/* + types and functions for network +*/ + +// isNotNullableString +type BGPStatusRoutesGetNetworkAttributeType = *string + +func getBGPStatusRoutesGetNetworkAttributeTypeOk(arg BGPStatusRoutesGetNetworkAttributeType) (ret BGPStatusRoutesGetNetworkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusRoutesGetNetworkAttributeType(arg *BGPStatusRoutesGetNetworkAttributeType, val BGPStatusRoutesGetNetworkRetType) { + *arg = &val +} + +type BGPStatusRoutesGetNetworkArgType = string +type BGPStatusRoutesGetNetworkRetType = string + +/* + types and functions for origin +*/ + +// isNotNullableString +type BGPStatusRoutesGetOriginAttributeType = *string + +func getBGPStatusRoutesGetOriginAttributeTypeOk(arg BGPStatusRoutesGetOriginAttributeType) (ret BGPStatusRoutesGetOriginRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusRoutesGetOriginAttributeType(arg *BGPStatusRoutesGetOriginAttributeType, val BGPStatusRoutesGetOriginRetType) { + *arg = &val +} + +type BGPStatusRoutesGetOriginArgType = string +type BGPStatusRoutesGetOriginRetType = string + +/* + types and functions for path +*/ + +// isNotNullableString +type BGPStatusRoutesGetPathAttributeType = *string + +func getBGPStatusRoutesGetPathAttributeTypeOk(arg BGPStatusRoutesGetPathAttributeType) (ret BGPStatusRoutesGetPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusRoutesGetPathAttributeType(arg *BGPStatusRoutesGetPathAttributeType, val BGPStatusRoutesGetPathRetType) { + *arg = &val +} + +type BGPStatusRoutesGetPathArgType = string +type BGPStatusRoutesGetPathRetType = string + +/* + types and functions for peerId +*/ + +// isNotNullableString +type BGPStatusRoutesGetPeerIdAttributeType = *string + +func getBGPStatusRoutesGetPeerIdAttributeTypeOk(arg BGPStatusRoutesGetPeerIdAttributeType) (ret BGPStatusRoutesGetPeerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusRoutesGetPeerIdAttributeType(arg *BGPStatusRoutesGetPeerIdAttributeType, val BGPStatusRoutesGetPeerIdRetType) { + *arg = &val +} + +type BGPStatusRoutesGetPeerIdArgType = string +type BGPStatusRoutesGetPeerIdRetType = string + +/* + types and functions for weight +*/ + +// isNumber +type BGPStatusRoutesGetWeightAttributeType = *float64 +type BGPStatusRoutesGetWeightArgType = float64 +type BGPStatusRoutesGetWeightRetType = float64 + +func getBGPStatusRoutesGetWeightAttributeTypeOk(arg BGPStatusRoutesGetWeightAttributeType) (ret BGPStatusRoutesGetWeightRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPStatusRoutesGetWeightAttributeType(arg *BGPStatusRoutesGetWeightAttributeType, val BGPStatusRoutesGetWeightRetType) { + *arg = &val +} + +// BGPStatusRoutes struct for BGPStatusRoutes +type BGPStatusRoutes struct { + // REQUIRED + Network BGPStatusRoutesGetNetworkAttributeType `json:"network" required:"true"` + // REQUIRED + Origin BGPStatusRoutesGetOriginAttributeType `json:"origin" required:"true"` + // REQUIRED + Path BGPStatusRoutesGetPathAttributeType `json:"path" required:"true"` + // REQUIRED + PeerId BGPStatusRoutesGetPeerIdAttributeType `json:"peerId" required:"true"` + // REQUIRED + Weight BGPStatusRoutesGetWeightAttributeType `json:"weight" required:"true"` +} + +type _BGPStatusRoutes BGPStatusRoutes + +// NewBGPStatusRoutes instantiates a new BGPStatusRoutes 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 NewBGPStatusRoutes(network BGPStatusRoutesGetNetworkArgType, origin BGPStatusRoutesGetOriginArgType, path BGPStatusRoutesGetPathArgType, peerId BGPStatusRoutesGetPeerIdArgType, weight BGPStatusRoutesGetWeightArgType) *BGPStatusRoutes { + this := BGPStatusRoutes{} + setBGPStatusRoutesGetNetworkAttributeType(&this.Network, network) + setBGPStatusRoutesGetOriginAttributeType(&this.Origin, origin) + setBGPStatusRoutesGetPathAttributeType(&this.Path, path) + setBGPStatusRoutesGetPeerIdAttributeType(&this.PeerId, peerId) + setBGPStatusRoutesGetWeightAttributeType(&this.Weight, weight) + return &this +} + +// NewBGPStatusRoutesWithDefaults instantiates a new BGPStatusRoutes 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 NewBGPStatusRoutesWithDefaults() *BGPStatusRoutes { + this := BGPStatusRoutes{} + return &this +} + +// GetNetwork returns the Network field value +func (o *BGPStatusRoutes) GetNetwork() (ret BGPStatusRoutesGetNetworkRetType) { + ret, _ = o.GetNetworkOk() + return ret +} + +// GetNetworkOk returns a tuple with the Network field value +// and a boolean to check if the value has been set. +func (o *BGPStatusRoutes) GetNetworkOk() (ret BGPStatusRoutesGetNetworkRetType, ok bool) { + return getBGPStatusRoutesGetNetworkAttributeTypeOk(o.Network) +} + +// SetNetwork sets field value +func (o *BGPStatusRoutes) SetNetwork(v BGPStatusRoutesGetNetworkRetType) { + setBGPStatusRoutesGetNetworkAttributeType(&o.Network, v) +} + +// GetOrigin returns the Origin field value +func (o *BGPStatusRoutes) GetOrigin() (ret BGPStatusRoutesGetOriginRetType) { + ret, _ = o.GetOriginOk() + return ret +} + +// GetOriginOk returns a tuple with the Origin field value +// and a boolean to check if the value has been set. +func (o *BGPStatusRoutes) GetOriginOk() (ret BGPStatusRoutesGetOriginRetType, ok bool) { + return getBGPStatusRoutesGetOriginAttributeTypeOk(o.Origin) +} + +// SetOrigin sets field value +func (o *BGPStatusRoutes) SetOrigin(v BGPStatusRoutesGetOriginRetType) { + setBGPStatusRoutesGetOriginAttributeType(&o.Origin, v) +} + +// GetPath returns the Path field value +func (o *BGPStatusRoutes) GetPath() (ret BGPStatusRoutesGetPathRetType) { + ret, _ = o.GetPathOk() + return ret +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *BGPStatusRoutes) GetPathOk() (ret BGPStatusRoutesGetPathRetType, ok bool) { + return getBGPStatusRoutesGetPathAttributeTypeOk(o.Path) +} + +// SetPath sets field value +func (o *BGPStatusRoutes) SetPath(v BGPStatusRoutesGetPathRetType) { + setBGPStatusRoutesGetPathAttributeType(&o.Path, v) +} + +// GetPeerId returns the PeerId field value +func (o *BGPStatusRoutes) GetPeerId() (ret BGPStatusRoutesGetPeerIdRetType) { + ret, _ = o.GetPeerIdOk() + return ret +} + +// GetPeerIdOk returns a tuple with the PeerId field value +// and a boolean to check if the value has been set. +func (o *BGPStatusRoutes) GetPeerIdOk() (ret BGPStatusRoutesGetPeerIdRetType, ok bool) { + return getBGPStatusRoutesGetPeerIdAttributeTypeOk(o.PeerId) +} + +// SetPeerId sets field value +func (o *BGPStatusRoutes) SetPeerId(v BGPStatusRoutesGetPeerIdRetType) { + setBGPStatusRoutesGetPeerIdAttributeType(&o.PeerId, v) +} + +// GetWeight returns the Weight field value +func (o *BGPStatusRoutes) GetWeight() (ret BGPStatusRoutesGetWeightRetType) { + ret, _ = o.GetWeightOk() + return ret +} + +// GetWeightOk returns a tuple with the Weight field value +// and a boolean to check if the value has been set. +func (o *BGPStatusRoutes) GetWeightOk() (ret BGPStatusRoutesGetWeightRetType, ok bool) { + return getBGPStatusRoutesGetWeightAttributeTypeOk(o.Weight) +} + +// SetWeight sets field value +func (o *BGPStatusRoutes) SetWeight(v BGPStatusRoutesGetWeightRetType) { + setBGPStatusRoutesGetWeightAttributeType(&o.Weight, v) +} + +func (o BGPStatusRoutes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBGPStatusRoutesGetNetworkAttributeTypeOk(o.Network); ok { + toSerialize["Network"] = val + } + if val, ok := getBGPStatusRoutesGetOriginAttributeTypeOk(o.Origin); ok { + toSerialize["Origin"] = val + } + if val, ok := getBGPStatusRoutesGetPathAttributeTypeOk(o.Path); ok { + toSerialize["Path"] = val + } + if val, ok := getBGPStatusRoutesGetPeerIdAttributeTypeOk(o.PeerId); ok { + toSerialize["PeerId"] = val + } + if val, ok := getBGPStatusRoutesGetWeightAttributeTypeOk(o.Weight); ok { + toSerialize["Weight"] = val + } + return toSerialize, nil +} + +type NullableBGPStatusRoutes struct { + value *BGPStatusRoutes + isSet bool +} + +func (v NullableBGPStatusRoutes) Get() *BGPStatusRoutes { + return v.value +} + +func (v *NullableBGPStatusRoutes) Set(val *BGPStatusRoutes) { + v.value = val + v.isSet = true +} + +func (v NullableBGPStatusRoutes) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPStatusRoutes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPStatusRoutes(val *BGPStatusRoutes) *NullableBGPStatusRoutes { + return &NullableBGPStatusRoutes{value: val, isSet: true} +} + +func (v NullableBGPStatusRoutes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPStatusRoutes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_bgp_status_routes_test.go b/pkg/vpnalpha/model_bgp_status_routes_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_bgp_status_routes_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_bgp_status_test.go b/pkg/vpnalpha/model_bgp_status_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_bgp_status_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_bgp_tunnel_config.go b/pkg/vpnalpha/model_bgp_tunnel_config.go new file mode 100644 index 00000000..ea6056c1 --- /dev/null +++ b/pkg/vpnalpha/model_bgp_tunnel_config.go @@ -0,0 +1,225 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the BGPTunnelConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BGPTunnelConfig{} + +/* + types and functions for localBgpAddress +*/ + +// isNotNullableString +type BGPTunnelConfigGetLocalBgpAddressAttributeType = *string + +func getBGPTunnelConfigGetLocalBgpAddressAttributeTypeOk(arg BGPTunnelConfigGetLocalBgpAddressAttributeType) (ret BGPTunnelConfigGetLocalBgpAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPTunnelConfigGetLocalBgpAddressAttributeType(arg *BGPTunnelConfigGetLocalBgpAddressAttributeType, val BGPTunnelConfigGetLocalBgpAddressRetType) { + *arg = &val +} + +type BGPTunnelConfigGetLocalBgpAddressArgType = string +type BGPTunnelConfigGetLocalBgpAddressRetType = string + +/* + types and functions for remoteAsn +*/ + +// isInteger +type BGPTunnelConfigGetRemoteAsnAttributeType = *int64 +type BGPTunnelConfigGetRemoteAsnArgType = int64 +type BGPTunnelConfigGetRemoteAsnRetType = int64 + +func getBGPTunnelConfigGetRemoteAsnAttributeTypeOk(arg BGPTunnelConfigGetRemoteAsnAttributeType) (ret BGPTunnelConfigGetRemoteAsnRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPTunnelConfigGetRemoteAsnAttributeType(arg *BGPTunnelConfigGetRemoteAsnAttributeType, val BGPTunnelConfigGetRemoteAsnRetType) { + *arg = &val +} + +/* + types and functions for remoteBgpAddress +*/ + +// isNotNullableString +type BGPTunnelConfigGetRemoteBgpAddressAttributeType = *string + +func getBGPTunnelConfigGetRemoteBgpAddressAttributeTypeOk(arg BGPTunnelConfigGetRemoteBgpAddressAttributeType) (ret BGPTunnelConfigGetRemoteBgpAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBGPTunnelConfigGetRemoteBgpAddressAttributeType(arg *BGPTunnelConfigGetRemoteBgpAddressAttributeType, val BGPTunnelConfigGetRemoteBgpAddressRetType) { + *arg = &val +} + +type BGPTunnelConfigGetRemoteBgpAddressArgType = string +type BGPTunnelConfigGetRemoteBgpAddressRetType = string + +// BGPTunnelConfig struct for BGPTunnelConfig +type BGPTunnelConfig struct { + LocalBgpAddress BGPTunnelConfigGetLocalBgpAddressAttributeType `json:"localBgpAddress,omitempty"` + // Remote ASN for Private Use (reserved by IANA) (required if enableBgp=true) + // Can be cast to int32 without loss of precision. + RemoteAsn BGPTunnelConfigGetRemoteAsnAttributeType `json:"remoteAsn,omitempty"` + RemoteBgpAddress BGPTunnelConfigGetRemoteBgpAddressAttributeType `json:"remoteBgpAddress,omitempty"` +} + +// NewBGPTunnelConfig instantiates a new BGPTunnelConfig 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 NewBGPTunnelConfig() *BGPTunnelConfig { + this := BGPTunnelConfig{} + return &this +} + +// NewBGPTunnelConfigWithDefaults instantiates a new BGPTunnelConfig 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 NewBGPTunnelConfigWithDefaults() *BGPTunnelConfig { + this := BGPTunnelConfig{} + return &this +} + +// GetLocalBgpAddress returns the LocalBgpAddress field value if set, zero value otherwise. +func (o *BGPTunnelConfig) GetLocalBgpAddress() (res BGPTunnelConfigGetLocalBgpAddressRetType) { + res, _ = o.GetLocalBgpAddressOk() + return +} + +// GetLocalBgpAddressOk returns a tuple with the LocalBgpAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPTunnelConfig) GetLocalBgpAddressOk() (ret BGPTunnelConfigGetLocalBgpAddressRetType, ok bool) { + return getBGPTunnelConfigGetLocalBgpAddressAttributeTypeOk(o.LocalBgpAddress) +} + +// HasLocalBgpAddress returns a boolean if a field has been set. +func (o *BGPTunnelConfig) HasLocalBgpAddress() bool { + _, ok := o.GetLocalBgpAddressOk() + return ok +} + +// SetLocalBgpAddress gets a reference to the given string and assigns it to the LocalBgpAddress field. +func (o *BGPTunnelConfig) SetLocalBgpAddress(v BGPTunnelConfigGetLocalBgpAddressRetType) { + setBGPTunnelConfigGetLocalBgpAddressAttributeType(&o.LocalBgpAddress, v) +} + +// GetRemoteAsn returns the RemoteAsn field value if set, zero value otherwise. +func (o *BGPTunnelConfig) GetRemoteAsn() (res BGPTunnelConfigGetRemoteAsnRetType) { + res, _ = o.GetRemoteAsnOk() + return +} + +// GetRemoteAsnOk returns a tuple with the RemoteAsn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPTunnelConfig) GetRemoteAsnOk() (ret BGPTunnelConfigGetRemoteAsnRetType, ok bool) { + return getBGPTunnelConfigGetRemoteAsnAttributeTypeOk(o.RemoteAsn) +} + +// HasRemoteAsn returns a boolean if a field has been set. +func (o *BGPTunnelConfig) HasRemoteAsn() bool { + _, ok := o.GetRemoteAsnOk() + return ok +} + +// SetRemoteAsn gets a reference to the given int64 and assigns it to the RemoteAsn field. +func (o *BGPTunnelConfig) SetRemoteAsn(v BGPTunnelConfigGetRemoteAsnRetType) { + setBGPTunnelConfigGetRemoteAsnAttributeType(&o.RemoteAsn, v) +} + +// GetRemoteBgpAddress returns the RemoteBgpAddress field value if set, zero value otherwise. +func (o *BGPTunnelConfig) GetRemoteBgpAddress() (res BGPTunnelConfigGetRemoteBgpAddressRetType) { + res, _ = o.GetRemoteBgpAddressOk() + return +} + +// GetRemoteBgpAddressOk returns a tuple with the RemoteBgpAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BGPTunnelConfig) GetRemoteBgpAddressOk() (ret BGPTunnelConfigGetRemoteBgpAddressRetType, ok bool) { + return getBGPTunnelConfigGetRemoteBgpAddressAttributeTypeOk(o.RemoteBgpAddress) +} + +// HasRemoteBgpAddress returns a boolean if a field has been set. +func (o *BGPTunnelConfig) HasRemoteBgpAddress() bool { + _, ok := o.GetRemoteBgpAddressOk() + return ok +} + +// SetRemoteBgpAddress gets a reference to the given string and assigns it to the RemoteBgpAddress field. +func (o *BGPTunnelConfig) SetRemoteBgpAddress(v BGPTunnelConfigGetRemoteBgpAddressRetType) { + setBGPTunnelConfigGetRemoteBgpAddressAttributeType(&o.RemoteBgpAddress, v) +} + +func (o BGPTunnelConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBGPTunnelConfigGetLocalBgpAddressAttributeTypeOk(o.LocalBgpAddress); ok { + toSerialize["LocalBgpAddress"] = val + } + if val, ok := getBGPTunnelConfigGetRemoteAsnAttributeTypeOk(o.RemoteAsn); ok { + toSerialize["RemoteAsn"] = val + } + if val, ok := getBGPTunnelConfigGetRemoteBgpAddressAttributeTypeOk(o.RemoteBgpAddress); ok { + toSerialize["RemoteBgpAddress"] = val + } + return toSerialize, nil +} + +type NullableBGPTunnelConfig struct { + value *BGPTunnelConfig + isSet bool +} + +func (v NullableBGPTunnelConfig) Get() *BGPTunnelConfig { + return v.value +} + +func (v *NullableBGPTunnelConfig) Set(val *BGPTunnelConfig) { + v.value = val + v.isSet = true +} + +func (v NullableBGPTunnelConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableBGPTunnelConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBGPTunnelConfig(val *BGPTunnelConfig) *NullableBGPTunnelConfig { + return &NullableBGPTunnelConfig{value: val, isSet: true} +} + +func (v NullableBGPTunnelConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBGPTunnelConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_bgp_tunnel_config_test.go b/pkg/vpnalpha/model_bgp_tunnel_config_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_bgp_tunnel_config_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_connection.go b/pkg/vpnalpha/model_connection.go new file mode 100644 index 00000000..22c7bfda --- /dev/null +++ b/pkg/vpnalpha/model_connection.go @@ -0,0 +1,397 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the Connection type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Connection{} + +/* + types and functions for enabled +*/ + +// isBoolean +type ConnectiongetEnabledAttributeType = *bool +type ConnectiongetEnabledArgType = bool +type ConnectiongetEnabledRetType = bool + +func getConnectiongetEnabledAttributeTypeOk(arg ConnectiongetEnabledAttributeType) (ret ConnectiongetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectiongetEnabledAttributeType(arg *ConnectiongetEnabledAttributeType, val ConnectiongetEnabledRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type ConnectionGetLabelsAttributeType = *map[string]string +type ConnectionGetLabelsArgType = map[string]string +type ConnectionGetLabelsRetType = map[string]string + +func getConnectionGetLabelsAttributeTypeOk(arg ConnectionGetLabelsAttributeType) (ret ConnectionGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionGetLabelsAttributeType(arg *ConnectionGetLabelsAttributeType, val ConnectionGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for localSubnets +*/ + +// isArray +type ConnectionGetLocalSubnetsAttributeType = *[]string +type ConnectionGetLocalSubnetsArgType = []string +type ConnectionGetLocalSubnetsRetType = []string + +func getConnectionGetLocalSubnetsAttributeTypeOk(arg ConnectionGetLocalSubnetsAttributeType) (ret ConnectionGetLocalSubnetsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionGetLocalSubnetsAttributeType(arg *ConnectionGetLocalSubnetsAttributeType, val ConnectionGetLocalSubnetsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type ConnectionGetNameAttributeType = *string + +func getConnectionGetNameAttributeTypeOk(arg ConnectionGetNameAttributeType) (ret ConnectionGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionGetNameAttributeType(arg *ConnectionGetNameAttributeType, val ConnectionGetNameRetType) { + *arg = &val +} + +type ConnectionGetNameArgType = string +type ConnectionGetNameRetType = string + +/* + types and functions for remoteSubnets +*/ + +// isArray +type ConnectionGetRemoteSubnetsAttributeType = *[]string +type ConnectionGetRemoteSubnetsArgType = []string +type ConnectionGetRemoteSubnetsRetType = []string + +func getConnectionGetRemoteSubnetsAttributeTypeOk(arg ConnectionGetRemoteSubnetsAttributeType) (ret ConnectionGetRemoteSubnetsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionGetRemoteSubnetsAttributeType(arg *ConnectionGetRemoteSubnetsAttributeType, val ConnectionGetRemoteSubnetsRetType) { + *arg = &val +} + +/* + types and functions for tunnel1 +*/ + +// isModel +type ConnectionGetTunnel1AttributeType = *ConnectionRequestTunnel1 +type ConnectionGetTunnel1ArgType = ConnectionRequestTunnel1 +type ConnectionGetTunnel1RetType = ConnectionRequestTunnel1 + +func getConnectionGetTunnel1AttributeTypeOk(arg ConnectionGetTunnel1AttributeType) (ret ConnectionGetTunnel1RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionGetTunnel1AttributeType(arg *ConnectionGetTunnel1AttributeType, val ConnectionGetTunnel1RetType) { + *arg = &val +} + +/* + types and functions for tunnel2 +*/ + +// isModel +type ConnectionGetTunnel2AttributeType = *ConnectionRequestTunnel1 +type ConnectionGetTunnel2ArgType = ConnectionRequestTunnel1 +type ConnectionGetTunnel2RetType = ConnectionRequestTunnel1 + +func getConnectionGetTunnel2AttributeTypeOk(arg ConnectionGetTunnel2AttributeType) (ret ConnectionGetTunnel2RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionGetTunnel2AttributeType(arg *ConnectionGetTunnel2AttributeType, val ConnectionGetTunnel2RetType) { + *arg = &val +} + +// Connection struct for Connection +type Connection struct { + // This flag decides whether this connection should be enabled or disabled + Enabled ConnectiongetEnabledAttributeType `json:"enabled,omitempty"` + // Map of custom labels. Key and values must be max 63 chars, start/end with alphanumeric. + Labels ConnectionGetLabelsAttributeType `json:"labels,omitempty"` + // List of local subnets (IPv4 CIDR). + // REQUIRED + LocalSubnets ConnectionGetLocalSubnetsAttributeType `json:"localSubnets" required:"true"` + // The name of the connection. Maximum 20 characters (only alphanumeric and hyphens allowed). The name bust be unique within the parent Gateway. Currently renaming is not possible therefore deleting and re-creating the connection is necessary. + // REQUIRED + Name ConnectionGetNameAttributeType `json:"name" required:"true"` + // List of remote subnets (IPv4 CIDR). + // REQUIRED + RemoteSubnets ConnectionGetRemoteSubnetsAttributeType `json:"remoteSubnets" required:"true"` + // REQUIRED + Tunnel1 ConnectionGetTunnel1AttributeType `json:"tunnel1" required:"true"` + // REQUIRED + Tunnel2 ConnectionGetTunnel2AttributeType `json:"tunnel2" required:"true"` +} + +type _Connection Connection + +// NewConnection instantiates a new Connection 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 NewConnection(localSubnets ConnectionGetLocalSubnetsArgType, name ConnectionGetNameArgType, remoteSubnets ConnectionGetRemoteSubnetsArgType, tunnel1 ConnectionGetTunnel1ArgType, tunnel2 ConnectionGetTunnel2ArgType) *Connection { + this := Connection{} + setConnectionGetLocalSubnetsAttributeType(&this.LocalSubnets, localSubnets) + setConnectionGetNameAttributeType(&this.Name, name) + setConnectionGetRemoteSubnetsAttributeType(&this.RemoteSubnets, remoteSubnets) + setConnectionGetTunnel1AttributeType(&this.Tunnel1, tunnel1) + setConnectionGetTunnel2AttributeType(&this.Tunnel2, tunnel2) + return &this +} + +// NewConnectionWithDefaults instantiates a new Connection 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 NewConnectionWithDefaults() *Connection { + this := Connection{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *Connection) GetEnabled() (res ConnectiongetEnabledRetType) { + res, _ = o.GetEnabledOk() + return +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Connection) GetEnabledOk() (ret ConnectiongetEnabledRetType, ok bool) { + return getConnectiongetEnabledAttributeTypeOk(o.Enabled) +} + +// HasEnabled returns a boolean if a field has been set. +func (o *Connection) HasEnabled() bool { + _, ok := o.GetEnabledOk() + return ok +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *Connection) SetEnabled(v ConnectiongetEnabledRetType) { + setConnectiongetEnabledAttributeType(&o.Enabled, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Connection) GetLabels() (res ConnectionGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Connection) GetLabelsOk() (ret ConnectionGetLabelsRetType, ok bool) { + return getConnectionGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Connection) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *Connection) SetLabels(v ConnectionGetLabelsRetType) { + setConnectionGetLabelsAttributeType(&o.Labels, v) +} + +// GetLocalSubnets returns the LocalSubnets field value +func (o *Connection) GetLocalSubnets() (ret ConnectionGetLocalSubnetsRetType) { + ret, _ = o.GetLocalSubnetsOk() + return ret +} + +// GetLocalSubnetsOk returns a tuple with the LocalSubnets field value +// and a boolean to check if the value has been set. +func (o *Connection) GetLocalSubnetsOk() (ret ConnectionGetLocalSubnetsRetType, ok bool) { + return getConnectionGetLocalSubnetsAttributeTypeOk(o.LocalSubnets) +} + +// SetLocalSubnets sets field value +func (o *Connection) SetLocalSubnets(v ConnectionGetLocalSubnetsRetType) { + setConnectionGetLocalSubnetsAttributeType(&o.LocalSubnets, v) +} + +// GetName returns the Name field value +func (o *Connection) GetName() (ret ConnectionGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Connection) GetNameOk() (ret ConnectionGetNameRetType, ok bool) { + return getConnectionGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Connection) SetName(v ConnectionGetNameRetType) { + setConnectionGetNameAttributeType(&o.Name, v) +} + +// GetRemoteSubnets returns the RemoteSubnets field value +func (o *Connection) GetRemoteSubnets() (ret ConnectionGetRemoteSubnetsRetType) { + ret, _ = o.GetRemoteSubnetsOk() + return ret +} + +// GetRemoteSubnetsOk returns a tuple with the RemoteSubnets field value +// and a boolean to check if the value has been set. +func (o *Connection) GetRemoteSubnetsOk() (ret ConnectionGetRemoteSubnetsRetType, ok bool) { + return getConnectionGetRemoteSubnetsAttributeTypeOk(o.RemoteSubnets) +} + +// SetRemoteSubnets sets field value +func (o *Connection) SetRemoteSubnets(v ConnectionGetRemoteSubnetsRetType) { + setConnectionGetRemoteSubnetsAttributeType(&o.RemoteSubnets, v) +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *Connection) GetTunnel1() (ret ConnectionGetTunnel1RetType) { + ret, _ = o.GetTunnel1Ok() + return ret +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *Connection) GetTunnel1Ok() (ret ConnectionGetTunnel1RetType, ok bool) { + return getConnectionGetTunnel1AttributeTypeOk(o.Tunnel1) +} + +// SetTunnel1 sets field value +func (o *Connection) SetTunnel1(v ConnectionGetTunnel1RetType) { + setConnectionGetTunnel1AttributeType(&o.Tunnel1, v) +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *Connection) GetTunnel2() (ret ConnectionGetTunnel2RetType) { + ret, _ = o.GetTunnel2Ok() + return ret +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *Connection) GetTunnel2Ok() (ret ConnectionGetTunnel2RetType, ok bool) { + return getConnectionGetTunnel2AttributeTypeOk(o.Tunnel2) +} + +// SetTunnel2 sets field value +func (o *Connection) SetTunnel2(v ConnectionGetTunnel2RetType) { + setConnectionGetTunnel2AttributeType(&o.Tunnel2, v) +} + +func (o Connection) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getConnectiongetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getConnectionGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getConnectionGetLocalSubnetsAttributeTypeOk(o.LocalSubnets); ok { + toSerialize["LocalSubnets"] = val + } + if val, ok := getConnectionGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getConnectionGetRemoteSubnetsAttributeTypeOk(o.RemoteSubnets); ok { + toSerialize["RemoteSubnets"] = val + } + if val, ok := getConnectionGetTunnel1AttributeTypeOk(o.Tunnel1); ok { + toSerialize["Tunnel1"] = val + } + if val, ok := getConnectionGetTunnel2AttributeTypeOk(o.Tunnel2); ok { + toSerialize["Tunnel2"] = val + } + return toSerialize, nil +} + +type NullableConnection struct { + value *Connection + isSet bool +} + +func (v NullableConnection) Get() *Connection { + return v.value +} + +func (v *NullableConnection) Set(val *Connection) { + v.value = val + v.isSet = true +} + +func (v NullableConnection) IsSet() bool { + return v.isSet +} + +func (v *NullableConnection) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnection(val *Connection) *NullableConnection { + return &NullableConnection{value: val, isSet: true} +} + +func (v NullableConnection) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnection) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_connection_list.go b/pkg/vpnalpha/model_connection_list.go new file mode 100644 index 00000000..e16a0e13 --- /dev/null +++ b/pkg/vpnalpha/model_connection_list.go @@ -0,0 +1,125 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the ConnectionList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConnectionList{} + +/* + types and functions for connections +*/ + +// isArray +type ConnectionListGetConnectionsAttributeType = *[]Connection +type ConnectionListGetConnectionsArgType = []Connection +type ConnectionListGetConnectionsRetType = []Connection + +func getConnectionListGetConnectionsAttributeTypeOk(arg ConnectionListGetConnectionsAttributeType) (ret ConnectionListGetConnectionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionListGetConnectionsAttributeType(arg *ConnectionListGetConnectionsAttributeType, val ConnectionListGetConnectionsRetType) { + *arg = &val +} + +// ConnectionList struct for ConnectionList +type ConnectionList struct { + // REQUIRED + Connections ConnectionListGetConnectionsAttributeType `json:"connections" required:"true"` +} + +type _ConnectionList ConnectionList + +// NewConnectionList instantiates a new ConnectionList 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 NewConnectionList(connections ConnectionListGetConnectionsArgType) *ConnectionList { + this := ConnectionList{} + setConnectionListGetConnectionsAttributeType(&this.Connections, connections) + return &this +} + +// NewConnectionListWithDefaults instantiates a new ConnectionList 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 NewConnectionListWithDefaults() *ConnectionList { + this := ConnectionList{} + return &this +} + +// GetConnections returns the Connections field value +func (o *ConnectionList) GetConnections() (ret ConnectionListGetConnectionsRetType) { + ret, _ = o.GetConnectionsOk() + return ret +} + +// GetConnectionsOk returns a tuple with the Connections field value +// and a boolean to check if the value has been set. +func (o *ConnectionList) GetConnectionsOk() (ret ConnectionListGetConnectionsRetType, ok bool) { + return getConnectionListGetConnectionsAttributeTypeOk(o.Connections) +} + +// SetConnections sets field value +func (o *ConnectionList) SetConnections(v ConnectionListGetConnectionsRetType) { + setConnectionListGetConnectionsAttributeType(&o.Connections, v) +} + +func (o ConnectionList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getConnectionListGetConnectionsAttributeTypeOk(o.Connections); ok { + toSerialize["Connections"] = val + } + return toSerialize, nil +} + +type NullableConnectionList struct { + value *ConnectionList + isSet bool +} + +func (v NullableConnectionList) Get() *ConnectionList { + return v.value +} + +func (v *NullableConnectionList) Set(val *ConnectionList) { + v.value = val + v.isSet = true +} + +func (v NullableConnectionList) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectionList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectionList(val *ConnectionList) *NullableConnectionList { + return &NullableConnectionList{value: val, isSet: true} +} + +func (v NullableConnectionList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectionList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_connection_list_test.go b/pkg/vpnalpha/model_connection_list_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_connection_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_connection_request.go b/pkg/vpnalpha/model_connection_request.go new file mode 100644 index 00000000..2651839d --- /dev/null +++ b/pkg/vpnalpha/model_connection_request.go @@ -0,0 +1,397 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the ConnectionRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConnectionRequest{} + +/* + types and functions for enabled +*/ + +// isBoolean +type ConnectionRequestgetEnabledAttributeType = *bool +type ConnectionRequestgetEnabledArgType = bool +type ConnectionRequestgetEnabledRetType = bool + +func getConnectionRequestgetEnabledAttributeTypeOk(arg ConnectionRequestgetEnabledAttributeType) (ret ConnectionRequestgetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestgetEnabledAttributeType(arg *ConnectionRequestgetEnabledAttributeType, val ConnectionRequestgetEnabledRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type ConnectionRequestGetLabelsAttributeType = *map[string]string +type ConnectionRequestGetLabelsArgType = map[string]string +type ConnectionRequestGetLabelsRetType = map[string]string + +func getConnectionRequestGetLabelsAttributeTypeOk(arg ConnectionRequestGetLabelsAttributeType) (ret ConnectionRequestGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestGetLabelsAttributeType(arg *ConnectionRequestGetLabelsAttributeType, val ConnectionRequestGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for localSubnets +*/ + +// isArray +type ConnectionRequestGetLocalSubnetsAttributeType = *[]string +type ConnectionRequestGetLocalSubnetsArgType = []string +type ConnectionRequestGetLocalSubnetsRetType = []string + +func getConnectionRequestGetLocalSubnetsAttributeTypeOk(arg ConnectionRequestGetLocalSubnetsAttributeType) (ret ConnectionRequestGetLocalSubnetsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestGetLocalSubnetsAttributeType(arg *ConnectionRequestGetLocalSubnetsAttributeType, val ConnectionRequestGetLocalSubnetsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type ConnectionRequestGetNameAttributeType = *string + +func getConnectionRequestGetNameAttributeTypeOk(arg ConnectionRequestGetNameAttributeType) (ret ConnectionRequestGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestGetNameAttributeType(arg *ConnectionRequestGetNameAttributeType, val ConnectionRequestGetNameRetType) { + *arg = &val +} + +type ConnectionRequestGetNameArgType = string +type ConnectionRequestGetNameRetType = string + +/* + types and functions for remoteSubnets +*/ + +// isArray +type ConnectionRequestGetRemoteSubnetsAttributeType = *[]string +type ConnectionRequestGetRemoteSubnetsArgType = []string +type ConnectionRequestGetRemoteSubnetsRetType = []string + +func getConnectionRequestGetRemoteSubnetsAttributeTypeOk(arg ConnectionRequestGetRemoteSubnetsAttributeType) (ret ConnectionRequestGetRemoteSubnetsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestGetRemoteSubnetsAttributeType(arg *ConnectionRequestGetRemoteSubnetsAttributeType, val ConnectionRequestGetRemoteSubnetsRetType) { + *arg = &val +} + +/* + types and functions for tunnel1 +*/ + +// isModel +type ConnectionRequestGetTunnel1AttributeType = *ConnectionRequestTunnel1 +type ConnectionRequestGetTunnel1ArgType = ConnectionRequestTunnel1 +type ConnectionRequestGetTunnel1RetType = ConnectionRequestTunnel1 + +func getConnectionRequestGetTunnel1AttributeTypeOk(arg ConnectionRequestGetTunnel1AttributeType) (ret ConnectionRequestGetTunnel1RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestGetTunnel1AttributeType(arg *ConnectionRequestGetTunnel1AttributeType, val ConnectionRequestGetTunnel1RetType) { + *arg = &val +} + +/* + types and functions for tunnel2 +*/ + +// isModel +type ConnectionRequestGetTunnel2AttributeType = *ConnectionRequestTunnel1 +type ConnectionRequestGetTunnel2ArgType = ConnectionRequestTunnel1 +type ConnectionRequestGetTunnel2RetType = ConnectionRequestTunnel1 + +func getConnectionRequestGetTunnel2AttributeTypeOk(arg ConnectionRequestGetTunnel2AttributeType) (ret ConnectionRequestGetTunnel2RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestGetTunnel2AttributeType(arg *ConnectionRequestGetTunnel2AttributeType, val ConnectionRequestGetTunnel2RetType) { + *arg = &val +} + +// ConnectionRequest struct for ConnectionRequest +type ConnectionRequest struct { + // This flag decides whether this connection should be enabled or disabled + Enabled ConnectionRequestgetEnabledAttributeType `json:"enabled,omitempty"` + // Map of custom labels. Key and values must be max 63 chars, start/end with alphanumeric. + Labels ConnectionRequestGetLabelsAttributeType `json:"labels,omitempty"` + // List of local subnets (IPv4 CIDR). + // REQUIRED + LocalSubnets ConnectionRequestGetLocalSubnetsAttributeType `json:"localSubnets" required:"true"` + // The name of the connection. Maximum 20 characters (only alphanumeric and hyphens allowed). The name bust be unique within the parent Gateway. Currently renaming is not possible therefore deleting and re-creating the connection is necessary. + // REQUIRED + Name ConnectionRequestGetNameAttributeType `json:"name" required:"true"` + // List of remote subnets (IPv4 CIDR). + // REQUIRED + RemoteSubnets ConnectionRequestGetRemoteSubnetsAttributeType `json:"remoteSubnets" required:"true"` + // REQUIRED + Tunnel1 ConnectionRequestGetTunnel1AttributeType `json:"tunnel1" required:"true"` + // REQUIRED + Tunnel2 ConnectionRequestGetTunnel2AttributeType `json:"tunnel2" required:"true"` +} + +type _ConnectionRequest ConnectionRequest + +// NewConnectionRequest instantiates a new ConnectionRequest 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 NewConnectionRequest(localSubnets ConnectionRequestGetLocalSubnetsArgType, name ConnectionRequestGetNameArgType, remoteSubnets ConnectionRequestGetRemoteSubnetsArgType, tunnel1 ConnectionRequestGetTunnel1ArgType, tunnel2 ConnectionRequestGetTunnel2ArgType) *ConnectionRequest { + this := ConnectionRequest{} + setConnectionRequestGetLocalSubnetsAttributeType(&this.LocalSubnets, localSubnets) + setConnectionRequestGetNameAttributeType(&this.Name, name) + setConnectionRequestGetRemoteSubnetsAttributeType(&this.RemoteSubnets, remoteSubnets) + setConnectionRequestGetTunnel1AttributeType(&this.Tunnel1, tunnel1) + setConnectionRequestGetTunnel2AttributeType(&this.Tunnel2, tunnel2) + return &this +} + +// NewConnectionRequestWithDefaults instantiates a new ConnectionRequest 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 NewConnectionRequestWithDefaults() *ConnectionRequest { + this := ConnectionRequest{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *ConnectionRequest) GetEnabled() (res ConnectionRequestgetEnabledRetType) { + res, _ = o.GetEnabledOk() + return +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionRequest) GetEnabledOk() (ret ConnectionRequestgetEnabledRetType, ok bool) { + return getConnectionRequestgetEnabledAttributeTypeOk(o.Enabled) +} + +// HasEnabled returns a boolean if a field has been set. +func (o *ConnectionRequest) HasEnabled() bool { + _, ok := o.GetEnabledOk() + return ok +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *ConnectionRequest) SetEnabled(v ConnectionRequestgetEnabledRetType) { + setConnectionRequestgetEnabledAttributeType(&o.Enabled, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *ConnectionRequest) GetLabels() (res ConnectionRequestGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionRequest) GetLabelsOk() (ret ConnectionRequestGetLabelsRetType, ok bool) { + return getConnectionRequestGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *ConnectionRequest) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *ConnectionRequest) SetLabels(v ConnectionRequestGetLabelsRetType) { + setConnectionRequestGetLabelsAttributeType(&o.Labels, v) +} + +// GetLocalSubnets returns the LocalSubnets field value +func (o *ConnectionRequest) GetLocalSubnets() (ret ConnectionRequestGetLocalSubnetsRetType) { + ret, _ = o.GetLocalSubnetsOk() + return ret +} + +// GetLocalSubnetsOk returns a tuple with the LocalSubnets field value +// and a boolean to check if the value has been set. +func (o *ConnectionRequest) GetLocalSubnetsOk() (ret ConnectionRequestGetLocalSubnetsRetType, ok bool) { + return getConnectionRequestGetLocalSubnetsAttributeTypeOk(o.LocalSubnets) +} + +// SetLocalSubnets sets field value +func (o *ConnectionRequest) SetLocalSubnets(v ConnectionRequestGetLocalSubnetsRetType) { + setConnectionRequestGetLocalSubnetsAttributeType(&o.LocalSubnets, v) +} + +// GetName returns the Name field value +func (o *ConnectionRequest) GetName() (ret ConnectionRequestGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ConnectionRequest) GetNameOk() (ret ConnectionRequestGetNameRetType, ok bool) { + return getConnectionRequestGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *ConnectionRequest) SetName(v ConnectionRequestGetNameRetType) { + setConnectionRequestGetNameAttributeType(&o.Name, v) +} + +// GetRemoteSubnets returns the RemoteSubnets field value +func (o *ConnectionRequest) GetRemoteSubnets() (ret ConnectionRequestGetRemoteSubnetsRetType) { + ret, _ = o.GetRemoteSubnetsOk() + return ret +} + +// GetRemoteSubnetsOk returns a tuple with the RemoteSubnets field value +// and a boolean to check if the value has been set. +func (o *ConnectionRequest) GetRemoteSubnetsOk() (ret ConnectionRequestGetRemoteSubnetsRetType, ok bool) { + return getConnectionRequestGetRemoteSubnetsAttributeTypeOk(o.RemoteSubnets) +} + +// SetRemoteSubnets sets field value +func (o *ConnectionRequest) SetRemoteSubnets(v ConnectionRequestGetRemoteSubnetsRetType) { + setConnectionRequestGetRemoteSubnetsAttributeType(&o.RemoteSubnets, v) +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *ConnectionRequest) GetTunnel1() (ret ConnectionRequestGetTunnel1RetType) { + ret, _ = o.GetTunnel1Ok() + return ret +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *ConnectionRequest) GetTunnel1Ok() (ret ConnectionRequestGetTunnel1RetType, ok bool) { + return getConnectionRequestGetTunnel1AttributeTypeOk(o.Tunnel1) +} + +// SetTunnel1 sets field value +func (o *ConnectionRequest) SetTunnel1(v ConnectionRequestGetTunnel1RetType) { + setConnectionRequestGetTunnel1AttributeType(&o.Tunnel1, v) +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *ConnectionRequest) GetTunnel2() (ret ConnectionRequestGetTunnel2RetType) { + ret, _ = o.GetTunnel2Ok() + return ret +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *ConnectionRequest) GetTunnel2Ok() (ret ConnectionRequestGetTunnel2RetType, ok bool) { + return getConnectionRequestGetTunnel2AttributeTypeOk(o.Tunnel2) +} + +// SetTunnel2 sets field value +func (o *ConnectionRequest) SetTunnel2(v ConnectionRequestGetTunnel2RetType) { + setConnectionRequestGetTunnel2AttributeType(&o.Tunnel2, v) +} + +func (o ConnectionRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getConnectionRequestgetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getConnectionRequestGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getConnectionRequestGetLocalSubnetsAttributeTypeOk(o.LocalSubnets); ok { + toSerialize["LocalSubnets"] = val + } + if val, ok := getConnectionRequestGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getConnectionRequestGetRemoteSubnetsAttributeTypeOk(o.RemoteSubnets); ok { + toSerialize["RemoteSubnets"] = val + } + if val, ok := getConnectionRequestGetTunnel1AttributeTypeOk(o.Tunnel1); ok { + toSerialize["Tunnel1"] = val + } + if val, ok := getConnectionRequestGetTunnel2AttributeTypeOk(o.Tunnel2); ok { + toSerialize["Tunnel2"] = val + } + return toSerialize, nil +} + +type NullableConnectionRequest struct { + value *ConnectionRequest + isSet bool +} + +func (v NullableConnectionRequest) Get() *ConnectionRequest { + return v.value +} + +func (v *NullableConnectionRequest) Set(val *ConnectionRequest) { + v.value = val + v.isSet = true +} + +func (v NullableConnectionRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectionRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectionRequest(val *ConnectionRequest) *NullableConnectionRequest { + return &NullableConnectionRequest{value: val, isSet: true} +} + +func (v NullableConnectionRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectionRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_connection_request_test.go b/pkg/vpnalpha/model_connection_request_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_connection_request_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_connection_request_tunnel1.go b/pkg/vpnalpha/model_connection_request_tunnel1.go new file mode 100644 index 00000000..eb5a5097 --- /dev/null +++ b/pkg/vpnalpha/model_connection_request_tunnel1.go @@ -0,0 +1,308 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the ConnectionRequestTunnel1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConnectionRequestTunnel1{} + +/* + types and functions for bgpTunnelConfig +*/ + +// isModel +type ConnectionRequestTunnel1GetBgpTunnelConfigAttributeType = *BGPTunnelConfig +type ConnectionRequestTunnel1GetBgpTunnelConfigArgType = BGPTunnelConfig +type ConnectionRequestTunnel1GetBgpTunnelConfigRetType = BGPTunnelConfig + +func getConnectionRequestTunnel1GetBgpTunnelConfigAttributeTypeOk(arg ConnectionRequestTunnel1GetBgpTunnelConfigAttributeType) (ret ConnectionRequestTunnel1GetBgpTunnelConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestTunnel1GetBgpTunnelConfigAttributeType(arg *ConnectionRequestTunnel1GetBgpTunnelConfigAttributeType, val ConnectionRequestTunnel1GetBgpTunnelConfigRetType) { + *arg = &val +} + +/* + types and functions for phase1 +*/ + +// isModel +type ConnectionRequestTunnel1GetPhase1AttributeType = *TunnelConfigurationPhase1 +type ConnectionRequestTunnel1GetPhase1ArgType = TunnelConfigurationPhase1 +type ConnectionRequestTunnel1GetPhase1RetType = TunnelConfigurationPhase1 + +func getConnectionRequestTunnel1GetPhase1AttributeTypeOk(arg ConnectionRequestTunnel1GetPhase1AttributeType) (ret ConnectionRequestTunnel1GetPhase1RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestTunnel1GetPhase1AttributeType(arg *ConnectionRequestTunnel1GetPhase1AttributeType, val ConnectionRequestTunnel1GetPhase1RetType) { + *arg = &val +} + +/* + types and functions for phase2 +*/ + +// isModel +type ConnectionRequestTunnel1GetPhase2AttributeType = *TunnelConfigurationPhase2 +type ConnectionRequestTunnel1GetPhase2ArgType = TunnelConfigurationPhase2 +type ConnectionRequestTunnel1GetPhase2RetType = TunnelConfigurationPhase2 + +func getConnectionRequestTunnel1GetPhase2AttributeTypeOk(arg ConnectionRequestTunnel1GetPhase2AttributeType) (ret ConnectionRequestTunnel1GetPhase2RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestTunnel1GetPhase2AttributeType(arg *ConnectionRequestTunnel1GetPhase2AttributeType, val ConnectionRequestTunnel1GetPhase2RetType) { + *arg = &val +} + +/* + types and functions for preSharedKey +*/ + +// isNotNullableString +type ConnectionRequestTunnel1GetPreSharedKeyAttributeType = *string + +func getConnectionRequestTunnel1GetPreSharedKeyAttributeTypeOk(arg ConnectionRequestTunnel1GetPreSharedKeyAttributeType) (ret ConnectionRequestTunnel1GetPreSharedKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestTunnel1GetPreSharedKeyAttributeType(arg *ConnectionRequestTunnel1GetPreSharedKeyAttributeType, val ConnectionRequestTunnel1GetPreSharedKeyRetType) { + *arg = &val +} + +type ConnectionRequestTunnel1GetPreSharedKeyArgType = string +type ConnectionRequestTunnel1GetPreSharedKeyRetType = string + +/* + types and functions for remoteAddress +*/ + +// isNotNullableString +type ConnectionRequestTunnel1GetRemoteAddressAttributeType = *string + +func getConnectionRequestTunnel1GetRemoteAddressAttributeTypeOk(arg ConnectionRequestTunnel1GetRemoteAddressAttributeType) (ret ConnectionRequestTunnel1GetRemoteAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionRequestTunnel1GetRemoteAddressAttributeType(arg *ConnectionRequestTunnel1GetRemoteAddressAttributeType, val ConnectionRequestTunnel1GetRemoteAddressRetType) { + *arg = &val +} + +type ConnectionRequestTunnel1GetRemoteAddressArgType = string +type ConnectionRequestTunnel1GetRemoteAddressRetType = string + +// ConnectionRequestTunnel1 struct for ConnectionRequestTunnel1 +type ConnectionRequestTunnel1 struct { + BgpTunnelConfig ConnectionRequestTunnel1GetBgpTunnelConfigAttributeType `json:"bgpTunnelConfig,omitempty"` + // REQUIRED + Phase1 ConnectionRequestTunnel1GetPhase1AttributeType `json:"phase1" required:"true"` + // REQUIRED + Phase2 ConnectionRequestTunnel1GetPhase2AttributeType `json:"phase2" required:"true"` + // A Pre-Shared Key for authentication. Required in create-requests, optional in update-requests and omitted in every response. + PreSharedKey ConnectionRequestTunnel1GetPreSharedKeyAttributeType `json:"preSharedKey,omitempty"` + // REQUIRED + RemoteAddress ConnectionRequestTunnel1GetRemoteAddressAttributeType `json:"remoteAddress" required:"true"` +} + +type _ConnectionRequestTunnel1 ConnectionRequestTunnel1 + +// NewConnectionRequestTunnel1 instantiates a new ConnectionRequestTunnel1 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 NewConnectionRequestTunnel1(phase1 ConnectionRequestTunnel1GetPhase1ArgType, phase2 ConnectionRequestTunnel1GetPhase2ArgType, remoteAddress ConnectionRequestTunnel1GetRemoteAddressArgType) *ConnectionRequestTunnel1 { + this := ConnectionRequestTunnel1{} + setConnectionRequestTunnel1GetPhase1AttributeType(&this.Phase1, phase1) + setConnectionRequestTunnel1GetPhase2AttributeType(&this.Phase2, phase2) + setConnectionRequestTunnel1GetRemoteAddressAttributeType(&this.RemoteAddress, remoteAddress) + return &this +} + +// NewConnectionRequestTunnel1WithDefaults instantiates a new ConnectionRequestTunnel1 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 NewConnectionRequestTunnel1WithDefaults() *ConnectionRequestTunnel1 { + this := ConnectionRequestTunnel1{} + return &this +} + +// GetBgpTunnelConfig returns the BgpTunnelConfig field value if set, zero value otherwise. +func (o *ConnectionRequestTunnel1) GetBgpTunnelConfig() (res ConnectionRequestTunnel1GetBgpTunnelConfigRetType) { + res, _ = o.GetBgpTunnelConfigOk() + return +} + +// GetBgpTunnelConfigOk returns a tuple with the BgpTunnelConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionRequestTunnel1) GetBgpTunnelConfigOk() (ret ConnectionRequestTunnel1GetBgpTunnelConfigRetType, ok bool) { + return getConnectionRequestTunnel1GetBgpTunnelConfigAttributeTypeOk(o.BgpTunnelConfig) +} + +// HasBgpTunnelConfig returns a boolean if a field has been set. +func (o *ConnectionRequestTunnel1) HasBgpTunnelConfig() bool { + _, ok := o.GetBgpTunnelConfigOk() + return ok +} + +// SetBgpTunnelConfig gets a reference to the given BGPTunnelConfig and assigns it to the BgpTunnelConfig field. +func (o *ConnectionRequestTunnel1) SetBgpTunnelConfig(v ConnectionRequestTunnel1GetBgpTunnelConfigRetType) { + setConnectionRequestTunnel1GetBgpTunnelConfigAttributeType(&o.BgpTunnelConfig, v) +} + +// GetPhase1 returns the Phase1 field value +func (o *ConnectionRequestTunnel1) GetPhase1() (ret ConnectionRequestTunnel1GetPhase1RetType) { + ret, _ = o.GetPhase1Ok() + return ret +} + +// GetPhase1Ok returns a tuple with the Phase1 field value +// and a boolean to check if the value has been set. +func (o *ConnectionRequestTunnel1) GetPhase1Ok() (ret ConnectionRequestTunnel1GetPhase1RetType, ok bool) { + return getConnectionRequestTunnel1GetPhase1AttributeTypeOk(o.Phase1) +} + +// SetPhase1 sets field value +func (o *ConnectionRequestTunnel1) SetPhase1(v ConnectionRequestTunnel1GetPhase1RetType) { + setConnectionRequestTunnel1GetPhase1AttributeType(&o.Phase1, v) +} + +// GetPhase2 returns the Phase2 field value +func (o *ConnectionRequestTunnel1) GetPhase2() (ret ConnectionRequestTunnel1GetPhase2RetType) { + ret, _ = o.GetPhase2Ok() + return ret +} + +// GetPhase2Ok returns a tuple with the Phase2 field value +// and a boolean to check if the value has been set. +func (o *ConnectionRequestTunnel1) GetPhase2Ok() (ret ConnectionRequestTunnel1GetPhase2RetType, ok bool) { + return getConnectionRequestTunnel1GetPhase2AttributeTypeOk(o.Phase2) +} + +// SetPhase2 sets field value +func (o *ConnectionRequestTunnel1) SetPhase2(v ConnectionRequestTunnel1GetPhase2RetType) { + setConnectionRequestTunnel1GetPhase2AttributeType(&o.Phase2, v) +} + +// GetPreSharedKey returns the PreSharedKey field value if set, zero value otherwise. +func (o *ConnectionRequestTunnel1) GetPreSharedKey() (res ConnectionRequestTunnel1GetPreSharedKeyRetType) { + res, _ = o.GetPreSharedKeyOk() + return +} + +// GetPreSharedKeyOk returns a tuple with the PreSharedKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionRequestTunnel1) GetPreSharedKeyOk() (ret ConnectionRequestTunnel1GetPreSharedKeyRetType, ok bool) { + return getConnectionRequestTunnel1GetPreSharedKeyAttributeTypeOk(o.PreSharedKey) +} + +// HasPreSharedKey returns a boolean if a field has been set. +func (o *ConnectionRequestTunnel1) HasPreSharedKey() bool { + _, ok := o.GetPreSharedKeyOk() + return ok +} + +// SetPreSharedKey gets a reference to the given string and assigns it to the PreSharedKey field. +func (o *ConnectionRequestTunnel1) SetPreSharedKey(v ConnectionRequestTunnel1GetPreSharedKeyRetType) { + setConnectionRequestTunnel1GetPreSharedKeyAttributeType(&o.PreSharedKey, v) +} + +// GetRemoteAddress returns the RemoteAddress field value +func (o *ConnectionRequestTunnel1) GetRemoteAddress() (ret ConnectionRequestTunnel1GetRemoteAddressRetType) { + ret, _ = o.GetRemoteAddressOk() + return ret +} + +// GetRemoteAddressOk returns a tuple with the RemoteAddress field value +// and a boolean to check if the value has been set. +func (o *ConnectionRequestTunnel1) GetRemoteAddressOk() (ret ConnectionRequestTunnel1GetRemoteAddressRetType, ok bool) { + return getConnectionRequestTunnel1GetRemoteAddressAttributeTypeOk(o.RemoteAddress) +} + +// SetRemoteAddress sets field value +func (o *ConnectionRequestTunnel1) SetRemoteAddress(v ConnectionRequestTunnel1GetRemoteAddressRetType) { + setConnectionRequestTunnel1GetRemoteAddressAttributeType(&o.RemoteAddress, v) +} + +func (o ConnectionRequestTunnel1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getConnectionRequestTunnel1GetBgpTunnelConfigAttributeTypeOk(o.BgpTunnelConfig); ok { + toSerialize["BgpTunnelConfig"] = val + } + if val, ok := getConnectionRequestTunnel1GetPhase1AttributeTypeOk(o.Phase1); ok { + toSerialize["Phase1"] = val + } + if val, ok := getConnectionRequestTunnel1GetPhase2AttributeTypeOk(o.Phase2); ok { + toSerialize["Phase2"] = val + } + if val, ok := getConnectionRequestTunnel1GetPreSharedKeyAttributeTypeOk(o.PreSharedKey); ok { + toSerialize["PreSharedKey"] = val + } + if val, ok := getConnectionRequestTunnel1GetRemoteAddressAttributeTypeOk(o.RemoteAddress); ok { + toSerialize["RemoteAddress"] = val + } + return toSerialize, nil +} + +type NullableConnectionRequestTunnel1 struct { + value *ConnectionRequestTunnel1 + isSet bool +} + +func (v NullableConnectionRequestTunnel1) Get() *ConnectionRequestTunnel1 { + return v.value +} + +func (v *NullableConnectionRequestTunnel1) Set(val *ConnectionRequestTunnel1) { + v.value = val + v.isSet = true +} + +func (v NullableConnectionRequestTunnel1) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectionRequestTunnel1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectionRequestTunnel1(val *ConnectionRequestTunnel1) *NullableConnectionRequestTunnel1 { + return &NullableConnectionRequestTunnel1{value: val, isSet: true} +} + +func (v NullableConnectionRequestTunnel1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectionRequestTunnel1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_connection_request_tunnel1_test.go b/pkg/vpnalpha/model_connection_request_tunnel1_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_connection_request_tunnel1_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_connection_status_response.go b/pkg/vpnalpha/model_connection_status_response.go new file mode 100644 index 00000000..cd37d76d --- /dev/null +++ b/pkg/vpnalpha/model_connection_status_response.go @@ -0,0 +1,223 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the ConnectionStatusResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConnectionStatusResponse{} + +/* + types and functions for enabled +*/ + +// isBoolean +type ConnectionStatusResponsegetEnabledAttributeType = *bool +type ConnectionStatusResponsegetEnabledArgType = bool +type ConnectionStatusResponsegetEnabledRetType = bool + +func getConnectionStatusResponsegetEnabledAttributeTypeOk(arg ConnectionStatusResponsegetEnabledAttributeType) (ret ConnectionStatusResponsegetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionStatusResponsegetEnabledAttributeType(arg *ConnectionStatusResponsegetEnabledAttributeType, val ConnectionStatusResponsegetEnabledRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type ConnectionStatusResponseGetNameAttributeType = *string + +func getConnectionStatusResponseGetNameAttributeTypeOk(arg ConnectionStatusResponseGetNameAttributeType) (ret ConnectionStatusResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionStatusResponseGetNameAttributeType(arg *ConnectionStatusResponseGetNameAttributeType, val ConnectionStatusResponseGetNameRetType) { + *arg = &val +} + +type ConnectionStatusResponseGetNameArgType = string +type ConnectionStatusResponseGetNameRetType = string + +/* + types and functions for tunnels +*/ + +// isArray +type ConnectionStatusResponseGetTunnelsAttributeType = *[]TunnelStatus +type ConnectionStatusResponseGetTunnelsArgType = []TunnelStatus +type ConnectionStatusResponseGetTunnelsRetType = []TunnelStatus + +func getConnectionStatusResponseGetTunnelsAttributeTypeOk(arg ConnectionStatusResponseGetTunnelsAttributeType) (ret ConnectionStatusResponseGetTunnelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setConnectionStatusResponseGetTunnelsAttributeType(arg *ConnectionStatusResponseGetTunnelsAttributeType, val ConnectionStatusResponseGetTunnelsRetType) { + *arg = &val +} + +// ConnectionStatusResponse struct for ConnectionStatusResponse +type ConnectionStatusResponse struct { + Enabled ConnectionStatusResponsegetEnabledAttributeType `json:"enabled,omitempty"` + // The name of the connection. + Name ConnectionStatusResponseGetNameAttributeType `json:"name,omitempty"` + Tunnels ConnectionStatusResponseGetTunnelsAttributeType `json:"tunnels,omitempty"` +} + +// NewConnectionStatusResponse instantiates a new ConnectionStatusResponse 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 NewConnectionStatusResponse() *ConnectionStatusResponse { + this := ConnectionStatusResponse{} + return &this +} + +// NewConnectionStatusResponseWithDefaults instantiates a new ConnectionStatusResponse 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 NewConnectionStatusResponseWithDefaults() *ConnectionStatusResponse { + this := ConnectionStatusResponse{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *ConnectionStatusResponse) GetEnabled() (res ConnectionStatusResponsegetEnabledRetType) { + res, _ = o.GetEnabledOk() + return +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatusResponse) GetEnabledOk() (ret ConnectionStatusResponsegetEnabledRetType, ok bool) { + return getConnectionStatusResponsegetEnabledAttributeTypeOk(o.Enabled) +} + +// HasEnabled returns a boolean if a field has been set. +func (o *ConnectionStatusResponse) HasEnabled() bool { + _, ok := o.GetEnabledOk() + return ok +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *ConnectionStatusResponse) SetEnabled(v ConnectionStatusResponsegetEnabledRetType) { + setConnectionStatusResponsegetEnabledAttributeType(&o.Enabled, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *ConnectionStatusResponse) GetName() (res ConnectionStatusResponseGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatusResponse) GetNameOk() (ret ConnectionStatusResponseGetNameRetType, ok bool) { + return getConnectionStatusResponseGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *ConnectionStatusResponse) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ConnectionStatusResponse) SetName(v ConnectionStatusResponseGetNameRetType) { + setConnectionStatusResponseGetNameAttributeType(&o.Name, v) +} + +// GetTunnels returns the Tunnels field value if set, zero value otherwise. +func (o *ConnectionStatusResponse) GetTunnels() (res ConnectionStatusResponseGetTunnelsRetType) { + res, _ = o.GetTunnelsOk() + return +} + +// GetTunnelsOk returns a tuple with the Tunnels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConnectionStatusResponse) GetTunnelsOk() (ret ConnectionStatusResponseGetTunnelsRetType, ok bool) { + return getConnectionStatusResponseGetTunnelsAttributeTypeOk(o.Tunnels) +} + +// HasTunnels returns a boolean if a field has been set. +func (o *ConnectionStatusResponse) HasTunnels() bool { + _, ok := o.GetTunnelsOk() + return ok +} + +// SetTunnels gets a reference to the given []TunnelStatus and assigns it to the Tunnels field. +func (o *ConnectionStatusResponse) SetTunnels(v ConnectionStatusResponseGetTunnelsRetType) { + setConnectionStatusResponseGetTunnelsAttributeType(&o.Tunnels, v) +} + +func (o ConnectionStatusResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getConnectionStatusResponsegetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getConnectionStatusResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getConnectionStatusResponseGetTunnelsAttributeTypeOk(o.Tunnels); ok { + toSerialize["Tunnels"] = val + } + return toSerialize, nil +} + +type NullableConnectionStatusResponse struct { + value *ConnectionStatusResponse + isSet bool +} + +func (v NullableConnectionStatusResponse) Get() *ConnectionStatusResponse { + return v.value +} + +func (v *NullableConnectionStatusResponse) Set(val *ConnectionStatusResponse) { + v.value = val + v.isSet = true +} + +func (v NullableConnectionStatusResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectionStatusResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectionStatusResponse(val *ConnectionStatusResponse) *NullableConnectionStatusResponse { + return &NullableConnectionStatusResponse{value: val, isSet: true} +} + +func (v NullableConnectionStatusResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectionStatusResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_connection_status_response_test.go b/pkg/vpnalpha/model_connection_status_response_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_connection_status_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_connection_test.go b/pkg/vpnalpha/model_connection_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_connection_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_create_gateway_connection_payload.go b/pkg/vpnalpha/model_create_gateway_connection_payload.go new file mode 100644 index 00000000..1c4d42a8 --- /dev/null +++ b/pkg/vpnalpha/model_create_gateway_connection_payload.go @@ -0,0 +1,397 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the CreateGatewayConnectionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateGatewayConnectionPayload{} + +/* + types and functions for enabled +*/ + +// isBoolean +type CreateGatewayConnectionPayloadgetEnabledAttributeType = *bool +type CreateGatewayConnectionPayloadgetEnabledArgType = bool +type CreateGatewayConnectionPayloadgetEnabledRetType = bool + +func getCreateGatewayConnectionPayloadgetEnabledAttributeTypeOk(arg CreateGatewayConnectionPayloadgetEnabledAttributeType) (ret CreateGatewayConnectionPayloadgetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateGatewayConnectionPayloadgetEnabledAttributeType(arg *CreateGatewayConnectionPayloadgetEnabledAttributeType, val CreateGatewayConnectionPayloadgetEnabledRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type CreateGatewayConnectionPayloadGetLabelsAttributeType = *map[string]string +type CreateGatewayConnectionPayloadGetLabelsArgType = map[string]string +type CreateGatewayConnectionPayloadGetLabelsRetType = map[string]string + +func getCreateGatewayConnectionPayloadGetLabelsAttributeTypeOk(arg CreateGatewayConnectionPayloadGetLabelsAttributeType) (ret CreateGatewayConnectionPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateGatewayConnectionPayloadGetLabelsAttributeType(arg *CreateGatewayConnectionPayloadGetLabelsAttributeType, val CreateGatewayConnectionPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for localSubnets +*/ + +// isArray +type CreateGatewayConnectionPayloadGetLocalSubnetsAttributeType = *[]string +type CreateGatewayConnectionPayloadGetLocalSubnetsArgType = []string +type CreateGatewayConnectionPayloadGetLocalSubnetsRetType = []string + +func getCreateGatewayConnectionPayloadGetLocalSubnetsAttributeTypeOk(arg CreateGatewayConnectionPayloadGetLocalSubnetsAttributeType) (ret CreateGatewayConnectionPayloadGetLocalSubnetsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateGatewayConnectionPayloadGetLocalSubnetsAttributeType(arg *CreateGatewayConnectionPayloadGetLocalSubnetsAttributeType, val CreateGatewayConnectionPayloadGetLocalSubnetsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateGatewayConnectionPayloadGetNameAttributeType = *string + +func getCreateGatewayConnectionPayloadGetNameAttributeTypeOk(arg CreateGatewayConnectionPayloadGetNameAttributeType) (ret CreateGatewayConnectionPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateGatewayConnectionPayloadGetNameAttributeType(arg *CreateGatewayConnectionPayloadGetNameAttributeType, val CreateGatewayConnectionPayloadGetNameRetType) { + *arg = &val +} + +type CreateGatewayConnectionPayloadGetNameArgType = string +type CreateGatewayConnectionPayloadGetNameRetType = string + +/* + types and functions for remoteSubnets +*/ + +// isArray +type CreateGatewayConnectionPayloadGetRemoteSubnetsAttributeType = *[]string +type CreateGatewayConnectionPayloadGetRemoteSubnetsArgType = []string +type CreateGatewayConnectionPayloadGetRemoteSubnetsRetType = []string + +func getCreateGatewayConnectionPayloadGetRemoteSubnetsAttributeTypeOk(arg CreateGatewayConnectionPayloadGetRemoteSubnetsAttributeType) (ret CreateGatewayConnectionPayloadGetRemoteSubnetsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateGatewayConnectionPayloadGetRemoteSubnetsAttributeType(arg *CreateGatewayConnectionPayloadGetRemoteSubnetsAttributeType, val CreateGatewayConnectionPayloadGetRemoteSubnetsRetType) { + *arg = &val +} + +/* + types and functions for tunnel1 +*/ + +// isModel +type CreateGatewayConnectionPayloadGetTunnel1AttributeType = *ConnectionRequestTunnel1 +type CreateGatewayConnectionPayloadGetTunnel1ArgType = ConnectionRequestTunnel1 +type CreateGatewayConnectionPayloadGetTunnel1RetType = ConnectionRequestTunnel1 + +func getCreateGatewayConnectionPayloadGetTunnel1AttributeTypeOk(arg CreateGatewayConnectionPayloadGetTunnel1AttributeType) (ret CreateGatewayConnectionPayloadGetTunnel1RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateGatewayConnectionPayloadGetTunnel1AttributeType(arg *CreateGatewayConnectionPayloadGetTunnel1AttributeType, val CreateGatewayConnectionPayloadGetTunnel1RetType) { + *arg = &val +} + +/* + types and functions for tunnel2 +*/ + +// isModel +type CreateGatewayConnectionPayloadGetTunnel2AttributeType = *ConnectionRequestTunnel1 +type CreateGatewayConnectionPayloadGetTunnel2ArgType = ConnectionRequestTunnel1 +type CreateGatewayConnectionPayloadGetTunnel2RetType = ConnectionRequestTunnel1 + +func getCreateGatewayConnectionPayloadGetTunnel2AttributeTypeOk(arg CreateGatewayConnectionPayloadGetTunnel2AttributeType) (ret CreateGatewayConnectionPayloadGetTunnel2RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateGatewayConnectionPayloadGetTunnel2AttributeType(arg *CreateGatewayConnectionPayloadGetTunnel2AttributeType, val CreateGatewayConnectionPayloadGetTunnel2RetType) { + *arg = &val +} + +// CreateGatewayConnectionPayload struct for CreateGatewayConnectionPayload +type CreateGatewayConnectionPayload struct { + // This flag decides whether this connection should be enabled or disabled + Enabled CreateGatewayConnectionPayloadgetEnabledAttributeType `json:"enabled,omitempty"` + // Map of custom labels. Key and values must be max 63 chars, start/end with alphanumeric. + Labels CreateGatewayConnectionPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // List of local subnets (IPv4 CIDR). + // REQUIRED + LocalSubnets CreateGatewayConnectionPayloadGetLocalSubnetsAttributeType `json:"localSubnets" required:"true"` + // The name of the connection. Maximum 20 characters (only alphanumeric and hyphens allowed). The name bust be unique within the parent Gateway. Currently renaming is not possible therefore deleting and re-creating the connection is necessary. + // REQUIRED + Name CreateGatewayConnectionPayloadGetNameAttributeType `json:"name" required:"true"` + // List of remote subnets (IPv4 CIDR). + // REQUIRED + RemoteSubnets CreateGatewayConnectionPayloadGetRemoteSubnetsAttributeType `json:"remoteSubnets" required:"true"` + // REQUIRED + Tunnel1 CreateGatewayConnectionPayloadGetTunnel1AttributeType `json:"tunnel1" required:"true"` + // REQUIRED + Tunnel2 CreateGatewayConnectionPayloadGetTunnel2AttributeType `json:"tunnel2" required:"true"` +} + +type _CreateGatewayConnectionPayload CreateGatewayConnectionPayload + +// NewCreateGatewayConnectionPayload instantiates a new CreateGatewayConnectionPayload 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 NewCreateGatewayConnectionPayload(localSubnets CreateGatewayConnectionPayloadGetLocalSubnetsArgType, name CreateGatewayConnectionPayloadGetNameArgType, remoteSubnets CreateGatewayConnectionPayloadGetRemoteSubnetsArgType, tunnel1 CreateGatewayConnectionPayloadGetTunnel1ArgType, tunnel2 CreateGatewayConnectionPayloadGetTunnel2ArgType) *CreateGatewayConnectionPayload { + this := CreateGatewayConnectionPayload{} + setCreateGatewayConnectionPayloadGetLocalSubnetsAttributeType(&this.LocalSubnets, localSubnets) + setCreateGatewayConnectionPayloadGetNameAttributeType(&this.Name, name) + setCreateGatewayConnectionPayloadGetRemoteSubnetsAttributeType(&this.RemoteSubnets, remoteSubnets) + setCreateGatewayConnectionPayloadGetTunnel1AttributeType(&this.Tunnel1, tunnel1) + setCreateGatewayConnectionPayloadGetTunnel2AttributeType(&this.Tunnel2, tunnel2) + return &this +} + +// NewCreateGatewayConnectionPayloadWithDefaults instantiates a new CreateGatewayConnectionPayload 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 NewCreateGatewayConnectionPayloadWithDefaults() *CreateGatewayConnectionPayload { + this := CreateGatewayConnectionPayload{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *CreateGatewayConnectionPayload) GetEnabled() (res CreateGatewayConnectionPayloadgetEnabledRetType) { + res, _ = o.GetEnabledOk() + return +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetEnabledOk() (ret CreateGatewayConnectionPayloadgetEnabledRetType, ok bool) { + return getCreateGatewayConnectionPayloadgetEnabledAttributeTypeOk(o.Enabled) +} + +// HasEnabled returns a boolean if a field has been set. +func (o *CreateGatewayConnectionPayload) HasEnabled() bool { + _, ok := o.GetEnabledOk() + return ok +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *CreateGatewayConnectionPayload) SetEnabled(v CreateGatewayConnectionPayloadgetEnabledRetType) { + setCreateGatewayConnectionPayloadgetEnabledAttributeType(&o.Enabled, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateGatewayConnectionPayload) GetLabels() (res CreateGatewayConnectionPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetLabelsOk() (ret CreateGatewayConnectionPayloadGetLabelsRetType, ok bool) { + return getCreateGatewayConnectionPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateGatewayConnectionPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateGatewayConnectionPayload) SetLabels(v CreateGatewayConnectionPayloadGetLabelsRetType) { + setCreateGatewayConnectionPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetLocalSubnets returns the LocalSubnets field value +func (o *CreateGatewayConnectionPayload) GetLocalSubnets() (ret CreateGatewayConnectionPayloadGetLocalSubnetsRetType) { + ret, _ = o.GetLocalSubnetsOk() + return ret +} + +// GetLocalSubnetsOk returns a tuple with the LocalSubnets field value +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetLocalSubnetsOk() (ret CreateGatewayConnectionPayloadGetLocalSubnetsRetType, ok bool) { + return getCreateGatewayConnectionPayloadGetLocalSubnetsAttributeTypeOk(o.LocalSubnets) +} + +// SetLocalSubnets sets field value +func (o *CreateGatewayConnectionPayload) SetLocalSubnets(v CreateGatewayConnectionPayloadGetLocalSubnetsRetType) { + setCreateGatewayConnectionPayloadGetLocalSubnetsAttributeType(&o.LocalSubnets, v) +} + +// GetName returns the Name field value +func (o *CreateGatewayConnectionPayload) GetName() (ret CreateGatewayConnectionPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetNameOk() (ret CreateGatewayConnectionPayloadGetNameRetType, ok bool) { + return getCreateGatewayConnectionPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateGatewayConnectionPayload) SetName(v CreateGatewayConnectionPayloadGetNameRetType) { + setCreateGatewayConnectionPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRemoteSubnets returns the RemoteSubnets field value +func (o *CreateGatewayConnectionPayload) GetRemoteSubnets() (ret CreateGatewayConnectionPayloadGetRemoteSubnetsRetType) { + ret, _ = o.GetRemoteSubnetsOk() + return ret +} + +// GetRemoteSubnetsOk returns a tuple with the RemoteSubnets field value +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetRemoteSubnetsOk() (ret CreateGatewayConnectionPayloadGetRemoteSubnetsRetType, ok bool) { + return getCreateGatewayConnectionPayloadGetRemoteSubnetsAttributeTypeOk(o.RemoteSubnets) +} + +// SetRemoteSubnets sets field value +func (o *CreateGatewayConnectionPayload) SetRemoteSubnets(v CreateGatewayConnectionPayloadGetRemoteSubnetsRetType) { + setCreateGatewayConnectionPayloadGetRemoteSubnetsAttributeType(&o.RemoteSubnets, v) +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *CreateGatewayConnectionPayload) GetTunnel1() (ret CreateGatewayConnectionPayloadGetTunnel1RetType) { + ret, _ = o.GetTunnel1Ok() + return ret +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetTunnel1Ok() (ret CreateGatewayConnectionPayloadGetTunnel1RetType, ok bool) { + return getCreateGatewayConnectionPayloadGetTunnel1AttributeTypeOk(o.Tunnel1) +} + +// SetTunnel1 sets field value +func (o *CreateGatewayConnectionPayload) SetTunnel1(v CreateGatewayConnectionPayloadGetTunnel1RetType) { + setCreateGatewayConnectionPayloadGetTunnel1AttributeType(&o.Tunnel1, v) +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *CreateGatewayConnectionPayload) GetTunnel2() (ret CreateGatewayConnectionPayloadGetTunnel2RetType) { + ret, _ = o.GetTunnel2Ok() + return ret +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *CreateGatewayConnectionPayload) GetTunnel2Ok() (ret CreateGatewayConnectionPayloadGetTunnel2RetType, ok bool) { + return getCreateGatewayConnectionPayloadGetTunnel2AttributeTypeOk(o.Tunnel2) +} + +// SetTunnel2 sets field value +func (o *CreateGatewayConnectionPayload) SetTunnel2(v CreateGatewayConnectionPayloadGetTunnel2RetType) { + setCreateGatewayConnectionPayloadGetTunnel2AttributeType(&o.Tunnel2, v) +} + +func (o CreateGatewayConnectionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateGatewayConnectionPayloadgetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getCreateGatewayConnectionPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateGatewayConnectionPayloadGetLocalSubnetsAttributeTypeOk(o.LocalSubnets); ok { + toSerialize["LocalSubnets"] = val + } + if val, ok := getCreateGatewayConnectionPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateGatewayConnectionPayloadGetRemoteSubnetsAttributeTypeOk(o.RemoteSubnets); ok { + toSerialize["RemoteSubnets"] = val + } + if val, ok := getCreateGatewayConnectionPayloadGetTunnel1AttributeTypeOk(o.Tunnel1); ok { + toSerialize["Tunnel1"] = val + } + if val, ok := getCreateGatewayConnectionPayloadGetTunnel2AttributeTypeOk(o.Tunnel2); ok { + toSerialize["Tunnel2"] = val + } + return toSerialize, nil +} + +type NullableCreateGatewayConnectionPayload struct { + value *CreateGatewayConnectionPayload + isSet bool +} + +func (v NullableCreateGatewayConnectionPayload) Get() *CreateGatewayConnectionPayload { + return v.value +} + +func (v *NullableCreateGatewayConnectionPayload) Set(val *CreateGatewayConnectionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateGatewayConnectionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateGatewayConnectionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateGatewayConnectionPayload(val *CreateGatewayConnectionPayload) *NullableCreateGatewayConnectionPayload { + return &NullableCreateGatewayConnectionPayload{value: val, isSet: true} +} + +func (v NullableCreateGatewayConnectionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateGatewayConnectionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_create_gateway_connection_payload_test.go b/pkg/vpnalpha/model_create_gateway_connection_payload_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_create_gateway_connection_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_create_vpn_gateway_payload.go b/pkg/vpnalpha/model_create_vpn_gateway_payload.go new file mode 100644 index 00000000..5c008763 --- /dev/null +++ b/pkg/vpnalpha/model_create_vpn_gateway_payload.go @@ -0,0 +1,358 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the CreateVPNGatewayPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVPNGatewayPayload{} + +/* + types and functions for availabilityZones +*/ + +// isModel +type CreateVPNGatewayPayloadGetAvailabilityZonesAttributeType = *CreateVPNGatewayPayloadAvailabilityZones +type CreateVPNGatewayPayloadGetAvailabilityZonesArgType = CreateVPNGatewayPayloadAvailabilityZones +type CreateVPNGatewayPayloadGetAvailabilityZonesRetType = CreateVPNGatewayPayloadAvailabilityZones + +func getCreateVPNGatewayPayloadGetAvailabilityZonesAttributeTypeOk(arg CreateVPNGatewayPayloadGetAvailabilityZonesAttributeType) (ret CreateVPNGatewayPayloadGetAvailabilityZonesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVPNGatewayPayloadGetAvailabilityZonesAttributeType(arg *CreateVPNGatewayPayloadGetAvailabilityZonesAttributeType, val CreateVPNGatewayPayloadGetAvailabilityZonesRetType) { + *arg = &val +} + +/* + types and functions for bgpEnabled +*/ + +// isBoolean +type CreateVPNGatewayPayloadgetBgpEnabledAttributeType = *bool +type CreateVPNGatewayPayloadgetBgpEnabledArgType = bool +type CreateVPNGatewayPayloadgetBgpEnabledRetType = bool + +func getCreateVPNGatewayPayloadgetBgpEnabledAttributeTypeOk(arg CreateVPNGatewayPayloadgetBgpEnabledAttributeType) (ret CreateVPNGatewayPayloadgetBgpEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVPNGatewayPayloadgetBgpEnabledAttributeType(arg *CreateVPNGatewayPayloadgetBgpEnabledAttributeType, val CreateVPNGatewayPayloadgetBgpEnabledRetType) { + *arg = &val +} + +/* + types and functions for bgpGatewayConfig +*/ + +// isModel +type CreateVPNGatewayPayloadGetBgpGatewayConfigAttributeType = *BGPGatewayConfig +type CreateVPNGatewayPayloadGetBgpGatewayConfigArgType = BGPGatewayConfig +type CreateVPNGatewayPayloadGetBgpGatewayConfigRetType = BGPGatewayConfig + +func getCreateVPNGatewayPayloadGetBgpGatewayConfigAttributeTypeOk(arg CreateVPNGatewayPayloadGetBgpGatewayConfigAttributeType) (ret CreateVPNGatewayPayloadGetBgpGatewayConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVPNGatewayPayloadGetBgpGatewayConfigAttributeType(arg *CreateVPNGatewayPayloadGetBgpGatewayConfigAttributeType, val CreateVPNGatewayPayloadGetBgpGatewayConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type CreateVPNGatewayPayloadGetLabelsAttributeType = *map[string]string +type CreateVPNGatewayPayloadGetLabelsArgType = map[string]string +type CreateVPNGatewayPayloadGetLabelsRetType = map[string]string + +func getCreateVPNGatewayPayloadGetLabelsAttributeTypeOk(arg CreateVPNGatewayPayloadGetLabelsAttributeType) (ret CreateVPNGatewayPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVPNGatewayPayloadGetLabelsAttributeType(arg *CreateVPNGatewayPayloadGetLabelsAttributeType, val CreateVPNGatewayPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateVPNGatewayPayloadGetNameAttributeType = *string + +func getCreateVPNGatewayPayloadGetNameAttributeTypeOk(arg CreateVPNGatewayPayloadGetNameAttributeType) (ret CreateVPNGatewayPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVPNGatewayPayloadGetNameAttributeType(arg *CreateVPNGatewayPayloadGetNameAttributeType, val CreateVPNGatewayPayloadGetNameRetType) { + *arg = &val +} + +type CreateVPNGatewayPayloadGetNameArgType = string +type CreateVPNGatewayPayloadGetNameRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type CreateVPNGatewayPayloadGetPlanIdAttributeType = *string + +func getCreateVPNGatewayPayloadGetPlanIdAttributeTypeOk(arg CreateVPNGatewayPayloadGetPlanIdAttributeType) (ret CreateVPNGatewayPayloadGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVPNGatewayPayloadGetPlanIdAttributeType(arg *CreateVPNGatewayPayloadGetPlanIdAttributeType, val CreateVPNGatewayPayloadGetPlanIdRetType) { + *arg = &val +} + +type CreateVPNGatewayPayloadGetPlanIdArgType = string +type CreateVPNGatewayPayloadGetPlanIdRetType = string + +// CreateVPNGatewayPayload struct for CreateVPNGatewayPayload +type CreateVPNGatewayPayload struct { + // REQUIRED + AvailabilityZones CreateVPNGatewayPayloadGetAvailabilityZonesAttributeType `json:"availabilityZones" required:"true"` + // Enable BGP routing. (This will require a BGPGatewayConfig and also a BGPTunnelConfig for each Tunnel in each Connection) + BgpEnabled CreateVPNGatewayPayloadgetBgpEnabledAttributeType `json:"bgpEnabled,omitempty"` + BgpGatewayConfig CreateVPNGatewayPayloadGetBgpGatewayConfigAttributeType `json:"bgpGatewayConfig,omitempty"` + // Map of custom labels. Key and values must be max 63 chars, start/end with alphanumeric. + Labels CreateVPNGatewayPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name of the VPN gateway. Maximum 20 characters (only alphanumeric and hyphens allowed). Not changeable after creation. + // REQUIRED + Name CreateVPNGatewayPayloadGetNameAttributeType `json:"name" required:"true"` + // Service Plan to configure the limits of the VPN. Currently supported plans are p50, p100, p200. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + // REQUIRED + PlanId CreateVPNGatewayPayloadGetPlanIdAttributeType `json:"planId" required:"true"` +} + +type _CreateVPNGatewayPayload CreateVPNGatewayPayload + +// NewCreateVPNGatewayPayload instantiates a new CreateVPNGatewayPayload 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 NewCreateVPNGatewayPayload(availabilityZones CreateVPNGatewayPayloadGetAvailabilityZonesArgType, name CreateVPNGatewayPayloadGetNameArgType, planId CreateVPNGatewayPayloadGetPlanIdArgType) *CreateVPNGatewayPayload { + this := CreateVPNGatewayPayload{} + setCreateVPNGatewayPayloadGetAvailabilityZonesAttributeType(&this.AvailabilityZones, availabilityZones) + setCreateVPNGatewayPayloadGetNameAttributeType(&this.Name, name) + setCreateVPNGatewayPayloadGetPlanIdAttributeType(&this.PlanId, planId) + return &this +} + +// NewCreateVPNGatewayPayloadWithDefaults instantiates a new CreateVPNGatewayPayload 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 NewCreateVPNGatewayPayloadWithDefaults() *CreateVPNGatewayPayload { + this := CreateVPNGatewayPayload{} + return &this +} + +// GetAvailabilityZones returns the AvailabilityZones field value +func (o *CreateVPNGatewayPayload) GetAvailabilityZones() (ret CreateVPNGatewayPayloadGetAvailabilityZonesRetType) { + ret, _ = o.GetAvailabilityZonesOk() + return ret +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetAvailabilityZonesOk() (ret CreateVPNGatewayPayloadGetAvailabilityZonesRetType, ok bool) { + return getCreateVPNGatewayPayloadGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones) +} + +// SetAvailabilityZones sets field value +func (o *CreateVPNGatewayPayload) SetAvailabilityZones(v CreateVPNGatewayPayloadGetAvailabilityZonesRetType) { + setCreateVPNGatewayPayloadGetAvailabilityZonesAttributeType(&o.AvailabilityZones, v) +} + +// GetBgpEnabled returns the BgpEnabled field value if set, zero value otherwise. +func (o *CreateVPNGatewayPayload) GetBgpEnabled() (res CreateVPNGatewayPayloadgetBgpEnabledRetType) { + res, _ = o.GetBgpEnabledOk() + return +} + +// GetBgpEnabledOk returns a tuple with the BgpEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetBgpEnabledOk() (ret CreateVPNGatewayPayloadgetBgpEnabledRetType, ok bool) { + return getCreateVPNGatewayPayloadgetBgpEnabledAttributeTypeOk(o.BgpEnabled) +} + +// HasBgpEnabled returns a boolean if a field has been set. +func (o *CreateVPNGatewayPayload) HasBgpEnabled() bool { + _, ok := o.GetBgpEnabledOk() + return ok +} + +// SetBgpEnabled gets a reference to the given bool and assigns it to the BgpEnabled field. +func (o *CreateVPNGatewayPayload) SetBgpEnabled(v CreateVPNGatewayPayloadgetBgpEnabledRetType) { + setCreateVPNGatewayPayloadgetBgpEnabledAttributeType(&o.BgpEnabled, v) +} + +// GetBgpGatewayConfig returns the BgpGatewayConfig field value if set, zero value otherwise. +func (o *CreateVPNGatewayPayload) GetBgpGatewayConfig() (res CreateVPNGatewayPayloadGetBgpGatewayConfigRetType) { + res, _ = o.GetBgpGatewayConfigOk() + return +} + +// GetBgpGatewayConfigOk returns a tuple with the BgpGatewayConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetBgpGatewayConfigOk() (ret CreateVPNGatewayPayloadGetBgpGatewayConfigRetType, ok bool) { + return getCreateVPNGatewayPayloadGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig) +} + +// HasBgpGatewayConfig returns a boolean if a field has been set. +func (o *CreateVPNGatewayPayload) HasBgpGatewayConfig() bool { + _, ok := o.GetBgpGatewayConfigOk() + return ok +} + +// SetBgpGatewayConfig gets a reference to the given BGPGatewayConfig and assigns it to the BgpGatewayConfig field. +func (o *CreateVPNGatewayPayload) SetBgpGatewayConfig(v CreateVPNGatewayPayloadGetBgpGatewayConfigRetType) { + setCreateVPNGatewayPayloadGetBgpGatewayConfigAttributeType(&o.BgpGatewayConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateVPNGatewayPayload) GetLabels() (res CreateVPNGatewayPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetLabelsOk() (ret CreateVPNGatewayPayloadGetLabelsRetType, ok bool) { + return getCreateVPNGatewayPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateVPNGatewayPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateVPNGatewayPayload) SetLabels(v CreateVPNGatewayPayloadGetLabelsRetType) { + setCreateVPNGatewayPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *CreateVPNGatewayPayload) GetName() (ret CreateVPNGatewayPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetNameOk() (ret CreateVPNGatewayPayloadGetNameRetType, ok bool) { + return getCreateVPNGatewayPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateVPNGatewayPayload) SetName(v CreateVPNGatewayPayloadGetNameRetType) { + setCreateVPNGatewayPayloadGetNameAttributeType(&o.Name, v) +} + +// GetPlanId returns the PlanId field value +func (o *CreateVPNGatewayPayload) GetPlanId() (ret CreateVPNGatewayPayloadGetPlanIdRetType) { + ret, _ = o.GetPlanIdOk() + return ret +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayload) GetPlanIdOk() (ret CreateVPNGatewayPayloadGetPlanIdRetType, ok bool) { + return getCreateVPNGatewayPayloadGetPlanIdAttributeTypeOk(o.PlanId) +} + +// SetPlanId sets field value +func (o *CreateVPNGatewayPayload) SetPlanId(v CreateVPNGatewayPayloadGetPlanIdRetType) { + setCreateVPNGatewayPayloadGetPlanIdAttributeType(&o.PlanId, v) +} + +func (o CreateVPNGatewayPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateVPNGatewayPayloadGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones); ok { + toSerialize["AvailabilityZones"] = val + } + if val, ok := getCreateVPNGatewayPayloadgetBgpEnabledAttributeTypeOk(o.BgpEnabled); ok { + toSerialize["BgpEnabled"] = val + } + if val, ok := getCreateVPNGatewayPayloadGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig); ok { + toSerialize["BgpGatewayConfig"] = val + } + if val, ok := getCreateVPNGatewayPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateVPNGatewayPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateVPNGatewayPayloadGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + return toSerialize, nil +} + +type NullableCreateVPNGatewayPayload struct { + value *CreateVPNGatewayPayload + isSet bool +} + +func (v NullableCreateVPNGatewayPayload) Get() *CreateVPNGatewayPayload { + return v.value +} + +func (v *NullableCreateVPNGatewayPayload) Set(val *CreateVPNGatewayPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVPNGatewayPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVPNGatewayPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVPNGatewayPayload(val *CreateVPNGatewayPayload) *NullableCreateVPNGatewayPayload { + return &NullableCreateVPNGatewayPayload{value: val, isSet: true} +} + +func (v NullableCreateVPNGatewayPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVPNGatewayPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_create_vpn_gateway_payload_availability_zones.go b/pkg/vpnalpha/model_create_vpn_gateway_payload_availability_zones.go new file mode 100644 index 00000000..b8c7dc60 --- /dev/null +++ b/pkg/vpnalpha/model_create_vpn_gateway_payload_availability_zones.go @@ -0,0 +1,172 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the CreateVPNGatewayPayloadAvailabilityZones type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVPNGatewayPayloadAvailabilityZones{} + +/* + types and functions for tunnel1 +*/ + +// isNotNullableString +type CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1AttributeType = *string + +func getCreateVPNGatewayPayloadAvailabilityZonesGetTunnel1AttributeTypeOk(arg CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1AttributeType) (ret CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVPNGatewayPayloadAvailabilityZonesGetTunnel1AttributeType(arg *CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1AttributeType, val CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1RetType) { + *arg = &val +} + +type CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1ArgType = string +type CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1RetType = string + +/* + types and functions for tunnel2 +*/ + +// isNotNullableString +type CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2AttributeType = *string + +func getCreateVPNGatewayPayloadAvailabilityZonesGetTunnel2AttributeTypeOk(arg CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2AttributeType) (ret CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVPNGatewayPayloadAvailabilityZonesGetTunnel2AttributeType(arg *CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2AttributeType, val CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2RetType) { + *arg = &val +} + +type CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2ArgType = string +type CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2RetType = string + +// CreateVPNGatewayPayloadAvailabilityZones struct for CreateVPNGatewayPayloadAvailabilityZones +type CreateVPNGatewayPayloadAvailabilityZones struct { + // Object that represents an availability zone. + // REQUIRED + Tunnel1 CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1AttributeType `json:"tunnel1" required:"true"` + // Object that represents an availability zone. + // REQUIRED + Tunnel2 CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2AttributeType `json:"tunnel2" required:"true"` +} + +type _CreateVPNGatewayPayloadAvailabilityZones CreateVPNGatewayPayloadAvailabilityZones + +// NewCreateVPNGatewayPayloadAvailabilityZones instantiates a new CreateVPNGatewayPayloadAvailabilityZones 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 NewCreateVPNGatewayPayloadAvailabilityZones(tunnel1 CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1ArgType, tunnel2 CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2ArgType) *CreateVPNGatewayPayloadAvailabilityZones { + this := CreateVPNGatewayPayloadAvailabilityZones{} + setCreateVPNGatewayPayloadAvailabilityZonesGetTunnel1AttributeType(&this.Tunnel1, tunnel1) + setCreateVPNGatewayPayloadAvailabilityZonesGetTunnel2AttributeType(&this.Tunnel2, tunnel2) + return &this +} + +// NewCreateVPNGatewayPayloadAvailabilityZonesWithDefaults instantiates a new CreateVPNGatewayPayloadAvailabilityZones 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 NewCreateVPNGatewayPayloadAvailabilityZonesWithDefaults() *CreateVPNGatewayPayloadAvailabilityZones { + this := CreateVPNGatewayPayloadAvailabilityZones{} + return &this +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *CreateVPNGatewayPayloadAvailabilityZones) GetTunnel1() (ret CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1RetType) { + ret, _ = o.GetTunnel1Ok() + return ret +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayloadAvailabilityZones) GetTunnel1Ok() (ret CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1RetType, ok bool) { + return getCreateVPNGatewayPayloadAvailabilityZonesGetTunnel1AttributeTypeOk(o.Tunnel1) +} + +// SetTunnel1 sets field value +func (o *CreateVPNGatewayPayloadAvailabilityZones) SetTunnel1(v CreateVPNGatewayPayloadAvailabilityZonesGetTunnel1RetType) { + setCreateVPNGatewayPayloadAvailabilityZonesGetTunnel1AttributeType(&o.Tunnel1, v) +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *CreateVPNGatewayPayloadAvailabilityZones) GetTunnel2() (ret CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2RetType) { + ret, _ = o.GetTunnel2Ok() + return ret +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *CreateVPNGatewayPayloadAvailabilityZones) GetTunnel2Ok() (ret CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2RetType, ok bool) { + return getCreateVPNGatewayPayloadAvailabilityZonesGetTunnel2AttributeTypeOk(o.Tunnel2) +} + +// SetTunnel2 sets field value +func (o *CreateVPNGatewayPayloadAvailabilityZones) SetTunnel2(v CreateVPNGatewayPayloadAvailabilityZonesGetTunnel2RetType) { + setCreateVPNGatewayPayloadAvailabilityZonesGetTunnel2AttributeType(&o.Tunnel2, v) +} + +func (o CreateVPNGatewayPayloadAvailabilityZones) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateVPNGatewayPayloadAvailabilityZonesGetTunnel1AttributeTypeOk(o.Tunnel1); ok { + toSerialize["Tunnel1"] = val + } + if val, ok := getCreateVPNGatewayPayloadAvailabilityZonesGetTunnel2AttributeTypeOk(o.Tunnel2); ok { + toSerialize["Tunnel2"] = val + } + return toSerialize, nil +} + +type NullableCreateVPNGatewayPayloadAvailabilityZones struct { + value *CreateVPNGatewayPayloadAvailabilityZones + isSet bool +} + +func (v NullableCreateVPNGatewayPayloadAvailabilityZones) Get() *CreateVPNGatewayPayloadAvailabilityZones { + return v.value +} + +func (v *NullableCreateVPNGatewayPayloadAvailabilityZones) Set(val *CreateVPNGatewayPayloadAvailabilityZones) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVPNGatewayPayloadAvailabilityZones) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVPNGatewayPayloadAvailabilityZones) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVPNGatewayPayloadAvailabilityZones(val *CreateVPNGatewayPayloadAvailabilityZones) *NullableCreateVPNGatewayPayloadAvailabilityZones { + return &NullableCreateVPNGatewayPayloadAvailabilityZones{value: val, isSet: true} +} + +func (v NullableCreateVPNGatewayPayloadAvailabilityZones) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVPNGatewayPayloadAvailabilityZones) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_create_vpn_gateway_payload_availability_zones_test.go b/pkg/vpnalpha/model_create_vpn_gateway_payload_availability_zones_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_create_vpn_gateway_payload_availability_zones_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_create_vpn_gateway_payload_test.go b/pkg/vpnalpha/model_create_vpn_gateway_payload_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_create_vpn_gateway_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_gateway.go b/pkg/vpnalpha/model_gateway.go new file mode 100644 index 00000000..760936a9 --- /dev/null +++ b/pkg/vpnalpha/model_gateway.go @@ -0,0 +1,454 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the Gateway type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Gateway{} + +/* + types and functions for region +*/ + +// isEnumRef +type GatewayGetRegionAttributeType = *Region +type GatewayGetRegionArgType = Region +type GatewayGetRegionRetType = Region + +func getGatewayGetRegionAttributeTypeOk(arg GatewayGetRegionAttributeType) (ret GatewayGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayGetRegionAttributeType(arg *GatewayGetRegionAttributeType, val GatewayGetRegionRetType) { + *arg = &val +} + +/* + types and functions for state +*/ + +// isEnumRef +type GatewayGetStateAttributeType = *GatewayStatus +type GatewayGetStateArgType = GatewayStatus +type GatewayGetStateRetType = GatewayStatus + +func getGatewayGetStateAttributeTypeOk(arg GatewayGetStateAttributeType) (ret GatewayGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayGetStateAttributeType(arg *GatewayGetStateAttributeType, val GatewayGetStateRetType) { + *arg = &val +} + +/* + types and functions for availabilityZones +*/ + +// isModel +type GatewayGetAvailabilityZonesAttributeType = *CreateVPNGatewayPayloadAvailabilityZones +type GatewayGetAvailabilityZonesArgType = CreateVPNGatewayPayloadAvailabilityZones +type GatewayGetAvailabilityZonesRetType = CreateVPNGatewayPayloadAvailabilityZones + +func getGatewayGetAvailabilityZonesAttributeTypeOk(arg GatewayGetAvailabilityZonesAttributeType) (ret GatewayGetAvailabilityZonesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayGetAvailabilityZonesAttributeType(arg *GatewayGetAvailabilityZonesAttributeType, val GatewayGetAvailabilityZonesRetType) { + *arg = &val +} + +/* + types and functions for bgpEnabled +*/ + +// isBoolean +type GatewaygetBgpEnabledAttributeType = *bool +type GatewaygetBgpEnabledArgType = bool +type GatewaygetBgpEnabledRetType = bool + +func getGatewaygetBgpEnabledAttributeTypeOk(arg GatewaygetBgpEnabledAttributeType) (ret GatewaygetBgpEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewaygetBgpEnabledAttributeType(arg *GatewaygetBgpEnabledAttributeType, val GatewaygetBgpEnabledRetType) { + *arg = &val +} + +/* + types and functions for bgpGatewayConfig +*/ + +// isModel +type GatewayGetBgpGatewayConfigAttributeType = *BGPGatewayConfig +type GatewayGetBgpGatewayConfigArgType = BGPGatewayConfig +type GatewayGetBgpGatewayConfigRetType = BGPGatewayConfig + +func getGatewayGetBgpGatewayConfigAttributeTypeOk(arg GatewayGetBgpGatewayConfigAttributeType) (ret GatewayGetBgpGatewayConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayGetBgpGatewayConfigAttributeType(arg *GatewayGetBgpGatewayConfigAttributeType, val GatewayGetBgpGatewayConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type GatewayGetLabelsAttributeType = *map[string]string +type GatewayGetLabelsArgType = map[string]string +type GatewayGetLabelsRetType = map[string]string + +func getGatewayGetLabelsAttributeTypeOk(arg GatewayGetLabelsAttributeType) (ret GatewayGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayGetLabelsAttributeType(arg *GatewayGetLabelsAttributeType, val GatewayGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type GatewayGetNameAttributeType = *string + +func getGatewayGetNameAttributeTypeOk(arg GatewayGetNameAttributeType) (ret GatewayGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayGetNameAttributeType(arg *GatewayGetNameAttributeType, val GatewayGetNameRetType) { + *arg = &val +} + +type GatewayGetNameArgType = string +type GatewayGetNameRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type GatewayGetPlanIdAttributeType = *string + +func getGatewayGetPlanIdAttributeTypeOk(arg GatewayGetPlanIdAttributeType) (ret GatewayGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayGetPlanIdAttributeType(arg *GatewayGetPlanIdAttributeType, val GatewayGetPlanIdRetType) { + *arg = &val +} + +type GatewayGetPlanIdArgType = string +type GatewayGetPlanIdRetType = string + +// Gateway struct for Gateway +type Gateway struct { + Region GatewayGetRegionAttributeType `json:"region,omitempty"` + State GatewayGetStateAttributeType `json:"state,omitempty"` + // REQUIRED + AvailabilityZones GatewayGetAvailabilityZonesAttributeType `json:"availabilityZones" required:"true"` + // Enable BGP routing. (This will require a BGPGatewayConfig and also a BGPTunnelConfig for each Tunnel in each Connection) + BgpEnabled GatewaygetBgpEnabledAttributeType `json:"bgpEnabled,omitempty"` + BgpGatewayConfig GatewayGetBgpGatewayConfigAttributeType `json:"bgpGatewayConfig,omitempty"` + // Map of custom labels. Key and values must be max 63 chars, start/end with alphanumeric. + Labels GatewayGetLabelsAttributeType `json:"labels,omitempty"` + // The name of the VPN gateway. Maximum 20 characters (only alphanumeric and hyphens allowed). Not changeable after creation. + // REQUIRED + Name GatewayGetNameAttributeType `json:"name" required:"true"` + // Service Plan to configure the limits of the VPN. Currently supported plans are p50, p100, p200. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + // REQUIRED + PlanId GatewayGetPlanIdAttributeType `json:"planId" required:"true"` +} + +type _Gateway Gateway + +// NewGateway instantiates a new Gateway 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 NewGateway(availabilityZones GatewayGetAvailabilityZonesArgType, name GatewayGetNameArgType, planId GatewayGetPlanIdArgType) *Gateway { + this := Gateway{} + setGatewayGetAvailabilityZonesAttributeType(&this.AvailabilityZones, availabilityZones) + setGatewayGetNameAttributeType(&this.Name, name) + setGatewayGetPlanIdAttributeType(&this.PlanId, planId) + return &this +} + +// NewGatewayWithDefaults instantiates a new Gateway 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 NewGatewayWithDefaults() *Gateway { + this := Gateway{} + var region Region = REGION_EU01 + this.Region = ®ion + return &this +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *Gateway) GetRegion() (res GatewayGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Gateway) GetRegionOk() (ret GatewayGetRegionRetType, ok bool) { + return getGatewayGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *Gateway) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given Region and assigns it to the Region field. +func (o *Gateway) SetRegion(v GatewayGetRegionRetType) { + setGatewayGetRegionAttributeType(&o.Region, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Gateway) GetState() (res GatewayGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Gateway) GetStateOk() (ret GatewayGetStateRetType, ok bool) { + return getGatewayGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *Gateway) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given GatewayStatus and assigns it to the State field. +func (o *Gateway) SetState(v GatewayGetStateRetType) { + setGatewayGetStateAttributeType(&o.State, v) +} + +// GetAvailabilityZones returns the AvailabilityZones field value +func (o *Gateway) GetAvailabilityZones() (ret GatewayGetAvailabilityZonesRetType) { + ret, _ = o.GetAvailabilityZonesOk() + return ret +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +func (o *Gateway) GetAvailabilityZonesOk() (ret GatewayGetAvailabilityZonesRetType, ok bool) { + return getGatewayGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones) +} + +// SetAvailabilityZones sets field value +func (o *Gateway) SetAvailabilityZones(v GatewayGetAvailabilityZonesRetType) { + setGatewayGetAvailabilityZonesAttributeType(&o.AvailabilityZones, v) +} + +// GetBgpEnabled returns the BgpEnabled field value if set, zero value otherwise. +func (o *Gateway) GetBgpEnabled() (res GatewaygetBgpEnabledRetType) { + res, _ = o.GetBgpEnabledOk() + return +} + +// GetBgpEnabledOk returns a tuple with the BgpEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Gateway) GetBgpEnabledOk() (ret GatewaygetBgpEnabledRetType, ok bool) { + return getGatewaygetBgpEnabledAttributeTypeOk(o.BgpEnabled) +} + +// HasBgpEnabled returns a boolean if a field has been set. +func (o *Gateway) HasBgpEnabled() bool { + _, ok := o.GetBgpEnabledOk() + return ok +} + +// SetBgpEnabled gets a reference to the given bool and assigns it to the BgpEnabled field. +func (o *Gateway) SetBgpEnabled(v GatewaygetBgpEnabledRetType) { + setGatewaygetBgpEnabledAttributeType(&o.BgpEnabled, v) +} + +// GetBgpGatewayConfig returns the BgpGatewayConfig field value if set, zero value otherwise. +func (o *Gateway) GetBgpGatewayConfig() (res GatewayGetBgpGatewayConfigRetType) { + res, _ = o.GetBgpGatewayConfigOk() + return +} + +// GetBgpGatewayConfigOk returns a tuple with the BgpGatewayConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Gateway) GetBgpGatewayConfigOk() (ret GatewayGetBgpGatewayConfigRetType, ok bool) { + return getGatewayGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig) +} + +// HasBgpGatewayConfig returns a boolean if a field has been set. +func (o *Gateway) HasBgpGatewayConfig() bool { + _, ok := o.GetBgpGatewayConfigOk() + return ok +} + +// SetBgpGatewayConfig gets a reference to the given BGPGatewayConfig and assigns it to the BgpGatewayConfig field. +func (o *Gateway) SetBgpGatewayConfig(v GatewayGetBgpGatewayConfigRetType) { + setGatewayGetBgpGatewayConfigAttributeType(&o.BgpGatewayConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Gateway) GetLabels() (res GatewayGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Gateway) GetLabelsOk() (ret GatewayGetLabelsRetType, ok bool) { + return getGatewayGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Gateway) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *Gateway) SetLabels(v GatewayGetLabelsRetType) { + setGatewayGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *Gateway) GetName() (ret GatewayGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Gateway) GetNameOk() (ret GatewayGetNameRetType, ok bool) { + return getGatewayGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Gateway) SetName(v GatewayGetNameRetType) { + setGatewayGetNameAttributeType(&o.Name, v) +} + +// GetPlanId returns the PlanId field value +func (o *Gateway) GetPlanId() (ret GatewayGetPlanIdRetType) { + ret, _ = o.GetPlanIdOk() + return ret +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *Gateway) GetPlanIdOk() (ret GatewayGetPlanIdRetType, ok bool) { + return getGatewayGetPlanIdAttributeTypeOk(o.PlanId) +} + +// SetPlanId sets field value +func (o *Gateway) SetPlanId(v GatewayGetPlanIdRetType) { + setGatewayGetPlanIdAttributeType(&o.PlanId, v) +} + +func (o Gateway) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGatewayGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getGatewayGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + if val, ok := getGatewayGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones); ok { + toSerialize["AvailabilityZones"] = val + } + if val, ok := getGatewaygetBgpEnabledAttributeTypeOk(o.BgpEnabled); ok { + toSerialize["BgpEnabled"] = val + } + if val, ok := getGatewayGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig); ok { + toSerialize["BgpGatewayConfig"] = val + } + if val, ok := getGatewayGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getGatewayGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGatewayGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + return toSerialize, nil +} + +type NullableGateway struct { + value *Gateway + isSet bool +} + +func (v NullableGateway) Get() *Gateway { + return v.value +} + +func (v *NullableGateway) Set(val *Gateway) { + v.value = val + v.isSet = true +} + +func (v NullableGateway) IsSet() bool { + return v.isSet +} + +func (v *NullableGateway) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGateway(val *Gateway) *NullableGateway { + return &NullableGateway{value: val, isSet: true} +} + +func (v NullableGateway) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGateway) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_gateway_list.go b/pkg/vpnalpha/model_gateway_list.go new file mode 100644 index 00000000..73191ac3 --- /dev/null +++ b/pkg/vpnalpha/model_gateway_list.go @@ -0,0 +1,125 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the GatewayList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GatewayList{} + +/* + types and functions for gateways +*/ + +// isArray +type GatewayListGetGatewaysAttributeType = *[]GatewayWithStatus +type GatewayListGetGatewaysArgType = []GatewayWithStatus +type GatewayListGetGatewaysRetType = []GatewayWithStatus + +func getGatewayListGetGatewaysAttributeTypeOk(arg GatewayListGetGatewaysAttributeType) (ret GatewayListGetGatewaysRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayListGetGatewaysAttributeType(arg *GatewayListGetGatewaysAttributeType, val GatewayListGetGatewaysRetType) { + *arg = &val +} + +// GatewayList struct for GatewayList +type GatewayList struct { + // REQUIRED + Gateways GatewayListGetGatewaysAttributeType `json:"gateways" required:"true"` +} + +type _GatewayList GatewayList + +// NewGatewayList instantiates a new GatewayList 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 NewGatewayList(gateways GatewayListGetGatewaysArgType) *GatewayList { + this := GatewayList{} + setGatewayListGetGatewaysAttributeType(&this.Gateways, gateways) + return &this +} + +// NewGatewayListWithDefaults instantiates a new GatewayList 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 NewGatewayListWithDefaults() *GatewayList { + this := GatewayList{} + return &this +} + +// GetGateways returns the Gateways field value +func (o *GatewayList) GetGateways() (ret GatewayListGetGatewaysRetType) { + ret, _ = o.GetGatewaysOk() + return ret +} + +// GetGatewaysOk returns a tuple with the Gateways field value +// and a boolean to check if the value has been set. +func (o *GatewayList) GetGatewaysOk() (ret GatewayListGetGatewaysRetType, ok bool) { + return getGatewayListGetGatewaysAttributeTypeOk(o.Gateways) +} + +// SetGateways sets field value +func (o *GatewayList) SetGateways(v GatewayListGetGatewaysRetType) { + setGatewayListGetGatewaysAttributeType(&o.Gateways, v) +} + +func (o GatewayList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGatewayListGetGatewaysAttributeTypeOk(o.Gateways); ok { + toSerialize["Gateways"] = val + } + return toSerialize, nil +} + +type NullableGatewayList struct { + value *GatewayList + isSet bool +} + +func (v NullableGatewayList) Get() *GatewayList { + return v.value +} + +func (v *NullableGatewayList) Set(val *GatewayList) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayList) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayList(val *GatewayList) *NullableGatewayList { + return &NullableGatewayList{value: val, isSet: true} +} + +func (v NullableGatewayList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_gateway_list_test.go b/pkg/vpnalpha/model_gateway_list_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_gateway_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_gateway_request.go b/pkg/vpnalpha/model_gateway_request.go new file mode 100644 index 00000000..ad5c8cbe --- /dev/null +++ b/pkg/vpnalpha/model_gateway_request.go @@ -0,0 +1,358 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the GatewayRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GatewayRequest{} + +/* + types and functions for availabilityZones +*/ + +// isModel +type GatewayRequestGetAvailabilityZonesAttributeType = *CreateVPNGatewayPayloadAvailabilityZones +type GatewayRequestGetAvailabilityZonesArgType = CreateVPNGatewayPayloadAvailabilityZones +type GatewayRequestGetAvailabilityZonesRetType = CreateVPNGatewayPayloadAvailabilityZones + +func getGatewayRequestGetAvailabilityZonesAttributeTypeOk(arg GatewayRequestGetAvailabilityZonesAttributeType) (ret GatewayRequestGetAvailabilityZonesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayRequestGetAvailabilityZonesAttributeType(arg *GatewayRequestGetAvailabilityZonesAttributeType, val GatewayRequestGetAvailabilityZonesRetType) { + *arg = &val +} + +/* + types and functions for bgpEnabled +*/ + +// isBoolean +type GatewayRequestgetBgpEnabledAttributeType = *bool +type GatewayRequestgetBgpEnabledArgType = bool +type GatewayRequestgetBgpEnabledRetType = bool + +func getGatewayRequestgetBgpEnabledAttributeTypeOk(arg GatewayRequestgetBgpEnabledAttributeType) (ret GatewayRequestgetBgpEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayRequestgetBgpEnabledAttributeType(arg *GatewayRequestgetBgpEnabledAttributeType, val GatewayRequestgetBgpEnabledRetType) { + *arg = &val +} + +/* + types and functions for bgpGatewayConfig +*/ + +// isModel +type GatewayRequestGetBgpGatewayConfigAttributeType = *BGPGatewayConfig +type GatewayRequestGetBgpGatewayConfigArgType = BGPGatewayConfig +type GatewayRequestGetBgpGatewayConfigRetType = BGPGatewayConfig + +func getGatewayRequestGetBgpGatewayConfigAttributeTypeOk(arg GatewayRequestGetBgpGatewayConfigAttributeType) (ret GatewayRequestGetBgpGatewayConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayRequestGetBgpGatewayConfigAttributeType(arg *GatewayRequestGetBgpGatewayConfigAttributeType, val GatewayRequestGetBgpGatewayConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type GatewayRequestGetLabelsAttributeType = *map[string]string +type GatewayRequestGetLabelsArgType = map[string]string +type GatewayRequestGetLabelsRetType = map[string]string + +func getGatewayRequestGetLabelsAttributeTypeOk(arg GatewayRequestGetLabelsAttributeType) (ret GatewayRequestGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayRequestGetLabelsAttributeType(arg *GatewayRequestGetLabelsAttributeType, val GatewayRequestGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type GatewayRequestGetNameAttributeType = *string + +func getGatewayRequestGetNameAttributeTypeOk(arg GatewayRequestGetNameAttributeType) (ret GatewayRequestGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayRequestGetNameAttributeType(arg *GatewayRequestGetNameAttributeType, val GatewayRequestGetNameRetType) { + *arg = &val +} + +type GatewayRequestGetNameArgType = string +type GatewayRequestGetNameRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type GatewayRequestGetPlanIdAttributeType = *string + +func getGatewayRequestGetPlanIdAttributeTypeOk(arg GatewayRequestGetPlanIdAttributeType) (ret GatewayRequestGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayRequestGetPlanIdAttributeType(arg *GatewayRequestGetPlanIdAttributeType, val GatewayRequestGetPlanIdRetType) { + *arg = &val +} + +type GatewayRequestGetPlanIdArgType = string +type GatewayRequestGetPlanIdRetType = string + +// GatewayRequest struct for GatewayRequest +type GatewayRequest struct { + // REQUIRED + AvailabilityZones GatewayRequestGetAvailabilityZonesAttributeType `json:"availabilityZones" required:"true"` + // Enable BGP routing. (This will require a BGPGatewayConfig and also a BGPTunnelConfig for each Tunnel in each Connection) + BgpEnabled GatewayRequestgetBgpEnabledAttributeType `json:"bgpEnabled,omitempty"` + BgpGatewayConfig GatewayRequestGetBgpGatewayConfigAttributeType `json:"bgpGatewayConfig,omitempty"` + // Map of custom labels. Key and values must be max 63 chars, start/end with alphanumeric. + Labels GatewayRequestGetLabelsAttributeType `json:"labels,omitempty"` + // The name of the VPN gateway. Maximum 20 characters (only alphanumeric and hyphens allowed). Not changeable after creation. + // REQUIRED + Name GatewayRequestGetNameAttributeType `json:"name" required:"true"` + // Service Plan to configure the limits of the VPN. Currently supported plans are p50, p100, p200. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + // REQUIRED + PlanId GatewayRequestGetPlanIdAttributeType `json:"planId" required:"true"` +} + +type _GatewayRequest GatewayRequest + +// NewGatewayRequest instantiates a new GatewayRequest 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 NewGatewayRequest(availabilityZones GatewayRequestGetAvailabilityZonesArgType, name GatewayRequestGetNameArgType, planId GatewayRequestGetPlanIdArgType) *GatewayRequest { + this := GatewayRequest{} + setGatewayRequestGetAvailabilityZonesAttributeType(&this.AvailabilityZones, availabilityZones) + setGatewayRequestGetNameAttributeType(&this.Name, name) + setGatewayRequestGetPlanIdAttributeType(&this.PlanId, planId) + return &this +} + +// NewGatewayRequestWithDefaults instantiates a new GatewayRequest 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 NewGatewayRequestWithDefaults() *GatewayRequest { + this := GatewayRequest{} + return &this +} + +// GetAvailabilityZones returns the AvailabilityZones field value +func (o *GatewayRequest) GetAvailabilityZones() (ret GatewayRequestGetAvailabilityZonesRetType) { + ret, _ = o.GetAvailabilityZonesOk() + return ret +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +func (o *GatewayRequest) GetAvailabilityZonesOk() (ret GatewayRequestGetAvailabilityZonesRetType, ok bool) { + return getGatewayRequestGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones) +} + +// SetAvailabilityZones sets field value +func (o *GatewayRequest) SetAvailabilityZones(v GatewayRequestGetAvailabilityZonesRetType) { + setGatewayRequestGetAvailabilityZonesAttributeType(&o.AvailabilityZones, v) +} + +// GetBgpEnabled returns the BgpEnabled field value if set, zero value otherwise. +func (o *GatewayRequest) GetBgpEnabled() (res GatewayRequestgetBgpEnabledRetType) { + res, _ = o.GetBgpEnabledOk() + return +} + +// GetBgpEnabledOk returns a tuple with the BgpEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayRequest) GetBgpEnabledOk() (ret GatewayRequestgetBgpEnabledRetType, ok bool) { + return getGatewayRequestgetBgpEnabledAttributeTypeOk(o.BgpEnabled) +} + +// HasBgpEnabled returns a boolean if a field has been set. +func (o *GatewayRequest) HasBgpEnabled() bool { + _, ok := o.GetBgpEnabledOk() + return ok +} + +// SetBgpEnabled gets a reference to the given bool and assigns it to the BgpEnabled field. +func (o *GatewayRequest) SetBgpEnabled(v GatewayRequestgetBgpEnabledRetType) { + setGatewayRequestgetBgpEnabledAttributeType(&o.BgpEnabled, v) +} + +// GetBgpGatewayConfig returns the BgpGatewayConfig field value if set, zero value otherwise. +func (o *GatewayRequest) GetBgpGatewayConfig() (res GatewayRequestGetBgpGatewayConfigRetType) { + res, _ = o.GetBgpGatewayConfigOk() + return +} + +// GetBgpGatewayConfigOk returns a tuple with the BgpGatewayConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayRequest) GetBgpGatewayConfigOk() (ret GatewayRequestGetBgpGatewayConfigRetType, ok bool) { + return getGatewayRequestGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig) +} + +// HasBgpGatewayConfig returns a boolean if a field has been set. +func (o *GatewayRequest) HasBgpGatewayConfig() bool { + _, ok := o.GetBgpGatewayConfigOk() + return ok +} + +// SetBgpGatewayConfig gets a reference to the given BGPGatewayConfig and assigns it to the BgpGatewayConfig field. +func (o *GatewayRequest) SetBgpGatewayConfig(v GatewayRequestGetBgpGatewayConfigRetType) { + setGatewayRequestGetBgpGatewayConfigAttributeType(&o.BgpGatewayConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *GatewayRequest) GetLabels() (res GatewayRequestGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayRequest) GetLabelsOk() (ret GatewayRequestGetLabelsRetType, ok bool) { + return getGatewayRequestGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *GatewayRequest) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *GatewayRequest) SetLabels(v GatewayRequestGetLabelsRetType) { + setGatewayRequestGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *GatewayRequest) GetName() (ret GatewayRequestGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GatewayRequest) GetNameOk() (ret GatewayRequestGetNameRetType, ok bool) { + return getGatewayRequestGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *GatewayRequest) SetName(v GatewayRequestGetNameRetType) { + setGatewayRequestGetNameAttributeType(&o.Name, v) +} + +// GetPlanId returns the PlanId field value +func (o *GatewayRequest) GetPlanId() (ret GatewayRequestGetPlanIdRetType) { + ret, _ = o.GetPlanIdOk() + return ret +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *GatewayRequest) GetPlanIdOk() (ret GatewayRequestGetPlanIdRetType, ok bool) { + return getGatewayRequestGetPlanIdAttributeTypeOk(o.PlanId) +} + +// SetPlanId sets field value +func (o *GatewayRequest) SetPlanId(v GatewayRequestGetPlanIdRetType) { + setGatewayRequestGetPlanIdAttributeType(&o.PlanId, v) +} + +func (o GatewayRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGatewayRequestGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones); ok { + toSerialize["AvailabilityZones"] = val + } + if val, ok := getGatewayRequestgetBgpEnabledAttributeTypeOk(o.BgpEnabled); ok { + toSerialize["BgpEnabled"] = val + } + if val, ok := getGatewayRequestGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig); ok { + toSerialize["BgpGatewayConfig"] = val + } + if val, ok := getGatewayRequestGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getGatewayRequestGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGatewayRequestGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + return toSerialize, nil +} + +type NullableGatewayRequest struct { + value *GatewayRequest + isSet bool +} + +func (v NullableGatewayRequest) Get() *GatewayRequest { + return v.value +} + +func (v *NullableGatewayRequest) Set(val *GatewayRequest) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayRequest(val *GatewayRequest) *NullableGatewayRequest { + return &NullableGatewayRequest{value: val, isSet: true} +} + +func (v NullableGatewayRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_gateway_request_test.go b/pkg/vpnalpha/model_gateway_request_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_gateway_request_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_gateway_status.go b/pkg/vpnalpha/model_gateway_status.go new file mode 100644 index 00000000..d5e7a826 --- /dev/null +++ b/pkg/vpnalpha/model_gateway_status.go @@ -0,0 +1,119 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" + "fmt" +) + +// GatewayStatus Describes the status of the surrounding infrastructure. +type GatewayStatus string + +// List of GatewayStatus +const ( + GATEWAYSTATUS_PENDING GatewayStatus = "PENDING" + GATEWAYSTATUS_READY GatewayStatus = "READY" + GATEWAYSTATUS_ERROR GatewayStatus = "ERROR" + GATEWAYSTATUS_DELETING GatewayStatus = "DELETING" +) + +// All allowed values of GatewayStatus enum +var AllowedGatewayStatusEnumValues = []GatewayStatus{ + "PENDING", + "READY", + "ERROR", + "DELETING", +} + +func (v *GatewayStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := GatewayStatus(value) + for _, existing := range AllowedGatewayStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid GatewayStatus", value) +} + +// NewGatewayStatusFromValue returns a pointer to a valid GatewayStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewGatewayStatusFromValue(v string) (*GatewayStatus, error) { + ev := GatewayStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for GatewayStatus: valid values are %v", v, AllowedGatewayStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v GatewayStatus) IsValid() bool { + for _, existing := range AllowedGatewayStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to GatewayStatus value +func (v GatewayStatus) Ptr() *GatewayStatus { + return &v +} + +type NullableGatewayStatus struct { + value *GatewayStatus + isSet bool +} + +func (v NullableGatewayStatus) Get() *GatewayStatus { + return v.value +} + +func (v *NullableGatewayStatus) Set(val *GatewayStatus) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayStatus(val *GatewayStatus) *NullableGatewayStatus { + return &NullableGatewayStatus{value: val, isSet: true} +} + +func (v NullableGatewayStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_gateway_status_response.go b/pkg/vpnalpha/model_gateway_status_response.go new file mode 100644 index 00000000..7aea7c83 --- /dev/null +++ b/pkg/vpnalpha/model_gateway_status_response.go @@ -0,0 +1,223 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the GatewayStatusResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GatewayStatusResponse{} + +/* + types and functions for gatewayName +*/ + +// isNotNullableString +type GatewayStatusResponseGetGatewayNameAttributeType = *string + +func getGatewayStatusResponseGetGatewayNameAttributeTypeOk(arg GatewayStatusResponseGetGatewayNameAttributeType) (ret GatewayStatusResponseGetGatewayNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayStatusResponseGetGatewayNameAttributeType(arg *GatewayStatusResponseGetGatewayNameAttributeType, val GatewayStatusResponseGetGatewayNameRetType) { + *arg = &val +} + +type GatewayStatusResponseGetGatewayNameArgType = string +type GatewayStatusResponseGetGatewayNameRetType = string + +/* + types and functions for gatewayStatus +*/ + +// isEnumRef +type GatewayStatusResponseGetGatewayStatusAttributeType = *GatewayStatus +type GatewayStatusResponseGetGatewayStatusArgType = GatewayStatus +type GatewayStatusResponseGetGatewayStatusRetType = GatewayStatus + +func getGatewayStatusResponseGetGatewayStatusAttributeTypeOk(arg GatewayStatusResponseGetGatewayStatusAttributeType) (ret GatewayStatusResponseGetGatewayStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayStatusResponseGetGatewayStatusAttributeType(arg *GatewayStatusResponseGetGatewayStatusAttributeType, val GatewayStatusResponseGetGatewayStatusRetType) { + *arg = &val +} + +/* + types and functions for tunnels +*/ + +// isArray +type GatewayStatusResponseGetTunnelsAttributeType = *[]VPNTunnels +type GatewayStatusResponseGetTunnelsArgType = []VPNTunnels +type GatewayStatusResponseGetTunnelsRetType = []VPNTunnels + +func getGatewayStatusResponseGetTunnelsAttributeTypeOk(arg GatewayStatusResponseGetTunnelsAttributeType) (ret GatewayStatusResponseGetTunnelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayStatusResponseGetTunnelsAttributeType(arg *GatewayStatusResponseGetTunnelsAttributeType, val GatewayStatusResponseGetTunnelsRetType) { + *arg = &val +} + +// GatewayStatusResponse struct for GatewayStatusResponse +type GatewayStatusResponse struct { + // VPN name + GatewayName GatewayStatusResponseGetGatewayNameAttributeType `json:"gatewayName,omitempty"` + GatewayStatus GatewayStatusResponseGetGatewayStatusAttributeType `json:"gatewayStatus,omitempty"` + Tunnels GatewayStatusResponseGetTunnelsAttributeType `json:"tunnels,omitempty"` +} + +// NewGatewayStatusResponse instantiates a new GatewayStatusResponse 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 NewGatewayStatusResponse() *GatewayStatusResponse { + this := GatewayStatusResponse{} + return &this +} + +// NewGatewayStatusResponseWithDefaults instantiates a new GatewayStatusResponse 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 NewGatewayStatusResponseWithDefaults() *GatewayStatusResponse { + this := GatewayStatusResponse{} + return &this +} + +// GetGatewayName returns the GatewayName field value if set, zero value otherwise. +func (o *GatewayStatusResponse) GetGatewayName() (res GatewayStatusResponseGetGatewayNameRetType) { + res, _ = o.GetGatewayNameOk() + return +} + +// GetGatewayNameOk returns a tuple with the GatewayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayStatusResponse) GetGatewayNameOk() (ret GatewayStatusResponseGetGatewayNameRetType, ok bool) { + return getGatewayStatusResponseGetGatewayNameAttributeTypeOk(o.GatewayName) +} + +// HasGatewayName returns a boolean if a field has been set. +func (o *GatewayStatusResponse) HasGatewayName() bool { + _, ok := o.GetGatewayNameOk() + return ok +} + +// SetGatewayName gets a reference to the given string and assigns it to the GatewayName field. +func (o *GatewayStatusResponse) SetGatewayName(v GatewayStatusResponseGetGatewayNameRetType) { + setGatewayStatusResponseGetGatewayNameAttributeType(&o.GatewayName, v) +} + +// GetGatewayStatus returns the GatewayStatus field value if set, zero value otherwise. +func (o *GatewayStatusResponse) GetGatewayStatus() (res GatewayStatusResponseGetGatewayStatusRetType) { + res, _ = o.GetGatewayStatusOk() + return +} + +// GetGatewayStatusOk returns a tuple with the GatewayStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayStatusResponse) GetGatewayStatusOk() (ret GatewayStatusResponseGetGatewayStatusRetType, ok bool) { + return getGatewayStatusResponseGetGatewayStatusAttributeTypeOk(o.GatewayStatus) +} + +// HasGatewayStatus returns a boolean if a field has been set. +func (o *GatewayStatusResponse) HasGatewayStatus() bool { + _, ok := o.GetGatewayStatusOk() + return ok +} + +// SetGatewayStatus gets a reference to the given GatewayStatus and assigns it to the GatewayStatus field. +func (o *GatewayStatusResponse) SetGatewayStatus(v GatewayStatusResponseGetGatewayStatusRetType) { + setGatewayStatusResponseGetGatewayStatusAttributeType(&o.GatewayStatus, v) +} + +// GetTunnels returns the Tunnels field value if set, zero value otherwise. +func (o *GatewayStatusResponse) GetTunnels() (res GatewayStatusResponseGetTunnelsRetType) { + res, _ = o.GetTunnelsOk() + return +} + +// GetTunnelsOk returns a tuple with the Tunnels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayStatusResponse) GetTunnelsOk() (ret GatewayStatusResponseGetTunnelsRetType, ok bool) { + return getGatewayStatusResponseGetTunnelsAttributeTypeOk(o.Tunnels) +} + +// HasTunnels returns a boolean if a field has been set. +func (o *GatewayStatusResponse) HasTunnels() bool { + _, ok := o.GetTunnelsOk() + return ok +} + +// SetTunnels gets a reference to the given []VPNTunnels and assigns it to the Tunnels field. +func (o *GatewayStatusResponse) SetTunnels(v GatewayStatusResponseGetTunnelsRetType) { + setGatewayStatusResponseGetTunnelsAttributeType(&o.Tunnels, v) +} + +func (o GatewayStatusResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGatewayStatusResponseGetGatewayNameAttributeTypeOk(o.GatewayName); ok { + toSerialize["GatewayName"] = val + } + if val, ok := getGatewayStatusResponseGetGatewayStatusAttributeTypeOk(o.GatewayStatus); ok { + toSerialize["GatewayStatus"] = val + } + if val, ok := getGatewayStatusResponseGetTunnelsAttributeTypeOk(o.Tunnels); ok { + toSerialize["Tunnels"] = val + } + return toSerialize, nil +} + +type NullableGatewayStatusResponse struct { + value *GatewayStatusResponse + isSet bool +} + +func (v NullableGatewayStatusResponse) Get() *GatewayStatusResponse { + return v.value +} + +func (v *NullableGatewayStatusResponse) Set(val *GatewayStatusResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayStatusResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayStatusResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayStatusResponse(val *GatewayStatusResponse) *NullableGatewayStatusResponse { + return &NullableGatewayStatusResponse{value: val, isSet: true} +} + +func (v NullableGatewayStatusResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayStatusResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_gateway_status_response_test.go b/pkg/vpnalpha/model_gateway_status_response_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_gateway_status_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_gateway_status_test.go b/pkg/vpnalpha/model_gateway_status_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_gateway_status_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_gateway_test.go b/pkg/vpnalpha/model_gateway_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_gateway_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_gateway_with_status.go b/pkg/vpnalpha/model_gateway_with_status.go new file mode 100644 index 00000000..f90da601 --- /dev/null +++ b/pkg/vpnalpha/model_gateway_with_status.go @@ -0,0 +1,407 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the GatewayWithStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GatewayWithStatus{} + +/* + types and functions for region +*/ + +// isEnumRef +type GatewayWithStatusGetRegionAttributeType = *Region +type GatewayWithStatusGetRegionArgType = Region +type GatewayWithStatusGetRegionRetType = Region + +func getGatewayWithStatusGetRegionAttributeTypeOk(arg GatewayWithStatusGetRegionAttributeType) (ret GatewayWithStatusGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayWithStatusGetRegionAttributeType(arg *GatewayWithStatusGetRegionAttributeType, val GatewayWithStatusGetRegionRetType) { + *arg = &val +} + +/* + types and functions for availabilityZones +*/ + +// isModel +type GatewayWithStatusGetAvailabilityZonesAttributeType = *CreateVPNGatewayPayloadAvailabilityZones +type GatewayWithStatusGetAvailabilityZonesArgType = CreateVPNGatewayPayloadAvailabilityZones +type GatewayWithStatusGetAvailabilityZonesRetType = CreateVPNGatewayPayloadAvailabilityZones + +func getGatewayWithStatusGetAvailabilityZonesAttributeTypeOk(arg GatewayWithStatusGetAvailabilityZonesAttributeType) (ret GatewayWithStatusGetAvailabilityZonesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayWithStatusGetAvailabilityZonesAttributeType(arg *GatewayWithStatusGetAvailabilityZonesAttributeType, val GatewayWithStatusGetAvailabilityZonesRetType) { + *arg = &val +} + +/* + types and functions for bgpEnabled +*/ + +// isBoolean +type GatewayWithStatusgetBgpEnabledAttributeType = *bool +type GatewayWithStatusgetBgpEnabledArgType = bool +type GatewayWithStatusgetBgpEnabledRetType = bool + +func getGatewayWithStatusgetBgpEnabledAttributeTypeOk(arg GatewayWithStatusgetBgpEnabledAttributeType) (ret GatewayWithStatusgetBgpEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayWithStatusgetBgpEnabledAttributeType(arg *GatewayWithStatusgetBgpEnabledAttributeType, val GatewayWithStatusgetBgpEnabledRetType) { + *arg = &val +} + +/* + types and functions for bgpGatewayConfig +*/ + +// isModel +type GatewayWithStatusGetBgpGatewayConfigAttributeType = *BGPGatewayConfig +type GatewayWithStatusGetBgpGatewayConfigArgType = BGPGatewayConfig +type GatewayWithStatusGetBgpGatewayConfigRetType = BGPGatewayConfig + +func getGatewayWithStatusGetBgpGatewayConfigAttributeTypeOk(arg GatewayWithStatusGetBgpGatewayConfigAttributeType) (ret GatewayWithStatusGetBgpGatewayConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayWithStatusGetBgpGatewayConfigAttributeType(arg *GatewayWithStatusGetBgpGatewayConfigAttributeType, val GatewayWithStatusGetBgpGatewayConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type GatewayWithStatusGetLabelsAttributeType = *map[string]string +type GatewayWithStatusGetLabelsArgType = map[string]string +type GatewayWithStatusGetLabelsRetType = map[string]string + +func getGatewayWithStatusGetLabelsAttributeTypeOk(arg GatewayWithStatusGetLabelsAttributeType) (ret GatewayWithStatusGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayWithStatusGetLabelsAttributeType(arg *GatewayWithStatusGetLabelsAttributeType, val GatewayWithStatusGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type GatewayWithStatusGetNameAttributeType = *string + +func getGatewayWithStatusGetNameAttributeTypeOk(arg GatewayWithStatusGetNameAttributeType) (ret GatewayWithStatusGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayWithStatusGetNameAttributeType(arg *GatewayWithStatusGetNameAttributeType, val GatewayWithStatusGetNameRetType) { + *arg = &val +} + +type GatewayWithStatusGetNameArgType = string +type GatewayWithStatusGetNameRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type GatewayWithStatusGetPlanIdAttributeType = *string + +func getGatewayWithStatusGetPlanIdAttributeTypeOk(arg GatewayWithStatusGetPlanIdAttributeType) (ret GatewayWithStatusGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayWithStatusGetPlanIdAttributeType(arg *GatewayWithStatusGetPlanIdAttributeType, val GatewayWithStatusGetPlanIdRetType) { + *arg = &val +} + +type GatewayWithStatusGetPlanIdArgType = string +type GatewayWithStatusGetPlanIdRetType = string + +// GatewayWithStatus struct for GatewayWithStatus +type GatewayWithStatus struct { + Region GatewayWithStatusGetRegionAttributeType `json:"region,omitempty"` + // REQUIRED + AvailabilityZones GatewayWithStatusGetAvailabilityZonesAttributeType `json:"availabilityZones" required:"true"` + // Enable BGP routing. (This will require a BGPGatewayConfig and also a BGPTunnelConfig for each Tunnel in each Connection) + BgpEnabled GatewayWithStatusgetBgpEnabledAttributeType `json:"bgpEnabled,omitempty"` + BgpGatewayConfig GatewayWithStatusGetBgpGatewayConfigAttributeType `json:"bgpGatewayConfig,omitempty"` + // Map of custom labels. Key and values must be max 63 chars, start/end with alphanumeric. + Labels GatewayWithStatusGetLabelsAttributeType `json:"labels,omitempty"` + // The name of the VPN gateway. Maximum 20 characters (only alphanumeric and hyphens allowed). Not changeable after creation. + // REQUIRED + Name GatewayWithStatusGetNameAttributeType `json:"name" required:"true"` + // Service Plan to configure the limits of the VPN. Currently supported plans are p50, p100, p200. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + // REQUIRED + PlanId GatewayWithStatusGetPlanIdAttributeType `json:"planId" required:"true"` +} + +type _GatewayWithStatus GatewayWithStatus + +// NewGatewayWithStatus instantiates a new GatewayWithStatus 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 NewGatewayWithStatus(availabilityZones GatewayWithStatusGetAvailabilityZonesArgType, name GatewayWithStatusGetNameArgType, planId GatewayWithStatusGetPlanIdArgType) *GatewayWithStatus { + this := GatewayWithStatus{} + setGatewayWithStatusGetAvailabilityZonesAttributeType(&this.AvailabilityZones, availabilityZones) + setGatewayWithStatusGetNameAttributeType(&this.Name, name) + setGatewayWithStatusGetPlanIdAttributeType(&this.PlanId, planId) + return &this +} + +// NewGatewayWithStatusWithDefaults instantiates a new GatewayWithStatus 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 NewGatewayWithStatusWithDefaults() *GatewayWithStatus { + this := GatewayWithStatus{} + var region Region = REGION_EU01 + this.Region = ®ion + return &this +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *GatewayWithStatus) GetRegion() (res GatewayWithStatusGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayWithStatus) GetRegionOk() (ret GatewayWithStatusGetRegionRetType, ok bool) { + return getGatewayWithStatusGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *GatewayWithStatus) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given Region and assigns it to the Region field. +func (o *GatewayWithStatus) SetRegion(v GatewayWithStatusGetRegionRetType) { + setGatewayWithStatusGetRegionAttributeType(&o.Region, v) +} + +// GetAvailabilityZones returns the AvailabilityZones field value +func (o *GatewayWithStatus) GetAvailabilityZones() (ret GatewayWithStatusGetAvailabilityZonesRetType) { + ret, _ = o.GetAvailabilityZonesOk() + return ret +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +func (o *GatewayWithStatus) GetAvailabilityZonesOk() (ret GatewayWithStatusGetAvailabilityZonesRetType, ok bool) { + return getGatewayWithStatusGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones) +} + +// SetAvailabilityZones sets field value +func (o *GatewayWithStatus) SetAvailabilityZones(v GatewayWithStatusGetAvailabilityZonesRetType) { + setGatewayWithStatusGetAvailabilityZonesAttributeType(&o.AvailabilityZones, v) +} + +// GetBgpEnabled returns the BgpEnabled field value if set, zero value otherwise. +func (o *GatewayWithStatus) GetBgpEnabled() (res GatewayWithStatusgetBgpEnabledRetType) { + res, _ = o.GetBgpEnabledOk() + return +} + +// GetBgpEnabledOk returns a tuple with the BgpEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayWithStatus) GetBgpEnabledOk() (ret GatewayWithStatusgetBgpEnabledRetType, ok bool) { + return getGatewayWithStatusgetBgpEnabledAttributeTypeOk(o.BgpEnabled) +} + +// HasBgpEnabled returns a boolean if a field has been set. +func (o *GatewayWithStatus) HasBgpEnabled() bool { + _, ok := o.GetBgpEnabledOk() + return ok +} + +// SetBgpEnabled gets a reference to the given bool and assigns it to the BgpEnabled field. +func (o *GatewayWithStatus) SetBgpEnabled(v GatewayWithStatusgetBgpEnabledRetType) { + setGatewayWithStatusgetBgpEnabledAttributeType(&o.BgpEnabled, v) +} + +// GetBgpGatewayConfig returns the BgpGatewayConfig field value if set, zero value otherwise. +func (o *GatewayWithStatus) GetBgpGatewayConfig() (res GatewayWithStatusGetBgpGatewayConfigRetType) { + res, _ = o.GetBgpGatewayConfigOk() + return +} + +// GetBgpGatewayConfigOk returns a tuple with the BgpGatewayConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayWithStatus) GetBgpGatewayConfigOk() (ret GatewayWithStatusGetBgpGatewayConfigRetType, ok bool) { + return getGatewayWithStatusGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig) +} + +// HasBgpGatewayConfig returns a boolean if a field has been set. +func (o *GatewayWithStatus) HasBgpGatewayConfig() bool { + _, ok := o.GetBgpGatewayConfigOk() + return ok +} + +// SetBgpGatewayConfig gets a reference to the given BGPGatewayConfig and assigns it to the BgpGatewayConfig field. +func (o *GatewayWithStatus) SetBgpGatewayConfig(v GatewayWithStatusGetBgpGatewayConfigRetType) { + setGatewayWithStatusGetBgpGatewayConfigAttributeType(&o.BgpGatewayConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *GatewayWithStatus) GetLabels() (res GatewayWithStatusGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayWithStatus) GetLabelsOk() (ret GatewayWithStatusGetLabelsRetType, ok bool) { + return getGatewayWithStatusGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *GatewayWithStatus) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *GatewayWithStatus) SetLabels(v GatewayWithStatusGetLabelsRetType) { + setGatewayWithStatusGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *GatewayWithStatus) GetName() (ret GatewayWithStatusGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GatewayWithStatus) GetNameOk() (ret GatewayWithStatusGetNameRetType, ok bool) { + return getGatewayWithStatusGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *GatewayWithStatus) SetName(v GatewayWithStatusGetNameRetType) { + setGatewayWithStatusGetNameAttributeType(&o.Name, v) +} + +// GetPlanId returns the PlanId field value +func (o *GatewayWithStatus) GetPlanId() (ret GatewayWithStatusGetPlanIdRetType) { + ret, _ = o.GetPlanIdOk() + return ret +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *GatewayWithStatus) GetPlanIdOk() (ret GatewayWithStatusGetPlanIdRetType, ok bool) { + return getGatewayWithStatusGetPlanIdAttributeTypeOk(o.PlanId) +} + +// SetPlanId sets field value +func (o *GatewayWithStatus) SetPlanId(v GatewayWithStatusGetPlanIdRetType) { + setGatewayWithStatusGetPlanIdAttributeType(&o.PlanId, v) +} + +func (o GatewayWithStatus) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGatewayWithStatusGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getGatewayWithStatusGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones); ok { + toSerialize["AvailabilityZones"] = val + } + if val, ok := getGatewayWithStatusgetBgpEnabledAttributeTypeOk(o.BgpEnabled); ok { + toSerialize["BgpEnabled"] = val + } + if val, ok := getGatewayWithStatusGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig); ok { + toSerialize["BgpGatewayConfig"] = val + } + if val, ok := getGatewayWithStatusGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getGatewayWithStatusGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGatewayWithStatusGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + return toSerialize, nil +} + +type NullableGatewayWithStatus struct { + value *GatewayWithStatus + isSet bool +} + +func (v NullableGatewayWithStatus) Get() *GatewayWithStatus { + return v.value +} + +func (v *NullableGatewayWithStatus) Set(val *GatewayWithStatus) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayWithStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayWithStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayWithStatus(val *GatewayWithStatus) *NullableGatewayWithStatus { + return &NullableGatewayWithStatus{value: val, isSet: true} +} + +func (v NullableGatewayWithStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayWithStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_gateway_with_status_test.go b/pkg/vpnalpha/model_gateway_with_status_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_gateway_with_status_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_gateways_response.go b/pkg/vpnalpha/model_gateways_response.go new file mode 100644 index 00000000..bddeef25 --- /dev/null +++ b/pkg/vpnalpha/model_gateways_response.go @@ -0,0 +1,400 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the GatewaysResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GatewaysResponse{} + +/* + types and functions for state +*/ + +// isEnumRef +type GatewaysResponseGetStateAttributeType = *GatewayStatus +type GatewaysResponseGetStateArgType = GatewayStatus +type GatewaysResponseGetStateRetType = GatewayStatus + +func getGatewaysResponseGetStateAttributeTypeOk(arg GatewaysResponseGetStateAttributeType) (ret GatewaysResponseGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewaysResponseGetStateAttributeType(arg *GatewaysResponseGetStateAttributeType, val GatewaysResponseGetStateRetType) { + *arg = &val +} + +/* + types and functions for availabilityZones +*/ + +// isModel +type GatewaysResponseGetAvailabilityZonesAttributeType = *CreateVPNGatewayPayloadAvailabilityZones +type GatewaysResponseGetAvailabilityZonesArgType = CreateVPNGatewayPayloadAvailabilityZones +type GatewaysResponseGetAvailabilityZonesRetType = CreateVPNGatewayPayloadAvailabilityZones + +func getGatewaysResponseGetAvailabilityZonesAttributeTypeOk(arg GatewaysResponseGetAvailabilityZonesAttributeType) (ret GatewaysResponseGetAvailabilityZonesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewaysResponseGetAvailabilityZonesAttributeType(arg *GatewaysResponseGetAvailabilityZonesAttributeType, val GatewaysResponseGetAvailabilityZonesRetType) { + *arg = &val +} + +/* + types and functions for bgpEnabled +*/ + +// isBoolean +type GatewaysResponsegetBgpEnabledAttributeType = *bool +type GatewaysResponsegetBgpEnabledArgType = bool +type GatewaysResponsegetBgpEnabledRetType = bool + +func getGatewaysResponsegetBgpEnabledAttributeTypeOk(arg GatewaysResponsegetBgpEnabledAttributeType) (ret GatewaysResponsegetBgpEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewaysResponsegetBgpEnabledAttributeType(arg *GatewaysResponsegetBgpEnabledAttributeType, val GatewaysResponsegetBgpEnabledRetType) { + *arg = &val +} + +/* + types and functions for bgpGatewayConfig +*/ + +// isModel +type GatewaysResponseGetBgpGatewayConfigAttributeType = *BGPGatewayConfig +type GatewaysResponseGetBgpGatewayConfigArgType = BGPGatewayConfig +type GatewaysResponseGetBgpGatewayConfigRetType = BGPGatewayConfig + +func getGatewaysResponseGetBgpGatewayConfigAttributeTypeOk(arg GatewaysResponseGetBgpGatewayConfigAttributeType) (ret GatewaysResponseGetBgpGatewayConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewaysResponseGetBgpGatewayConfigAttributeType(arg *GatewaysResponseGetBgpGatewayConfigAttributeType, val GatewaysResponseGetBgpGatewayConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type GatewaysResponseGetLabelsAttributeType = *map[string]string +type GatewaysResponseGetLabelsArgType = map[string]string +type GatewaysResponseGetLabelsRetType = map[string]string + +func getGatewaysResponseGetLabelsAttributeTypeOk(arg GatewaysResponseGetLabelsAttributeType) (ret GatewaysResponseGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewaysResponseGetLabelsAttributeType(arg *GatewaysResponseGetLabelsAttributeType, val GatewaysResponseGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type GatewaysResponseGetNameAttributeType = *string + +func getGatewaysResponseGetNameAttributeTypeOk(arg GatewaysResponseGetNameAttributeType) (ret GatewaysResponseGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewaysResponseGetNameAttributeType(arg *GatewaysResponseGetNameAttributeType, val GatewaysResponseGetNameRetType) { + *arg = &val +} + +type GatewaysResponseGetNameArgType = string +type GatewaysResponseGetNameRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type GatewaysResponseGetPlanIdAttributeType = *string + +func getGatewaysResponseGetPlanIdAttributeTypeOk(arg GatewaysResponseGetPlanIdAttributeType) (ret GatewaysResponseGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewaysResponseGetPlanIdAttributeType(arg *GatewaysResponseGetPlanIdAttributeType, val GatewaysResponseGetPlanIdRetType) { + *arg = &val +} + +type GatewaysResponseGetPlanIdArgType = string +type GatewaysResponseGetPlanIdRetType = string + +// GatewaysResponse struct for GatewaysResponse +type GatewaysResponse struct { + // REQUIRED + State GatewaysResponseGetStateAttributeType `json:"state" required:"true"` + // REQUIRED + AvailabilityZones GatewaysResponseGetAvailabilityZonesAttributeType `json:"availabilityZones" required:"true"` + // Enable BGP routing. (This will require a BGPGatewayConfig and also a BGPTunnelConfig for each Tunnel in each Connection) + BgpEnabled GatewaysResponsegetBgpEnabledAttributeType `json:"bgpEnabled,omitempty"` + BgpGatewayConfig GatewaysResponseGetBgpGatewayConfigAttributeType `json:"bgpGatewayConfig,omitempty"` + // Map of custom labels. Key and values must be max 63 chars, start/end with alphanumeric. + Labels GatewaysResponseGetLabelsAttributeType `json:"labels,omitempty"` + // The name of the VPN gateway. Maximum 20 characters (only alphanumeric and hyphens allowed). Not changeable after creation. + // REQUIRED + Name GatewaysResponseGetNameAttributeType `json:"name" required:"true"` + // Service Plan to configure the limits of the VPN. Currently supported plans are p50, p100, p200. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + // REQUIRED + PlanId GatewaysResponseGetPlanIdAttributeType `json:"planId" required:"true"` +} + +type _GatewaysResponse GatewaysResponse + +// NewGatewaysResponse instantiates a new GatewaysResponse 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 NewGatewaysResponse(state GatewaysResponseGetStateArgType, availabilityZones GatewaysResponseGetAvailabilityZonesArgType, name GatewaysResponseGetNameArgType, planId GatewaysResponseGetPlanIdArgType) *GatewaysResponse { + this := GatewaysResponse{} + setGatewaysResponseGetAvailabilityZonesAttributeType(&this.AvailabilityZones, availabilityZones) + setGatewaysResponseGetNameAttributeType(&this.Name, name) + setGatewaysResponseGetPlanIdAttributeType(&this.PlanId, planId) + return &this +} + +// NewGatewaysResponseWithDefaults instantiates a new GatewaysResponse 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 NewGatewaysResponseWithDefaults() *GatewaysResponse { + this := GatewaysResponse{} + return &this +} + +// GetState returns the State field value +func (o *GatewaysResponse) GetState() (ret GatewaysResponseGetStateRetType) { + ret, _ = o.GetStateOk() + return ret +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *GatewaysResponse) GetStateOk() (ret GatewaysResponseGetStateRetType, ok bool) { + return getGatewaysResponseGetStateAttributeTypeOk(o.State) +} + +// SetState sets field value +func (o *GatewaysResponse) SetState(v GatewaysResponseGetStateRetType) { + setGatewaysResponseGetStateAttributeType(&o.State, v) +} + +// GetAvailabilityZones returns the AvailabilityZones field value +func (o *GatewaysResponse) GetAvailabilityZones() (ret GatewaysResponseGetAvailabilityZonesRetType) { + ret, _ = o.GetAvailabilityZonesOk() + return ret +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +func (o *GatewaysResponse) GetAvailabilityZonesOk() (ret GatewaysResponseGetAvailabilityZonesRetType, ok bool) { + return getGatewaysResponseGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones) +} + +// SetAvailabilityZones sets field value +func (o *GatewaysResponse) SetAvailabilityZones(v GatewaysResponseGetAvailabilityZonesRetType) { + setGatewaysResponseGetAvailabilityZonesAttributeType(&o.AvailabilityZones, v) +} + +// GetBgpEnabled returns the BgpEnabled field value if set, zero value otherwise. +func (o *GatewaysResponse) GetBgpEnabled() (res GatewaysResponsegetBgpEnabledRetType) { + res, _ = o.GetBgpEnabledOk() + return +} + +// GetBgpEnabledOk returns a tuple with the BgpEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewaysResponse) GetBgpEnabledOk() (ret GatewaysResponsegetBgpEnabledRetType, ok bool) { + return getGatewaysResponsegetBgpEnabledAttributeTypeOk(o.BgpEnabled) +} + +// HasBgpEnabled returns a boolean if a field has been set. +func (o *GatewaysResponse) HasBgpEnabled() bool { + _, ok := o.GetBgpEnabledOk() + return ok +} + +// SetBgpEnabled gets a reference to the given bool and assigns it to the BgpEnabled field. +func (o *GatewaysResponse) SetBgpEnabled(v GatewaysResponsegetBgpEnabledRetType) { + setGatewaysResponsegetBgpEnabledAttributeType(&o.BgpEnabled, v) +} + +// GetBgpGatewayConfig returns the BgpGatewayConfig field value if set, zero value otherwise. +func (o *GatewaysResponse) GetBgpGatewayConfig() (res GatewaysResponseGetBgpGatewayConfigRetType) { + res, _ = o.GetBgpGatewayConfigOk() + return +} + +// GetBgpGatewayConfigOk returns a tuple with the BgpGatewayConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewaysResponse) GetBgpGatewayConfigOk() (ret GatewaysResponseGetBgpGatewayConfigRetType, ok bool) { + return getGatewaysResponseGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig) +} + +// HasBgpGatewayConfig returns a boolean if a field has been set. +func (o *GatewaysResponse) HasBgpGatewayConfig() bool { + _, ok := o.GetBgpGatewayConfigOk() + return ok +} + +// SetBgpGatewayConfig gets a reference to the given BGPGatewayConfig and assigns it to the BgpGatewayConfig field. +func (o *GatewaysResponse) SetBgpGatewayConfig(v GatewaysResponseGetBgpGatewayConfigRetType) { + setGatewaysResponseGetBgpGatewayConfigAttributeType(&o.BgpGatewayConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *GatewaysResponse) GetLabels() (res GatewaysResponseGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewaysResponse) GetLabelsOk() (ret GatewaysResponseGetLabelsRetType, ok bool) { + return getGatewaysResponseGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *GatewaysResponse) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *GatewaysResponse) SetLabels(v GatewaysResponseGetLabelsRetType) { + setGatewaysResponseGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *GatewaysResponse) GetName() (ret GatewaysResponseGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GatewaysResponse) GetNameOk() (ret GatewaysResponseGetNameRetType, ok bool) { + return getGatewaysResponseGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *GatewaysResponse) SetName(v GatewaysResponseGetNameRetType) { + setGatewaysResponseGetNameAttributeType(&o.Name, v) +} + +// GetPlanId returns the PlanId field value +func (o *GatewaysResponse) GetPlanId() (ret GatewaysResponseGetPlanIdRetType) { + ret, _ = o.GetPlanIdOk() + return ret +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *GatewaysResponse) GetPlanIdOk() (ret GatewaysResponseGetPlanIdRetType, ok bool) { + return getGatewaysResponseGetPlanIdAttributeTypeOk(o.PlanId) +} + +// SetPlanId sets field value +func (o *GatewaysResponse) SetPlanId(v GatewaysResponseGetPlanIdRetType) { + setGatewaysResponseGetPlanIdAttributeType(&o.PlanId, v) +} + +func (o GatewaysResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGatewaysResponseGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + if val, ok := getGatewaysResponseGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones); ok { + toSerialize["AvailabilityZones"] = val + } + if val, ok := getGatewaysResponsegetBgpEnabledAttributeTypeOk(o.BgpEnabled); ok { + toSerialize["BgpEnabled"] = val + } + if val, ok := getGatewaysResponseGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig); ok { + toSerialize["BgpGatewayConfig"] = val + } + if val, ok := getGatewaysResponseGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getGatewaysResponseGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getGatewaysResponseGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + return toSerialize, nil +} + +type NullableGatewaysResponse struct { + value *GatewaysResponse + isSet bool +} + +func (v NullableGatewaysResponse) Get() *GatewaysResponse { + return v.value +} + +func (v *NullableGatewaysResponse) Set(val *GatewaysResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGatewaysResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewaysResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewaysResponse(val *GatewaysResponse) *NullableGatewaysResponse { + return &NullableGatewaysResponse{value: val, isSet: true} +} + +func (v NullableGatewaysResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewaysResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_gateways_response_test.go b/pkg/vpnalpha/model_gateways_response_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_gateways_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_phase.go b/pkg/vpnalpha/model_phase.go new file mode 100644 index 00000000..ed7de217 --- /dev/null +++ b/pkg/vpnalpha/model_phase.go @@ -0,0 +1,216 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the Phase type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Phase{} + +/* + types and functions for dhGroups +*/ + +// isArray +type PhaseGetDhGroupsAttributeType = *[]string +type PhaseGetDhGroupsArgType = []string +type PhaseGetDhGroupsRetType = []string + +func getPhaseGetDhGroupsAttributeTypeOk(arg PhaseGetDhGroupsAttributeType) (ret PhaseGetDhGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhaseGetDhGroupsAttributeType(arg *PhaseGetDhGroupsAttributeType, val PhaseGetDhGroupsRetType) { + *arg = &val +} + +/* + types and functions for encryptionAlgorithms +*/ + +// isArray +type PhaseGetEncryptionAlgorithmsAttributeType = *[]string +type PhaseGetEncryptionAlgorithmsArgType = []string +type PhaseGetEncryptionAlgorithmsRetType = []string + +func getPhaseGetEncryptionAlgorithmsAttributeTypeOk(arg PhaseGetEncryptionAlgorithmsAttributeType) (ret PhaseGetEncryptionAlgorithmsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhaseGetEncryptionAlgorithmsAttributeType(arg *PhaseGetEncryptionAlgorithmsAttributeType, val PhaseGetEncryptionAlgorithmsRetType) { + *arg = &val +} + +/* + types and functions for integrityAlgorithms +*/ + +// isArray +type PhaseGetIntegrityAlgorithmsAttributeType = *[]string +type PhaseGetIntegrityAlgorithmsArgType = []string +type PhaseGetIntegrityAlgorithmsRetType = []string + +func getPhaseGetIntegrityAlgorithmsAttributeTypeOk(arg PhaseGetIntegrityAlgorithmsAttributeType) (ret PhaseGetIntegrityAlgorithmsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhaseGetIntegrityAlgorithmsAttributeType(arg *PhaseGetIntegrityAlgorithmsAttributeType, val PhaseGetIntegrityAlgorithmsRetType) { + *arg = &val +} + +// Phase struct for Phase +type Phase struct { + // The Diffie-Hellman Group. Required, except if AEAD algorithms are selected. + DhGroups PhaseGetDhGroupsAttributeType `json:"dhGroups,omitempty"` + // REQUIRED + EncryptionAlgorithms PhaseGetEncryptionAlgorithmsAttributeType `json:"encryptionAlgorithms" required:"true"` + // REQUIRED + IntegrityAlgorithms PhaseGetIntegrityAlgorithmsAttributeType `json:"integrityAlgorithms" required:"true"` +} + +type _Phase Phase + +// NewPhase instantiates a new Phase 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 NewPhase(encryptionAlgorithms PhaseGetEncryptionAlgorithmsArgType, integrityAlgorithms PhaseGetIntegrityAlgorithmsArgType) *Phase { + this := Phase{} + setPhaseGetEncryptionAlgorithmsAttributeType(&this.EncryptionAlgorithms, encryptionAlgorithms) + setPhaseGetIntegrityAlgorithmsAttributeType(&this.IntegrityAlgorithms, integrityAlgorithms) + return &this +} + +// NewPhaseWithDefaults instantiates a new Phase 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 NewPhaseWithDefaults() *Phase { + this := Phase{} + return &this +} + +// GetDhGroups returns the DhGroups field value if set, zero value otherwise. +func (o *Phase) GetDhGroups() (res PhaseGetDhGroupsRetType) { + res, _ = o.GetDhGroupsOk() + return +} + +// GetDhGroupsOk returns a tuple with the DhGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase) GetDhGroupsOk() (ret PhaseGetDhGroupsRetType, ok bool) { + return getPhaseGetDhGroupsAttributeTypeOk(o.DhGroups) +} + +// HasDhGroups returns a boolean if a field has been set. +func (o *Phase) HasDhGroups() bool { + _, ok := o.GetDhGroupsOk() + return ok +} + +// SetDhGroups gets a reference to the given []string and assigns it to the DhGroups field. +func (o *Phase) SetDhGroups(v PhaseGetDhGroupsRetType) { + setPhaseGetDhGroupsAttributeType(&o.DhGroups, v) +} + +// GetEncryptionAlgorithms returns the EncryptionAlgorithms field value +func (o *Phase) GetEncryptionAlgorithms() (ret PhaseGetEncryptionAlgorithmsRetType) { + ret, _ = o.GetEncryptionAlgorithmsOk() + return ret +} + +// GetEncryptionAlgorithmsOk returns a tuple with the EncryptionAlgorithms field value +// and a boolean to check if the value has been set. +func (o *Phase) GetEncryptionAlgorithmsOk() (ret PhaseGetEncryptionAlgorithmsRetType, ok bool) { + return getPhaseGetEncryptionAlgorithmsAttributeTypeOk(o.EncryptionAlgorithms) +} + +// SetEncryptionAlgorithms sets field value +func (o *Phase) SetEncryptionAlgorithms(v PhaseGetEncryptionAlgorithmsRetType) { + setPhaseGetEncryptionAlgorithmsAttributeType(&o.EncryptionAlgorithms, v) +} + +// GetIntegrityAlgorithms returns the IntegrityAlgorithms field value +func (o *Phase) GetIntegrityAlgorithms() (ret PhaseGetIntegrityAlgorithmsRetType) { + ret, _ = o.GetIntegrityAlgorithmsOk() + return ret +} + +// GetIntegrityAlgorithmsOk returns a tuple with the IntegrityAlgorithms field value +// and a boolean to check if the value has been set. +func (o *Phase) GetIntegrityAlgorithmsOk() (ret PhaseGetIntegrityAlgorithmsRetType, ok bool) { + return getPhaseGetIntegrityAlgorithmsAttributeTypeOk(o.IntegrityAlgorithms) +} + +// SetIntegrityAlgorithms sets field value +func (o *Phase) SetIntegrityAlgorithms(v PhaseGetIntegrityAlgorithmsRetType) { + setPhaseGetIntegrityAlgorithmsAttributeType(&o.IntegrityAlgorithms, v) +} + +func (o Phase) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPhaseGetDhGroupsAttributeTypeOk(o.DhGroups); ok { + toSerialize["DhGroups"] = val + } + if val, ok := getPhaseGetEncryptionAlgorithmsAttributeTypeOk(o.EncryptionAlgorithms); ok { + toSerialize["EncryptionAlgorithms"] = val + } + if val, ok := getPhaseGetIntegrityAlgorithmsAttributeTypeOk(o.IntegrityAlgorithms); ok { + toSerialize["IntegrityAlgorithms"] = val + } + return toSerialize, nil +} + +type NullablePhase struct { + value *Phase + isSet bool +} + +func (v NullablePhase) Get() *Phase { + return v.value +} + +func (v *NullablePhase) Set(val *Phase) { + v.value = val + v.isSet = true +} + +func (v NullablePhase) IsSet() bool { + return v.isSet +} + +func (v *NullablePhase) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePhase(val *Phase) *NullablePhase { + return &NullablePhase{value: val, isSet: true} +} + +func (v NullablePhase) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePhase) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_phase1_status.go b/pkg/vpnalpha/model_phase1_status.go new file mode 100644 index 00000000..b0ebb34b --- /dev/null +++ b/pkg/vpnalpha/model_phase1_status.go @@ -0,0 +1,275 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the Phase1Status type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Phase1Status{} + +/* + types and functions for dhGroup +*/ + +// isNotNullableString +type Phase1StatusGetDhGroupAttributeType = *string + +func getPhase1StatusGetDhGroupAttributeTypeOk(arg Phase1StatusGetDhGroupAttributeType) (ret Phase1StatusGetDhGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase1StatusGetDhGroupAttributeType(arg *Phase1StatusGetDhGroupAttributeType, val Phase1StatusGetDhGroupRetType) { + *arg = &val +} + +type Phase1StatusGetDhGroupArgType = string +type Phase1StatusGetDhGroupRetType = string + +/* + types and functions for encryptionAlgorithm +*/ + +// isNotNullableString +type Phase1StatusGetEncryptionAlgorithmAttributeType = *string + +func getPhase1StatusGetEncryptionAlgorithmAttributeTypeOk(arg Phase1StatusGetEncryptionAlgorithmAttributeType) (ret Phase1StatusGetEncryptionAlgorithmRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase1StatusGetEncryptionAlgorithmAttributeType(arg *Phase1StatusGetEncryptionAlgorithmAttributeType, val Phase1StatusGetEncryptionAlgorithmRetType) { + *arg = &val +} + +type Phase1StatusGetEncryptionAlgorithmArgType = string +type Phase1StatusGetEncryptionAlgorithmRetType = string + +/* + types and functions for integrityAlgorithm +*/ + +// isNotNullableString +type Phase1StatusGetIntegrityAlgorithmAttributeType = *string + +func getPhase1StatusGetIntegrityAlgorithmAttributeTypeOk(arg Phase1StatusGetIntegrityAlgorithmAttributeType) (ret Phase1StatusGetIntegrityAlgorithmRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase1StatusGetIntegrityAlgorithmAttributeType(arg *Phase1StatusGetIntegrityAlgorithmAttributeType, val Phase1StatusGetIntegrityAlgorithmRetType) { + *arg = &val +} + +type Phase1StatusGetIntegrityAlgorithmArgType = string +type Phase1StatusGetIntegrityAlgorithmRetType = string + +/* + types and functions for state +*/ + +// isNotNullableString +type Phase1StatusGetStateAttributeType = *string + +func getPhase1StatusGetStateAttributeTypeOk(arg Phase1StatusGetStateAttributeType) (ret Phase1StatusGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase1StatusGetStateAttributeType(arg *Phase1StatusGetStateAttributeType, val Phase1StatusGetStateRetType) { + *arg = &val +} + +type Phase1StatusGetStateArgType = string +type Phase1StatusGetStateRetType = string + +// Phase1Status struct for Phase1Status +type Phase1Status struct { + // Negotiated Diffie-Hellman Group + DhGroup Phase1StatusGetDhGroupAttributeType `json:"dhGroup,omitempty"` + // Negotiated encryption algorithm. + EncryptionAlgorithm Phase1StatusGetEncryptionAlgorithmAttributeType `json:"encryptionAlgorithm,omitempty"` + // Negotiated integrity algorithm or pseudo-random-function. + IntegrityAlgorithm Phase1StatusGetIntegrityAlgorithmAttributeType `json:"integrityAlgorithm,omitempty"` + State Phase1StatusGetStateAttributeType `json:"state,omitempty"` +} + +// NewPhase1Status instantiates a new Phase1Status 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 NewPhase1Status() *Phase1Status { + this := Phase1Status{} + return &this +} + +// NewPhase1StatusWithDefaults instantiates a new Phase1Status 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 NewPhase1StatusWithDefaults() *Phase1Status { + this := Phase1Status{} + return &this +} + +// GetDhGroup returns the DhGroup field value if set, zero value otherwise. +func (o *Phase1Status) GetDhGroup() (res Phase1StatusGetDhGroupRetType) { + res, _ = o.GetDhGroupOk() + return +} + +// GetDhGroupOk returns a tuple with the DhGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase1Status) GetDhGroupOk() (ret Phase1StatusGetDhGroupRetType, ok bool) { + return getPhase1StatusGetDhGroupAttributeTypeOk(o.DhGroup) +} + +// HasDhGroup returns a boolean if a field has been set. +func (o *Phase1Status) HasDhGroup() bool { + _, ok := o.GetDhGroupOk() + return ok +} + +// SetDhGroup gets a reference to the given string and assigns it to the DhGroup field. +func (o *Phase1Status) SetDhGroup(v Phase1StatusGetDhGroupRetType) { + setPhase1StatusGetDhGroupAttributeType(&o.DhGroup, v) +} + +// GetEncryptionAlgorithm returns the EncryptionAlgorithm field value if set, zero value otherwise. +func (o *Phase1Status) GetEncryptionAlgorithm() (res Phase1StatusGetEncryptionAlgorithmRetType) { + res, _ = o.GetEncryptionAlgorithmOk() + return +} + +// GetEncryptionAlgorithmOk returns a tuple with the EncryptionAlgorithm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase1Status) GetEncryptionAlgorithmOk() (ret Phase1StatusGetEncryptionAlgorithmRetType, ok bool) { + return getPhase1StatusGetEncryptionAlgorithmAttributeTypeOk(o.EncryptionAlgorithm) +} + +// HasEncryptionAlgorithm returns a boolean if a field has been set. +func (o *Phase1Status) HasEncryptionAlgorithm() bool { + _, ok := o.GetEncryptionAlgorithmOk() + return ok +} + +// SetEncryptionAlgorithm gets a reference to the given string and assigns it to the EncryptionAlgorithm field. +func (o *Phase1Status) SetEncryptionAlgorithm(v Phase1StatusGetEncryptionAlgorithmRetType) { + setPhase1StatusGetEncryptionAlgorithmAttributeType(&o.EncryptionAlgorithm, v) +} + +// GetIntegrityAlgorithm returns the IntegrityAlgorithm field value if set, zero value otherwise. +func (o *Phase1Status) GetIntegrityAlgorithm() (res Phase1StatusGetIntegrityAlgorithmRetType) { + res, _ = o.GetIntegrityAlgorithmOk() + return +} + +// GetIntegrityAlgorithmOk returns a tuple with the IntegrityAlgorithm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase1Status) GetIntegrityAlgorithmOk() (ret Phase1StatusGetIntegrityAlgorithmRetType, ok bool) { + return getPhase1StatusGetIntegrityAlgorithmAttributeTypeOk(o.IntegrityAlgorithm) +} + +// HasIntegrityAlgorithm returns a boolean if a field has been set. +func (o *Phase1Status) HasIntegrityAlgorithm() bool { + _, ok := o.GetIntegrityAlgorithmOk() + return ok +} + +// SetIntegrityAlgorithm gets a reference to the given string and assigns it to the IntegrityAlgorithm field. +func (o *Phase1Status) SetIntegrityAlgorithm(v Phase1StatusGetIntegrityAlgorithmRetType) { + setPhase1StatusGetIntegrityAlgorithmAttributeType(&o.IntegrityAlgorithm, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Phase1Status) GetState() (res Phase1StatusGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase1Status) GetStateOk() (ret Phase1StatusGetStateRetType, ok bool) { + return getPhase1StatusGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *Phase1Status) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *Phase1Status) SetState(v Phase1StatusGetStateRetType) { + setPhase1StatusGetStateAttributeType(&o.State, v) +} + +func (o Phase1Status) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPhase1StatusGetDhGroupAttributeTypeOk(o.DhGroup); ok { + toSerialize["DhGroup"] = val + } + if val, ok := getPhase1StatusGetEncryptionAlgorithmAttributeTypeOk(o.EncryptionAlgorithm); ok { + toSerialize["EncryptionAlgorithm"] = val + } + if val, ok := getPhase1StatusGetIntegrityAlgorithmAttributeTypeOk(o.IntegrityAlgorithm); ok { + toSerialize["IntegrityAlgorithm"] = val + } + if val, ok := getPhase1StatusGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullablePhase1Status struct { + value *Phase1Status + isSet bool +} + +func (v NullablePhase1Status) Get() *Phase1Status { + return v.value +} + +func (v *NullablePhase1Status) Set(val *Phase1Status) { + v.value = val + v.isSet = true +} + +func (v NullablePhase1Status) IsSet() bool { + return v.isSet +} + +func (v *NullablePhase1Status) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePhase1Status(val *Phase1Status) *NullablePhase1Status { + return &NullablePhase1Status{value: val, isSet: true} +} + +func (v NullablePhase1Status) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePhase1Status) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_phase1_status_test.go b/pkg/vpnalpha/model_phase1_status_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_phase1_status_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_phase2_status.go b/pkg/vpnalpha/model_phase2_status.go new file mode 100644 index 00000000..0a3c338a --- /dev/null +++ b/pkg/vpnalpha/model_phase2_status.go @@ -0,0 +1,567 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the Phase2Status type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Phase2Status{} + +/* + types and functions for bytesIn +*/ + +// isNotNullableString +type Phase2StatusGetBytesInAttributeType = *string + +func getPhase2StatusGetBytesInAttributeTypeOk(arg Phase2StatusGetBytesInAttributeType) (ret Phase2StatusGetBytesInRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase2StatusGetBytesInAttributeType(arg *Phase2StatusGetBytesInAttributeType, val Phase2StatusGetBytesInRetType) { + *arg = &val +} + +type Phase2StatusGetBytesInArgType = string +type Phase2StatusGetBytesInRetType = string + +/* + types and functions for bytesOut +*/ + +// isNotNullableString +type Phase2StatusGetBytesOutAttributeType = *string + +func getPhase2StatusGetBytesOutAttributeTypeOk(arg Phase2StatusGetBytesOutAttributeType) (ret Phase2StatusGetBytesOutRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase2StatusGetBytesOutAttributeType(arg *Phase2StatusGetBytesOutAttributeType, val Phase2StatusGetBytesOutRetType) { + *arg = &val +} + +type Phase2StatusGetBytesOutArgType = string +type Phase2StatusGetBytesOutRetType = string + +/* + types and functions for dhGroup +*/ + +// isNotNullableString +type Phase2StatusGetDhGroupAttributeType = *string + +func getPhase2StatusGetDhGroupAttributeTypeOk(arg Phase2StatusGetDhGroupAttributeType) (ret Phase2StatusGetDhGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase2StatusGetDhGroupAttributeType(arg *Phase2StatusGetDhGroupAttributeType, val Phase2StatusGetDhGroupRetType) { + *arg = &val +} + +type Phase2StatusGetDhGroupArgType = string +type Phase2StatusGetDhGroupRetType = string + +/* + types and functions for encap +*/ + +// isNotNullableString +type Phase2StatusGetEncapAttributeType = *string + +func getPhase2StatusGetEncapAttributeTypeOk(arg Phase2StatusGetEncapAttributeType) (ret Phase2StatusGetEncapRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase2StatusGetEncapAttributeType(arg *Phase2StatusGetEncapAttributeType, val Phase2StatusGetEncapRetType) { + *arg = &val +} + +type Phase2StatusGetEncapArgType = string +type Phase2StatusGetEncapRetType = string + +/* + types and functions for encryptionAlgorithm +*/ + +// isNotNullableString +type Phase2StatusGetEncryptionAlgorithmAttributeType = *string + +func getPhase2StatusGetEncryptionAlgorithmAttributeTypeOk(arg Phase2StatusGetEncryptionAlgorithmAttributeType) (ret Phase2StatusGetEncryptionAlgorithmRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase2StatusGetEncryptionAlgorithmAttributeType(arg *Phase2StatusGetEncryptionAlgorithmAttributeType, val Phase2StatusGetEncryptionAlgorithmRetType) { + *arg = &val +} + +type Phase2StatusGetEncryptionAlgorithmArgType = string +type Phase2StatusGetEncryptionAlgorithmRetType = string + +/* + types and functions for integrityAlgorithm +*/ + +// isNotNullableString +type Phase2StatusGetIntegrityAlgorithmAttributeType = *string + +func getPhase2StatusGetIntegrityAlgorithmAttributeTypeOk(arg Phase2StatusGetIntegrityAlgorithmAttributeType) (ret Phase2StatusGetIntegrityAlgorithmRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase2StatusGetIntegrityAlgorithmAttributeType(arg *Phase2StatusGetIntegrityAlgorithmAttributeType, val Phase2StatusGetIntegrityAlgorithmRetType) { + *arg = &val +} + +type Phase2StatusGetIntegrityAlgorithmArgType = string +type Phase2StatusGetIntegrityAlgorithmRetType = string + +/* + types and functions for packetsIn +*/ + +// isNotNullableString +type Phase2StatusGetPacketsInAttributeType = *string + +func getPhase2StatusGetPacketsInAttributeTypeOk(arg Phase2StatusGetPacketsInAttributeType) (ret Phase2StatusGetPacketsInRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase2StatusGetPacketsInAttributeType(arg *Phase2StatusGetPacketsInAttributeType, val Phase2StatusGetPacketsInRetType) { + *arg = &val +} + +type Phase2StatusGetPacketsInArgType = string +type Phase2StatusGetPacketsInRetType = string + +/* + types and functions for packetsOut +*/ + +// isNotNullableString +type Phase2StatusGetPacketsOutAttributeType = *string + +func getPhase2StatusGetPacketsOutAttributeTypeOk(arg Phase2StatusGetPacketsOutAttributeType) (ret Phase2StatusGetPacketsOutRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase2StatusGetPacketsOutAttributeType(arg *Phase2StatusGetPacketsOutAttributeType, val Phase2StatusGetPacketsOutRetType) { + *arg = &val +} + +type Phase2StatusGetPacketsOutArgType = string +type Phase2StatusGetPacketsOutRetType = string + +/* + types and functions for protocol +*/ + +// isNotNullableString +type Phase2StatusGetProtocolAttributeType = *string + +func getPhase2StatusGetProtocolAttributeTypeOk(arg Phase2StatusGetProtocolAttributeType) (ret Phase2StatusGetProtocolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase2StatusGetProtocolAttributeType(arg *Phase2StatusGetProtocolAttributeType, val Phase2StatusGetProtocolRetType) { + *arg = &val +} + +type Phase2StatusGetProtocolArgType = string +type Phase2StatusGetProtocolRetType = string + +/* + types and functions for state +*/ + +// isNotNullableString +type Phase2StatusGetStateAttributeType = *string + +func getPhase2StatusGetStateAttributeTypeOk(arg Phase2StatusGetStateAttributeType) (ret Phase2StatusGetStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPhase2StatusGetStateAttributeType(arg *Phase2StatusGetStateAttributeType, val Phase2StatusGetStateRetType) { + *arg = &val +} + +type Phase2StatusGetStateArgType = string +type Phase2StatusGetStateRetType = string + +// Phase2Status struct for Phase2Status +type Phase2Status struct { + // Bytes received. + BytesIn Phase2StatusGetBytesInAttributeType `json:"bytesIn,omitempty"` + // Bytes sent. + BytesOut Phase2StatusGetBytesOutAttributeType `json:"bytesOut,omitempty"` + // Negotiated Diffie-Hellman Group + DhGroup Phase2StatusGetDhGroupAttributeType `json:"dhGroup,omitempty"` + Encap Phase2StatusGetEncapAttributeType `json:"encap,omitempty"` + // Negotiated encryption algorithm. + EncryptionAlgorithm Phase2StatusGetEncryptionAlgorithmAttributeType `json:"encryptionAlgorithm,omitempty"` + // Negotiated integrity algorithm or pseudo-random-function. + IntegrityAlgorithm Phase2StatusGetIntegrityAlgorithmAttributeType `json:"integrityAlgorithm,omitempty"` + // Packets received. + PacketsIn Phase2StatusGetPacketsInAttributeType `json:"packetsIn,omitempty"` + // Packets sent. + PacketsOut Phase2StatusGetPacketsOutAttributeType `json:"packetsOut,omitempty"` + Protocol Phase2StatusGetProtocolAttributeType `json:"protocol,omitempty"` + State Phase2StatusGetStateAttributeType `json:"state,omitempty"` +} + +// NewPhase2Status instantiates a new Phase2Status 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 NewPhase2Status() *Phase2Status { + this := Phase2Status{} + return &this +} + +// NewPhase2StatusWithDefaults instantiates a new Phase2Status 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 NewPhase2StatusWithDefaults() *Phase2Status { + this := Phase2Status{} + return &this +} + +// GetBytesIn returns the BytesIn field value if set, zero value otherwise. +func (o *Phase2Status) GetBytesIn() (res Phase2StatusGetBytesInRetType) { + res, _ = o.GetBytesInOk() + return +} + +// GetBytesInOk returns a tuple with the BytesIn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetBytesInOk() (ret Phase2StatusGetBytesInRetType, ok bool) { + return getPhase2StatusGetBytesInAttributeTypeOk(o.BytesIn) +} + +// HasBytesIn returns a boolean if a field has been set. +func (o *Phase2Status) HasBytesIn() bool { + _, ok := o.GetBytesInOk() + return ok +} + +// SetBytesIn gets a reference to the given string and assigns it to the BytesIn field. +func (o *Phase2Status) SetBytesIn(v Phase2StatusGetBytesInRetType) { + setPhase2StatusGetBytesInAttributeType(&o.BytesIn, v) +} + +// GetBytesOut returns the BytesOut field value if set, zero value otherwise. +func (o *Phase2Status) GetBytesOut() (res Phase2StatusGetBytesOutRetType) { + res, _ = o.GetBytesOutOk() + return +} + +// GetBytesOutOk returns a tuple with the BytesOut field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetBytesOutOk() (ret Phase2StatusGetBytesOutRetType, ok bool) { + return getPhase2StatusGetBytesOutAttributeTypeOk(o.BytesOut) +} + +// HasBytesOut returns a boolean if a field has been set. +func (o *Phase2Status) HasBytesOut() bool { + _, ok := o.GetBytesOutOk() + return ok +} + +// SetBytesOut gets a reference to the given string and assigns it to the BytesOut field. +func (o *Phase2Status) SetBytesOut(v Phase2StatusGetBytesOutRetType) { + setPhase2StatusGetBytesOutAttributeType(&o.BytesOut, v) +} + +// GetDhGroup returns the DhGroup field value if set, zero value otherwise. +func (o *Phase2Status) GetDhGroup() (res Phase2StatusGetDhGroupRetType) { + res, _ = o.GetDhGroupOk() + return +} + +// GetDhGroupOk returns a tuple with the DhGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetDhGroupOk() (ret Phase2StatusGetDhGroupRetType, ok bool) { + return getPhase2StatusGetDhGroupAttributeTypeOk(o.DhGroup) +} + +// HasDhGroup returns a boolean if a field has been set. +func (o *Phase2Status) HasDhGroup() bool { + _, ok := o.GetDhGroupOk() + return ok +} + +// SetDhGroup gets a reference to the given string and assigns it to the DhGroup field. +func (o *Phase2Status) SetDhGroup(v Phase2StatusGetDhGroupRetType) { + setPhase2StatusGetDhGroupAttributeType(&o.DhGroup, v) +} + +// GetEncap returns the Encap field value if set, zero value otherwise. +func (o *Phase2Status) GetEncap() (res Phase2StatusGetEncapRetType) { + res, _ = o.GetEncapOk() + return +} + +// GetEncapOk returns a tuple with the Encap field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetEncapOk() (ret Phase2StatusGetEncapRetType, ok bool) { + return getPhase2StatusGetEncapAttributeTypeOk(o.Encap) +} + +// HasEncap returns a boolean if a field has been set. +func (o *Phase2Status) HasEncap() bool { + _, ok := o.GetEncapOk() + return ok +} + +// SetEncap gets a reference to the given string and assigns it to the Encap field. +func (o *Phase2Status) SetEncap(v Phase2StatusGetEncapRetType) { + setPhase2StatusGetEncapAttributeType(&o.Encap, v) +} + +// GetEncryptionAlgorithm returns the EncryptionAlgorithm field value if set, zero value otherwise. +func (o *Phase2Status) GetEncryptionAlgorithm() (res Phase2StatusGetEncryptionAlgorithmRetType) { + res, _ = o.GetEncryptionAlgorithmOk() + return +} + +// GetEncryptionAlgorithmOk returns a tuple with the EncryptionAlgorithm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetEncryptionAlgorithmOk() (ret Phase2StatusGetEncryptionAlgorithmRetType, ok bool) { + return getPhase2StatusGetEncryptionAlgorithmAttributeTypeOk(o.EncryptionAlgorithm) +} + +// HasEncryptionAlgorithm returns a boolean if a field has been set. +func (o *Phase2Status) HasEncryptionAlgorithm() bool { + _, ok := o.GetEncryptionAlgorithmOk() + return ok +} + +// SetEncryptionAlgorithm gets a reference to the given string and assigns it to the EncryptionAlgorithm field. +func (o *Phase2Status) SetEncryptionAlgorithm(v Phase2StatusGetEncryptionAlgorithmRetType) { + setPhase2StatusGetEncryptionAlgorithmAttributeType(&o.EncryptionAlgorithm, v) +} + +// GetIntegrityAlgorithm returns the IntegrityAlgorithm field value if set, zero value otherwise. +func (o *Phase2Status) GetIntegrityAlgorithm() (res Phase2StatusGetIntegrityAlgorithmRetType) { + res, _ = o.GetIntegrityAlgorithmOk() + return +} + +// GetIntegrityAlgorithmOk returns a tuple with the IntegrityAlgorithm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetIntegrityAlgorithmOk() (ret Phase2StatusGetIntegrityAlgorithmRetType, ok bool) { + return getPhase2StatusGetIntegrityAlgorithmAttributeTypeOk(o.IntegrityAlgorithm) +} + +// HasIntegrityAlgorithm returns a boolean if a field has been set. +func (o *Phase2Status) HasIntegrityAlgorithm() bool { + _, ok := o.GetIntegrityAlgorithmOk() + return ok +} + +// SetIntegrityAlgorithm gets a reference to the given string and assigns it to the IntegrityAlgorithm field. +func (o *Phase2Status) SetIntegrityAlgorithm(v Phase2StatusGetIntegrityAlgorithmRetType) { + setPhase2StatusGetIntegrityAlgorithmAttributeType(&o.IntegrityAlgorithm, v) +} + +// GetPacketsIn returns the PacketsIn field value if set, zero value otherwise. +func (o *Phase2Status) GetPacketsIn() (res Phase2StatusGetPacketsInRetType) { + res, _ = o.GetPacketsInOk() + return +} + +// GetPacketsInOk returns a tuple with the PacketsIn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetPacketsInOk() (ret Phase2StatusGetPacketsInRetType, ok bool) { + return getPhase2StatusGetPacketsInAttributeTypeOk(o.PacketsIn) +} + +// HasPacketsIn returns a boolean if a field has been set. +func (o *Phase2Status) HasPacketsIn() bool { + _, ok := o.GetPacketsInOk() + return ok +} + +// SetPacketsIn gets a reference to the given string and assigns it to the PacketsIn field. +func (o *Phase2Status) SetPacketsIn(v Phase2StatusGetPacketsInRetType) { + setPhase2StatusGetPacketsInAttributeType(&o.PacketsIn, v) +} + +// GetPacketsOut returns the PacketsOut field value if set, zero value otherwise. +func (o *Phase2Status) GetPacketsOut() (res Phase2StatusGetPacketsOutRetType) { + res, _ = o.GetPacketsOutOk() + return +} + +// GetPacketsOutOk returns a tuple with the PacketsOut field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetPacketsOutOk() (ret Phase2StatusGetPacketsOutRetType, ok bool) { + return getPhase2StatusGetPacketsOutAttributeTypeOk(o.PacketsOut) +} + +// HasPacketsOut returns a boolean if a field has been set. +func (o *Phase2Status) HasPacketsOut() bool { + _, ok := o.GetPacketsOutOk() + return ok +} + +// SetPacketsOut gets a reference to the given string and assigns it to the PacketsOut field. +func (o *Phase2Status) SetPacketsOut(v Phase2StatusGetPacketsOutRetType) { + setPhase2StatusGetPacketsOutAttributeType(&o.PacketsOut, v) +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *Phase2Status) GetProtocol() (res Phase2StatusGetProtocolRetType) { + res, _ = o.GetProtocolOk() + return +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetProtocolOk() (ret Phase2StatusGetProtocolRetType, ok bool) { + return getPhase2StatusGetProtocolAttributeTypeOk(o.Protocol) +} + +// HasProtocol returns a boolean if a field has been set. +func (o *Phase2Status) HasProtocol() bool { + _, ok := o.GetProtocolOk() + return ok +} + +// SetProtocol gets a reference to the given string and assigns it to the Protocol field. +func (o *Phase2Status) SetProtocol(v Phase2StatusGetProtocolRetType) { + setPhase2StatusGetProtocolAttributeType(&o.Protocol, v) +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Phase2Status) GetState() (res Phase2StatusGetStateRetType) { + res, _ = o.GetStateOk() + return +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Phase2Status) GetStateOk() (ret Phase2StatusGetStateRetType, ok bool) { + return getPhase2StatusGetStateAttributeTypeOk(o.State) +} + +// HasState returns a boolean if a field has been set. +func (o *Phase2Status) HasState() bool { + _, ok := o.GetStateOk() + return ok +} + +// SetState gets a reference to the given string and assigns it to the State field. +func (o *Phase2Status) SetState(v Phase2StatusGetStateRetType) { + setPhase2StatusGetStateAttributeType(&o.State, v) +} + +func (o Phase2Status) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPhase2StatusGetBytesInAttributeTypeOk(o.BytesIn); ok { + toSerialize["BytesIn"] = val + } + if val, ok := getPhase2StatusGetBytesOutAttributeTypeOk(o.BytesOut); ok { + toSerialize["BytesOut"] = val + } + if val, ok := getPhase2StatusGetDhGroupAttributeTypeOk(o.DhGroup); ok { + toSerialize["DhGroup"] = val + } + if val, ok := getPhase2StatusGetEncapAttributeTypeOk(o.Encap); ok { + toSerialize["Encap"] = val + } + if val, ok := getPhase2StatusGetEncryptionAlgorithmAttributeTypeOk(o.EncryptionAlgorithm); ok { + toSerialize["EncryptionAlgorithm"] = val + } + if val, ok := getPhase2StatusGetIntegrityAlgorithmAttributeTypeOk(o.IntegrityAlgorithm); ok { + toSerialize["IntegrityAlgorithm"] = val + } + if val, ok := getPhase2StatusGetPacketsInAttributeTypeOk(o.PacketsIn); ok { + toSerialize["PacketsIn"] = val + } + if val, ok := getPhase2StatusGetPacketsOutAttributeTypeOk(o.PacketsOut); ok { + toSerialize["PacketsOut"] = val + } + if val, ok := getPhase2StatusGetProtocolAttributeTypeOk(o.Protocol); ok { + toSerialize["Protocol"] = val + } + if val, ok := getPhase2StatusGetStateAttributeTypeOk(o.State); ok { + toSerialize["State"] = val + } + return toSerialize, nil +} + +type NullablePhase2Status struct { + value *Phase2Status + isSet bool +} + +func (v NullablePhase2Status) Get() *Phase2Status { + return v.value +} + +func (v *NullablePhase2Status) Set(val *Phase2Status) { + v.value = val + v.isSet = true +} + +func (v NullablePhase2Status) IsSet() bool { + return v.isSet +} + +func (v *NullablePhase2Status) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePhase2Status(val *Phase2Status) *NullablePhase2Status { + return &NullablePhase2Status{value: val, isSet: true} +} + +func (v NullablePhase2Status) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePhase2Status) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_phase2_status_test.go b/pkg/vpnalpha/model_phase2_status_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_phase2_status_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_phase_test.go b/pkg/vpnalpha/model_phase_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_phase_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_plan.go b/pkg/vpnalpha/model_plan.go new file mode 100644 index 00000000..2a93f1cd --- /dev/null +++ b/pkg/vpnalpha/model_plan.go @@ -0,0 +1,527 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" + "fmt" +) + +// checks if the Plan type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Plan{} + +/* + types and functions for maxBandwidth +*/ + +// isInteger +type PlanGetMaxBandwidthAttributeType = *int64 +type PlanGetMaxBandwidthArgType = int64 +type PlanGetMaxBandwidthRetType = int64 + +func getPlanGetMaxBandwidthAttributeTypeOk(arg PlanGetMaxBandwidthAttributeType) (ret PlanGetMaxBandwidthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetMaxBandwidthAttributeType(arg *PlanGetMaxBandwidthAttributeType, val PlanGetMaxBandwidthRetType) { + *arg = &val +} + +/* + types and functions for maxConnections +*/ + +// isInteger +type PlanGetMaxConnectionsAttributeType = *int64 +type PlanGetMaxConnectionsArgType = int64 +type PlanGetMaxConnectionsRetType = int64 + +func getPlanGetMaxConnectionsAttributeTypeOk(arg PlanGetMaxConnectionsAttributeType) (ret PlanGetMaxConnectionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetMaxConnectionsAttributeType(arg *PlanGetMaxConnectionsAttributeType, val PlanGetMaxConnectionsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type PlanGetNameAttributeType = *string + +func getPlanGetNameAttributeTypeOk(arg PlanGetNameAttributeType) (ret PlanGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetNameAttributeType(arg *PlanGetNameAttributeType, val PlanGetNameRetType) { + *arg = &val +} + +type PlanGetNameArgType = string +type PlanGetNameRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type PlanGetPlanIdAttributeType = *string + +func getPlanGetPlanIdAttributeTypeOk(arg PlanGetPlanIdAttributeType) (ret PlanGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetPlanIdAttributeType(arg *PlanGetPlanIdAttributeType, val PlanGetPlanIdRetType) { + *arg = &val +} + +type PlanGetPlanIdArgType = string +type PlanGetPlanIdRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type PlanGetRegionAttributeType = *string + +func getPlanGetRegionAttributeTypeOk(arg PlanGetRegionAttributeType) (ret PlanGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetRegionAttributeType(arg *PlanGetRegionAttributeType, val PlanGetRegionRetType) { + *arg = &val +} + +type PlanGetRegionArgType = string +type PlanGetRegionRetType = string + +/* + types and functions for sku +*/ + +// isNotNullableString +type PlanGetSkuAttributeType = *string + +func getPlanGetSkuAttributeTypeOk(arg PlanGetSkuAttributeType) (ret PlanGetSkuRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetSkuAttributeType(arg *PlanGetSkuAttributeType, val PlanGetSkuRetType) { + *arg = &val +} + +type PlanGetSkuArgType = string +type PlanGetSkuRetType = string + +/* + types and functions for type +*/ + +// isEnum + +// PlanTypes Service plan type +// value type for enums +type PlanTypes string + +// List of Type +const ( + PLANTYPE_HIGH_AVAILABILITY PlanTypes = "high-availability" + PLANTYPE_SINGLE PlanTypes = "single" +) + +// All allowed values of Plan enum +var AllowedPlanTypesEnumValues = []PlanTypes{ + "high-availability", + "single", +} + +func (v *PlanTypes) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson PlanTypes + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := PlanTypes(value) + for _, existing := range AllowedPlanTypesEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Plan", value) +} + +// NewPlanTypesFromValue returns a pointer to a valid PlanTypes +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPlanTypesFromValue(v PlanTypes) (*PlanTypes, error) { + ev := PlanTypes(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PlanTypes: valid values are %v", v, AllowedPlanTypesEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PlanTypes) IsValid() bool { + for _, existing := range AllowedPlanTypesEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TypeTypes value +func (v PlanTypes) Ptr() *PlanTypes { + return &v +} + +type NullablePlanTypes struct { + value *PlanTypes + isSet bool +} + +func (v NullablePlanTypes) Get() *PlanTypes { + return v.value +} + +func (v *NullablePlanTypes) Set(val *PlanTypes) { + v.value = val + v.isSet = true +} + +func (v NullablePlanTypes) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanTypes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanTypes(val *PlanTypes) *NullablePlanTypes { + return &NullablePlanTypes{value: val, isSet: true} +} + +func (v NullablePlanTypes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanTypes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type PlanGetTypeAttributeType = *PlanTypes +type PlanGetTypeArgType = PlanTypes +type PlanGetTypeRetType = PlanTypes + +func getPlanGetTypeAttributeTypeOk(arg PlanGetTypeAttributeType) (ret PlanGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanGetTypeAttributeType(arg *PlanGetTypeAttributeType, val PlanGetTypeRetType) { + *arg = &val +} + +// Plan struct for Plan +type Plan struct { + // Maximum bandwidth of a VPN instance. + // Can be cast to int32 without loss of precision. + MaxBandwidth PlanGetMaxBandwidthAttributeType `json:"maxBandwidth,omitempty"` + // Maximum concurrent connections of a VPN Gateway. + // Can be cast to int32 without loss of precision. + MaxConnections PlanGetMaxConnectionsAttributeType `json:"maxConnections,omitempty"` + // Service plan name + Name PlanGetNameAttributeType `json:"name,omitempty"` + // Service plan identifier + PlanId PlanGetPlanIdAttributeType `json:"planId,omitempty"` + // Region (read-only) + Region PlanGetRegionAttributeType `json:"region,omitempty"` + // Plan SKU + Sku PlanGetSkuAttributeType `json:"sku,omitempty"` + // Service plan type + Type PlanGetTypeAttributeType `json:"type,omitempty"` +} + +// NewPlan instantiates a new Plan object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlan() *Plan { + this := Plan{} + return &this +} + +// NewPlanWithDefaults instantiates a new Plan object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanWithDefaults() *Plan { + this := Plan{} + return &this +} + +// GetMaxBandwidth returns the MaxBandwidth field value if set, zero value otherwise. +func (o *Plan) GetMaxBandwidth() (res PlanGetMaxBandwidthRetType) { + res, _ = o.GetMaxBandwidthOk() + return +} + +// GetMaxBandwidthOk returns a tuple with the MaxBandwidth field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetMaxBandwidthOk() (ret PlanGetMaxBandwidthRetType, ok bool) { + return getPlanGetMaxBandwidthAttributeTypeOk(o.MaxBandwidth) +} + +// HasMaxBandwidth returns a boolean if a field has been set. +func (o *Plan) HasMaxBandwidth() bool { + _, ok := o.GetMaxBandwidthOk() + return ok +} + +// SetMaxBandwidth gets a reference to the given int64 and assigns it to the MaxBandwidth field. +func (o *Plan) SetMaxBandwidth(v PlanGetMaxBandwidthRetType) { + setPlanGetMaxBandwidthAttributeType(&o.MaxBandwidth, v) +} + +// GetMaxConnections returns the MaxConnections field value if set, zero value otherwise. +func (o *Plan) GetMaxConnections() (res PlanGetMaxConnectionsRetType) { + res, _ = o.GetMaxConnectionsOk() + return +} + +// GetMaxConnectionsOk returns a tuple with the MaxConnections field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetMaxConnectionsOk() (ret PlanGetMaxConnectionsRetType, ok bool) { + return getPlanGetMaxConnectionsAttributeTypeOk(o.MaxConnections) +} + +// HasMaxConnections returns a boolean if a field has been set. +func (o *Plan) HasMaxConnections() bool { + _, ok := o.GetMaxConnectionsOk() + return ok +} + +// SetMaxConnections gets a reference to the given int64 and assigns it to the MaxConnections field. +func (o *Plan) SetMaxConnections(v PlanGetMaxConnectionsRetType) { + setPlanGetMaxConnectionsAttributeType(&o.MaxConnections, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Plan) GetName() (res PlanGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetNameOk() (ret PlanGetNameRetType, ok bool) { + return getPlanGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Plan) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Plan) SetName(v PlanGetNameRetType) { + setPlanGetNameAttributeType(&o.Name, v) +} + +// GetPlanId returns the PlanId field value if set, zero value otherwise. +func (o *Plan) GetPlanId() (res PlanGetPlanIdRetType) { + res, _ = o.GetPlanIdOk() + return +} + +// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetPlanIdOk() (ret PlanGetPlanIdRetType, ok bool) { + return getPlanGetPlanIdAttributeTypeOk(o.PlanId) +} + +// HasPlanId returns a boolean if a field has been set. +func (o *Plan) HasPlanId() bool { + _, ok := o.GetPlanIdOk() + return ok +} + +// SetPlanId gets a reference to the given string and assigns it to the PlanId field. +func (o *Plan) SetPlanId(v PlanGetPlanIdRetType) { + setPlanGetPlanIdAttributeType(&o.PlanId, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *Plan) GetRegion() (res PlanGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetRegionOk() (ret PlanGetRegionRetType, ok bool) { + return getPlanGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *Plan) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *Plan) SetRegion(v PlanGetRegionRetType) { + setPlanGetRegionAttributeType(&o.Region, v) +} + +// GetSku returns the Sku field value if set, zero value otherwise. +func (o *Plan) GetSku() (res PlanGetSkuRetType) { + res, _ = o.GetSkuOk() + return +} + +// GetSkuOk returns a tuple with the Sku field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetSkuOk() (ret PlanGetSkuRetType, ok bool) { + return getPlanGetSkuAttributeTypeOk(o.Sku) +} + +// HasSku returns a boolean if a field has been set. +func (o *Plan) HasSku() bool { + _, ok := o.GetSkuOk() + return ok +} + +// SetSku gets a reference to the given string and assigns it to the Sku field. +func (o *Plan) SetSku(v PlanGetSkuRetType) { + setPlanGetSkuAttributeType(&o.Sku, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *Plan) GetType() (res PlanGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Plan) GetTypeOk() (ret PlanGetTypeRetType, ok bool) { + return getPlanGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *Plan) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Plan) SetType(v PlanGetTypeRetType) { + setPlanGetTypeAttributeType(&o.Type, v) +} + +func (o Plan) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPlanGetMaxBandwidthAttributeTypeOk(o.MaxBandwidth); ok { + toSerialize["MaxBandwidth"] = val + } + if val, ok := getPlanGetMaxConnectionsAttributeTypeOk(o.MaxConnections); ok { + toSerialize["MaxConnections"] = val + } + if val, ok := getPlanGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getPlanGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + if val, ok := getPlanGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getPlanGetSkuAttributeTypeOk(o.Sku); ok { + toSerialize["Sku"] = val + } + if val, ok := getPlanGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullablePlan struct { + value *Plan + isSet bool +} + +func (v NullablePlan) Get() *Plan { + return v.value +} + +func (v *NullablePlan) Set(val *Plan) { + v.value = val + v.isSet = true +} + +func (v NullablePlan) IsSet() bool { + return v.isSet +} + +func (v *NullablePlan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlan(val *Plan) *NullablePlan { + return &NullablePlan{value: val, isSet: true} +} + +func (v NullablePlan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_plan_list.go b/pkg/vpnalpha/model_plan_list.go new file mode 100644 index 00000000..bf44f36f --- /dev/null +++ b/pkg/vpnalpha/model_plan_list.go @@ -0,0 +1,223 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the PlanList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PlanList{} + +/* + types and functions for defaultPlanId +*/ + +// isNotNullableString +type PlanListGetDefaultPlanIdAttributeType = *string + +func getPlanListGetDefaultPlanIdAttributeTypeOk(arg PlanListGetDefaultPlanIdAttributeType) (ret PlanListGetDefaultPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanListGetDefaultPlanIdAttributeType(arg *PlanListGetDefaultPlanIdAttributeType, val PlanListGetDefaultPlanIdRetType) { + *arg = &val +} + +type PlanListGetDefaultPlanIdArgType = string +type PlanListGetDefaultPlanIdRetType = string + +/* + types and functions for plans +*/ + +// isArray +type PlanListGetPlansAttributeType = *[]Plan +type PlanListGetPlansArgType = []Plan +type PlanListGetPlansRetType = []Plan + +func getPlanListGetPlansAttributeTypeOk(arg PlanListGetPlansAttributeType) (ret PlanListGetPlansRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanListGetPlansAttributeType(arg *PlanListGetPlansAttributeType, val PlanListGetPlansRetType) { + *arg = &val +} + +/* + types and functions for tunnel +*/ + +// isModel +type PlanListGetTunnelAttributeType = *VPNTunnelPlan +type PlanListGetTunnelArgType = VPNTunnelPlan +type PlanListGetTunnelRetType = VPNTunnelPlan + +func getPlanListGetTunnelAttributeTypeOk(arg PlanListGetTunnelAttributeType) (ret PlanListGetTunnelRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPlanListGetTunnelAttributeType(arg *PlanListGetTunnelAttributeType, val PlanListGetTunnelRetType) { + *arg = &val +} + +// PlanList struct for PlanList +type PlanList struct { + // Default Plan ID for the current region + DefaultPlanId PlanListGetDefaultPlanIdAttributeType `json:"defaultPlanId,omitempty"` + Plans PlanListGetPlansAttributeType `json:"plans,omitempty"` + Tunnel PlanListGetTunnelAttributeType `json:"tunnel,omitempty"` +} + +// NewPlanList instantiates a new PlanList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPlanList() *PlanList { + this := PlanList{} + return &this +} + +// NewPlanListWithDefaults instantiates a new PlanList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPlanListWithDefaults() *PlanList { + this := PlanList{} + return &this +} + +// GetDefaultPlanId returns the DefaultPlanId field value if set, zero value otherwise. +func (o *PlanList) GetDefaultPlanId() (res PlanListGetDefaultPlanIdRetType) { + res, _ = o.GetDefaultPlanIdOk() + return +} + +// GetDefaultPlanIdOk returns a tuple with the DefaultPlanId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanList) GetDefaultPlanIdOk() (ret PlanListGetDefaultPlanIdRetType, ok bool) { + return getPlanListGetDefaultPlanIdAttributeTypeOk(o.DefaultPlanId) +} + +// HasDefaultPlanId returns a boolean if a field has been set. +func (o *PlanList) HasDefaultPlanId() bool { + _, ok := o.GetDefaultPlanIdOk() + return ok +} + +// SetDefaultPlanId gets a reference to the given string and assigns it to the DefaultPlanId field. +func (o *PlanList) SetDefaultPlanId(v PlanListGetDefaultPlanIdRetType) { + setPlanListGetDefaultPlanIdAttributeType(&o.DefaultPlanId, v) +} + +// GetPlans returns the Plans field value if set, zero value otherwise. +func (o *PlanList) GetPlans() (res PlanListGetPlansRetType) { + res, _ = o.GetPlansOk() + return +} + +// GetPlansOk returns a tuple with the Plans field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanList) GetPlansOk() (ret PlanListGetPlansRetType, ok bool) { + return getPlanListGetPlansAttributeTypeOk(o.Plans) +} + +// HasPlans returns a boolean if a field has been set. +func (o *PlanList) HasPlans() bool { + _, ok := o.GetPlansOk() + return ok +} + +// SetPlans gets a reference to the given []Plan and assigns it to the Plans field. +func (o *PlanList) SetPlans(v PlanListGetPlansRetType) { + setPlanListGetPlansAttributeType(&o.Plans, v) +} + +// GetTunnel returns the Tunnel field value if set, zero value otherwise. +func (o *PlanList) GetTunnel() (res PlanListGetTunnelRetType) { + res, _ = o.GetTunnelOk() + return +} + +// GetTunnelOk returns a tuple with the Tunnel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlanList) GetTunnelOk() (ret PlanListGetTunnelRetType, ok bool) { + return getPlanListGetTunnelAttributeTypeOk(o.Tunnel) +} + +// HasTunnel returns a boolean if a field has been set. +func (o *PlanList) HasTunnel() bool { + _, ok := o.GetTunnelOk() + return ok +} + +// SetTunnel gets a reference to the given VPNTunnelPlan and assigns it to the Tunnel field. +func (o *PlanList) SetTunnel(v PlanListGetTunnelRetType) { + setPlanListGetTunnelAttributeType(&o.Tunnel, v) +} + +func (o PlanList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPlanListGetDefaultPlanIdAttributeTypeOk(o.DefaultPlanId); ok { + toSerialize["DefaultPlanId"] = val + } + if val, ok := getPlanListGetPlansAttributeTypeOk(o.Plans); ok { + toSerialize["Plans"] = val + } + if val, ok := getPlanListGetTunnelAttributeTypeOk(o.Tunnel); ok { + toSerialize["Tunnel"] = val + } + return toSerialize, nil +} + +type NullablePlanList struct { + value *PlanList + isSet bool +} + +func (v NullablePlanList) Get() *PlanList { + return v.value +} + +func (v *NullablePlanList) Set(val *PlanList) { + v.value = val + v.isSet = true +} + +func (v NullablePlanList) IsSet() bool { + return v.isSet +} + +func (v *NullablePlanList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePlanList(val *PlanList) *NullablePlanList { + return &NullablePlanList{value: val, isSet: true} +} + +func (v NullablePlanList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePlanList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_plan_list_test.go b/pkg/vpnalpha/model_plan_list_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_plan_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_plan_test.go b/pkg/vpnalpha/model_plan_test.go new file mode 100644 index 00000000..a44985a8 --- /dev/null +++ b/pkg/vpnalpha/model_plan_test.go @@ -0,0 +1,58 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "testing" +) + +// isEnum + +func TestPlanTypes_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"high-availability"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"single"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := PlanTypes("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/vpnalpha/model_quota.go b/pkg/vpnalpha/model_quota.go new file mode 100644 index 00000000..f5330653 --- /dev/null +++ b/pkg/vpnalpha/model_quota.go @@ -0,0 +1,168 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the Quota type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Quota{} + +/* + types and functions for limit +*/ + +// isInteger +type QuotaGetLimitAttributeType = *int64 +type QuotaGetLimitArgType = int64 +type QuotaGetLimitRetType = int64 + +func getQuotaGetLimitAttributeTypeOk(arg QuotaGetLimitAttributeType) (ret QuotaGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaGetLimitAttributeType(arg *QuotaGetLimitAttributeType, val QuotaGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isInteger +type QuotaGetUsageAttributeType = *int64 +type QuotaGetUsageArgType = int64 +type QuotaGetUsageRetType = int64 + +func getQuotaGetUsageAttributeTypeOk(arg QuotaGetUsageAttributeType) (ret QuotaGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaGetUsageAttributeType(arg *QuotaGetUsageAttributeType, val QuotaGetUsageRetType) { + *arg = &val +} + +// Quota struct for Quota +type Quota struct { + // REQUIRED + Limit QuotaGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaGetUsageAttributeType `json:"usage" required:"true"` +} + +type _Quota Quota + +// NewQuota instantiates a new Quota 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 NewQuota(limit QuotaGetLimitArgType, usage QuotaGetUsageArgType) *Quota { + this := Quota{} + setQuotaGetLimitAttributeType(&this.Limit, limit) + setQuotaGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaWithDefaults instantiates a new Quota 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 NewQuotaWithDefaults() *Quota { + this := Quota{} + return &this +} + +// GetLimit returns the Limit field value +func (o *Quota) GetLimit() (ret QuotaGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *Quota) GetLimitOk() (ret QuotaGetLimitRetType, ok bool) { + return getQuotaGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *Quota) SetLimit(v QuotaGetLimitRetType) { + setQuotaGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *Quota) GetUsage() (ret QuotaGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *Quota) GetUsageOk() (ret QuotaGetUsageRetType, ok bool) { + return getQuotaGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *Quota) SetUsage(v QuotaGetUsageRetType) { + setQuotaGetUsageAttributeType(&o.Usage, v) +} + +func (o Quota) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuota struct { + value *Quota + isSet bool +} + +func (v NullableQuota) Get() *Quota { + return v.value +} + +func (v *NullableQuota) Set(val *Quota) { + v.value = val + v.isSet = true +} + +func (v NullableQuota) IsSet() bool { + return v.isSet +} + +func (v *NullableQuota) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuota(val *Quota) *NullableQuota { + return &NullableQuota{value: val, isSet: true} +} + +func (v NullableQuota) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuota) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_quota_list.go b/pkg/vpnalpha/model_quota_list.go new file mode 100644 index 00000000..9f70a07a --- /dev/null +++ b/pkg/vpnalpha/model_quota_list.go @@ -0,0 +1,125 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the QuotaList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaList{} + +/* + types and functions for gateways +*/ + +// isModel +type QuotaListGetGatewaysAttributeType = *QuotaListGateways +type QuotaListGetGatewaysArgType = QuotaListGateways +type QuotaListGetGatewaysRetType = QuotaListGateways + +func getQuotaListGetGatewaysAttributeTypeOk(arg QuotaListGetGatewaysAttributeType) (ret QuotaListGetGatewaysRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetGatewaysAttributeType(arg *QuotaListGetGatewaysAttributeType, val QuotaListGetGatewaysRetType) { + *arg = &val +} + +// QuotaList struct for QuotaList +type QuotaList struct { + // REQUIRED + Gateways QuotaListGetGatewaysAttributeType `json:"gateways" required:"true"` +} + +type _QuotaList QuotaList + +// NewQuotaList instantiates a new QuotaList 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 NewQuotaList(gateways QuotaListGetGatewaysArgType) *QuotaList { + this := QuotaList{} + setQuotaListGetGatewaysAttributeType(&this.Gateways, gateways) + return &this +} + +// NewQuotaListWithDefaults instantiates a new QuotaList 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 NewQuotaListWithDefaults() *QuotaList { + this := QuotaList{} + return &this +} + +// GetGateways returns the Gateways field value +func (o *QuotaList) GetGateways() (ret QuotaListGetGatewaysRetType) { + ret, _ = o.GetGatewaysOk() + return ret +} + +// GetGatewaysOk returns a tuple with the Gateways field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetGatewaysOk() (ret QuotaListGetGatewaysRetType, ok bool) { + return getQuotaListGetGatewaysAttributeTypeOk(o.Gateways) +} + +// SetGateways sets field value +func (o *QuotaList) SetGateways(v QuotaListGetGatewaysRetType) { + setQuotaListGetGatewaysAttributeType(&o.Gateways, v) +} + +func (o QuotaList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListGetGatewaysAttributeTypeOk(o.Gateways); ok { + toSerialize["Gateways"] = val + } + return toSerialize, nil +} + +type NullableQuotaList struct { + value *QuotaList + isSet bool +} + +func (v NullableQuotaList) Get() *QuotaList { + return v.value +} + +func (v *NullableQuotaList) Set(val *QuotaList) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaList) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaList(val *QuotaList) *NullableQuotaList { + return &NullableQuotaList{value: val, isSet: true} +} + +func (v NullableQuotaList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_quota_list_gateways.go b/pkg/vpnalpha/model_quota_list_gateways.go new file mode 100644 index 00000000..9332cefd --- /dev/null +++ b/pkg/vpnalpha/model_quota_list_gateways.go @@ -0,0 +1,168 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the QuotaListGateways type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListGateways{} + +/* + types and functions for limit +*/ + +// isInteger +type QuotaListGatewaysGetLimitAttributeType = *int64 +type QuotaListGatewaysGetLimitArgType = int64 +type QuotaListGatewaysGetLimitRetType = int64 + +func getQuotaListGatewaysGetLimitAttributeTypeOk(arg QuotaListGatewaysGetLimitAttributeType) (ret QuotaListGatewaysGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGatewaysGetLimitAttributeType(arg *QuotaListGatewaysGetLimitAttributeType, val QuotaListGatewaysGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isInteger +type QuotaListGatewaysGetUsageAttributeType = *int64 +type QuotaListGatewaysGetUsageArgType = int64 +type QuotaListGatewaysGetUsageRetType = int64 + +func getQuotaListGatewaysGetUsageAttributeTypeOk(arg QuotaListGatewaysGetUsageAttributeType) (ret QuotaListGatewaysGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGatewaysGetUsageAttributeType(arg *QuotaListGatewaysGetUsageAttributeType, val QuotaListGatewaysGetUsageRetType) { + *arg = &val +} + +// QuotaListGateways The number of gateways. +type QuotaListGateways struct { + // REQUIRED + Limit QuotaListGatewaysGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListGatewaysGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListGateways QuotaListGateways + +// NewQuotaListGateways instantiates a new QuotaListGateways 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 NewQuotaListGateways(limit QuotaListGatewaysGetLimitArgType, usage QuotaListGatewaysGetUsageArgType) *QuotaListGateways { + this := QuotaListGateways{} + setQuotaListGatewaysGetLimitAttributeType(&this.Limit, limit) + setQuotaListGatewaysGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListGatewaysWithDefaults instantiates a new QuotaListGateways 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 NewQuotaListGatewaysWithDefaults() *QuotaListGateways { + this := QuotaListGateways{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListGateways) GetLimit() (ret QuotaListGatewaysGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListGateways) GetLimitOk() (ret QuotaListGatewaysGetLimitRetType, ok bool) { + return getQuotaListGatewaysGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListGateways) SetLimit(v QuotaListGatewaysGetLimitRetType) { + setQuotaListGatewaysGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListGateways) GetUsage() (ret QuotaListGatewaysGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListGateways) GetUsageOk() (ret QuotaListGatewaysGetUsageRetType, ok bool) { + return getQuotaListGatewaysGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListGateways) SetUsage(v QuotaListGatewaysGetUsageRetType) { + setQuotaListGatewaysGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListGateways) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListGatewaysGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListGatewaysGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListGateways struct { + value *QuotaListGateways + isSet bool +} + +func (v NullableQuotaListGateways) Get() *QuotaListGateways { + return v.value +} + +func (v *NullableQuotaListGateways) Set(val *QuotaListGateways) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListGateways) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListGateways) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListGateways(val *QuotaListGateways) *NullableQuotaListGateways { + return &NullableQuotaListGateways{value: val, isSet: true} +} + +func (v NullableQuotaListGateways) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListGateways) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_quota_list_gateways_test.go b/pkg/vpnalpha/model_quota_list_gateways_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_quota_list_gateways_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_quota_list_response.go b/pkg/vpnalpha/model_quota_list_response.go new file mode 100644 index 00000000..b3bd0711 --- /dev/null +++ b/pkg/vpnalpha/model_quota_list_response.go @@ -0,0 +1,125 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the QuotaListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListResponse{} + +/* + types and functions for quotas +*/ + +// isModel +type QuotaListResponseGetQuotasAttributeType = *QuotaList +type QuotaListResponseGetQuotasArgType = QuotaList +type QuotaListResponseGetQuotasRetType = QuotaList + +func getQuotaListResponseGetQuotasAttributeTypeOk(arg QuotaListResponseGetQuotasAttributeType) (ret QuotaListResponseGetQuotasRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListResponseGetQuotasAttributeType(arg *QuotaListResponseGetQuotasAttributeType, val QuotaListResponseGetQuotasRetType) { + *arg = &val +} + +// QuotaListResponse struct for QuotaListResponse +type QuotaListResponse struct { + // REQUIRED + Quotas QuotaListResponseGetQuotasAttributeType `json:"quotas" required:"true"` +} + +type _QuotaListResponse QuotaListResponse + +// NewQuotaListResponse instantiates a new QuotaListResponse 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 NewQuotaListResponse(quotas QuotaListResponseGetQuotasArgType) *QuotaListResponse { + this := QuotaListResponse{} + setQuotaListResponseGetQuotasAttributeType(&this.Quotas, quotas) + return &this +} + +// NewQuotaListResponseWithDefaults instantiates a new QuotaListResponse 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 NewQuotaListResponseWithDefaults() *QuotaListResponse { + this := QuotaListResponse{} + return &this +} + +// GetQuotas returns the Quotas field value +func (o *QuotaListResponse) GetQuotas() (ret QuotaListResponseGetQuotasRetType) { + ret, _ = o.GetQuotasOk() + return ret +} + +// GetQuotasOk returns a tuple with the Quotas field value +// and a boolean to check if the value has been set. +func (o *QuotaListResponse) GetQuotasOk() (ret QuotaListResponseGetQuotasRetType, ok bool) { + return getQuotaListResponseGetQuotasAttributeTypeOk(o.Quotas) +} + +// SetQuotas sets field value +func (o *QuotaListResponse) SetQuotas(v QuotaListResponseGetQuotasRetType) { + setQuotaListResponseGetQuotasAttributeType(&o.Quotas, v) +} + +func (o QuotaListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListResponseGetQuotasAttributeTypeOk(o.Quotas); ok { + toSerialize["Quotas"] = val + } + return toSerialize, nil +} + +type NullableQuotaListResponse struct { + value *QuotaListResponse + isSet bool +} + +func (v NullableQuotaListResponse) Get() *QuotaListResponse { + return v.value +} + +func (v *NullableQuotaListResponse) Set(val *QuotaListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListResponse(val *QuotaListResponse) *NullableQuotaListResponse { + return &NullableQuotaListResponse{value: val, isSet: true} +} + +func (v NullableQuotaListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_quota_list_response_test.go b/pkg/vpnalpha/model_quota_list_response_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_quota_list_response_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_quota_list_test.go b/pkg/vpnalpha/model_quota_list_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_quota_list_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_quota_test.go b/pkg/vpnalpha/model_quota_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_quota_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_region.go b/pkg/vpnalpha/model_region.go new file mode 100644 index 00000000..44ac7db0 --- /dev/null +++ b/pkg/vpnalpha/model_region.go @@ -0,0 +1,115 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" + "fmt" +) + +// Region The region in which the resource is located. +type Region string + +// List of Region +const ( + REGION_EU01 Region = "eu01" + REGION_EU02 Region = "eu02" +) + +// All allowed values of Region enum +var AllowedRegionEnumValues = []Region{ + "eu01", + "eu02", +} + +func (v *Region) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := Region(value) + for _, existing := range AllowedRegionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Region", value) +} + +// NewRegionFromValue returns a pointer to a valid Region +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRegionFromValue(v string) (*Region, error) { + ev := Region(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Region: valid values are %v", v, AllowedRegionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Region) IsValid() bool { + for _, existing := range AllowedRegionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Region value +func (v Region) Ptr() *Region { + return &v +} + +type NullableRegion struct { + value *Region + isSet bool +} + +func (v NullableRegion) Get() *Region { + return v.value +} + +func (v *NullableRegion) Set(val *Region) { + v.value = val + v.isSet = true +} + +func (v NullableRegion) IsSet() bool { + return v.isSet +} + +func (v *NullableRegion) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegion(val *Region) *NullableRegion { + return &NullableRegion{value: val, isSet: true} +} + +func (v NullableRegion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_region_test.go b/pkg/vpnalpha/model_region_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_region_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_tunnel_configuration.go b/pkg/vpnalpha/model_tunnel_configuration.go new file mode 100644 index 00000000..2c725487 --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_configuration.go @@ -0,0 +1,308 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the TunnelConfiguration type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TunnelConfiguration{} + +/* + types and functions for bgpTunnelConfig +*/ + +// isModel +type TunnelConfigurationGetBgpTunnelConfigAttributeType = *BGPTunnelConfig +type TunnelConfigurationGetBgpTunnelConfigArgType = BGPTunnelConfig +type TunnelConfigurationGetBgpTunnelConfigRetType = BGPTunnelConfig + +func getTunnelConfigurationGetBgpTunnelConfigAttributeTypeOk(arg TunnelConfigurationGetBgpTunnelConfigAttributeType) (ret TunnelConfigurationGetBgpTunnelConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationGetBgpTunnelConfigAttributeType(arg *TunnelConfigurationGetBgpTunnelConfigAttributeType, val TunnelConfigurationGetBgpTunnelConfigRetType) { + *arg = &val +} + +/* + types and functions for phase1 +*/ + +// isModel +type TunnelConfigurationGetPhase1AttributeType = *TunnelConfigurationPhase1 +type TunnelConfigurationGetPhase1ArgType = TunnelConfigurationPhase1 +type TunnelConfigurationGetPhase1RetType = TunnelConfigurationPhase1 + +func getTunnelConfigurationGetPhase1AttributeTypeOk(arg TunnelConfigurationGetPhase1AttributeType) (ret TunnelConfigurationGetPhase1RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationGetPhase1AttributeType(arg *TunnelConfigurationGetPhase1AttributeType, val TunnelConfigurationGetPhase1RetType) { + *arg = &val +} + +/* + types and functions for phase2 +*/ + +// isModel +type TunnelConfigurationGetPhase2AttributeType = *TunnelConfigurationPhase2 +type TunnelConfigurationGetPhase2ArgType = TunnelConfigurationPhase2 +type TunnelConfigurationGetPhase2RetType = TunnelConfigurationPhase2 + +func getTunnelConfigurationGetPhase2AttributeTypeOk(arg TunnelConfigurationGetPhase2AttributeType) (ret TunnelConfigurationGetPhase2RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationGetPhase2AttributeType(arg *TunnelConfigurationGetPhase2AttributeType, val TunnelConfigurationGetPhase2RetType) { + *arg = &val +} + +/* + types and functions for preSharedKey +*/ + +// isNotNullableString +type TunnelConfigurationGetPreSharedKeyAttributeType = *string + +func getTunnelConfigurationGetPreSharedKeyAttributeTypeOk(arg TunnelConfigurationGetPreSharedKeyAttributeType) (ret TunnelConfigurationGetPreSharedKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationGetPreSharedKeyAttributeType(arg *TunnelConfigurationGetPreSharedKeyAttributeType, val TunnelConfigurationGetPreSharedKeyRetType) { + *arg = &val +} + +type TunnelConfigurationGetPreSharedKeyArgType = string +type TunnelConfigurationGetPreSharedKeyRetType = string + +/* + types and functions for remoteAddress +*/ + +// isNotNullableString +type TunnelConfigurationGetRemoteAddressAttributeType = *string + +func getTunnelConfigurationGetRemoteAddressAttributeTypeOk(arg TunnelConfigurationGetRemoteAddressAttributeType) (ret TunnelConfigurationGetRemoteAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationGetRemoteAddressAttributeType(arg *TunnelConfigurationGetRemoteAddressAttributeType, val TunnelConfigurationGetRemoteAddressRetType) { + *arg = &val +} + +type TunnelConfigurationGetRemoteAddressArgType = string +type TunnelConfigurationGetRemoteAddressRetType = string + +// TunnelConfiguration struct for TunnelConfiguration +type TunnelConfiguration struct { + BgpTunnelConfig TunnelConfigurationGetBgpTunnelConfigAttributeType `json:"bgpTunnelConfig,omitempty"` + // REQUIRED + Phase1 TunnelConfigurationGetPhase1AttributeType `json:"phase1" required:"true"` + // REQUIRED + Phase2 TunnelConfigurationGetPhase2AttributeType `json:"phase2" required:"true"` + // A Pre-Shared Key for authentication. Required in create-requests, optional in update-requests and omitted in every response. + PreSharedKey TunnelConfigurationGetPreSharedKeyAttributeType `json:"preSharedKey,omitempty"` + // REQUIRED + RemoteAddress TunnelConfigurationGetRemoteAddressAttributeType `json:"remoteAddress" required:"true"` +} + +type _TunnelConfiguration TunnelConfiguration + +// NewTunnelConfiguration instantiates a new TunnelConfiguration 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 NewTunnelConfiguration(phase1 TunnelConfigurationGetPhase1ArgType, phase2 TunnelConfigurationGetPhase2ArgType, remoteAddress TunnelConfigurationGetRemoteAddressArgType) *TunnelConfiguration { + this := TunnelConfiguration{} + setTunnelConfigurationGetPhase1AttributeType(&this.Phase1, phase1) + setTunnelConfigurationGetPhase2AttributeType(&this.Phase2, phase2) + setTunnelConfigurationGetRemoteAddressAttributeType(&this.RemoteAddress, remoteAddress) + return &this +} + +// NewTunnelConfigurationWithDefaults instantiates a new TunnelConfiguration 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 NewTunnelConfigurationWithDefaults() *TunnelConfiguration { + this := TunnelConfiguration{} + return &this +} + +// GetBgpTunnelConfig returns the BgpTunnelConfig field value if set, zero value otherwise. +func (o *TunnelConfiguration) GetBgpTunnelConfig() (res TunnelConfigurationGetBgpTunnelConfigRetType) { + res, _ = o.GetBgpTunnelConfigOk() + return +} + +// GetBgpTunnelConfigOk returns a tuple with the BgpTunnelConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetBgpTunnelConfigOk() (ret TunnelConfigurationGetBgpTunnelConfigRetType, ok bool) { + return getTunnelConfigurationGetBgpTunnelConfigAttributeTypeOk(o.BgpTunnelConfig) +} + +// HasBgpTunnelConfig returns a boolean if a field has been set. +func (o *TunnelConfiguration) HasBgpTunnelConfig() bool { + _, ok := o.GetBgpTunnelConfigOk() + return ok +} + +// SetBgpTunnelConfig gets a reference to the given BGPTunnelConfig and assigns it to the BgpTunnelConfig field. +func (o *TunnelConfiguration) SetBgpTunnelConfig(v TunnelConfigurationGetBgpTunnelConfigRetType) { + setTunnelConfigurationGetBgpTunnelConfigAttributeType(&o.BgpTunnelConfig, v) +} + +// GetPhase1 returns the Phase1 field value +func (o *TunnelConfiguration) GetPhase1() (ret TunnelConfigurationGetPhase1RetType) { + ret, _ = o.GetPhase1Ok() + return ret +} + +// GetPhase1Ok returns a tuple with the Phase1 field value +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetPhase1Ok() (ret TunnelConfigurationGetPhase1RetType, ok bool) { + return getTunnelConfigurationGetPhase1AttributeTypeOk(o.Phase1) +} + +// SetPhase1 sets field value +func (o *TunnelConfiguration) SetPhase1(v TunnelConfigurationGetPhase1RetType) { + setTunnelConfigurationGetPhase1AttributeType(&o.Phase1, v) +} + +// GetPhase2 returns the Phase2 field value +func (o *TunnelConfiguration) GetPhase2() (ret TunnelConfigurationGetPhase2RetType) { + ret, _ = o.GetPhase2Ok() + return ret +} + +// GetPhase2Ok returns a tuple with the Phase2 field value +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetPhase2Ok() (ret TunnelConfigurationGetPhase2RetType, ok bool) { + return getTunnelConfigurationGetPhase2AttributeTypeOk(o.Phase2) +} + +// SetPhase2 sets field value +func (o *TunnelConfiguration) SetPhase2(v TunnelConfigurationGetPhase2RetType) { + setTunnelConfigurationGetPhase2AttributeType(&o.Phase2, v) +} + +// GetPreSharedKey returns the PreSharedKey field value if set, zero value otherwise. +func (o *TunnelConfiguration) GetPreSharedKey() (res TunnelConfigurationGetPreSharedKeyRetType) { + res, _ = o.GetPreSharedKeyOk() + return +} + +// GetPreSharedKeyOk returns a tuple with the PreSharedKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetPreSharedKeyOk() (ret TunnelConfigurationGetPreSharedKeyRetType, ok bool) { + return getTunnelConfigurationGetPreSharedKeyAttributeTypeOk(o.PreSharedKey) +} + +// HasPreSharedKey returns a boolean if a field has been set. +func (o *TunnelConfiguration) HasPreSharedKey() bool { + _, ok := o.GetPreSharedKeyOk() + return ok +} + +// SetPreSharedKey gets a reference to the given string and assigns it to the PreSharedKey field. +func (o *TunnelConfiguration) SetPreSharedKey(v TunnelConfigurationGetPreSharedKeyRetType) { + setTunnelConfigurationGetPreSharedKeyAttributeType(&o.PreSharedKey, v) +} + +// GetRemoteAddress returns the RemoteAddress field value +func (o *TunnelConfiguration) GetRemoteAddress() (ret TunnelConfigurationGetRemoteAddressRetType) { + ret, _ = o.GetRemoteAddressOk() + return ret +} + +// GetRemoteAddressOk returns a tuple with the RemoteAddress field value +// and a boolean to check if the value has been set. +func (o *TunnelConfiguration) GetRemoteAddressOk() (ret TunnelConfigurationGetRemoteAddressRetType, ok bool) { + return getTunnelConfigurationGetRemoteAddressAttributeTypeOk(o.RemoteAddress) +} + +// SetRemoteAddress sets field value +func (o *TunnelConfiguration) SetRemoteAddress(v TunnelConfigurationGetRemoteAddressRetType) { + setTunnelConfigurationGetRemoteAddressAttributeType(&o.RemoteAddress, v) +} + +func (o TunnelConfiguration) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTunnelConfigurationGetBgpTunnelConfigAttributeTypeOk(o.BgpTunnelConfig); ok { + toSerialize["BgpTunnelConfig"] = val + } + if val, ok := getTunnelConfigurationGetPhase1AttributeTypeOk(o.Phase1); ok { + toSerialize["Phase1"] = val + } + if val, ok := getTunnelConfigurationGetPhase2AttributeTypeOk(o.Phase2); ok { + toSerialize["Phase2"] = val + } + if val, ok := getTunnelConfigurationGetPreSharedKeyAttributeTypeOk(o.PreSharedKey); ok { + toSerialize["PreSharedKey"] = val + } + if val, ok := getTunnelConfigurationGetRemoteAddressAttributeTypeOk(o.RemoteAddress); ok { + toSerialize["RemoteAddress"] = val + } + return toSerialize, nil +} + +type NullableTunnelConfiguration struct { + value *TunnelConfiguration + isSet bool +} + +func (v NullableTunnelConfiguration) Get() *TunnelConfiguration { + return v.value +} + +func (v *NullableTunnelConfiguration) Set(val *TunnelConfiguration) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfiguration) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfiguration) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfiguration(val *TunnelConfiguration) *NullableTunnelConfiguration { + return &NullableTunnelConfiguration{value: val, isSet: true} +} + +func (v NullableTunnelConfiguration) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfiguration) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_tunnel_configuration_phase1.go b/pkg/vpnalpha/model_tunnel_configuration_phase1.go new file mode 100644 index 00000000..8080e582 --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_configuration_phase1.go @@ -0,0 +1,267 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the TunnelConfigurationPhase1 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TunnelConfigurationPhase1{} + +/* + types and functions for dhGroups +*/ + +// isArray +type TunnelConfigurationPhase1GetDhGroupsAttributeType = *[]string +type TunnelConfigurationPhase1GetDhGroupsArgType = []string +type TunnelConfigurationPhase1GetDhGroupsRetType = []string + +func getTunnelConfigurationPhase1GetDhGroupsAttributeTypeOk(arg TunnelConfigurationPhase1GetDhGroupsAttributeType) (ret TunnelConfigurationPhase1GetDhGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase1GetDhGroupsAttributeType(arg *TunnelConfigurationPhase1GetDhGroupsAttributeType, val TunnelConfigurationPhase1GetDhGroupsRetType) { + *arg = &val +} + +/* + types and functions for encryptionAlgorithms +*/ + +// isArray +type TunnelConfigurationPhase1GetEncryptionAlgorithmsAttributeType = *[]string +type TunnelConfigurationPhase1GetEncryptionAlgorithmsArgType = []string +type TunnelConfigurationPhase1GetEncryptionAlgorithmsRetType = []string + +func getTunnelConfigurationPhase1GetEncryptionAlgorithmsAttributeTypeOk(arg TunnelConfigurationPhase1GetEncryptionAlgorithmsAttributeType) (ret TunnelConfigurationPhase1GetEncryptionAlgorithmsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase1GetEncryptionAlgorithmsAttributeType(arg *TunnelConfigurationPhase1GetEncryptionAlgorithmsAttributeType, val TunnelConfigurationPhase1GetEncryptionAlgorithmsRetType) { + *arg = &val +} + +/* + types and functions for integrityAlgorithms +*/ + +// isArray +type TunnelConfigurationPhase1GetIntegrityAlgorithmsAttributeType = *[]string +type TunnelConfigurationPhase1GetIntegrityAlgorithmsArgType = []string +type TunnelConfigurationPhase1GetIntegrityAlgorithmsRetType = []string + +func getTunnelConfigurationPhase1GetIntegrityAlgorithmsAttributeTypeOk(arg TunnelConfigurationPhase1GetIntegrityAlgorithmsAttributeType) (ret TunnelConfigurationPhase1GetIntegrityAlgorithmsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase1GetIntegrityAlgorithmsAttributeType(arg *TunnelConfigurationPhase1GetIntegrityAlgorithmsAttributeType, val TunnelConfigurationPhase1GetIntegrityAlgorithmsRetType) { + *arg = &val +} + +/* + types and functions for rekeyTime +*/ + +// isInteger +type TunnelConfigurationPhase1GetRekeyTimeAttributeType = *int64 +type TunnelConfigurationPhase1GetRekeyTimeArgType = int64 +type TunnelConfigurationPhase1GetRekeyTimeRetType = int64 + +func getTunnelConfigurationPhase1GetRekeyTimeAttributeTypeOk(arg TunnelConfigurationPhase1GetRekeyTimeAttributeType) (ret TunnelConfigurationPhase1GetRekeyTimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase1GetRekeyTimeAttributeType(arg *TunnelConfigurationPhase1GetRekeyTimeAttributeType, val TunnelConfigurationPhase1GetRekeyTimeRetType) { + *arg = &val +} + +// TunnelConfigurationPhase1 struct for TunnelConfigurationPhase1 +type TunnelConfigurationPhase1 struct { + // The Diffie-Hellman Group. Required, except if AEAD algorithms are selected. + DhGroups TunnelConfigurationPhase1GetDhGroupsAttributeType `json:"dhGroups,omitempty"` + // REQUIRED + EncryptionAlgorithms TunnelConfigurationPhase1GetEncryptionAlgorithmsAttributeType `json:"encryptionAlgorithms" required:"true"` + // REQUIRED + IntegrityAlgorithms TunnelConfigurationPhase1GetIntegrityAlgorithmsAttributeType `json:"integrityAlgorithms" required:"true"` + // Time to schedule a IKE re-keying (in seconds). + // Can be cast to int32 without loss of precision. + RekeyTime TunnelConfigurationPhase1GetRekeyTimeAttributeType `json:"rekeyTime,omitempty"` +} + +type _TunnelConfigurationPhase1 TunnelConfigurationPhase1 + +// NewTunnelConfigurationPhase1 instantiates a new TunnelConfigurationPhase1 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 NewTunnelConfigurationPhase1(encryptionAlgorithms TunnelConfigurationPhase1GetEncryptionAlgorithmsArgType, integrityAlgorithms TunnelConfigurationPhase1GetIntegrityAlgorithmsArgType) *TunnelConfigurationPhase1 { + this := TunnelConfigurationPhase1{} + setTunnelConfigurationPhase1GetEncryptionAlgorithmsAttributeType(&this.EncryptionAlgorithms, encryptionAlgorithms) + setTunnelConfigurationPhase1GetIntegrityAlgorithmsAttributeType(&this.IntegrityAlgorithms, integrityAlgorithms) + return &this +} + +// NewTunnelConfigurationPhase1WithDefaults instantiates a new TunnelConfigurationPhase1 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 NewTunnelConfigurationPhase1WithDefaults() *TunnelConfigurationPhase1 { + this := TunnelConfigurationPhase1{} + var rekeyTime int64 = 14400 + this.RekeyTime = &rekeyTime + return &this +} + +// GetDhGroups returns the DhGroups field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase1) GetDhGroups() (res TunnelConfigurationPhase1GetDhGroupsRetType) { + res, _ = o.GetDhGroupsOk() + return +} + +// GetDhGroupsOk returns a tuple with the DhGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase1) GetDhGroupsOk() (ret TunnelConfigurationPhase1GetDhGroupsRetType, ok bool) { + return getTunnelConfigurationPhase1GetDhGroupsAttributeTypeOk(o.DhGroups) +} + +// HasDhGroups returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase1) HasDhGroups() bool { + _, ok := o.GetDhGroupsOk() + return ok +} + +// SetDhGroups gets a reference to the given []string and assigns it to the DhGroups field. +func (o *TunnelConfigurationPhase1) SetDhGroups(v TunnelConfigurationPhase1GetDhGroupsRetType) { + setTunnelConfigurationPhase1GetDhGroupsAttributeType(&o.DhGroups, v) +} + +// GetEncryptionAlgorithms returns the EncryptionAlgorithms field value +func (o *TunnelConfigurationPhase1) GetEncryptionAlgorithms() (ret TunnelConfigurationPhase1GetEncryptionAlgorithmsRetType) { + ret, _ = o.GetEncryptionAlgorithmsOk() + return ret +} + +// GetEncryptionAlgorithmsOk returns a tuple with the EncryptionAlgorithms field value +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase1) GetEncryptionAlgorithmsOk() (ret TunnelConfigurationPhase1GetEncryptionAlgorithmsRetType, ok bool) { + return getTunnelConfigurationPhase1GetEncryptionAlgorithmsAttributeTypeOk(o.EncryptionAlgorithms) +} + +// SetEncryptionAlgorithms sets field value +func (o *TunnelConfigurationPhase1) SetEncryptionAlgorithms(v TunnelConfigurationPhase1GetEncryptionAlgorithmsRetType) { + setTunnelConfigurationPhase1GetEncryptionAlgorithmsAttributeType(&o.EncryptionAlgorithms, v) +} + +// GetIntegrityAlgorithms returns the IntegrityAlgorithms field value +func (o *TunnelConfigurationPhase1) GetIntegrityAlgorithms() (ret TunnelConfigurationPhase1GetIntegrityAlgorithmsRetType) { + ret, _ = o.GetIntegrityAlgorithmsOk() + return ret +} + +// GetIntegrityAlgorithmsOk returns a tuple with the IntegrityAlgorithms field value +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase1) GetIntegrityAlgorithmsOk() (ret TunnelConfigurationPhase1GetIntegrityAlgorithmsRetType, ok bool) { + return getTunnelConfigurationPhase1GetIntegrityAlgorithmsAttributeTypeOk(o.IntegrityAlgorithms) +} + +// SetIntegrityAlgorithms sets field value +func (o *TunnelConfigurationPhase1) SetIntegrityAlgorithms(v TunnelConfigurationPhase1GetIntegrityAlgorithmsRetType) { + setTunnelConfigurationPhase1GetIntegrityAlgorithmsAttributeType(&o.IntegrityAlgorithms, v) +} + +// GetRekeyTime returns the RekeyTime field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase1) GetRekeyTime() (res TunnelConfigurationPhase1GetRekeyTimeRetType) { + res, _ = o.GetRekeyTimeOk() + return +} + +// GetRekeyTimeOk returns a tuple with the RekeyTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase1) GetRekeyTimeOk() (ret TunnelConfigurationPhase1GetRekeyTimeRetType, ok bool) { + return getTunnelConfigurationPhase1GetRekeyTimeAttributeTypeOk(o.RekeyTime) +} + +// HasRekeyTime returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase1) HasRekeyTime() bool { + _, ok := o.GetRekeyTimeOk() + return ok +} + +// SetRekeyTime gets a reference to the given int64 and assigns it to the RekeyTime field. +func (o *TunnelConfigurationPhase1) SetRekeyTime(v TunnelConfigurationPhase1GetRekeyTimeRetType) { + setTunnelConfigurationPhase1GetRekeyTimeAttributeType(&o.RekeyTime, v) +} + +func (o TunnelConfigurationPhase1) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTunnelConfigurationPhase1GetDhGroupsAttributeTypeOk(o.DhGroups); ok { + toSerialize["DhGroups"] = val + } + if val, ok := getTunnelConfigurationPhase1GetEncryptionAlgorithmsAttributeTypeOk(o.EncryptionAlgorithms); ok { + toSerialize["EncryptionAlgorithms"] = val + } + if val, ok := getTunnelConfigurationPhase1GetIntegrityAlgorithmsAttributeTypeOk(o.IntegrityAlgorithms); ok { + toSerialize["IntegrityAlgorithms"] = val + } + if val, ok := getTunnelConfigurationPhase1GetRekeyTimeAttributeTypeOk(o.RekeyTime); ok { + toSerialize["RekeyTime"] = val + } + return toSerialize, nil +} + +type NullableTunnelConfigurationPhase1 struct { + value *TunnelConfigurationPhase1 + isSet bool +} + +func (v NullableTunnelConfigurationPhase1) Get() *TunnelConfigurationPhase1 { + return v.value +} + +func (v *NullableTunnelConfigurationPhase1) Set(val *TunnelConfigurationPhase1) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfigurationPhase1) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfigurationPhase1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfigurationPhase1(val *TunnelConfigurationPhase1) *NullableTunnelConfigurationPhase1 { + return &NullableTunnelConfigurationPhase1{value: val, isSet: true} +} + +func (v NullableTunnelConfigurationPhase1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfigurationPhase1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_tunnel_configuration_phase1_all_of.go b/pkg/vpnalpha/model_tunnel_configuration_phase1_all_of.go new file mode 100644 index 00000000..030af440 --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_configuration_phase1_all_of.go @@ -0,0 +1,131 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the TunnelConfigurationPhase1AllOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TunnelConfigurationPhase1AllOf{} + +/* + types and functions for rekeyTime +*/ + +// isInteger +type TunnelConfigurationPhase1AllOfGetRekeyTimeAttributeType = *int64 +type TunnelConfigurationPhase1AllOfGetRekeyTimeArgType = int64 +type TunnelConfigurationPhase1AllOfGetRekeyTimeRetType = int64 + +func getTunnelConfigurationPhase1AllOfGetRekeyTimeAttributeTypeOk(arg TunnelConfigurationPhase1AllOfGetRekeyTimeAttributeType) (ret TunnelConfigurationPhase1AllOfGetRekeyTimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase1AllOfGetRekeyTimeAttributeType(arg *TunnelConfigurationPhase1AllOfGetRekeyTimeAttributeType, val TunnelConfigurationPhase1AllOfGetRekeyTimeRetType) { + *arg = &val +} + +// TunnelConfigurationPhase1AllOf struct for TunnelConfigurationPhase1AllOf +type TunnelConfigurationPhase1AllOf struct { + // Time to schedule a IKE re-keying (in seconds). + // Can be cast to int32 without loss of precision. + RekeyTime TunnelConfigurationPhase1AllOfGetRekeyTimeAttributeType `json:"rekeyTime,omitempty"` +} + +// NewTunnelConfigurationPhase1AllOf instantiates a new TunnelConfigurationPhase1AllOf 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 NewTunnelConfigurationPhase1AllOf() *TunnelConfigurationPhase1AllOf { + this := TunnelConfigurationPhase1AllOf{} + return &this +} + +// NewTunnelConfigurationPhase1AllOfWithDefaults instantiates a new TunnelConfigurationPhase1AllOf 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 NewTunnelConfigurationPhase1AllOfWithDefaults() *TunnelConfigurationPhase1AllOf { + this := TunnelConfigurationPhase1AllOf{} + var rekeyTime int64 = 14400 + this.RekeyTime = &rekeyTime + return &this +} + +// GetRekeyTime returns the RekeyTime field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase1AllOf) GetRekeyTime() (res TunnelConfigurationPhase1AllOfGetRekeyTimeRetType) { + res, _ = o.GetRekeyTimeOk() + return +} + +// GetRekeyTimeOk returns a tuple with the RekeyTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase1AllOf) GetRekeyTimeOk() (ret TunnelConfigurationPhase1AllOfGetRekeyTimeRetType, ok bool) { + return getTunnelConfigurationPhase1AllOfGetRekeyTimeAttributeTypeOk(o.RekeyTime) +} + +// HasRekeyTime returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase1AllOf) HasRekeyTime() bool { + _, ok := o.GetRekeyTimeOk() + return ok +} + +// SetRekeyTime gets a reference to the given int64 and assigns it to the RekeyTime field. +func (o *TunnelConfigurationPhase1AllOf) SetRekeyTime(v TunnelConfigurationPhase1AllOfGetRekeyTimeRetType) { + setTunnelConfigurationPhase1AllOfGetRekeyTimeAttributeType(&o.RekeyTime, v) +} + +func (o TunnelConfigurationPhase1AllOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTunnelConfigurationPhase1AllOfGetRekeyTimeAttributeTypeOk(o.RekeyTime); ok { + toSerialize["RekeyTime"] = val + } + return toSerialize, nil +} + +type NullableTunnelConfigurationPhase1AllOf struct { + value *TunnelConfigurationPhase1AllOf + isSet bool +} + +func (v NullableTunnelConfigurationPhase1AllOf) Get() *TunnelConfigurationPhase1AllOf { + return v.value +} + +func (v *NullableTunnelConfigurationPhase1AllOf) Set(val *TunnelConfigurationPhase1AllOf) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfigurationPhase1AllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfigurationPhase1AllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfigurationPhase1AllOf(val *TunnelConfigurationPhase1AllOf) *NullableTunnelConfigurationPhase1AllOf { + return &NullableTunnelConfigurationPhase1AllOf{value: val, isSet: true} +} + +func (v NullableTunnelConfigurationPhase1AllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfigurationPhase1AllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_tunnel_configuration_phase1_all_of_test.go b/pkg/vpnalpha/model_tunnel_configuration_phase1_all_of_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_configuration_phase1_all_of_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_tunnel_configuration_phase1_test.go b/pkg/vpnalpha/model_tunnel_configuration_phase1_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_configuration_phase1_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_tunnel_configuration_phase2.go b/pkg/vpnalpha/model_tunnel_configuration_phase2.go new file mode 100644 index 00000000..e6130731 --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_configuration_phase2.go @@ -0,0 +1,582 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" + "fmt" +) + +// checks if the TunnelConfigurationPhase2 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TunnelConfigurationPhase2{} + +/* + types and functions for dhGroups +*/ + +// isArray +type TunnelConfigurationPhase2GetDhGroupsAttributeType = *[]string +type TunnelConfigurationPhase2GetDhGroupsArgType = []string +type TunnelConfigurationPhase2GetDhGroupsRetType = []string + +func getTunnelConfigurationPhase2GetDhGroupsAttributeTypeOk(arg TunnelConfigurationPhase2GetDhGroupsAttributeType) (ret TunnelConfigurationPhase2GetDhGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase2GetDhGroupsAttributeType(arg *TunnelConfigurationPhase2GetDhGroupsAttributeType, val TunnelConfigurationPhase2GetDhGroupsRetType) { + *arg = &val +} + +/* + types and functions for encryptionAlgorithms +*/ + +// isArray +type TunnelConfigurationPhase2GetEncryptionAlgorithmsAttributeType = *[]string +type TunnelConfigurationPhase2GetEncryptionAlgorithmsArgType = []string +type TunnelConfigurationPhase2GetEncryptionAlgorithmsRetType = []string + +func getTunnelConfigurationPhase2GetEncryptionAlgorithmsAttributeTypeOk(arg TunnelConfigurationPhase2GetEncryptionAlgorithmsAttributeType) (ret TunnelConfigurationPhase2GetEncryptionAlgorithmsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase2GetEncryptionAlgorithmsAttributeType(arg *TunnelConfigurationPhase2GetEncryptionAlgorithmsAttributeType, val TunnelConfigurationPhase2GetEncryptionAlgorithmsRetType) { + *arg = &val +} + +/* + types and functions for integrityAlgorithms +*/ + +// isArray +type TunnelConfigurationPhase2GetIntegrityAlgorithmsAttributeType = *[]string +type TunnelConfigurationPhase2GetIntegrityAlgorithmsArgType = []string +type TunnelConfigurationPhase2GetIntegrityAlgorithmsRetType = []string + +func getTunnelConfigurationPhase2GetIntegrityAlgorithmsAttributeTypeOk(arg TunnelConfigurationPhase2GetIntegrityAlgorithmsAttributeType) (ret TunnelConfigurationPhase2GetIntegrityAlgorithmsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase2GetIntegrityAlgorithmsAttributeType(arg *TunnelConfigurationPhase2GetIntegrityAlgorithmsAttributeType, val TunnelConfigurationPhase2GetIntegrityAlgorithmsRetType) { + *arg = &val +} + +/* + types and functions for dpdAction +*/ + +// isEnum + +// TunnelConfigurationPhase2DpdAction Action to perform for this CHILD_SA on DPD timeout. \"clear\": Closes the CHILD_SA and does not take further action. \"trap\": installs a trap policy which will catch matching traffic and tries to re-negotiate the tunnel on-demand). \"restart\": immediately tries to re-negotiate the CILD_SA under a fresh IKE_SA. +// value type for enums +type TunnelConfigurationPhase2DpdAction string + +// List of DpdAction +const ( + TUNNELCONFIGURATIONPHASE2DPD_ACTION_CLEAR TunnelConfigurationPhase2DpdAction = "clear" + TUNNELCONFIGURATIONPHASE2DPD_ACTION_TRAP TunnelConfigurationPhase2DpdAction = "trap" + TUNNELCONFIGURATIONPHASE2DPD_ACTION_RESTART TunnelConfigurationPhase2DpdAction = "restart" +) + +// All allowed values of TunnelConfigurationPhase2 enum +var AllowedTunnelConfigurationPhase2DpdActionEnumValues = []TunnelConfigurationPhase2DpdAction{ + "clear", + "trap", + "restart", +} + +func (v *TunnelConfigurationPhase2DpdAction) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson TunnelConfigurationPhase2DpdAction + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := TunnelConfigurationPhase2DpdAction(value) + for _, existing := range AllowedTunnelConfigurationPhase2DpdActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid TunnelConfigurationPhase2", value) +} + +// NewTunnelConfigurationPhase2DpdActionFromValue returns a pointer to a valid TunnelConfigurationPhase2DpdAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTunnelConfigurationPhase2DpdActionFromValue(v TunnelConfigurationPhase2DpdAction) (*TunnelConfigurationPhase2DpdAction, error) { + ev := TunnelConfigurationPhase2DpdAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TunnelConfigurationPhase2DpdAction: valid values are %v", v, AllowedTunnelConfigurationPhase2DpdActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TunnelConfigurationPhase2DpdAction) IsValid() bool { + for _, existing := range AllowedTunnelConfigurationPhase2DpdActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DpdActionDpdAction value +func (v TunnelConfigurationPhase2DpdAction) Ptr() *TunnelConfigurationPhase2DpdAction { + return &v +} + +type NullableTunnelConfigurationPhase2DpdAction struct { + value *TunnelConfigurationPhase2DpdAction + isSet bool +} + +func (v NullableTunnelConfigurationPhase2DpdAction) Get() *TunnelConfigurationPhase2DpdAction { + return v.value +} + +func (v *NullableTunnelConfigurationPhase2DpdAction) Set(val *TunnelConfigurationPhase2DpdAction) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfigurationPhase2DpdAction) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfigurationPhase2DpdAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfigurationPhase2DpdAction(val *TunnelConfigurationPhase2DpdAction) *NullableTunnelConfigurationPhase2DpdAction { + return &NullableTunnelConfigurationPhase2DpdAction{value: val, isSet: true} +} + +func (v NullableTunnelConfigurationPhase2DpdAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfigurationPhase2DpdAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type TunnelConfigurationPhase2GetDpdActionAttributeType = *TunnelConfigurationPhase2DpdAction +type TunnelConfigurationPhase2GetDpdActionArgType = TunnelConfigurationPhase2DpdAction +type TunnelConfigurationPhase2GetDpdActionRetType = TunnelConfigurationPhase2DpdAction + +func getTunnelConfigurationPhase2GetDpdActionAttributeTypeOk(arg TunnelConfigurationPhase2GetDpdActionAttributeType) (ret TunnelConfigurationPhase2GetDpdActionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase2GetDpdActionAttributeType(arg *TunnelConfigurationPhase2GetDpdActionAttributeType, val TunnelConfigurationPhase2GetDpdActionRetType) { + *arg = &val +} + +/* + types and functions for rekeyTime +*/ + +// isInteger +type TunnelConfigurationPhase2GetRekeyTimeAttributeType = *int64 +type TunnelConfigurationPhase2GetRekeyTimeArgType = int64 +type TunnelConfigurationPhase2GetRekeyTimeRetType = int64 + +func getTunnelConfigurationPhase2GetRekeyTimeAttributeTypeOk(arg TunnelConfigurationPhase2GetRekeyTimeAttributeType) (ret TunnelConfigurationPhase2GetRekeyTimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase2GetRekeyTimeAttributeType(arg *TunnelConfigurationPhase2GetRekeyTimeAttributeType, val TunnelConfigurationPhase2GetRekeyTimeRetType) { + *arg = &val +} + +/* + types and functions for startAction +*/ + +// isEnum + +// TunnelConfigurationPhase2StartAction Action to perform after loading the connection configuration. \"none\": The connection will be loaded but needs to be manually initiated. \"trap\": installs a trap policy which triggers the tunnel as soon as matching traffic has been detected. \"start\": initiates the connection actively. \"start|stop\": Immediately initiate a connection for which trap policies have been installed. +// value type for enums +type TunnelConfigurationPhase2StartAction string + +// List of StartAction +const ( + TUNNELCONFIGURATIONPHASE2START_ACTION_NONE TunnelConfigurationPhase2StartAction = "none" + TUNNELCONFIGURATIONPHASE2START_ACTION_TRAP TunnelConfigurationPhase2StartAction = "trap" + TUNNELCONFIGURATIONPHASE2START_ACTION_START TunnelConfigurationPhase2StartAction = "start" + TUNNELCONFIGURATIONPHASE2START_ACTION_TRAP_START TunnelConfigurationPhase2StartAction = "trap|start" +) + +// All allowed values of TunnelConfigurationPhase2 enum +var AllowedTunnelConfigurationPhase2StartActionEnumValues = []TunnelConfigurationPhase2StartAction{ + "none", + "trap", + "start", + "trap|start", +} + +func (v *TunnelConfigurationPhase2StartAction) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson TunnelConfigurationPhase2StartAction + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := TunnelConfigurationPhase2StartAction(value) + for _, existing := range AllowedTunnelConfigurationPhase2StartActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid TunnelConfigurationPhase2", value) +} + +// NewTunnelConfigurationPhase2StartActionFromValue returns a pointer to a valid TunnelConfigurationPhase2StartAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTunnelConfigurationPhase2StartActionFromValue(v TunnelConfigurationPhase2StartAction) (*TunnelConfigurationPhase2StartAction, error) { + ev := TunnelConfigurationPhase2StartAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TunnelConfigurationPhase2StartAction: valid values are %v", v, AllowedTunnelConfigurationPhase2StartActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TunnelConfigurationPhase2StartAction) IsValid() bool { + for _, existing := range AllowedTunnelConfigurationPhase2StartActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StartActionStartAction value +func (v TunnelConfigurationPhase2StartAction) Ptr() *TunnelConfigurationPhase2StartAction { + return &v +} + +type NullableTunnelConfigurationPhase2StartAction struct { + value *TunnelConfigurationPhase2StartAction + isSet bool +} + +func (v NullableTunnelConfigurationPhase2StartAction) Get() *TunnelConfigurationPhase2StartAction { + return v.value +} + +func (v *NullableTunnelConfigurationPhase2StartAction) Set(val *TunnelConfigurationPhase2StartAction) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfigurationPhase2StartAction) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfigurationPhase2StartAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfigurationPhase2StartAction(val *TunnelConfigurationPhase2StartAction) *NullableTunnelConfigurationPhase2StartAction { + return &NullableTunnelConfigurationPhase2StartAction{value: val, isSet: true} +} + +func (v NullableTunnelConfigurationPhase2StartAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfigurationPhase2StartAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type TunnelConfigurationPhase2GetStartActionAttributeType = *TunnelConfigurationPhase2StartAction +type TunnelConfigurationPhase2GetStartActionArgType = TunnelConfigurationPhase2StartAction +type TunnelConfigurationPhase2GetStartActionRetType = TunnelConfigurationPhase2StartAction + +func getTunnelConfigurationPhase2GetStartActionAttributeTypeOk(arg TunnelConfigurationPhase2GetStartActionAttributeType) (ret TunnelConfigurationPhase2GetStartActionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase2GetStartActionAttributeType(arg *TunnelConfigurationPhase2GetStartActionAttributeType, val TunnelConfigurationPhase2GetStartActionRetType) { + *arg = &val +} + +// TunnelConfigurationPhase2 struct for TunnelConfigurationPhase2 +type TunnelConfigurationPhase2 struct { + // The Diffie-Hellman Group. Required, except if AEAD algorithms are selected. + DhGroups TunnelConfigurationPhase2GetDhGroupsAttributeType `json:"dhGroups,omitempty"` + // REQUIRED + EncryptionAlgorithms TunnelConfigurationPhase2GetEncryptionAlgorithmsAttributeType `json:"encryptionAlgorithms" required:"true"` + // REQUIRED + IntegrityAlgorithms TunnelConfigurationPhase2GetIntegrityAlgorithmsAttributeType `json:"integrityAlgorithms" required:"true"` + // Action to perform for this CHILD_SA on DPD timeout. \"clear\": Closes the CHILD_SA and does not take further action. \"trap\": installs a trap policy which will catch matching traffic and tries to re-negotiate the tunnel on-demand). \"restart\": immediately tries to re-negotiate the CILD_SA under a fresh IKE_SA. + DpdAction TunnelConfigurationPhase2GetDpdActionAttributeType `json:"dpdAction,omitempty"` + // Time to schedule a Child SA re-keying (in seconds). + // Can be cast to int32 without loss of precision. + RekeyTime TunnelConfigurationPhase2GetRekeyTimeAttributeType `json:"rekeyTime,omitempty"` + // Action to perform after loading the connection configuration. \"none\": The connection will be loaded but needs to be manually initiated. \"trap\": installs a trap policy which triggers the tunnel as soon as matching traffic has been detected. \"start\": initiates the connection actively. \"start|stop\": Immediately initiate a connection for which trap policies have been installed. + StartAction TunnelConfigurationPhase2GetStartActionAttributeType `json:"startAction,omitempty"` +} + +type _TunnelConfigurationPhase2 TunnelConfigurationPhase2 + +// NewTunnelConfigurationPhase2 instantiates a new TunnelConfigurationPhase2 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 NewTunnelConfigurationPhase2(encryptionAlgorithms TunnelConfigurationPhase2GetEncryptionAlgorithmsArgType, integrityAlgorithms TunnelConfigurationPhase2GetIntegrityAlgorithmsArgType) *TunnelConfigurationPhase2 { + this := TunnelConfigurationPhase2{} + setTunnelConfigurationPhase2GetEncryptionAlgorithmsAttributeType(&this.EncryptionAlgorithms, encryptionAlgorithms) + setTunnelConfigurationPhase2GetIntegrityAlgorithmsAttributeType(&this.IntegrityAlgorithms, integrityAlgorithms) + return &this +} + +// NewTunnelConfigurationPhase2WithDefaults instantiates a new TunnelConfigurationPhase2 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 NewTunnelConfigurationPhase2WithDefaults() *TunnelConfigurationPhase2 { + this := TunnelConfigurationPhase2{} + var dpdAction TunnelConfigurationPhase2DpdAction = "restart" + this.DpdAction = &dpdAction + var rekeyTime int64 = 3600 + this.RekeyTime = &rekeyTime + var startAction TunnelConfigurationPhase2StartAction = "start" + this.StartAction = &startAction + return &this +} + +// GetDhGroups returns the DhGroups field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2) GetDhGroups() (res TunnelConfigurationPhase2GetDhGroupsRetType) { + res, _ = o.GetDhGroupsOk() + return +} + +// GetDhGroupsOk returns a tuple with the DhGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetDhGroupsOk() (ret TunnelConfigurationPhase2GetDhGroupsRetType, ok bool) { + return getTunnelConfigurationPhase2GetDhGroupsAttributeTypeOk(o.DhGroups) +} + +// HasDhGroups returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2) HasDhGroups() bool { + _, ok := o.GetDhGroupsOk() + return ok +} + +// SetDhGroups gets a reference to the given []string and assigns it to the DhGroups field. +func (o *TunnelConfigurationPhase2) SetDhGroups(v TunnelConfigurationPhase2GetDhGroupsRetType) { + setTunnelConfigurationPhase2GetDhGroupsAttributeType(&o.DhGroups, v) +} + +// GetEncryptionAlgorithms returns the EncryptionAlgorithms field value +func (o *TunnelConfigurationPhase2) GetEncryptionAlgorithms() (ret TunnelConfigurationPhase2GetEncryptionAlgorithmsRetType) { + ret, _ = o.GetEncryptionAlgorithmsOk() + return ret +} + +// GetEncryptionAlgorithmsOk returns a tuple with the EncryptionAlgorithms field value +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetEncryptionAlgorithmsOk() (ret TunnelConfigurationPhase2GetEncryptionAlgorithmsRetType, ok bool) { + return getTunnelConfigurationPhase2GetEncryptionAlgorithmsAttributeTypeOk(o.EncryptionAlgorithms) +} + +// SetEncryptionAlgorithms sets field value +func (o *TunnelConfigurationPhase2) SetEncryptionAlgorithms(v TunnelConfigurationPhase2GetEncryptionAlgorithmsRetType) { + setTunnelConfigurationPhase2GetEncryptionAlgorithmsAttributeType(&o.EncryptionAlgorithms, v) +} + +// GetIntegrityAlgorithms returns the IntegrityAlgorithms field value +func (o *TunnelConfigurationPhase2) GetIntegrityAlgorithms() (ret TunnelConfigurationPhase2GetIntegrityAlgorithmsRetType) { + ret, _ = o.GetIntegrityAlgorithmsOk() + return ret +} + +// GetIntegrityAlgorithmsOk returns a tuple with the IntegrityAlgorithms field value +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetIntegrityAlgorithmsOk() (ret TunnelConfigurationPhase2GetIntegrityAlgorithmsRetType, ok bool) { + return getTunnelConfigurationPhase2GetIntegrityAlgorithmsAttributeTypeOk(o.IntegrityAlgorithms) +} + +// SetIntegrityAlgorithms sets field value +func (o *TunnelConfigurationPhase2) SetIntegrityAlgorithms(v TunnelConfigurationPhase2GetIntegrityAlgorithmsRetType) { + setTunnelConfigurationPhase2GetIntegrityAlgorithmsAttributeType(&o.IntegrityAlgorithms, v) +} + +// GetDpdAction returns the DpdAction field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2) GetDpdAction() (res TunnelConfigurationPhase2GetDpdActionRetType) { + res, _ = o.GetDpdActionOk() + return +} + +// GetDpdActionOk returns a tuple with the DpdAction field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetDpdActionOk() (ret TunnelConfigurationPhase2GetDpdActionRetType, ok bool) { + return getTunnelConfigurationPhase2GetDpdActionAttributeTypeOk(o.DpdAction) +} + +// HasDpdAction returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2) HasDpdAction() bool { + _, ok := o.GetDpdActionOk() + return ok +} + +// SetDpdAction gets a reference to the given string and assigns it to the DpdAction field. +func (o *TunnelConfigurationPhase2) SetDpdAction(v TunnelConfigurationPhase2GetDpdActionRetType) { + setTunnelConfigurationPhase2GetDpdActionAttributeType(&o.DpdAction, v) +} + +// GetRekeyTime returns the RekeyTime field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2) GetRekeyTime() (res TunnelConfigurationPhase2GetRekeyTimeRetType) { + res, _ = o.GetRekeyTimeOk() + return +} + +// GetRekeyTimeOk returns a tuple with the RekeyTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetRekeyTimeOk() (ret TunnelConfigurationPhase2GetRekeyTimeRetType, ok bool) { + return getTunnelConfigurationPhase2GetRekeyTimeAttributeTypeOk(o.RekeyTime) +} + +// HasRekeyTime returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2) HasRekeyTime() bool { + _, ok := o.GetRekeyTimeOk() + return ok +} + +// SetRekeyTime gets a reference to the given int64 and assigns it to the RekeyTime field. +func (o *TunnelConfigurationPhase2) SetRekeyTime(v TunnelConfigurationPhase2GetRekeyTimeRetType) { + setTunnelConfigurationPhase2GetRekeyTimeAttributeType(&o.RekeyTime, v) +} + +// GetStartAction returns the StartAction field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2) GetStartAction() (res TunnelConfigurationPhase2GetStartActionRetType) { + res, _ = o.GetStartActionOk() + return +} + +// GetStartActionOk returns a tuple with the StartAction field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2) GetStartActionOk() (ret TunnelConfigurationPhase2GetStartActionRetType, ok bool) { + return getTunnelConfigurationPhase2GetStartActionAttributeTypeOk(o.StartAction) +} + +// HasStartAction returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2) HasStartAction() bool { + _, ok := o.GetStartActionOk() + return ok +} + +// SetStartAction gets a reference to the given string and assigns it to the StartAction field. +func (o *TunnelConfigurationPhase2) SetStartAction(v TunnelConfigurationPhase2GetStartActionRetType) { + setTunnelConfigurationPhase2GetStartActionAttributeType(&o.StartAction, v) +} + +func (o TunnelConfigurationPhase2) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTunnelConfigurationPhase2GetDhGroupsAttributeTypeOk(o.DhGroups); ok { + toSerialize["DhGroups"] = val + } + if val, ok := getTunnelConfigurationPhase2GetEncryptionAlgorithmsAttributeTypeOk(o.EncryptionAlgorithms); ok { + toSerialize["EncryptionAlgorithms"] = val + } + if val, ok := getTunnelConfigurationPhase2GetIntegrityAlgorithmsAttributeTypeOk(o.IntegrityAlgorithms); ok { + toSerialize["IntegrityAlgorithms"] = val + } + if val, ok := getTunnelConfigurationPhase2GetDpdActionAttributeTypeOk(o.DpdAction); ok { + toSerialize["DpdAction"] = val + } + if val, ok := getTunnelConfigurationPhase2GetRekeyTimeAttributeTypeOk(o.RekeyTime); ok { + toSerialize["RekeyTime"] = val + } + if val, ok := getTunnelConfigurationPhase2GetStartActionAttributeTypeOk(o.StartAction); ok { + toSerialize["StartAction"] = val + } + return toSerialize, nil +} + +type NullableTunnelConfigurationPhase2 struct { + value *TunnelConfigurationPhase2 + isSet bool +} + +func (v NullableTunnelConfigurationPhase2) Get() *TunnelConfigurationPhase2 { + return v.value +} + +func (v *NullableTunnelConfigurationPhase2) Set(val *TunnelConfigurationPhase2) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfigurationPhase2) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfigurationPhase2) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfigurationPhase2(val *TunnelConfigurationPhase2) *NullableTunnelConfigurationPhase2 { + return &NullableTunnelConfigurationPhase2{value: val, isSet: true} +} + +func (v NullableTunnelConfigurationPhase2) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfigurationPhase2) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_tunnel_configuration_phase2_all_of.go b/pkg/vpnalpha/model_tunnel_configuration_phase2_all_of.go new file mode 100644 index 00000000..98ec4f55 --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_configuration_phase2_all_of.go @@ -0,0 +1,446 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" + "fmt" +) + +// checks if the TunnelConfigurationPhase2AllOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TunnelConfigurationPhase2AllOf{} + +/* + types and functions for dpdAction +*/ + +// isEnum + +// TunnelConfigurationPhase2AllOfDpdAction Action to perform for this CHILD_SA on DPD timeout. \"clear\": Closes the CHILD_SA and does not take further action. \"trap\": installs a trap policy which will catch matching traffic and tries to re-negotiate the tunnel on-demand). \"restart\": immediately tries to re-negotiate the CILD_SA under a fresh IKE_SA. +// value type for enums +type TunnelConfigurationPhase2AllOfDpdAction string + +// List of DpdAction +const ( + TUNNELCONFIGURATIONPHASE2ALLOFDPD_ACTION_CLEAR TunnelConfigurationPhase2AllOfDpdAction = "clear" + TUNNELCONFIGURATIONPHASE2ALLOFDPD_ACTION_TRAP TunnelConfigurationPhase2AllOfDpdAction = "trap" + TUNNELCONFIGURATIONPHASE2ALLOFDPD_ACTION_RESTART TunnelConfigurationPhase2AllOfDpdAction = "restart" +) + +// All allowed values of TunnelConfigurationPhase2AllOf enum +var AllowedTunnelConfigurationPhase2AllOfDpdActionEnumValues = []TunnelConfigurationPhase2AllOfDpdAction{ + "clear", + "trap", + "restart", +} + +func (v *TunnelConfigurationPhase2AllOfDpdAction) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson TunnelConfigurationPhase2AllOfDpdAction + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := TunnelConfigurationPhase2AllOfDpdAction(value) + for _, existing := range AllowedTunnelConfigurationPhase2AllOfDpdActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid TunnelConfigurationPhase2AllOf", value) +} + +// NewTunnelConfigurationPhase2AllOfDpdActionFromValue returns a pointer to a valid TunnelConfigurationPhase2AllOfDpdAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTunnelConfigurationPhase2AllOfDpdActionFromValue(v TunnelConfigurationPhase2AllOfDpdAction) (*TunnelConfigurationPhase2AllOfDpdAction, error) { + ev := TunnelConfigurationPhase2AllOfDpdAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TunnelConfigurationPhase2AllOfDpdAction: valid values are %v", v, AllowedTunnelConfigurationPhase2AllOfDpdActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TunnelConfigurationPhase2AllOfDpdAction) IsValid() bool { + for _, existing := range AllowedTunnelConfigurationPhase2AllOfDpdActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DpdActionDpdAction value +func (v TunnelConfigurationPhase2AllOfDpdAction) Ptr() *TunnelConfigurationPhase2AllOfDpdAction { + return &v +} + +type NullableTunnelConfigurationPhase2AllOfDpdAction struct { + value *TunnelConfigurationPhase2AllOfDpdAction + isSet bool +} + +func (v NullableTunnelConfigurationPhase2AllOfDpdAction) Get() *TunnelConfigurationPhase2AllOfDpdAction { + return v.value +} + +func (v *NullableTunnelConfigurationPhase2AllOfDpdAction) Set(val *TunnelConfigurationPhase2AllOfDpdAction) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfigurationPhase2AllOfDpdAction) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfigurationPhase2AllOfDpdAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfigurationPhase2AllOfDpdAction(val *TunnelConfigurationPhase2AllOfDpdAction) *NullableTunnelConfigurationPhase2AllOfDpdAction { + return &NullableTunnelConfigurationPhase2AllOfDpdAction{value: val, isSet: true} +} + +func (v NullableTunnelConfigurationPhase2AllOfDpdAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfigurationPhase2AllOfDpdAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type TunnelConfigurationPhase2AllOfGetDpdActionAttributeType = *TunnelConfigurationPhase2AllOfDpdAction +type TunnelConfigurationPhase2AllOfGetDpdActionArgType = TunnelConfigurationPhase2AllOfDpdAction +type TunnelConfigurationPhase2AllOfGetDpdActionRetType = TunnelConfigurationPhase2AllOfDpdAction + +func getTunnelConfigurationPhase2AllOfGetDpdActionAttributeTypeOk(arg TunnelConfigurationPhase2AllOfGetDpdActionAttributeType) (ret TunnelConfigurationPhase2AllOfGetDpdActionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase2AllOfGetDpdActionAttributeType(arg *TunnelConfigurationPhase2AllOfGetDpdActionAttributeType, val TunnelConfigurationPhase2AllOfGetDpdActionRetType) { + *arg = &val +} + +/* + types and functions for rekeyTime +*/ + +// isInteger +type TunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType = *int64 +type TunnelConfigurationPhase2AllOfGetRekeyTimeArgType = int64 +type TunnelConfigurationPhase2AllOfGetRekeyTimeRetType = int64 + +func getTunnelConfigurationPhase2AllOfGetRekeyTimeAttributeTypeOk(arg TunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType) (ret TunnelConfigurationPhase2AllOfGetRekeyTimeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType(arg *TunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType, val TunnelConfigurationPhase2AllOfGetRekeyTimeRetType) { + *arg = &val +} + +/* + types and functions for startAction +*/ + +// isEnum + +// TunnelConfigurationPhase2AllOfStartAction Action to perform after loading the connection configuration. \"none\": The connection will be loaded but needs to be manually initiated. \"trap\": installs a trap policy which triggers the tunnel as soon as matching traffic has been detected. \"start\": initiates the connection actively. \"start|stop\": Immediately initiate a connection for which trap policies have been installed. +// value type for enums +type TunnelConfigurationPhase2AllOfStartAction string + +// List of StartAction +const ( + TUNNELCONFIGURATIONPHASE2ALLOFSTART_ACTION_NONE TunnelConfigurationPhase2AllOfStartAction = "none" + TUNNELCONFIGURATIONPHASE2ALLOFSTART_ACTION_TRAP TunnelConfigurationPhase2AllOfStartAction = "trap" + TUNNELCONFIGURATIONPHASE2ALLOFSTART_ACTION_START TunnelConfigurationPhase2AllOfStartAction = "start" + TUNNELCONFIGURATIONPHASE2ALLOFSTART_ACTION_TRAP_START TunnelConfigurationPhase2AllOfStartAction = "trap|start" +) + +// All allowed values of TunnelConfigurationPhase2AllOf enum +var AllowedTunnelConfigurationPhase2AllOfStartActionEnumValues = []TunnelConfigurationPhase2AllOfStartAction{ + "none", + "trap", + "start", + "trap|start", +} + +func (v *TunnelConfigurationPhase2AllOfStartAction) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson TunnelConfigurationPhase2AllOfStartAction + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := TunnelConfigurationPhase2AllOfStartAction(value) + for _, existing := range AllowedTunnelConfigurationPhase2AllOfStartActionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid TunnelConfigurationPhase2AllOf", value) +} + +// NewTunnelConfigurationPhase2AllOfStartActionFromValue returns a pointer to a valid TunnelConfigurationPhase2AllOfStartAction +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTunnelConfigurationPhase2AllOfStartActionFromValue(v TunnelConfigurationPhase2AllOfStartAction) (*TunnelConfigurationPhase2AllOfStartAction, error) { + ev := TunnelConfigurationPhase2AllOfStartAction(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TunnelConfigurationPhase2AllOfStartAction: valid values are %v", v, AllowedTunnelConfigurationPhase2AllOfStartActionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TunnelConfigurationPhase2AllOfStartAction) IsValid() bool { + for _, existing := range AllowedTunnelConfigurationPhase2AllOfStartActionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StartActionStartAction value +func (v TunnelConfigurationPhase2AllOfStartAction) Ptr() *TunnelConfigurationPhase2AllOfStartAction { + return &v +} + +type NullableTunnelConfigurationPhase2AllOfStartAction struct { + value *TunnelConfigurationPhase2AllOfStartAction + isSet bool +} + +func (v NullableTunnelConfigurationPhase2AllOfStartAction) Get() *TunnelConfigurationPhase2AllOfStartAction { + return v.value +} + +func (v *NullableTunnelConfigurationPhase2AllOfStartAction) Set(val *TunnelConfigurationPhase2AllOfStartAction) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfigurationPhase2AllOfStartAction) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfigurationPhase2AllOfStartAction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfigurationPhase2AllOfStartAction(val *TunnelConfigurationPhase2AllOfStartAction) *NullableTunnelConfigurationPhase2AllOfStartAction { + return &NullableTunnelConfigurationPhase2AllOfStartAction{value: val, isSet: true} +} + +func (v NullableTunnelConfigurationPhase2AllOfStartAction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfigurationPhase2AllOfStartAction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type TunnelConfigurationPhase2AllOfGetStartActionAttributeType = *TunnelConfigurationPhase2AllOfStartAction +type TunnelConfigurationPhase2AllOfGetStartActionArgType = TunnelConfigurationPhase2AllOfStartAction +type TunnelConfigurationPhase2AllOfGetStartActionRetType = TunnelConfigurationPhase2AllOfStartAction + +func getTunnelConfigurationPhase2AllOfGetStartActionAttributeTypeOk(arg TunnelConfigurationPhase2AllOfGetStartActionAttributeType) (ret TunnelConfigurationPhase2AllOfGetStartActionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelConfigurationPhase2AllOfGetStartActionAttributeType(arg *TunnelConfigurationPhase2AllOfGetStartActionAttributeType, val TunnelConfigurationPhase2AllOfGetStartActionRetType) { + *arg = &val +} + +// TunnelConfigurationPhase2AllOf struct for TunnelConfigurationPhase2AllOf +type TunnelConfigurationPhase2AllOf struct { + // Action to perform for this CHILD_SA on DPD timeout. \"clear\": Closes the CHILD_SA and does not take further action. \"trap\": installs a trap policy which will catch matching traffic and tries to re-negotiate the tunnel on-demand). \"restart\": immediately tries to re-negotiate the CILD_SA under a fresh IKE_SA. + DpdAction TunnelConfigurationPhase2AllOfGetDpdActionAttributeType `json:"dpdAction,omitempty"` + // Time to schedule a Child SA re-keying (in seconds). + // Can be cast to int32 without loss of precision. + RekeyTime TunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType `json:"rekeyTime,omitempty"` + // Action to perform after loading the connection configuration. \"none\": The connection will be loaded but needs to be manually initiated. \"trap\": installs a trap policy which triggers the tunnel as soon as matching traffic has been detected. \"start\": initiates the connection actively. \"start|stop\": Immediately initiate a connection for which trap policies have been installed. + StartAction TunnelConfigurationPhase2AllOfGetStartActionAttributeType `json:"startAction,omitempty"` +} + +// NewTunnelConfigurationPhase2AllOf instantiates a new TunnelConfigurationPhase2AllOf 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 NewTunnelConfigurationPhase2AllOf() *TunnelConfigurationPhase2AllOf { + this := TunnelConfigurationPhase2AllOf{} + return &this +} + +// NewTunnelConfigurationPhase2AllOfWithDefaults instantiates a new TunnelConfigurationPhase2AllOf 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 NewTunnelConfigurationPhase2AllOfWithDefaults() *TunnelConfigurationPhase2AllOf { + this := TunnelConfigurationPhase2AllOf{} + var dpdAction TunnelConfigurationPhase2AllOfDpdAction = "restart" + this.DpdAction = &dpdAction + var rekeyTime int64 = 3600 + this.RekeyTime = &rekeyTime + var startAction TunnelConfigurationPhase2AllOfStartAction = "start" + this.StartAction = &startAction + return &this +} + +// GetDpdAction returns the DpdAction field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2AllOf) GetDpdAction() (res TunnelConfigurationPhase2AllOfGetDpdActionRetType) { + res, _ = o.GetDpdActionOk() + return +} + +// GetDpdActionOk returns a tuple with the DpdAction field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2AllOf) GetDpdActionOk() (ret TunnelConfigurationPhase2AllOfGetDpdActionRetType, ok bool) { + return getTunnelConfigurationPhase2AllOfGetDpdActionAttributeTypeOk(o.DpdAction) +} + +// HasDpdAction returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2AllOf) HasDpdAction() bool { + _, ok := o.GetDpdActionOk() + return ok +} + +// SetDpdAction gets a reference to the given string and assigns it to the DpdAction field. +func (o *TunnelConfigurationPhase2AllOf) SetDpdAction(v TunnelConfigurationPhase2AllOfGetDpdActionRetType) { + setTunnelConfigurationPhase2AllOfGetDpdActionAttributeType(&o.DpdAction, v) +} + +// GetRekeyTime returns the RekeyTime field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2AllOf) GetRekeyTime() (res TunnelConfigurationPhase2AllOfGetRekeyTimeRetType) { + res, _ = o.GetRekeyTimeOk() + return +} + +// GetRekeyTimeOk returns a tuple with the RekeyTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2AllOf) GetRekeyTimeOk() (ret TunnelConfigurationPhase2AllOfGetRekeyTimeRetType, ok bool) { + return getTunnelConfigurationPhase2AllOfGetRekeyTimeAttributeTypeOk(o.RekeyTime) +} + +// HasRekeyTime returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2AllOf) HasRekeyTime() bool { + _, ok := o.GetRekeyTimeOk() + return ok +} + +// SetRekeyTime gets a reference to the given int64 and assigns it to the RekeyTime field. +func (o *TunnelConfigurationPhase2AllOf) SetRekeyTime(v TunnelConfigurationPhase2AllOfGetRekeyTimeRetType) { + setTunnelConfigurationPhase2AllOfGetRekeyTimeAttributeType(&o.RekeyTime, v) +} + +// GetStartAction returns the StartAction field value if set, zero value otherwise. +func (o *TunnelConfigurationPhase2AllOf) GetStartAction() (res TunnelConfigurationPhase2AllOfGetStartActionRetType) { + res, _ = o.GetStartActionOk() + return +} + +// GetStartActionOk returns a tuple with the StartAction field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelConfigurationPhase2AllOf) GetStartActionOk() (ret TunnelConfigurationPhase2AllOfGetStartActionRetType, ok bool) { + return getTunnelConfigurationPhase2AllOfGetStartActionAttributeTypeOk(o.StartAction) +} + +// HasStartAction returns a boolean if a field has been set. +func (o *TunnelConfigurationPhase2AllOf) HasStartAction() bool { + _, ok := o.GetStartActionOk() + return ok +} + +// SetStartAction gets a reference to the given string and assigns it to the StartAction field. +func (o *TunnelConfigurationPhase2AllOf) SetStartAction(v TunnelConfigurationPhase2AllOfGetStartActionRetType) { + setTunnelConfigurationPhase2AllOfGetStartActionAttributeType(&o.StartAction, v) +} + +func (o TunnelConfigurationPhase2AllOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTunnelConfigurationPhase2AllOfGetDpdActionAttributeTypeOk(o.DpdAction); ok { + toSerialize["DpdAction"] = val + } + if val, ok := getTunnelConfigurationPhase2AllOfGetRekeyTimeAttributeTypeOk(o.RekeyTime); ok { + toSerialize["RekeyTime"] = val + } + if val, ok := getTunnelConfigurationPhase2AllOfGetStartActionAttributeTypeOk(o.StartAction); ok { + toSerialize["StartAction"] = val + } + return toSerialize, nil +} + +type NullableTunnelConfigurationPhase2AllOf struct { + value *TunnelConfigurationPhase2AllOf + isSet bool +} + +func (v NullableTunnelConfigurationPhase2AllOf) Get() *TunnelConfigurationPhase2AllOf { + return v.value +} + +func (v *NullableTunnelConfigurationPhase2AllOf) Set(val *TunnelConfigurationPhase2AllOf) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelConfigurationPhase2AllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelConfigurationPhase2AllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelConfigurationPhase2AllOf(val *TunnelConfigurationPhase2AllOf) *NullableTunnelConfigurationPhase2AllOf { + return &NullableTunnelConfigurationPhase2AllOf{value: val, isSet: true} +} + +func (v NullableTunnelConfigurationPhase2AllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelConfigurationPhase2AllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_tunnel_configuration_phase2_all_of_test.go b/pkg/vpnalpha/model_tunnel_configuration_phase2_all_of_test.go new file mode 100644 index 00000000..a98765fb --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_configuration_phase2_all_of_test.go @@ -0,0 +1,122 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "testing" +) + +// isEnum + +func TestTunnelConfigurationPhase2AllOfDpdAction_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"clear"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"trap"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"restart"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := TunnelConfigurationPhase2AllOfDpdAction("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +// isEnum + +func TestTunnelConfigurationPhase2AllOfStartAction_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"none"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"trap"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"start"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"trap|start"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := TunnelConfigurationPhase2AllOfStartAction("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/vpnalpha/model_tunnel_configuration_phase2_test.go b/pkg/vpnalpha/model_tunnel_configuration_phase2_test.go new file mode 100644 index 00000000..ea6e45ba --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_configuration_phase2_test.go @@ -0,0 +1,122 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "testing" +) + +// isEnum + +func TestTunnelConfigurationPhase2DpdAction_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"clear"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"trap"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"restart"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := TunnelConfigurationPhase2DpdAction("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +// isEnum + +func TestTunnelConfigurationPhase2StartAction_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"none"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"trap"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"start"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 4`, + args: args{ + src: []byte(`"trap|start"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := TunnelConfigurationPhase2StartAction("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/vpnalpha/model_tunnel_configuration_test.go b/pkg/vpnalpha/model_tunnel_configuration_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_configuration_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_tunnel_status.go b/pkg/vpnalpha/model_tunnel_status.go new file mode 100644 index 00000000..241fbd6a --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_status.go @@ -0,0 +1,373 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" + "fmt" +) + +// checks if the TunnelStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TunnelStatus{} + +/* + types and functions for established +*/ + +// isBoolean +type TunnelStatusgetEstablishedAttributeType = *bool +type TunnelStatusgetEstablishedArgType = bool +type TunnelStatusgetEstablishedRetType = bool + +func getTunnelStatusgetEstablishedAttributeTypeOk(arg TunnelStatusgetEstablishedAttributeType) (ret TunnelStatusgetEstablishedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelStatusgetEstablishedAttributeType(arg *TunnelStatusgetEstablishedAttributeType, val TunnelStatusgetEstablishedRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isEnum + +// TunnelStatusName the model 'TunnelStatus' +// value type for enums +type TunnelStatusName string + +// List of Name +const ( + TUNNELSTATUSNAME_TUNNEL1 TunnelStatusName = "tunnel1" + TUNNELSTATUSNAME_TUNNEL2 TunnelStatusName = "tunnel2" +) + +// All allowed values of TunnelStatus enum +var AllowedTunnelStatusNameEnumValues = []TunnelStatusName{ + "tunnel1", + "tunnel2", +} + +func (v *TunnelStatusName) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson TunnelStatusName + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := TunnelStatusName(value) + for _, existing := range AllowedTunnelStatusNameEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid TunnelStatus", value) +} + +// NewTunnelStatusNameFromValue returns a pointer to a valid TunnelStatusName +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTunnelStatusNameFromValue(v TunnelStatusName) (*TunnelStatusName, error) { + ev := TunnelStatusName(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TunnelStatusName: valid values are %v", v, AllowedTunnelStatusNameEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TunnelStatusName) IsValid() bool { + for _, existing := range AllowedTunnelStatusNameEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NameName value +func (v TunnelStatusName) Ptr() *TunnelStatusName { + return &v +} + +type NullableTunnelStatusName struct { + value *TunnelStatusName + isSet bool +} + +func (v NullableTunnelStatusName) Get() *TunnelStatusName { + return v.value +} + +func (v *NullableTunnelStatusName) Set(val *TunnelStatusName) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelStatusName) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelStatusName) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelStatusName(val *TunnelStatusName) *NullableTunnelStatusName { + return &NullableTunnelStatusName{value: val, isSet: true} +} + +func (v NullableTunnelStatusName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelStatusName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type TunnelStatusGetNameAttributeType = *TunnelStatusName +type TunnelStatusGetNameArgType = TunnelStatusName +type TunnelStatusGetNameRetType = TunnelStatusName + +func getTunnelStatusGetNameAttributeTypeOk(arg TunnelStatusGetNameAttributeType) (ret TunnelStatusGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelStatusGetNameAttributeType(arg *TunnelStatusGetNameAttributeType, val TunnelStatusGetNameRetType) { + *arg = &val +} + +/* + types and functions for phase1 +*/ + +// isModel +type TunnelStatusGetPhase1AttributeType = *Phase1Status +type TunnelStatusGetPhase1ArgType = Phase1Status +type TunnelStatusGetPhase1RetType = Phase1Status + +func getTunnelStatusGetPhase1AttributeTypeOk(arg TunnelStatusGetPhase1AttributeType) (ret TunnelStatusGetPhase1RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelStatusGetPhase1AttributeType(arg *TunnelStatusGetPhase1AttributeType, val TunnelStatusGetPhase1RetType) { + *arg = &val +} + +/* + types and functions for phase2 +*/ + +// isModel +type TunnelStatusGetPhase2AttributeType = *Phase2Status +type TunnelStatusGetPhase2ArgType = Phase2Status +type TunnelStatusGetPhase2RetType = Phase2Status + +func getTunnelStatusGetPhase2AttributeTypeOk(arg TunnelStatusGetPhase2AttributeType) (ret TunnelStatusGetPhase2RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setTunnelStatusGetPhase2AttributeType(arg *TunnelStatusGetPhase2AttributeType, val TunnelStatusGetPhase2RetType) { + *arg = &val +} + +// TunnelStatus Describes the status of the VPN itself. +type TunnelStatus struct { + Established TunnelStatusgetEstablishedAttributeType `json:"established,omitempty"` + Name TunnelStatusGetNameAttributeType `json:"name,omitempty"` + Phase1 TunnelStatusGetPhase1AttributeType `json:"phase1,omitempty"` + Phase2 TunnelStatusGetPhase2AttributeType `json:"phase2,omitempty"` +} + +// NewTunnelStatus instantiates a new TunnelStatus 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 NewTunnelStatus() *TunnelStatus { + this := TunnelStatus{} + return &this +} + +// NewTunnelStatusWithDefaults instantiates a new TunnelStatus 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 NewTunnelStatusWithDefaults() *TunnelStatus { + this := TunnelStatus{} + return &this +} + +// GetEstablished returns the Established field value if set, zero value otherwise. +func (o *TunnelStatus) GetEstablished() (res TunnelStatusgetEstablishedRetType) { + res, _ = o.GetEstablishedOk() + return +} + +// GetEstablishedOk returns a tuple with the Established field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelStatus) GetEstablishedOk() (ret TunnelStatusgetEstablishedRetType, ok bool) { + return getTunnelStatusgetEstablishedAttributeTypeOk(o.Established) +} + +// HasEstablished returns a boolean if a field has been set. +func (o *TunnelStatus) HasEstablished() bool { + _, ok := o.GetEstablishedOk() + return ok +} + +// SetEstablished gets a reference to the given bool and assigns it to the Established field. +func (o *TunnelStatus) SetEstablished(v TunnelStatusgetEstablishedRetType) { + setTunnelStatusgetEstablishedAttributeType(&o.Established, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TunnelStatus) GetName() (res TunnelStatusGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelStatus) GetNameOk() (ret TunnelStatusGetNameRetType, ok bool) { + return getTunnelStatusGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *TunnelStatus) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TunnelStatus) SetName(v TunnelStatusGetNameRetType) { + setTunnelStatusGetNameAttributeType(&o.Name, v) +} + +// GetPhase1 returns the Phase1 field value if set, zero value otherwise. +func (o *TunnelStatus) GetPhase1() (res TunnelStatusGetPhase1RetType) { + res, _ = o.GetPhase1Ok() + return +} + +// GetPhase1Ok returns a tuple with the Phase1 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelStatus) GetPhase1Ok() (ret TunnelStatusGetPhase1RetType, ok bool) { + return getTunnelStatusGetPhase1AttributeTypeOk(o.Phase1) +} + +// HasPhase1 returns a boolean if a field has been set. +func (o *TunnelStatus) HasPhase1() bool { + _, ok := o.GetPhase1Ok() + return ok +} + +// SetPhase1 gets a reference to the given Phase1Status and assigns it to the Phase1 field. +func (o *TunnelStatus) SetPhase1(v TunnelStatusGetPhase1RetType) { + setTunnelStatusGetPhase1AttributeType(&o.Phase1, v) +} + +// GetPhase2 returns the Phase2 field value if set, zero value otherwise. +func (o *TunnelStatus) GetPhase2() (res TunnelStatusGetPhase2RetType) { + res, _ = o.GetPhase2Ok() + return +} + +// GetPhase2Ok returns a tuple with the Phase2 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TunnelStatus) GetPhase2Ok() (ret TunnelStatusGetPhase2RetType, ok bool) { + return getTunnelStatusGetPhase2AttributeTypeOk(o.Phase2) +} + +// HasPhase2 returns a boolean if a field has been set. +func (o *TunnelStatus) HasPhase2() bool { + _, ok := o.GetPhase2Ok() + return ok +} + +// SetPhase2 gets a reference to the given Phase2Status and assigns it to the Phase2 field. +func (o *TunnelStatus) SetPhase2(v TunnelStatusGetPhase2RetType) { + setTunnelStatusGetPhase2AttributeType(&o.Phase2, v) +} + +func (o TunnelStatus) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getTunnelStatusgetEstablishedAttributeTypeOk(o.Established); ok { + toSerialize["Established"] = val + } + if val, ok := getTunnelStatusGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getTunnelStatusGetPhase1AttributeTypeOk(o.Phase1); ok { + toSerialize["Phase1"] = val + } + if val, ok := getTunnelStatusGetPhase2AttributeTypeOk(o.Phase2); ok { + toSerialize["Phase2"] = val + } + return toSerialize, nil +} + +type NullableTunnelStatus struct { + value *TunnelStatus + isSet bool +} + +func (v NullableTunnelStatus) Get() *TunnelStatus { + return v.value +} + +func (v *NullableTunnelStatus) Set(val *TunnelStatus) { + v.value = val + v.isSet = true +} + +func (v NullableTunnelStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableTunnelStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTunnelStatus(val *TunnelStatus) *NullableTunnelStatus { + return &NullableTunnelStatus{value: val, isSet: true} +} + +func (v NullableTunnelStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTunnelStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_tunnel_status_test.go b/pkg/vpnalpha/model_tunnel_status_test.go new file mode 100644 index 00000000..9054bd57 --- /dev/null +++ b/pkg/vpnalpha/model_tunnel_status_test.go @@ -0,0 +1,58 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "testing" +) + +// isEnum + +func TestTunnelStatusName_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"tunnel1"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"tunnel2"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := TunnelStatusName("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/vpnalpha/model_update_gateway_connection_payload.go b/pkg/vpnalpha/model_update_gateway_connection_payload.go new file mode 100644 index 00000000..8263b56f --- /dev/null +++ b/pkg/vpnalpha/model_update_gateway_connection_payload.go @@ -0,0 +1,397 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the UpdateGatewayConnectionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateGatewayConnectionPayload{} + +/* + types and functions for enabled +*/ + +// isBoolean +type UpdateGatewayConnectionPayloadgetEnabledAttributeType = *bool +type UpdateGatewayConnectionPayloadgetEnabledArgType = bool +type UpdateGatewayConnectionPayloadgetEnabledRetType = bool + +func getUpdateGatewayConnectionPayloadgetEnabledAttributeTypeOk(arg UpdateGatewayConnectionPayloadgetEnabledAttributeType) (ret UpdateGatewayConnectionPayloadgetEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateGatewayConnectionPayloadgetEnabledAttributeType(arg *UpdateGatewayConnectionPayloadgetEnabledAttributeType, val UpdateGatewayConnectionPayloadgetEnabledRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type UpdateGatewayConnectionPayloadGetLabelsAttributeType = *map[string]string +type UpdateGatewayConnectionPayloadGetLabelsArgType = map[string]string +type UpdateGatewayConnectionPayloadGetLabelsRetType = map[string]string + +func getUpdateGatewayConnectionPayloadGetLabelsAttributeTypeOk(arg UpdateGatewayConnectionPayloadGetLabelsAttributeType) (ret UpdateGatewayConnectionPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateGatewayConnectionPayloadGetLabelsAttributeType(arg *UpdateGatewayConnectionPayloadGetLabelsAttributeType, val UpdateGatewayConnectionPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for localSubnets +*/ + +// isArray +type UpdateGatewayConnectionPayloadGetLocalSubnetsAttributeType = *[]string +type UpdateGatewayConnectionPayloadGetLocalSubnetsArgType = []string +type UpdateGatewayConnectionPayloadGetLocalSubnetsRetType = []string + +func getUpdateGatewayConnectionPayloadGetLocalSubnetsAttributeTypeOk(arg UpdateGatewayConnectionPayloadGetLocalSubnetsAttributeType) (ret UpdateGatewayConnectionPayloadGetLocalSubnetsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateGatewayConnectionPayloadGetLocalSubnetsAttributeType(arg *UpdateGatewayConnectionPayloadGetLocalSubnetsAttributeType, val UpdateGatewayConnectionPayloadGetLocalSubnetsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateGatewayConnectionPayloadGetNameAttributeType = *string + +func getUpdateGatewayConnectionPayloadGetNameAttributeTypeOk(arg UpdateGatewayConnectionPayloadGetNameAttributeType) (ret UpdateGatewayConnectionPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateGatewayConnectionPayloadGetNameAttributeType(arg *UpdateGatewayConnectionPayloadGetNameAttributeType, val UpdateGatewayConnectionPayloadGetNameRetType) { + *arg = &val +} + +type UpdateGatewayConnectionPayloadGetNameArgType = string +type UpdateGatewayConnectionPayloadGetNameRetType = string + +/* + types and functions for remoteSubnets +*/ + +// isArray +type UpdateGatewayConnectionPayloadGetRemoteSubnetsAttributeType = *[]string +type UpdateGatewayConnectionPayloadGetRemoteSubnetsArgType = []string +type UpdateGatewayConnectionPayloadGetRemoteSubnetsRetType = []string + +func getUpdateGatewayConnectionPayloadGetRemoteSubnetsAttributeTypeOk(arg UpdateGatewayConnectionPayloadGetRemoteSubnetsAttributeType) (ret UpdateGatewayConnectionPayloadGetRemoteSubnetsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateGatewayConnectionPayloadGetRemoteSubnetsAttributeType(arg *UpdateGatewayConnectionPayloadGetRemoteSubnetsAttributeType, val UpdateGatewayConnectionPayloadGetRemoteSubnetsRetType) { + *arg = &val +} + +/* + types and functions for tunnel1 +*/ + +// isModel +type UpdateGatewayConnectionPayloadGetTunnel1AttributeType = *ConnectionRequestTunnel1 +type UpdateGatewayConnectionPayloadGetTunnel1ArgType = ConnectionRequestTunnel1 +type UpdateGatewayConnectionPayloadGetTunnel1RetType = ConnectionRequestTunnel1 + +func getUpdateGatewayConnectionPayloadGetTunnel1AttributeTypeOk(arg UpdateGatewayConnectionPayloadGetTunnel1AttributeType) (ret UpdateGatewayConnectionPayloadGetTunnel1RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateGatewayConnectionPayloadGetTunnel1AttributeType(arg *UpdateGatewayConnectionPayloadGetTunnel1AttributeType, val UpdateGatewayConnectionPayloadGetTunnel1RetType) { + *arg = &val +} + +/* + types and functions for tunnel2 +*/ + +// isModel +type UpdateGatewayConnectionPayloadGetTunnel2AttributeType = *ConnectionRequestTunnel1 +type UpdateGatewayConnectionPayloadGetTunnel2ArgType = ConnectionRequestTunnel1 +type UpdateGatewayConnectionPayloadGetTunnel2RetType = ConnectionRequestTunnel1 + +func getUpdateGatewayConnectionPayloadGetTunnel2AttributeTypeOk(arg UpdateGatewayConnectionPayloadGetTunnel2AttributeType) (ret UpdateGatewayConnectionPayloadGetTunnel2RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateGatewayConnectionPayloadGetTunnel2AttributeType(arg *UpdateGatewayConnectionPayloadGetTunnel2AttributeType, val UpdateGatewayConnectionPayloadGetTunnel2RetType) { + *arg = &val +} + +// UpdateGatewayConnectionPayload struct for UpdateGatewayConnectionPayload +type UpdateGatewayConnectionPayload struct { + // This flag decides whether this connection should be enabled or disabled + Enabled UpdateGatewayConnectionPayloadgetEnabledAttributeType `json:"enabled,omitempty"` + // Map of custom labels. Key and values must be max 63 chars, start/end with alphanumeric. + Labels UpdateGatewayConnectionPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // List of local subnets (IPv4 CIDR). + // REQUIRED + LocalSubnets UpdateGatewayConnectionPayloadGetLocalSubnetsAttributeType `json:"localSubnets" required:"true"` + // The name of the connection. Maximum 20 characters (only alphanumeric and hyphens allowed). The name bust be unique within the parent Gateway. Currently renaming is not possible therefore deleting and re-creating the connection is necessary. + // REQUIRED + Name UpdateGatewayConnectionPayloadGetNameAttributeType `json:"name" required:"true"` + // List of remote subnets (IPv4 CIDR). + // REQUIRED + RemoteSubnets UpdateGatewayConnectionPayloadGetRemoteSubnetsAttributeType `json:"remoteSubnets" required:"true"` + // REQUIRED + Tunnel1 UpdateGatewayConnectionPayloadGetTunnel1AttributeType `json:"tunnel1" required:"true"` + // REQUIRED + Tunnel2 UpdateGatewayConnectionPayloadGetTunnel2AttributeType `json:"tunnel2" required:"true"` +} + +type _UpdateGatewayConnectionPayload UpdateGatewayConnectionPayload + +// NewUpdateGatewayConnectionPayload instantiates a new UpdateGatewayConnectionPayload 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 NewUpdateGatewayConnectionPayload(localSubnets UpdateGatewayConnectionPayloadGetLocalSubnetsArgType, name UpdateGatewayConnectionPayloadGetNameArgType, remoteSubnets UpdateGatewayConnectionPayloadGetRemoteSubnetsArgType, tunnel1 UpdateGatewayConnectionPayloadGetTunnel1ArgType, tunnel2 UpdateGatewayConnectionPayloadGetTunnel2ArgType) *UpdateGatewayConnectionPayload { + this := UpdateGatewayConnectionPayload{} + setUpdateGatewayConnectionPayloadGetLocalSubnetsAttributeType(&this.LocalSubnets, localSubnets) + setUpdateGatewayConnectionPayloadGetNameAttributeType(&this.Name, name) + setUpdateGatewayConnectionPayloadGetRemoteSubnetsAttributeType(&this.RemoteSubnets, remoteSubnets) + setUpdateGatewayConnectionPayloadGetTunnel1AttributeType(&this.Tunnel1, tunnel1) + setUpdateGatewayConnectionPayloadGetTunnel2AttributeType(&this.Tunnel2, tunnel2) + return &this +} + +// NewUpdateGatewayConnectionPayloadWithDefaults instantiates a new UpdateGatewayConnectionPayload 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 NewUpdateGatewayConnectionPayloadWithDefaults() *UpdateGatewayConnectionPayload { + this := UpdateGatewayConnectionPayload{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *UpdateGatewayConnectionPayload) GetEnabled() (res UpdateGatewayConnectionPayloadgetEnabledRetType) { + res, _ = o.GetEnabledOk() + return +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetEnabledOk() (ret UpdateGatewayConnectionPayloadgetEnabledRetType, ok bool) { + return getUpdateGatewayConnectionPayloadgetEnabledAttributeTypeOk(o.Enabled) +} + +// HasEnabled returns a boolean if a field has been set. +func (o *UpdateGatewayConnectionPayload) HasEnabled() bool { + _, ok := o.GetEnabledOk() + return ok +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *UpdateGatewayConnectionPayload) SetEnabled(v UpdateGatewayConnectionPayloadgetEnabledRetType) { + setUpdateGatewayConnectionPayloadgetEnabledAttributeType(&o.Enabled, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateGatewayConnectionPayload) GetLabels() (res UpdateGatewayConnectionPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetLabelsOk() (ret UpdateGatewayConnectionPayloadGetLabelsRetType, ok bool) { + return getUpdateGatewayConnectionPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateGatewayConnectionPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateGatewayConnectionPayload) SetLabels(v UpdateGatewayConnectionPayloadGetLabelsRetType) { + setUpdateGatewayConnectionPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetLocalSubnets returns the LocalSubnets field value +func (o *UpdateGatewayConnectionPayload) GetLocalSubnets() (ret UpdateGatewayConnectionPayloadGetLocalSubnetsRetType) { + ret, _ = o.GetLocalSubnetsOk() + return ret +} + +// GetLocalSubnetsOk returns a tuple with the LocalSubnets field value +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetLocalSubnetsOk() (ret UpdateGatewayConnectionPayloadGetLocalSubnetsRetType, ok bool) { + return getUpdateGatewayConnectionPayloadGetLocalSubnetsAttributeTypeOk(o.LocalSubnets) +} + +// SetLocalSubnets sets field value +func (o *UpdateGatewayConnectionPayload) SetLocalSubnets(v UpdateGatewayConnectionPayloadGetLocalSubnetsRetType) { + setUpdateGatewayConnectionPayloadGetLocalSubnetsAttributeType(&o.LocalSubnets, v) +} + +// GetName returns the Name field value +func (o *UpdateGatewayConnectionPayload) GetName() (ret UpdateGatewayConnectionPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetNameOk() (ret UpdateGatewayConnectionPayloadGetNameRetType, ok bool) { + return getUpdateGatewayConnectionPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *UpdateGatewayConnectionPayload) SetName(v UpdateGatewayConnectionPayloadGetNameRetType) { + setUpdateGatewayConnectionPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRemoteSubnets returns the RemoteSubnets field value +func (o *UpdateGatewayConnectionPayload) GetRemoteSubnets() (ret UpdateGatewayConnectionPayloadGetRemoteSubnetsRetType) { + ret, _ = o.GetRemoteSubnetsOk() + return ret +} + +// GetRemoteSubnetsOk returns a tuple with the RemoteSubnets field value +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetRemoteSubnetsOk() (ret UpdateGatewayConnectionPayloadGetRemoteSubnetsRetType, ok bool) { + return getUpdateGatewayConnectionPayloadGetRemoteSubnetsAttributeTypeOk(o.RemoteSubnets) +} + +// SetRemoteSubnets sets field value +func (o *UpdateGatewayConnectionPayload) SetRemoteSubnets(v UpdateGatewayConnectionPayloadGetRemoteSubnetsRetType) { + setUpdateGatewayConnectionPayloadGetRemoteSubnetsAttributeType(&o.RemoteSubnets, v) +} + +// GetTunnel1 returns the Tunnel1 field value +func (o *UpdateGatewayConnectionPayload) GetTunnel1() (ret UpdateGatewayConnectionPayloadGetTunnel1RetType) { + ret, _ = o.GetTunnel1Ok() + return ret +} + +// GetTunnel1Ok returns a tuple with the Tunnel1 field value +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetTunnel1Ok() (ret UpdateGatewayConnectionPayloadGetTunnel1RetType, ok bool) { + return getUpdateGatewayConnectionPayloadGetTunnel1AttributeTypeOk(o.Tunnel1) +} + +// SetTunnel1 sets field value +func (o *UpdateGatewayConnectionPayload) SetTunnel1(v UpdateGatewayConnectionPayloadGetTunnel1RetType) { + setUpdateGatewayConnectionPayloadGetTunnel1AttributeType(&o.Tunnel1, v) +} + +// GetTunnel2 returns the Tunnel2 field value +func (o *UpdateGatewayConnectionPayload) GetTunnel2() (ret UpdateGatewayConnectionPayloadGetTunnel2RetType) { + ret, _ = o.GetTunnel2Ok() + return ret +} + +// GetTunnel2Ok returns a tuple with the Tunnel2 field value +// and a boolean to check if the value has been set. +func (o *UpdateGatewayConnectionPayload) GetTunnel2Ok() (ret UpdateGatewayConnectionPayloadGetTunnel2RetType, ok bool) { + return getUpdateGatewayConnectionPayloadGetTunnel2AttributeTypeOk(o.Tunnel2) +} + +// SetTunnel2 sets field value +func (o *UpdateGatewayConnectionPayload) SetTunnel2(v UpdateGatewayConnectionPayloadGetTunnel2RetType) { + setUpdateGatewayConnectionPayloadGetTunnel2AttributeType(&o.Tunnel2, v) +} + +func (o UpdateGatewayConnectionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateGatewayConnectionPayloadgetEnabledAttributeTypeOk(o.Enabled); ok { + toSerialize["Enabled"] = val + } + if val, ok := getUpdateGatewayConnectionPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateGatewayConnectionPayloadGetLocalSubnetsAttributeTypeOk(o.LocalSubnets); ok { + toSerialize["LocalSubnets"] = val + } + if val, ok := getUpdateGatewayConnectionPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateGatewayConnectionPayloadGetRemoteSubnetsAttributeTypeOk(o.RemoteSubnets); ok { + toSerialize["RemoteSubnets"] = val + } + if val, ok := getUpdateGatewayConnectionPayloadGetTunnel1AttributeTypeOk(o.Tunnel1); ok { + toSerialize["Tunnel1"] = val + } + if val, ok := getUpdateGatewayConnectionPayloadGetTunnel2AttributeTypeOk(o.Tunnel2); ok { + toSerialize["Tunnel2"] = val + } + return toSerialize, nil +} + +type NullableUpdateGatewayConnectionPayload struct { + value *UpdateGatewayConnectionPayload + isSet bool +} + +func (v NullableUpdateGatewayConnectionPayload) Get() *UpdateGatewayConnectionPayload { + return v.value +} + +func (v *NullableUpdateGatewayConnectionPayload) Set(val *UpdateGatewayConnectionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateGatewayConnectionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateGatewayConnectionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateGatewayConnectionPayload(val *UpdateGatewayConnectionPayload) *NullableUpdateGatewayConnectionPayload { + return &NullableUpdateGatewayConnectionPayload{value: val, isSet: true} +} + +func (v NullableUpdateGatewayConnectionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateGatewayConnectionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_update_gateway_connection_payload_test.go b/pkg/vpnalpha/model_update_gateway_connection_payload_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_update_gateway_connection_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_update_vpn_gateway_payload.go b/pkg/vpnalpha/model_update_vpn_gateway_payload.go new file mode 100644 index 00000000..634876ae --- /dev/null +++ b/pkg/vpnalpha/model_update_vpn_gateway_payload.go @@ -0,0 +1,358 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the UpdateVPNGatewayPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVPNGatewayPayload{} + +/* + types and functions for availabilityZones +*/ + +// isModel +type UpdateVPNGatewayPayloadGetAvailabilityZonesAttributeType = *CreateVPNGatewayPayloadAvailabilityZones +type UpdateVPNGatewayPayloadGetAvailabilityZonesArgType = CreateVPNGatewayPayloadAvailabilityZones +type UpdateVPNGatewayPayloadGetAvailabilityZonesRetType = CreateVPNGatewayPayloadAvailabilityZones + +func getUpdateVPNGatewayPayloadGetAvailabilityZonesAttributeTypeOk(arg UpdateVPNGatewayPayloadGetAvailabilityZonesAttributeType) (ret UpdateVPNGatewayPayloadGetAvailabilityZonesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVPNGatewayPayloadGetAvailabilityZonesAttributeType(arg *UpdateVPNGatewayPayloadGetAvailabilityZonesAttributeType, val UpdateVPNGatewayPayloadGetAvailabilityZonesRetType) { + *arg = &val +} + +/* + types and functions for bgpEnabled +*/ + +// isBoolean +type UpdateVPNGatewayPayloadgetBgpEnabledAttributeType = *bool +type UpdateVPNGatewayPayloadgetBgpEnabledArgType = bool +type UpdateVPNGatewayPayloadgetBgpEnabledRetType = bool + +func getUpdateVPNGatewayPayloadgetBgpEnabledAttributeTypeOk(arg UpdateVPNGatewayPayloadgetBgpEnabledAttributeType) (ret UpdateVPNGatewayPayloadgetBgpEnabledRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVPNGatewayPayloadgetBgpEnabledAttributeType(arg *UpdateVPNGatewayPayloadgetBgpEnabledAttributeType, val UpdateVPNGatewayPayloadgetBgpEnabledRetType) { + *arg = &val +} + +/* + types and functions for bgpGatewayConfig +*/ + +// isModel +type UpdateVPNGatewayPayloadGetBgpGatewayConfigAttributeType = *BGPGatewayConfig +type UpdateVPNGatewayPayloadGetBgpGatewayConfigArgType = BGPGatewayConfig +type UpdateVPNGatewayPayloadGetBgpGatewayConfigRetType = BGPGatewayConfig + +func getUpdateVPNGatewayPayloadGetBgpGatewayConfigAttributeTypeOk(arg UpdateVPNGatewayPayloadGetBgpGatewayConfigAttributeType) (ret UpdateVPNGatewayPayloadGetBgpGatewayConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVPNGatewayPayloadGetBgpGatewayConfigAttributeType(arg *UpdateVPNGatewayPayloadGetBgpGatewayConfigAttributeType, val UpdateVPNGatewayPayloadGetBgpGatewayConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isContainer +type UpdateVPNGatewayPayloadGetLabelsAttributeType = *map[string]string +type UpdateVPNGatewayPayloadGetLabelsArgType = map[string]string +type UpdateVPNGatewayPayloadGetLabelsRetType = map[string]string + +func getUpdateVPNGatewayPayloadGetLabelsAttributeTypeOk(arg UpdateVPNGatewayPayloadGetLabelsAttributeType) (ret UpdateVPNGatewayPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVPNGatewayPayloadGetLabelsAttributeType(arg *UpdateVPNGatewayPayloadGetLabelsAttributeType, val UpdateVPNGatewayPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateVPNGatewayPayloadGetNameAttributeType = *string + +func getUpdateVPNGatewayPayloadGetNameAttributeTypeOk(arg UpdateVPNGatewayPayloadGetNameAttributeType) (ret UpdateVPNGatewayPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVPNGatewayPayloadGetNameAttributeType(arg *UpdateVPNGatewayPayloadGetNameAttributeType, val UpdateVPNGatewayPayloadGetNameRetType) { + *arg = &val +} + +type UpdateVPNGatewayPayloadGetNameArgType = string +type UpdateVPNGatewayPayloadGetNameRetType = string + +/* + types and functions for planId +*/ + +// isNotNullableString +type UpdateVPNGatewayPayloadGetPlanIdAttributeType = *string + +func getUpdateVPNGatewayPayloadGetPlanIdAttributeTypeOk(arg UpdateVPNGatewayPayloadGetPlanIdAttributeType) (ret UpdateVPNGatewayPayloadGetPlanIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVPNGatewayPayloadGetPlanIdAttributeType(arg *UpdateVPNGatewayPayloadGetPlanIdAttributeType, val UpdateVPNGatewayPayloadGetPlanIdRetType) { + *arg = &val +} + +type UpdateVPNGatewayPayloadGetPlanIdArgType = string +type UpdateVPNGatewayPayloadGetPlanIdRetType = string + +// UpdateVPNGatewayPayload struct for UpdateVPNGatewayPayload +type UpdateVPNGatewayPayload struct { + // REQUIRED + AvailabilityZones UpdateVPNGatewayPayloadGetAvailabilityZonesAttributeType `json:"availabilityZones" required:"true"` + // Enable BGP routing. (This will require a BGPGatewayConfig and also a BGPTunnelConfig for each Tunnel in each Connection) + BgpEnabled UpdateVPNGatewayPayloadgetBgpEnabledAttributeType `json:"bgpEnabled,omitempty"` + BgpGatewayConfig UpdateVPNGatewayPayloadGetBgpGatewayConfigAttributeType `json:"bgpGatewayConfig,omitempty"` + // Map of custom labels. Key and values must be max 63 chars, start/end with alphanumeric. + Labels UpdateVPNGatewayPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name of the VPN gateway. Maximum 20 characters (only alphanumeric and hyphens allowed). Not changeable after creation. + // REQUIRED + Name UpdateVPNGatewayPayloadGetNameAttributeType `json:"name" required:"true"` + // Service Plan to configure the limits of the VPN. Currently supported plans are p50, p100, p200. This list can change in the future where plan ids will be removed and new plans by added. That is the reason this is not an enum. + // REQUIRED + PlanId UpdateVPNGatewayPayloadGetPlanIdAttributeType `json:"planId" required:"true"` +} + +type _UpdateVPNGatewayPayload UpdateVPNGatewayPayload + +// NewUpdateVPNGatewayPayload instantiates a new UpdateVPNGatewayPayload 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 NewUpdateVPNGatewayPayload(availabilityZones UpdateVPNGatewayPayloadGetAvailabilityZonesArgType, name UpdateVPNGatewayPayloadGetNameArgType, planId UpdateVPNGatewayPayloadGetPlanIdArgType) *UpdateVPNGatewayPayload { + this := UpdateVPNGatewayPayload{} + setUpdateVPNGatewayPayloadGetAvailabilityZonesAttributeType(&this.AvailabilityZones, availabilityZones) + setUpdateVPNGatewayPayloadGetNameAttributeType(&this.Name, name) + setUpdateVPNGatewayPayloadGetPlanIdAttributeType(&this.PlanId, planId) + return &this +} + +// NewUpdateVPNGatewayPayloadWithDefaults instantiates a new UpdateVPNGatewayPayload 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 NewUpdateVPNGatewayPayloadWithDefaults() *UpdateVPNGatewayPayload { + this := UpdateVPNGatewayPayload{} + return &this +} + +// GetAvailabilityZones returns the AvailabilityZones field value +func (o *UpdateVPNGatewayPayload) GetAvailabilityZones() (ret UpdateVPNGatewayPayloadGetAvailabilityZonesRetType) { + ret, _ = o.GetAvailabilityZonesOk() + return ret +} + +// GetAvailabilityZonesOk returns a tuple with the AvailabilityZones field value +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetAvailabilityZonesOk() (ret UpdateVPNGatewayPayloadGetAvailabilityZonesRetType, ok bool) { + return getUpdateVPNGatewayPayloadGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones) +} + +// SetAvailabilityZones sets field value +func (o *UpdateVPNGatewayPayload) SetAvailabilityZones(v UpdateVPNGatewayPayloadGetAvailabilityZonesRetType) { + setUpdateVPNGatewayPayloadGetAvailabilityZonesAttributeType(&o.AvailabilityZones, v) +} + +// GetBgpEnabled returns the BgpEnabled field value if set, zero value otherwise. +func (o *UpdateVPNGatewayPayload) GetBgpEnabled() (res UpdateVPNGatewayPayloadgetBgpEnabledRetType) { + res, _ = o.GetBgpEnabledOk() + return +} + +// GetBgpEnabledOk returns a tuple with the BgpEnabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetBgpEnabledOk() (ret UpdateVPNGatewayPayloadgetBgpEnabledRetType, ok bool) { + return getUpdateVPNGatewayPayloadgetBgpEnabledAttributeTypeOk(o.BgpEnabled) +} + +// HasBgpEnabled returns a boolean if a field has been set. +func (o *UpdateVPNGatewayPayload) HasBgpEnabled() bool { + _, ok := o.GetBgpEnabledOk() + return ok +} + +// SetBgpEnabled gets a reference to the given bool and assigns it to the BgpEnabled field. +func (o *UpdateVPNGatewayPayload) SetBgpEnabled(v UpdateVPNGatewayPayloadgetBgpEnabledRetType) { + setUpdateVPNGatewayPayloadgetBgpEnabledAttributeType(&o.BgpEnabled, v) +} + +// GetBgpGatewayConfig returns the BgpGatewayConfig field value if set, zero value otherwise. +func (o *UpdateVPNGatewayPayload) GetBgpGatewayConfig() (res UpdateVPNGatewayPayloadGetBgpGatewayConfigRetType) { + res, _ = o.GetBgpGatewayConfigOk() + return +} + +// GetBgpGatewayConfigOk returns a tuple with the BgpGatewayConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetBgpGatewayConfigOk() (ret UpdateVPNGatewayPayloadGetBgpGatewayConfigRetType, ok bool) { + return getUpdateVPNGatewayPayloadGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig) +} + +// HasBgpGatewayConfig returns a boolean if a field has been set. +func (o *UpdateVPNGatewayPayload) HasBgpGatewayConfig() bool { + _, ok := o.GetBgpGatewayConfigOk() + return ok +} + +// SetBgpGatewayConfig gets a reference to the given BGPGatewayConfig and assigns it to the BgpGatewayConfig field. +func (o *UpdateVPNGatewayPayload) SetBgpGatewayConfig(v UpdateVPNGatewayPayloadGetBgpGatewayConfigRetType) { + setUpdateVPNGatewayPayloadGetBgpGatewayConfigAttributeType(&o.BgpGatewayConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateVPNGatewayPayload) GetLabels() (res UpdateVPNGatewayPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetLabelsOk() (ret UpdateVPNGatewayPayloadGetLabelsRetType, ok bool) { + return getUpdateVPNGatewayPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateVPNGatewayPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateVPNGatewayPayload) SetLabels(v UpdateVPNGatewayPayloadGetLabelsRetType) { + setUpdateVPNGatewayPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *UpdateVPNGatewayPayload) GetName() (ret UpdateVPNGatewayPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetNameOk() (ret UpdateVPNGatewayPayloadGetNameRetType, ok bool) { + return getUpdateVPNGatewayPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *UpdateVPNGatewayPayload) SetName(v UpdateVPNGatewayPayloadGetNameRetType) { + setUpdateVPNGatewayPayloadGetNameAttributeType(&o.Name, v) +} + +// GetPlanId returns the PlanId field value +func (o *UpdateVPNGatewayPayload) GetPlanId() (ret UpdateVPNGatewayPayloadGetPlanIdRetType) { + ret, _ = o.GetPlanIdOk() + return ret +} + +// GetPlanIdOk returns a tuple with the PlanId field value +// and a boolean to check if the value has been set. +func (o *UpdateVPNGatewayPayload) GetPlanIdOk() (ret UpdateVPNGatewayPayloadGetPlanIdRetType, ok bool) { + return getUpdateVPNGatewayPayloadGetPlanIdAttributeTypeOk(o.PlanId) +} + +// SetPlanId sets field value +func (o *UpdateVPNGatewayPayload) SetPlanId(v UpdateVPNGatewayPayloadGetPlanIdRetType) { + setUpdateVPNGatewayPayloadGetPlanIdAttributeType(&o.PlanId, v) +} + +func (o UpdateVPNGatewayPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateVPNGatewayPayloadGetAvailabilityZonesAttributeTypeOk(o.AvailabilityZones); ok { + toSerialize["AvailabilityZones"] = val + } + if val, ok := getUpdateVPNGatewayPayloadgetBgpEnabledAttributeTypeOk(o.BgpEnabled); ok { + toSerialize["BgpEnabled"] = val + } + if val, ok := getUpdateVPNGatewayPayloadGetBgpGatewayConfigAttributeTypeOk(o.BgpGatewayConfig); ok { + toSerialize["BgpGatewayConfig"] = val + } + if val, ok := getUpdateVPNGatewayPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateVPNGatewayPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateVPNGatewayPayloadGetPlanIdAttributeTypeOk(o.PlanId); ok { + toSerialize["PlanId"] = val + } + return toSerialize, nil +} + +type NullableUpdateVPNGatewayPayload struct { + value *UpdateVPNGatewayPayload + isSet bool +} + +func (v NullableUpdateVPNGatewayPayload) Get() *UpdateVPNGatewayPayload { + return v.value +} + +func (v *NullableUpdateVPNGatewayPayload) Set(val *UpdateVPNGatewayPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateVPNGatewayPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateVPNGatewayPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateVPNGatewayPayload(val *UpdateVPNGatewayPayload) *NullableUpdateVPNGatewayPayload { + return &NullableUpdateVPNGatewayPayload{value: val, isSet: true} +} + +func (v NullableUpdateVPNGatewayPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateVPNGatewayPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_update_vpn_gateway_payload_test.go b/pkg/vpnalpha/model_update_vpn_gateway_payload_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_update_vpn_gateway_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_vpn_tunnel_plan.go b/pkg/vpnalpha/model_vpn_tunnel_plan.go new file mode 100644 index 00000000..08c1903b --- /dev/null +++ b/pkg/vpnalpha/model_vpn_tunnel_plan.go @@ -0,0 +1,227 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" +) + +// checks if the VPNTunnelPlan type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VPNTunnelPlan{} + +/* + types and functions for name +*/ + +// isNotNullableString +type VPNTunnelPlanGetNameAttributeType = *string + +func getVPNTunnelPlanGetNameAttributeTypeOk(arg VPNTunnelPlanGetNameAttributeType) (ret VPNTunnelPlanGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVPNTunnelPlanGetNameAttributeType(arg *VPNTunnelPlanGetNameAttributeType, val VPNTunnelPlanGetNameRetType) { + *arg = &val +} + +type VPNTunnelPlanGetNameArgType = string +type VPNTunnelPlanGetNameRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type VPNTunnelPlanGetRegionAttributeType = *string + +func getVPNTunnelPlanGetRegionAttributeTypeOk(arg VPNTunnelPlanGetRegionAttributeType) (ret VPNTunnelPlanGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVPNTunnelPlanGetRegionAttributeType(arg *VPNTunnelPlanGetRegionAttributeType, val VPNTunnelPlanGetRegionRetType) { + *arg = &val +} + +type VPNTunnelPlanGetRegionArgType = string +type VPNTunnelPlanGetRegionRetType = string + +/* + types and functions for sku +*/ + +// isNotNullableString +type VPNTunnelPlanGetSkuAttributeType = *string + +func getVPNTunnelPlanGetSkuAttributeTypeOk(arg VPNTunnelPlanGetSkuAttributeType) (ret VPNTunnelPlanGetSkuRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVPNTunnelPlanGetSkuAttributeType(arg *VPNTunnelPlanGetSkuAttributeType, val VPNTunnelPlanGetSkuRetType) { + *arg = &val +} + +type VPNTunnelPlanGetSkuArgType = string +type VPNTunnelPlanGetSkuRetType = string + +// VPNTunnelPlan struct for VPNTunnelPlan +type VPNTunnelPlan struct { + // Tunnel model name + Name VPNTunnelPlanGetNameAttributeType `json:"name,omitempty"` + // Tunnel model region + Region VPNTunnelPlanGetRegionAttributeType `json:"region,omitempty"` + // Tunnel model SKU + Sku VPNTunnelPlanGetSkuAttributeType `json:"sku,omitempty"` +} + +// NewVPNTunnelPlan instantiates a new VPNTunnelPlan 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 NewVPNTunnelPlan() *VPNTunnelPlan { + this := VPNTunnelPlan{} + return &this +} + +// NewVPNTunnelPlanWithDefaults instantiates a new VPNTunnelPlan 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 NewVPNTunnelPlanWithDefaults() *VPNTunnelPlan { + this := VPNTunnelPlan{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VPNTunnelPlan) GetName() (res VPNTunnelPlanGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VPNTunnelPlan) GetNameOk() (ret VPNTunnelPlanGetNameRetType, ok bool) { + return getVPNTunnelPlanGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *VPNTunnelPlan) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VPNTunnelPlan) SetName(v VPNTunnelPlanGetNameRetType) { + setVPNTunnelPlanGetNameAttributeType(&o.Name, v) +} + +// GetRegion returns the Region field value if set, zero value otherwise. +func (o *VPNTunnelPlan) GetRegion() (res VPNTunnelPlanGetRegionRetType) { + res, _ = o.GetRegionOk() + return +} + +// GetRegionOk returns a tuple with the Region field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VPNTunnelPlan) GetRegionOk() (ret VPNTunnelPlanGetRegionRetType, ok bool) { + return getVPNTunnelPlanGetRegionAttributeTypeOk(o.Region) +} + +// HasRegion returns a boolean if a field has been set. +func (o *VPNTunnelPlan) HasRegion() bool { + _, ok := o.GetRegionOk() + return ok +} + +// SetRegion gets a reference to the given string and assigns it to the Region field. +func (o *VPNTunnelPlan) SetRegion(v VPNTunnelPlanGetRegionRetType) { + setVPNTunnelPlanGetRegionAttributeType(&o.Region, v) +} + +// GetSku returns the Sku field value if set, zero value otherwise. +func (o *VPNTunnelPlan) GetSku() (res VPNTunnelPlanGetSkuRetType) { + res, _ = o.GetSkuOk() + return +} + +// GetSkuOk returns a tuple with the Sku field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VPNTunnelPlan) GetSkuOk() (ret VPNTunnelPlanGetSkuRetType, ok bool) { + return getVPNTunnelPlanGetSkuAttributeTypeOk(o.Sku) +} + +// HasSku returns a boolean if a field has been set. +func (o *VPNTunnelPlan) HasSku() bool { + _, ok := o.GetSkuOk() + return ok +} + +// SetSku gets a reference to the given string and assigns it to the Sku field. +func (o *VPNTunnelPlan) SetSku(v VPNTunnelPlanGetSkuRetType) { + setVPNTunnelPlanGetSkuAttributeType(&o.Sku, v) +} + +func (o VPNTunnelPlan) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVPNTunnelPlanGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getVPNTunnelPlanGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getVPNTunnelPlanGetSkuAttributeTypeOk(o.Sku); ok { + toSerialize["Sku"] = val + } + return toSerialize, nil +} + +type NullableVPNTunnelPlan struct { + value *VPNTunnelPlan + isSet bool +} + +func (v NullableVPNTunnelPlan) Get() *VPNTunnelPlan { + return v.value +} + +func (v *NullableVPNTunnelPlan) Set(val *VPNTunnelPlan) { + v.value = val + v.isSet = true +} + +func (v NullableVPNTunnelPlan) IsSet() bool { + return v.isSet +} + +func (v *NullableVPNTunnelPlan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVPNTunnelPlan(val *VPNTunnelPlan) *NullableVPNTunnelPlan { + return &NullableVPNTunnelPlan{value: val, isSet: true} +} + +func (v NullableVPNTunnelPlan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVPNTunnelPlan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_vpn_tunnel_plan_test.go b/pkg/vpnalpha/model_vpn_tunnel_plan_test.go new file mode 100644 index 00000000..3e0ebd4f --- /dev/null +++ b/pkg/vpnalpha/model_vpn_tunnel_plan_test.go @@ -0,0 +1,11 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha diff --git a/pkg/vpnalpha/model_vpn_tunnels.go b/pkg/vpnalpha/model_vpn_tunnels.go new file mode 100644 index 00000000..d6b0b091 --- /dev/null +++ b/pkg/vpnalpha/model_vpn_tunnels.go @@ -0,0 +1,385 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" + "fmt" +) + +// checks if the VPNTunnels type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VPNTunnels{} + +/* + types and functions for bgpStatus +*/ + +// isModel +type VPNTunnelsGetBgpStatusAttributeType = *NullableBGPStatus +type VPNTunnelsGetBgpStatusArgType = *NullableBGPStatus +type VPNTunnelsGetBgpStatusRetType = *NullableBGPStatus + +func getVPNTunnelsGetBgpStatusAttributeTypeOk(arg VPNTunnelsGetBgpStatusAttributeType) (ret VPNTunnelsGetBgpStatusRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg, true +} + +func setVPNTunnelsGetBgpStatusAttributeType(arg *VPNTunnelsGetBgpStatusAttributeType, val VPNTunnelsGetBgpStatusRetType) { + *arg = val +} + +/* + types and functions for instanceState +*/ + +// isEnumRef +type VPNTunnelsGetInstanceStateAttributeType = *GatewayStatus +type VPNTunnelsGetInstanceStateArgType = GatewayStatus +type VPNTunnelsGetInstanceStateRetType = GatewayStatus + +func getVPNTunnelsGetInstanceStateAttributeTypeOk(arg VPNTunnelsGetInstanceStateAttributeType) (ret VPNTunnelsGetInstanceStateRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVPNTunnelsGetInstanceStateAttributeType(arg *VPNTunnelsGetInstanceStateAttributeType, val VPNTunnelsGetInstanceStateRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isEnum + +// VPNTunnelsName the model 'VPNTunnels' +// value type for enums +type VPNTunnelsName string + +// List of Name +const ( + VPNTUNNELSNAME_TUNNEL1 VPNTunnelsName = "tunnel1" + VPNTUNNELSNAME_TUNNEL2 VPNTunnelsName = "tunnel2" +) + +// All allowed values of VPNTunnels enum +var AllowedVPNTunnelsNameEnumValues = []VPNTunnelsName{ + "tunnel1", + "tunnel2", +} + +func (v *VPNTunnelsName) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson VPNTunnelsName + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := VPNTunnelsName(value) + for _, existing := range AllowedVPNTunnelsNameEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid VPNTunnels", value) +} + +// NewVPNTunnelsNameFromValue returns a pointer to a valid VPNTunnelsName +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewVPNTunnelsNameFromValue(v VPNTunnelsName) (*VPNTunnelsName, error) { + ev := VPNTunnelsName(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for VPNTunnelsName: valid values are %v", v, AllowedVPNTunnelsNameEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v VPNTunnelsName) IsValid() bool { + for _, existing := range AllowedVPNTunnelsNameEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to NameName value +func (v VPNTunnelsName) Ptr() *VPNTunnelsName { + return &v +} + +type NullableVPNTunnelsName struct { + value *VPNTunnelsName + isSet bool +} + +func (v NullableVPNTunnelsName) Get() *VPNTunnelsName { + return v.value +} + +func (v *NullableVPNTunnelsName) Set(val *VPNTunnelsName) { + v.value = val + v.isSet = true +} + +func (v NullableVPNTunnelsName) IsSet() bool { + return v.isSet +} + +func (v *NullableVPNTunnelsName) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVPNTunnelsName(val *VPNTunnelsName) *NullableVPNTunnelsName { + return &NullableVPNTunnelsName{value: val, isSet: true} +} + +func (v NullableVPNTunnelsName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVPNTunnelsName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type VPNTunnelsGetNameAttributeType = *VPNTunnelsName +type VPNTunnelsGetNameArgType = VPNTunnelsName +type VPNTunnelsGetNameRetType = VPNTunnelsName + +func getVPNTunnelsGetNameAttributeTypeOk(arg VPNTunnelsGetNameAttributeType) (ret VPNTunnelsGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVPNTunnelsGetNameAttributeType(arg *VPNTunnelsGetNameAttributeType, val VPNTunnelsGetNameRetType) { + *arg = &val +} + +/* + types and functions for publicIP +*/ + +// isNotNullableString +type VPNTunnelsGetPublicIPAttributeType = *string + +func getVPNTunnelsGetPublicIPAttributeTypeOk(arg VPNTunnelsGetPublicIPAttributeType) (ret VPNTunnelsGetPublicIPRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVPNTunnelsGetPublicIPAttributeType(arg *VPNTunnelsGetPublicIPAttributeType, val VPNTunnelsGetPublicIPRetType) { + *arg = &val +} + +type VPNTunnelsGetPublicIPArgType = string +type VPNTunnelsGetPublicIPRetType = string + +// VPNTunnels List all available tunnels with public IP and status +type VPNTunnels struct { + BgpStatus VPNTunnelsGetBgpStatusAttributeType `json:"bgpStatus,omitempty"` + InstanceState VPNTunnelsGetInstanceStateAttributeType `json:"instanceState,omitempty"` + Name VPNTunnelsGetNameAttributeType `json:"name,omitempty"` + PublicIP VPNTunnelsGetPublicIPAttributeType `json:"publicIP,omitempty"` +} + +// NewVPNTunnels instantiates a new VPNTunnels 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 NewVPNTunnels() *VPNTunnels { + this := VPNTunnels{} + return &this +} + +// NewVPNTunnelsWithDefaults instantiates a new VPNTunnels 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 NewVPNTunnelsWithDefaults() *VPNTunnels { + this := VPNTunnels{} + return &this +} + +// GetBgpStatus returns the BgpStatus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *VPNTunnels) GetBgpStatus() (res VPNTunnelsGetBgpStatusRetType) { + res, _ = o.GetBgpStatusOk() + return +} + +// GetBgpStatusOk returns a tuple with the BgpStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *VPNTunnels) GetBgpStatusOk() (ret VPNTunnelsGetBgpStatusRetType, ok bool) { + return getVPNTunnelsGetBgpStatusAttributeTypeOk(o.BgpStatus) +} + +// HasBgpStatus returns a boolean if a field has been set. +func (o *VPNTunnels) HasBgpStatus() bool { + _, ok := o.GetBgpStatusOk() + return ok +} + +// SetBgpStatus gets a reference to the given BGPStatus and assigns it to the BgpStatus field. +func (o *VPNTunnels) SetBgpStatus(v VPNTunnelsGetBgpStatusRetType) { + setVPNTunnelsGetBgpStatusAttributeType(&o.BgpStatus, v) +} + +// SetBgpStatusNil sets the value for BgpStatus to be an explicit nil +func (o *VPNTunnels) SetBgpStatusNil() { + o.BgpStatus = nil +} + +// UnsetBgpStatus ensures that no value is present for BgpStatus, not even an explicit nil +func (o *VPNTunnels) UnsetBgpStatus() { + o.BgpStatus = nil +} + +// GetInstanceState returns the InstanceState field value if set, zero value otherwise. +func (o *VPNTunnels) GetInstanceState() (res VPNTunnelsGetInstanceStateRetType) { + res, _ = o.GetInstanceStateOk() + return +} + +// GetInstanceStateOk returns a tuple with the InstanceState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VPNTunnels) GetInstanceStateOk() (ret VPNTunnelsGetInstanceStateRetType, ok bool) { + return getVPNTunnelsGetInstanceStateAttributeTypeOk(o.InstanceState) +} + +// HasInstanceState returns a boolean if a field has been set. +func (o *VPNTunnels) HasInstanceState() bool { + _, ok := o.GetInstanceStateOk() + return ok +} + +// SetInstanceState gets a reference to the given GatewayStatus and assigns it to the InstanceState field. +func (o *VPNTunnels) SetInstanceState(v VPNTunnelsGetInstanceStateRetType) { + setVPNTunnelsGetInstanceStateAttributeType(&o.InstanceState, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *VPNTunnels) GetName() (res VPNTunnelsGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VPNTunnels) GetNameOk() (ret VPNTunnelsGetNameRetType, ok bool) { + return getVPNTunnelsGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *VPNTunnels) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VPNTunnels) SetName(v VPNTunnelsGetNameRetType) { + setVPNTunnelsGetNameAttributeType(&o.Name, v) +} + +// GetPublicIP returns the PublicIP field value if set, zero value otherwise. +func (o *VPNTunnels) GetPublicIP() (res VPNTunnelsGetPublicIPRetType) { + res, _ = o.GetPublicIPOk() + return +} + +// GetPublicIPOk returns a tuple with the PublicIP field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VPNTunnels) GetPublicIPOk() (ret VPNTunnelsGetPublicIPRetType, ok bool) { + return getVPNTunnelsGetPublicIPAttributeTypeOk(o.PublicIP) +} + +// HasPublicIP returns a boolean if a field has been set. +func (o *VPNTunnels) HasPublicIP() bool { + _, ok := o.GetPublicIPOk() + return ok +} + +// SetPublicIP gets a reference to the given string and assigns it to the PublicIP field. +func (o *VPNTunnels) SetPublicIP(v VPNTunnelsGetPublicIPRetType) { + setVPNTunnelsGetPublicIPAttributeType(&o.PublicIP, v) +} + +func (o VPNTunnels) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVPNTunnelsGetBgpStatusAttributeTypeOk(o.BgpStatus); ok { + toSerialize["BgpStatus"] = val + } + if val, ok := getVPNTunnelsGetInstanceStateAttributeTypeOk(o.InstanceState); ok { + toSerialize["InstanceState"] = val + } + if val, ok := getVPNTunnelsGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getVPNTunnelsGetPublicIPAttributeTypeOk(o.PublicIP); ok { + toSerialize["PublicIP"] = val + } + return toSerialize, nil +} + +type NullableVPNTunnels struct { + value *VPNTunnels + isSet bool +} + +func (v NullableVPNTunnels) Get() *VPNTunnels { + return v.value +} + +func (v *NullableVPNTunnels) Set(val *VPNTunnels) { + v.value = val + v.isSet = true +} + +func (v NullableVPNTunnels) IsSet() bool { + return v.isSet +} + +func (v *NullableVPNTunnels) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVPNTunnels(val *VPNTunnels) *NullableVPNTunnels { + return &NullableVPNTunnels{value: val, isSet: true} +} + +func (v NullableVPNTunnels) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVPNTunnels) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/vpnalpha/model_vpn_tunnels_test.go b/pkg/vpnalpha/model_vpn_tunnels_test.go new file mode 100644 index 00000000..bd03cfbe --- /dev/null +++ b/pkg/vpnalpha/model_vpn_tunnels_test.go @@ -0,0 +1,58 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "testing" +) + +// isEnum + +func TestVPNTunnelsName_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"tunnel1"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"tunnel2"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := VPNTunnelsName("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/vpnalpha/utils.go b/pkg/vpnalpha/utils.go new file mode 100644 index 00000000..30c916c0 --- /dev/null +++ b/pkg/vpnalpha/utils.go @@ -0,0 +1,385 @@ +/* +STACKIT VPN API + +The STACKIT VPN API provides endpoints to provision and manage VPN instances in your STACKIT project. + +API version: 1alpha1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package vpnalpha + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/sample/postgres/outputs.tf b/sample/postgres/outputs.tf index bbe5490c..674ca8b9 100644 --- a/sample/postgres/outputs.tf +++ b/sample/postgres/outputs.tf @@ -1,3 +1,4 @@ + output "postgres_flavor" { value = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id } diff --git a/sample/postgres/postresql.tf b/sample/postgres/postresql.tf index 57a13fae..fa2f49e8 100644 --- a/sample/postgres/postresql.tf +++ b/sample/postgres/postresql.tf @@ -1,37 +1,65 @@ + data "stackitprivatepreview_postgresflexalpha_flavor" "pgsql_flavor" { - project_id = var.project_id - region = "eu01" - cpu = 2 - ram = 4 - node_type = "Single" + project_id = var.project_id + region = "eu01" + cpu = 2 + ram = 4 + node_type = "Single" storage_class = "premium-perf2-stackit" } resource "stackitprivatepreview_postgresflexalpha_instance" "msh-sna-pe-example" { project_id = var.project_id - name = "msh-sna-pe-example" + name = "mshpetest2" backup_schedule = "0 0 * * *" - retention_days = 33 - flavor_id = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id - replicas = 1 + retention_days = 45 + flavor_id = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id + replicas = 1 storage = { # class = "premium-perf2-stackit" - class = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.storage_class - size = 10 + performance_class = "premium-perf2-stackit" + size = 10 } encryption = { # key_id = stackit_kms_key.key.key_id # keyring_id = stackit_kms_keyring.keyring.keyring_id - key_id = var.key_id - keyring_id = var.keyring_id - key_version = var.key_version + kek_key_id = var.key_id + kek_key_ring_id = var.keyring_id + kek_key_version = var.key_version + service_account = var.sa_email + } + network = { + acl = ["0.0.0.0/0", "193.148.160.0/19", "170.85.2.177/32"] + access_scope = "PUBLIC" + } + version = 17 +} + +resource "stackitprivatepreview_postgresflexalpha_instance" "msh-sna-pe-example2" { + project_id = var.project_id + name = "mshpetest2-1" + backup_schedule = "0 0 * * *" + retention_days = 45 + flavor_id = data.stackitprivatepreview_postgresflexalpha_flavor.pgsql_flavor.flavor_id + replicas = 1 + storage = { + # class = "premium-perf2-stackit" + performance_class = "premium-perf2-stackit" + size = 10 + } + encryption = { + # key_id = stackit_kms_key.key.key_id + # keyring_id = stackit_kms_keyring.keyring.keyring_id + kek_key_id = var.key_id + kek_key_ring_id = var.keyring_id + kek_key_version = var.key_version service_account = var.sa_email } network = { acl = ["0.0.0.0/0", "193.148.160.0/19", "170.85.2.177/32"] access_scope = "SNA" } - version = 14 + version = 16 } resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbadminuser" { @@ -42,6 +70,14 @@ resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbadminuser" { # roles = ["createdb", "login", "createrole"] } +resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbadminuser2" { + project_id = var.project_id + instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-sna-pe-example2.instance_id + username = var.db_admin_username + roles = ["createdb", "login"] + # roles = ["createdb", "login", "createrole"] +} + resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbuser" { project_id = var.project_id instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-sna-pe-example.instance_id @@ -51,29 +87,30 @@ resource "stackitprivatepreview_postgresflexalpha_user" "ptlsdbuser" { } resource "stackitprivatepreview_postgresflexalpha_database" "example" { - depends_on = [stackitprivatepreview_postgresflexalpha_user.ptlsdbadminuser] + count = 5 + depends_on = [stackitprivatepreview_postgresflexalpha_user.ptlsdbadminuser] project_id = var.project_id instance_id = stackitprivatepreview_postgresflexalpha_instance.msh-sna-pe-example.instance_id - name = var.db_name + name = "${var.db_name}${count.index}" owner = var.db_admin_username } -data "stackitprivatepreview_postgresflexalpha_instance" "datapsql" { - project_id = var.project_id - instance_id = var.instance_id - region = "eu01" -} +# data "stackitprivatepreview_postgresflexalpha_instance" "datapsql" { +# project_id = var.project_id +# instance_id = var.instance_id +# region = "eu01" +# } -output "psql_instance_id" { - value = data.stackitprivatepreview_postgresflexalpha_instance.datapsql.instance_id -} +# output "psql_instance_id" { +# value = data.stackitprivatepreview_postgresflexalpha_instance.datapsql.instance_id +# } output "psql_user_password" { - value = stackitprivatepreview_postgresflexalpha_user.ptlsdbuser.password + value = stackitprivatepreview_postgresflexalpha_user.ptlsdbuser.password sensitive = true } output "psql_user_conn" { - value = stackitprivatepreview_postgresflexalpha_user.ptlsdbuser.connection_string + value = stackitprivatepreview_postgresflexalpha_user.ptlsdbuser.connection_string sensitive = true } diff --git a/sample/postgres/providers.tf b/sample/postgres/providers.tf index c5171712..5a54a129 100644 --- a/sample/postgres/providers.tf +++ b/sample/postgres/providers.tf @@ -1,3 +1,4 @@ + terraform { required_providers { # stackit = { @@ -5,8 +6,8 @@ terraform { # version = "~> 0.70" # } stackitprivatepreview = { - source = "registry.terraform.io/mhenselin/stackitprivatepreview" - version = "~> 0.1" + source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview" + version = "> 0.0" } } } diff --git a/sample/sqlserver/flavor.tf b/sample/sqlserver/flavor.tf index 667ead6f..216c8f1e 100644 --- a/sample/sqlserver/flavor.tf +++ b/sample/sqlserver/flavor.tf @@ -1,9 +1,10 @@ + data "stackitprivatepreview_sqlserverflexalpha_flavor" "sqlserver_flavor" { - project_id = var.project_id - region = "eu01" - cpu = 4 - ram = 16 - node_type = "Single" + project_id = var.project_id + region = "eu01" + cpu = 4 + ram = 16 + node_type = "Single" storage_class = "premium-perf2-stackit" } diff --git a/sample/sqlserver/providers.tf b/sample/sqlserver/providers.tf index c5171712..233d4df2 100644 --- a/sample/sqlserver/providers.tf +++ b/sample/sqlserver/providers.tf @@ -1,3 +1,4 @@ + terraform { required_providers { # stackit = { @@ -5,8 +6,8 @@ terraform { # version = "~> 0.70" # } stackitprivatepreview = { - source = "registry.terraform.io/mhenselin/stackitprivatepreview" - version = "~> 0.1" + source = "tfregistry.sysops.stackit.rocks/mhenselin/stackitprivatepreview" + version = "> 0.0" } } } @@ -14,7 +15,7 @@ terraform { # provider "stackit" { # default_region = "eu01" # enable_beta_resources = true -# service_account_key_path = "./service_account.json" +# service_account_key_path = "../service_account.json" # } provider "stackitprivatepreview" { diff --git a/sample/sqlserver/sqlserver.tf b/sample/sqlserver/sqlserver.tf index 4206b0fc..923bb423 100644 --- a/sample/sqlserver/sqlserver.tf +++ b/sample/sqlserver/sqlserver.tf @@ -13,7 +13,7 @@ # purpose = "symmetric_encrypt_decrypt" # access_scope = "SNA" # } - +# # output "keyid" { # value = stackit_kms_key.key.key_id # } @@ -23,16 +23,19 @@ resource "stackitprivatepreview_sqlserverflexalpha_instance" "sqlsrv" { name = "msh-example-instance-002" backup_schedule = "0 3 * * *" retention_days = 31 - flavor_id = data.stackitprivatepreview_sqlserverflexalpha_flavor.sqlserver_flavor.flavor_id + flavor_id = data.stackitprivatepreview_sqlserverflexalpha_flavor.sqlserver_flavor.flavor_id storage = { class = "premium-perf2-stackit" size = 50 } version = 2022 encryption = { - # key_id = stackit_kms_key.key.key_id - # keyring_id = stackit_kms_keyring.keyring.keyring_id - key_id = var.key_id + #key_id = stackit_kms_key.key.key_id + #keyring_id = stackit_kms_keyring.keyring.keyring_id + #key_version = 1 + # key with scope public + key_id = "fe039bcf-8d7b-431a-801d-9e81371a6b7b" + # key_id = var.key_id keyring_id = var.keyring_id key_version = var.key_version service_account = var.sa_email @@ -43,6 +46,34 @@ resource "stackitprivatepreview_sqlserverflexalpha_instance" "sqlsrv" { } } +resource "stackitprivatepreview_sqlserverflexalpha_instance" "sqlsrv-nosna" { + project_id = var.project_id + name = "msh-example-instance-nosna" + backup_schedule = "0 3 * * *" + retention_days = 31 + flavor_id = data.stackitprivatepreview_sqlserverflexalpha_flavor.sqlserver_flavor.flavor_id + storage = { + class = "premium-perf2-stackit" + size = 50 + } + version = 2022 + encryption = { + #key_id = stackit_kms_key.key.key_id + #keyring_id = stackit_kms_keyring.keyring.keyring_id + #key_version = 1 + #key_id = var.key_id + # key with scope public + key_id = "fe039bcf-8d7b-431a-801d-9e81371a6b7b" + keyring_id = var.keyring_id + key_version = var.key_version + service_account = var.sa_email + } + network = { + acl = ["0.0.0.0/0", "193.148.160.0/19"] + access_scope = "PUBLIC" + } +} + # data "stackitprivatepreview_sqlserverflexalpha_instance" "test" { # project_id = var.project_id # instance_id = var.instance_id @@ -53,17 +84,17 @@ resource "stackitprivatepreview_sqlserverflexalpha_instance" "sqlsrv" { # value = data.stackitprivatepreview_sqlserverflexalpha_instance.test # } -resource "stackitprivatepreview_sqlserverflexalpha_user" "ptlsdbadminuser" { - project_id = var.project_id - instance_id = stackitprivatepreview_sqlserverflexalpha_instance.sqlsrv.instance_id - username = var.db_admin_username - roles = ["##STACKIT_LoginManager##", "##STACKIT_DatabaseManager##"] -} +# resource "stackitprivatepreview_sqlserverflexalpha_user" "ptlsdbadminuser" { +# project_id = var.project_id +# instance_id = stackitprivatepreview_sqlserverflexalpha_instance.sqlsrv.instance_id +# username = var.db_admin_username +# roles = ["##STACKIT_LoginManager##", "##STACKIT_DatabaseManager##"] +# } -resource "stackitprivatepreview_sqlserverflexalpha_user" "ptlsdbuser" { - project_id = var.project_id - instance_id = stackitprivatepreview_sqlserverflexalpha_instance.sqlsrv.instance_id - username = var.db_username - roles = ["##STACKIT_LoginManager##"] -} +# resource "stackitprivatepreview_sqlserverflexalpha_user" "ptlsdbuser" { +# project_id = var.project_id +# instance_id = stackitprivatepreview_sqlserverflexalpha_instance.sqlsrv.instance_id +# username = var.db_username +# roles = ["##STACKIT_LoginManager##"] +# } diff --git a/sample/tf.sh b/sample/tf.sh index acec7988..8feaf799 100755 --- a/sample/tf.sh +++ b/sample/tf.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash + # ./tf.sh apply > >(tee -a stdout.log) 2> >(tee -a stderr.log >&2) usage() { @@ -13,7 +14,9 @@ usage() { CONFIG_FOLDER=$(dirname "$0") BINARY=terraform -while getopts ":b:hdit" arg; do +ADD="" + +while getopts ":b:hdirt" arg; do case $arg in b) # Set binary (default is terraform). BINARY=${OPTARG} @@ -29,6 +32,10 @@ while getopts ":b:hdit" arg; do export TF_LOG shift ;; + r) # Set log level to INFO. + ADD="-refresh-only" + shift + ;; t) # Set log level to TRACE. TF_LOG=TRACE export TF_LOG @@ -43,4 +50,4 @@ done TERRAFORM_CONFIG=${CONFIG_FOLDER}/config.tfrc export TERRAFORM_CONFIG -${BINARY} "$@" +${BINARY} "$@" ${ADD} diff --git a/scripts/check-docs.sh b/scripts/check-docs.sh index 7d50bc26..f741baf4 100755 --- a/scripts/check-docs.sh +++ b/scripts/check-docs.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash + # This script is used to ensure for PRs the docs are up-to-date via the CI pipeline # Usage: ./check-docs.sh set -eo pipefail diff --git a/scripts/lint-golangci-lint.sh b/scripts/lint-golangci-lint.sh index c2ffd78f..0a883589 100755 --- a/scripts/lint-golangci-lint.sh +++ b/scripts/lint-golangci-lint.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash + # This script lints the SDK modules and the internal examples # Pre-requisites: golangci-lint set -eo pipefail diff --git a/scripts/project.sh b/scripts/project.sh index 3a810b49..1d570c6a 100755 --- a/scripts/project.sh +++ b/scripts/project.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash + # This script is used to manage the project, only used for installing the required tools for now # Usage: ./project.sh [action] # * tools: Install required tools to run the project diff --git a/scripts/replace.sh b/scripts/replace.sh index 9326b1f7..a3169638 100755 --- a/scripts/replace.sh +++ b/scripts/replace.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash + # Add replace directives to local files to go.work set -eo pipefail diff --git a/scripts/tfplugindocs.sh b/scripts/tfplugindocs.sh index 18ac6ad8..6f9d5d1b 100755 --- a/scripts/tfplugindocs.sh +++ b/scripts/tfplugindocs.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash + # Pre-requisites: tfplugindocs set -eo pipefail diff --git a/service_specs/postgres-flex_database_config.yml b/service_specs/postgres-flex_database_config.yml new file mode 100644 index 00000000..8211b1a7 --- /dev/null +++ b/service_specs/postgres-flex_database_config.yml @@ -0,0 +1,24 @@ + +provider: + name: stackitprivatepreview + +resources: + database: + create: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases + method: POST + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId} + method: GET + update: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId} + method: PUT + delete: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId} + method: DELETE + +data_sources: + databases: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases + method: GET diff --git a/service_specs/postgres-flex_flavors_config.yml b/service_specs/postgres-flex_flavors_config.yml new file mode 100644 index 00000000..ad0f33e5 --- /dev/null +++ b/service_specs/postgres-flex_flavors_config.yml @@ -0,0 +1,9 @@ + +provider: + name: stackitprivatepreview + +data_sources: + flavors: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/flavors + method: GET diff --git a/service_specs/postgres-flex_instance_config.yml b/service_specs/postgres-flex_instance_config.yml new file mode 100644 index 00000000..91d70ed6 --- /dev/null +++ b/service_specs/postgres-flex_instance_config.yml @@ -0,0 +1,35 @@ + +provider: + name: stackitprivatepreview + +resources: + instance: + schema: + attributes: + name: + plan_modifiers: + - UseStateForUnknown + + create: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances + method: POST + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId} + method: GET + update: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId} + method: PUT + delete: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId} + method: DELETE + +data_sources: + instances: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances + method: GET + + instance: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId} + method: GET diff --git a/service_specs/postgres-flex_role_config.yml b/service_specs/postgres-flex_role_config.yml new file mode 100644 index 00000000..74ae78f9 --- /dev/null +++ b/service_specs/postgres-flex_role_config.yml @@ -0,0 +1,9 @@ + +provider: + name: stackitprivatepreview + +data_sources: + roles: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/roles + method: GET diff --git a/service_specs/postgres-flex_user_config.yml b/service_specs/postgres-flex_user_config.yml new file mode 100644 index 00000000..2ce03079 --- /dev/null +++ b/service_specs/postgres-flex_user_config.yml @@ -0,0 +1,29 @@ + +provider: + name: stackitprivatepreview + +resources: + user: + create: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users + method: POST + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId} + method: GET + update: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId} + method: PUT + delete: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId} + method: DELETE + +data_sources: + users: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users + method: GET + + user: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId} + method: GET diff --git a/service_specs/postgres-flex_version_config.yml b/service_specs/postgres-flex_version_config.yml new file mode 100644 index 00000000..937dccd5 --- /dev/null +++ b/service_specs/postgres-flex_version_config.yml @@ -0,0 +1,9 @@ + +provider: + name: stackitprivatepreview + +data_sources: + versions: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/versions + method: GET diff --git a/service_specs/sqlserverflex_backup_config.yml.disabled b/service_specs/sqlserverflex_backup_config.yml.disabled new file mode 100644 index 00000000..c75d34ef --- /dev/null +++ b/service_specs/sqlserverflex_backup_config.yml.disabled @@ -0,0 +1,13 @@ +provider: + name: stackitprivatepreview + +data_sources: + backups: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups + method: GET + + backup: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/{backupId} + method: GET diff --git a/service_specs/sqlserverflex_collation_config.yml.disabled b/service_specs/sqlserverflex_collation_config.yml.disabled new file mode 100644 index 00000000..9cb13c19 --- /dev/null +++ b/service_specs/sqlserverflex_collation_config.yml.disabled @@ -0,0 +1,8 @@ +provider: + name: stackitprivatepreview + +data_sources: + collation: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/collations + method: GET diff --git a/service_specs/sqlserverflex_database_config.yml b/service_specs/sqlserverflex_database_config.yml new file mode 100644 index 00000000..e8ea6ef9 --- /dev/null +++ b/service_specs/sqlserverflex_database_config.yml @@ -0,0 +1,34 @@ + +provider: + name: stackitprivatepreview + +resources: + database: + schema: + attributes: + aliases: + id: database_id + create: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases + method: POST + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseName} + method: GET + delete: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseName} + method: DELETE + + +data_sources: + databases: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases + method: GET + + database: + attributes: + aliases: + id: database_id + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseName} + method: GET diff --git a/service_specs/sqlserverflex_flavors_config.yml b/service_specs/sqlserverflex_flavors_config.yml new file mode 100644 index 00000000..ad0f33e5 --- /dev/null +++ b/service_specs/sqlserverflex_flavors_config.yml @@ -0,0 +1,9 @@ + +provider: + name: stackitprivatepreview + +data_sources: + flavors: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/flavors + method: GET diff --git a/service_specs/sqlserverflex_instance_config.yml b/service_specs/sqlserverflex_instance_config.yml new file mode 100644 index 00000000..bef39890 --- /dev/null +++ b/service_specs/sqlserverflex_instance_config.yml @@ -0,0 +1,24 @@ + +provider: + name: stackitprivatepreview + +resources: + instance: + create: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances + method: POST + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId} + method: GET + update: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId} + method: PUT + delete: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId} + method: DELETE + +data_sources: + instance: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId} + method: GET diff --git a/service_specs/sqlserverflex_user_config.yml b/service_specs/sqlserverflex_user_config.yml new file mode 100644 index 00000000..574f1f12 --- /dev/null +++ b/service_specs/sqlserverflex_user_config.yml @@ -0,0 +1,24 @@ + +provider: + name: stackitprivatepreview + +resources: + user: + create: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users + method: POST + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId} + method: GET + update: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId} + method: PUT + delete: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId} + method: DELETE + +data_sources: + user: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/instances/{instanceId}/users + method: GET diff --git a/service_specs/sqlserverflex_version_config.yml b/service_specs/sqlserverflex_version_config.yml new file mode 100644 index 00000000..3a3f982d --- /dev/null +++ b/service_specs/sqlserverflex_version_config.yml @@ -0,0 +1,9 @@ + +provider: + name: stackitprivatepreview + +data_sources: + version: + read: + path: /v3alpha1/projects/{projectId}/regions/{region}/versions + method: GET diff --git a/stackit/internal/services/postgresflexalpha/database/datasources_gen/databases_data_source_gen.go b/stackit/internal/services/postgresflexalpha/database/datasources_gen/databases_data_source_gen.go new file mode 100644 index 00000000..7e3e1eec --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/database/datasources_gen/databases_data_source_gen.go @@ -0,0 +1,1180 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package postgresflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func DatabasesDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "databases": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "created": schema.StringAttribute{ + Computed: true, + Description: "The data when the database was created in RFC3339 format.", + MarkdownDescription: "The data when the database was created in RFC3339 format.", + }, + "id": schema.Int64Attribute{ + Computed: true, + Description: "The id of the database.", + MarkdownDescription: "The id of the database.", + }, + "name": schema.StringAttribute{ + Computed: true, + Description: "The name of the database.", + MarkdownDescription: "The name of the database.", + }, + "owner": schema.StringAttribute{ + Computed: true, + Description: "The owner of the database.", + MarkdownDescription: "The owner of the database.", + }, + }, + CustomType: DatabasesType{ + ObjectType: types.ObjectType{ + AttrTypes: DatabasesValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "A list containing all databases for the instance.", + MarkdownDescription: "A list containing all databases for the instance.", + }, + "instance_id": schema.StringAttribute{ + Required: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "page": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of the page of items list to be returned.", + MarkdownDescription: "Number of the page of items list to be returned.", + }, + "pagination": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "page": schema.Int64Attribute{ + Computed: true, + }, + "size": schema.Int64Attribute{ + Computed: true, + }, + "sort": schema.StringAttribute{ + Computed: true, + }, + "total_pages": schema.Int64Attribute{ + Computed: true, + }, + "total_rows": schema.Int64Attribute{ + Computed: true, + }, + }, + CustomType: PaginationType{ + ObjectType: types.ObjectType{ + AttrTypes: PaginationValue{}.AttributeTypes(ctx), + }, + }, + Computed: true, + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "size": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of items to be returned on each page.", + MarkdownDescription: "Number of items to be returned on each page.", + }, + "sort": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "Sorting of the databases to be returned on each page.", + MarkdownDescription: "Sorting of the databases to be returned on each page.", + Validators: []validator.String{ + stringvalidator.OneOf( + "created_at.desc", + "created_at.asc", + "database_id.desc", + "database_id.asc", + "database_name.desc", + "database_name.asc", + "database_owner.desc", + "database_owner.asc", + "index.asc", + "index.desc", + ), + }, + }, + }, + } +} + +type DatabasesModel struct { + Databases types.List `tfsdk:"databases"` + InstanceId types.String `tfsdk:"instance_id"` + Page types.Int64 `tfsdk:"page"` + Pagination PaginationValue `tfsdk:"pagination"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Size types.Int64 `tfsdk:"size"` + Sort types.String `tfsdk:"sort"` +} + +var _ basetypes.ObjectTypable = DatabasesType{} + +type DatabasesType struct { + basetypes.ObjectType +} + +func (t DatabasesType) Equal(o attr.Type) bool { + other, ok := o.(DatabasesType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t DatabasesType) String() string { + return "DatabasesType" +} + +func (t DatabasesType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + createdAttribute, ok := attributes["created"] + + if !ok { + diags.AddError( + "Attribute Missing", + `created is missing from object`) + + return nil, diags + } + + createdVal, ok := createdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`created expected to be basetypes.StringValue, was: %T`, createdAttribute)) + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return nil, diags + } + + idVal, ok := idAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute)) + } + + nameAttribute, ok := attributes["name"] + + if !ok { + diags.AddError( + "Attribute Missing", + `name is missing from object`) + + return nil, diags + } + + nameVal, ok := nameAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute)) + } + + ownerAttribute, ok := attributes["owner"] + + if !ok { + diags.AddError( + "Attribute Missing", + `owner is missing from object`) + + return nil, diags + } + + ownerVal, ok := ownerAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`owner expected to be basetypes.StringValue, was: %T`, ownerAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return DatabasesValue{ + Created: createdVal, + Id: idVal, + Name: nameVal, + Owner: ownerVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewDatabasesValueNull() DatabasesValue { + return DatabasesValue{ + state: attr.ValueStateNull, + } +} + +func NewDatabasesValueUnknown() DatabasesValue { + return DatabasesValue{ + state: attr.ValueStateUnknown, + } +} + +func NewDatabasesValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (DatabasesValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing DatabasesValue Attribute Value", + "While creating a DatabasesValue value, a missing attribute value was detected. "+ + "A DatabasesValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("DatabasesValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid DatabasesValue Attribute Type", + "While creating a DatabasesValue value, an invalid attribute value was detected. "+ + "A DatabasesValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("DatabasesValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("DatabasesValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra DatabasesValue Attribute Value", + "While creating a DatabasesValue value, an extra attribute value was detected. "+ + "A DatabasesValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra DatabasesValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewDatabasesValueUnknown(), diags + } + + createdAttribute, ok := attributes["created"] + + if !ok { + diags.AddError( + "Attribute Missing", + `created is missing from object`) + + return NewDatabasesValueUnknown(), diags + } + + createdVal, ok := createdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`created expected to be basetypes.StringValue, was: %T`, createdAttribute)) + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return NewDatabasesValueUnknown(), diags + } + + idVal, ok := idAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute)) + } + + nameAttribute, ok := attributes["name"] + + if !ok { + diags.AddError( + "Attribute Missing", + `name is missing from object`) + + return NewDatabasesValueUnknown(), diags + } + + nameVal, ok := nameAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute)) + } + + ownerAttribute, ok := attributes["owner"] + + if !ok { + diags.AddError( + "Attribute Missing", + `owner is missing from object`) + + return NewDatabasesValueUnknown(), diags + } + + ownerVal, ok := ownerAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`owner expected to be basetypes.StringValue, was: %T`, ownerAttribute)) + } + + if diags.HasError() { + return NewDatabasesValueUnknown(), diags + } + + return DatabasesValue{ + Created: createdVal, + Id: idVal, + Name: nameVal, + Owner: ownerVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewDatabasesValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) DatabasesValue { + object, diags := NewDatabasesValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewDatabasesValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t DatabasesType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewDatabasesValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewDatabasesValueUnknown(), nil + } + + if in.IsNull() { + return NewDatabasesValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewDatabasesValueMust(DatabasesValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t DatabasesType) ValueType(ctx context.Context) attr.Value { + return DatabasesValue{} +} + +var _ basetypes.ObjectValuable = DatabasesValue{} + +type DatabasesValue struct { + Created basetypes.StringValue `tfsdk:"created"` + Id basetypes.Int64Value `tfsdk:"id"` + Name basetypes.StringValue `tfsdk:"name"` + Owner basetypes.StringValue `tfsdk:"owner"` + state attr.ValueState +} + +func (v DatabasesValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 4) + + var val tftypes.Value + var err error + + attrTypes["created"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["id"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["name"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["owner"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 4) + + val, err = v.Created.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["created"] = val + + val, err = v.Id.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["id"] = val + + val, err = v.Name.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["name"] = val + + val, err = v.Owner.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["owner"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v DatabasesValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v DatabasesValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v DatabasesValue) String() string { + return "DatabasesValue" +} + +func (v DatabasesValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "created": basetypes.StringType{}, + "id": basetypes.Int64Type{}, + "name": basetypes.StringType{}, + "owner": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "created": v.Created, + "id": v.Id, + "name": v.Name, + "owner": v.Owner, + }) + + return objVal, diags +} + +func (v DatabasesValue) Equal(o attr.Value) bool { + other, ok := o.(DatabasesValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Created.Equal(other.Created) { + return false + } + + if !v.Id.Equal(other.Id) { + return false + } + + if !v.Name.Equal(other.Name) { + return false + } + + if !v.Owner.Equal(other.Owner) { + return false + } + + return true +} + +func (v DatabasesValue) Type(ctx context.Context) attr.Type { + return DatabasesType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v DatabasesValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "created": basetypes.StringType{}, + "id": basetypes.Int64Type{}, + "name": basetypes.StringType{}, + "owner": basetypes.StringType{}, + } +} + +var _ basetypes.ObjectTypable = PaginationType{} + +type PaginationType struct { + basetypes.ObjectType +} + +func (t PaginationType) Equal(o attr.Type) bool { + other, ok := o.(PaginationType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t PaginationType) String() string { + return "PaginationType" +} + +func (t PaginationType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return nil, diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return nil, diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return nil, diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return nil, diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return nil, diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueNull() PaginationValue { + return PaginationValue{ + state: attr.ValueStateNull, + } +} + +func NewPaginationValueUnknown() PaginationValue { + return PaginationValue{ + state: attr.ValueStateUnknown, + } +} + +func NewPaginationValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (PaginationValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing PaginationValue Attribute Value", + "While creating a PaginationValue value, a missing attribute value was detected. "+ + "A PaginationValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid PaginationValue Attribute Type", + "While creating a PaginationValue value, an invalid attribute value was detected. "+ + "A PaginationValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra PaginationValue Attribute Value", + "While creating a PaginationValue value, an extra attribute value was detected. "+ + "A PaginationValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra PaginationValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) PaginationValue { + object, diags := NewPaginationValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewPaginationValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t PaginationType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewPaginationValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewPaginationValueUnknown(), nil + } + + if in.IsNull() { + return NewPaginationValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewPaginationValueMust(PaginationValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t PaginationType) ValueType(ctx context.Context) attr.Value { + return PaginationValue{} +} + +var _ basetypes.ObjectValuable = PaginationValue{} + +type PaginationValue struct { + Page basetypes.Int64Value `tfsdk:"page"` + Size basetypes.Int64Value `tfsdk:"size"` + Sort basetypes.StringValue `tfsdk:"sort"` + TotalPages basetypes.Int64Value `tfsdk:"total_pages"` + TotalRows basetypes.Int64Value `tfsdk:"total_rows"` + state attr.ValueState +} + +func (v PaginationValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 5) + + var val tftypes.Value + var err error + + attrTypes["page"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["size"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["sort"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["total_pages"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["total_rows"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 5) + + val, err = v.Page.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["page"] = val + + val, err = v.Size.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["size"] = val + + val, err = v.Sort.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["sort"] = val + + val, err = v.TotalPages.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_pages"] = val + + val, err = v.TotalRows.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_rows"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v PaginationValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v PaginationValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v PaginationValue) String() string { + return "PaginationValue" +} + +func (v PaginationValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "page": v.Page, + "size": v.Size, + "sort": v.Sort, + "total_pages": v.TotalPages, + "total_rows": v.TotalRows, + }) + + return objVal, diags +} + +func (v PaginationValue) Equal(o attr.Value) bool { + other, ok := o.(PaginationValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Page.Equal(other.Page) { + return false + } + + if !v.Size.Equal(other.Size) { + return false + } + + if !v.Sort.Equal(other.Sort) { + return false + } + + if !v.TotalPages.Equal(other.TotalPages) { + return false + } + + if !v.TotalRows.Equal(other.TotalRows) { + return false + } + + return true +} + +func (v PaginationValue) Type(ctx context.Context) attr.Type { + return PaginationType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v PaginationValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } +} diff --git a/stackit/internal/services/postgresflexalpha/database/resources_gen/database_resource_gen.go b/stackit/internal/services/postgresflexalpha/database/resources_gen/database_resource_gen.go new file mode 100644 index 00000000..95f6b6e5 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/database/resources_gen/database_resource_gen.go @@ -0,0 +1,39 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package postgresflexalpha + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework/types" + + "github.com/hashicorp/terraform-plugin-framework/resource/schema" +) + +func DatabaseResourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "id": schema.Int64Attribute{ + Computed: true, + Description: "The id of the database.", + MarkdownDescription: "The id of the database.", + }, + "name": schema.StringAttribute{ + Required: true, + Description: "The name of the database.", + MarkdownDescription: "The name of the database.", + }, + "owner": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The owner of the database.", + MarkdownDescription: "The owner of the database.", + }, + }, + } +} + +type DatabaseModel struct { + Id types.Int64 `tfsdk:"id"` + Name types.String `tfsdk:"name"` + Owner types.String `tfsdk:"owner"` +} diff --git a/stackit/internal/services/postgresflexalpha/flavor/datasource.go b/stackit/internal/services/postgresflexalpha/flavor/datasource.go index b7ed25ee..646d35ac 100644 --- a/stackit/internal/services/postgresflexalpha/flavor/datasource.go +++ b/stackit/internal/services/postgresflexalpha/flavor/datasource.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha" "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" - postgresflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha" + postgresflexalphaGen "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavors/datasources_gen" postgresflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils" "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/utils" @@ -143,9 +143,9 @@ func (r *flavorDataSource) Schema(ctx context.Context, _ datasource.SchemaReques Computed: true, }, }, - CustomType: postgresflex.StorageClassesType{ + CustomType: postgresflexalphaGen.StorageClassesType{ ObjectType: types.ObjectType{ - AttrTypes: postgresflex.StorageClassesValue{}.AttributeTypes(ctx), + AttrTypes: postgresflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx), }, }, }, @@ -210,9 +210,9 @@ func (r *flavorDataSource) Read(ctx context.Context, req datasource.ReadRequest, model.MinGb = types.Int64Value(*f.MinGB) if f.StorageClasses == nil { - model.StorageClasses = types.ListNull(postgresflex.StorageClassesType{ + model.StorageClasses = types.ListNull(postgresflexalphaGen.StorageClassesType{ ObjectType: basetypes.ObjectType{ - AttrTypes: postgresflex.StorageClassesValue{}.AttributeTypes(ctx), + AttrTypes: postgresflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx), }, }) } else { @@ -220,8 +220,8 @@ func (r *flavorDataSource) Read(ctx context.Context, req datasource.ReadRequest, for _, sc := range *f.StorageClasses { scList = append( scList, - postgresflex.NewStorageClassesValueMust( - postgresflex.StorageClassesValue{}.AttributeTypes(ctx), + postgresflexalphaGen.NewStorageClassesValueMust( + postgresflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx), map[string]attr.Value{ "class": types.StringValue(*sc.Class), "max_io_per_sec": types.Int64Value(*sc.MaxIoPerSec), @@ -231,9 +231,9 @@ func (r *flavorDataSource) Read(ctx context.Context, req datasource.ReadRequest, ) } storageClassesList := types.ListValueMust( - postgresflex.StorageClassesType{ + postgresflexalphaGen.StorageClassesType{ ObjectType: basetypes.ObjectType{ - AttrTypes: postgresflex.StorageClassesValue{}.AttributeTypes(ctx), + AttrTypes: postgresflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx), }, }, scList, diff --git a/stackit/internal/services/postgresflexalpha/flavor_data_source_gen.go b/stackit/internal/services/postgresflexalpha/flavor/datasources_gen/flavors_data_source_gen.go similarity index 97% rename from stackit/internal/services/postgresflexalpha/flavor_data_source_gen.go rename to stackit/internal/services/postgresflexalpha/flavor/datasources_gen/flavors_data_source_gen.go index 9e0f567e..924d1375 100644 --- a/stackit/internal/services/postgresflexalpha/flavor_data_source_gen.go +++ b/stackit/internal/services/postgresflexalpha/flavor/datasources_gen/flavors_data_source_gen.go @@ -1,12 +1,10 @@ // Code generated by terraform-plugin-framework-generator DO NOT EDIT. -package postgresflex +package postgresflexalpha import ( "context" "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" @@ -14,42 +12,18 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" ) -func FlavorDataSourceSchema(ctx context.Context) schema.Schema { +func FlavorsDataSourceSchema(ctx context.Context) schema.Schema { return schema.Schema{ Attributes: map[string]schema.Attribute{ - "cpu": schema.Int64Attribute{ - Optional: true, - Computed: true, - //Description: "The cpu count of the instance.", - //MarkdownDescription: "The cpu count of the instance.", - }, - "ram": schema.Int64Attribute{ - Optional: true, - Computed: true, - //Description: "The cpu count of the instance.", - //MarkdownDescription: "The cpu count of the instance.", - }, - "node_type": schema.StringAttribute{ - Optional: true, - Computed: true, - //Description: "The cpu count of the instance.", - //MarkdownDescription: "The cpu count of the instance.", - }, - "storage_class": schema.StringAttribute{ - Optional: true, - Computed: true, - //Description: "The cpu count of the instance.", - //MarkdownDescription: "The cpu count of the instance.", - }, "flavors": schema.ListNestedAttribute{ NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ "cpu": schema.Int64Attribute{ - Optional: true, Computed: true, Description: "The cpu count of the instance.", MarkdownDescription: "The cpu count of the instance.", @@ -70,7 +44,6 @@ func FlavorDataSourceSchema(ctx context.Context) schema.Schema { MarkdownDescription: "maximum storage which can be ordered for the flavor in Gigabyte.", }, "memory": schema.Int64Attribute{ - Optional: true, Computed: true, Description: "The memory of the instance in Gibibyte.", MarkdownDescription: "The memory of the instance in Gibibyte.", @@ -81,7 +54,6 @@ func FlavorDataSourceSchema(ctx context.Context) schema.Schema { MarkdownDescription: "minimum storage which is required to order in Gigabyte.", }, "node_type": schema.StringAttribute{ - Optional: true, Computed: true, Description: "defines the nodeType it can be either single or replica", MarkdownDescription: "defines the nodeType it can be either single or replica", @@ -205,9 +177,6 @@ func FlavorDataSourceSchema(ctx context.Context) schema.Schema { } type FlavorsModel struct { - Cpu types.Int64 `tfsdk:"cpu"` - Ram types.Int64 `tfsdk:"ram"` - NodeType types.String `tfsdk:"node_type"` Flavors types.List `tfsdk:"flavors"` Page types.Int64 `tfsdk:"page"` Pagination PaginationValue `tfsdk:"pagination"` diff --git a/stackit/internal/services/postgresflexalpha/flavors/datasource.go b/stackit/internal/services/postgresflexalpha/flavors/datasource.go new file mode 100644 index 00000000..5a0c3626 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/flavors/datasource.go @@ -0,0 +1,70 @@ +package postgresflexalpha + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" + postgresflexalphaGen "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavors/datasources_gen" + postgresflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils" +) + +var ( + _ datasource.DataSource = &flavorsDataSource{} + _ datasource.DataSourceWithConfigure = &flavorsDataSource{} +) + +func NewFlavorsDataSource() datasource.DataSource { + return &flavorsDataSource{} +} + +type flavorsDataSource struct { + client *postgresflexalpha.APIClient + providerData core.ProviderData +} + +func (d *flavorsDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_postgresflexalpha_flavors" +} + +func (d *flavorsDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = postgresflexalphaGen.FlavorsDataSourceSchema(ctx) +} + +// Configure adds the provider configured client to the data source. +func (d *flavorsDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + var ok bool + d.providerData, ok = conversion.ParseProviderData(ctx, req.ProviderData, &resp.Diagnostics) + if !ok { + return + } + + apiClient := postgresflexUtils.ConfigureClient(ctx, &d.providerData, &resp.Diagnostics) + if resp.Diagnostics.HasError() { + return + } + d.client = apiClient + tflog.Info(ctx, "Postgres Flex version client configured") +} + +func (d *flavorsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + var data postgresflexalphaGen.FlavorsModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Read API call logic + + // Example data value setting + // data.Id = types.StringValue("example-id") + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} diff --git a/stackit/internal/services/sqlserverflexalpha/flavor_data_source_gen.go b/stackit/internal/services/postgresflexalpha/flavors/datasources_gen/flavors_data_source_gen.go similarity index 97% rename from stackit/internal/services/sqlserverflexalpha/flavor_data_source_gen.go rename to stackit/internal/services/postgresflexalpha/flavors/datasources_gen/flavors_data_source_gen.go index d9e87331..924d1375 100644 --- a/stackit/internal/services/sqlserverflexalpha/flavor_data_source_gen.go +++ b/stackit/internal/services/postgresflexalpha/flavors/datasources_gen/flavors_data_source_gen.go @@ -1,12 +1,10 @@ // Code generated by terraform-plugin-framework-generator DO NOT EDIT. -package sqlserverflex +package postgresflexalpha import ( "context" "fmt" - "strings" - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" @@ -14,42 +12,18 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" ) -func FlavorDataSourceSchema(ctx context.Context) schema.Schema { +func FlavorsDataSourceSchema(ctx context.Context) schema.Schema { return schema.Schema{ Attributes: map[string]schema.Attribute{ - "cpu": schema.Int64Attribute{ - Optional: true, - Computed: true, - //Description: "The cpu count of the instance.", - //MarkdownDescription: "The cpu count of the instance.", - }, - "ram": schema.Int64Attribute{ - Optional: true, - Computed: true, - //Description: "The cpu count of the instance.", - //MarkdownDescription: "The cpu count of the instance.", - }, - "node_type": schema.StringAttribute{ - Optional: true, - Computed: true, - //Description: "The cpu count of the instance.", - //MarkdownDescription: "The cpu count of the instance.", - }, - "storage_class": schema.StringAttribute{ - Optional: true, - Computed: true, - //Description: "The cpu count of the instance.", - //MarkdownDescription: "The cpu count of the instance.", - }, "flavors": schema.ListNestedAttribute{ NestedObject: schema.NestedAttributeObject{ Attributes: map[string]schema.Attribute{ "cpu": schema.Int64Attribute{ - Optional: true, Computed: true, Description: "The cpu count of the instance.", MarkdownDescription: "The cpu count of the instance.", @@ -70,7 +44,6 @@ func FlavorDataSourceSchema(ctx context.Context) schema.Schema { MarkdownDescription: "maximum storage which can be ordered for the flavor in Gigabyte.", }, "memory": schema.Int64Attribute{ - Optional: true, Computed: true, Description: "The memory of the instance in Gibibyte.", MarkdownDescription: "The memory of the instance in Gibibyte.", @@ -81,7 +54,6 @@ func FlavorDataSourceSchema(ctx context.Context) schema.Schema { MarkdownDescription: "minimum storage which is required to order in Gigabyte.", }, "node_type": schema.StringAttribute{ - Optional: true, Computed: true, Description: "defines the nodeType it can be either single or replica", MarkdownDescription: "defines the nodeType it can be either single or replica", @@ -205,9 +177,6 @@ func FlavorDataSourceSchema(ctx context.Context) schema.Schema { } type FlavorsModel struct { - Cpu types.Int64 `tfsdk:"cpu"` - Ram types.Int64 `tfsdk:"ram"` - NodeType types.String `tfsdk:"node_type"` Flavors types.List `tfsdk:"flavors"` Page types.Int64 `tfsdk:"page"` Pagination PaginationValue `tfsdk:"pagination"` diff --git a/stackit/internal/services/postgresflexalpha/instance/datasource.go b/stackit/internal/services/postgresflexalpha/instance/datasource.go index c08ec8b9..498ce251 100644 --- a/stackit/internal/services/postgresflexalpha/instance/datasource.go +++ b/stackit/internal/services/postgresflexalpha/instance/datasource.go @@ -7,18 +7,13 @@ import ( "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha" "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" + postgresflexalpha2 "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance/datasources_gen" postgresflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils" "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/utils" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/validate" - - "github.com/hashicorp/terraform-plugin-framework/datasource/schema" - "github.com/hashicorp/terraform-plugin-framework/types" ) // Ensure the implementation satisfies the expected interfaces. @@ -38,20 +33,12 @@ type instanceDataSource struct { } // Metadata returns the data source type name. -func (r *instanceDataSource) Metadata( - _ context.Context, - req datasource.MetadataRequest, - resp *datasource.MetadataResponse, -) { +func (r *instanceDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { resp.TypeName = req.ProviderTypeName + "_postgresflexalpha_instance" } // Configure adds the provider configured client to the data source. -func (r *instanceDataSource) Configure( - ctx context.Context, - req datasource.ConfigureRequest, - resp *datasource.ConfigureResponse, -) { +func (r *instanceDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { var ok bool r.providerData, ok = conversion.ParseProviderData(ctx, req.ProviderData, &resp.Diagnostics) if !ok { @@ -67,131 +54,13 @@ func (r *instanceDataSource) Configure( } // Schema defines the schema for the data source. -func (r *instanceDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { - descriptions := map[string]string{ - "main": "Postgres Flex instance data source schema. Must have a `region` specified in the provider configuration.", - "id": "Terraform's internal data source. ID. It is structured as \"`project_id`,`region`,`instance_id`\".", - "instance_id": "ID of the PostgresFlex instance.", - "project_id": "STACKIT project ID to which the instance is associated.", - "name": "Instance name.", - "acl": "The Access Control List (ACL) for the PostgresFlex instance.", - "region": "The resource region. If not defined, the provider region is used.", - } - - resp.Schema = schema.Schema{ - Description: descriptions["main"], - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Description: descriptions["id"], - Computed: true, - }, - "instance_id": schema.StringAttribute{ - Description: descriptions["instance_id"], - Required: true, - Validators: []validator.String{ - validate.UUID(), - validate.NoSeparator(), - }, - }, - "project_id": schema.StringAttribute{ - Description: descriptions["project_id"], - Required: true, - Validators: []validator.String{ - validate.UUID(), - validate.NoSeparator(), - }, - }, - "name": schema.StringAttribute{ - Description: descriptions["name"], - Computed: true, - }, - "backup_schedule": schema.StringAttribute{ - Computed: true, - }, - "retention_days": schema.Int64Attribute{ - Computed: true, - }, - "flavor_id": schema.StringAttribute{ - Computed: true, - }, - "replicas": schema.Int64Attribute{ - Computed: true, - }, - "storage": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "class": schema.StringAttribute{ - Computed: true, - }, - "size": schema.Int64Attribute{ - Computed: true, - }, - }, - }, - "version": schema.StringAttribute{ - Computed: true, - }, - "region": schema.StringAttribute{ - // the region cannot be found, so it has to be passed - Optional: true, - Description: descriptions["region"], - }, - "encryption": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "key_id": schema.StringAttribute{ - Description: descriptions["key_id"], - Computed: true, - }, - "key_version": schema.StringAttribute{ - Description: descriptions["key_version"], - Computed: true, - }, - "keyring_id": schema.StringAttribute{ - Description: descriptions["keyring_id"], - Computed: true, - }, - "service_account": schema.StringAttribute{ - Description: descriptions["service_account"], - Computed: true, - }, - }, - Description: descriptions["encryption"], - }, - "network": schema.SingleNestedAttribute{ - Computed: true, - Attributes: map[string]schema.Attribute{ - "access_scope": schema.StringAttribute{ - Description: descriptions["access_scope"], - Computed: true, - }, - "acl": schema.ListAttribute{ - Description: descriptions["acl"], - ElementType: types.StringType, - Computed: true, - }, - "instance_address": schema.StringAttribute{ - Description: descriptions["instance_address"], - Computed: true, - }, - "router_address": schema.StringAttribute{ - Description: descriptions["router_address"], - Computed: true, - }, - }, - Description: descriptions["network"], - }, - }, - } +func (r *instanceDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = postgresflexalpha2.InstanceDataSourceSchema(ctx) } // Read refreshes the Terraform state with the latest data. -func (r *instanceDataSource) Read( - ctx context.Context, - req datasource.ReadRequest, - resp *datasource.ReadResponse, -) { // nolint:gocritic // function signature required by Terraform - var model Model +func (r *instanceDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { // nolint:gocritic // function signature required by Terraform + var model postgresflexalpha2.InstanceModel diags := req.Config.Get(ctx, &model) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { @@ -224,43 +93,12 @@ func (r *instanceDataSource) Read( ctx = core.LogResponse(ctx) - var storage = &storageModel{} - if !model.Storage.IsNull() && !model.Storage.IsUnknown() { - diags = model.Storage.As(ctx, storage, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var network = &networkModel{} - if !model.Network.IsNull() && !model.Network.IsUnknown() { - diags = model.Network.As(ctx, network, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var encryption = &encryptionModel{} - if !model.Encryption.IsNull() && !model.Encryption.IsUnknown() { - diags = model.Encryption.As(ctx, encryption, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - err = mapFields(ctx, instanceResp, &model, storage, encryption, network, region) + err = mapGetDataInstanceResponseToModel(ctx, &model, instanceResp) if err != nil { - core.LogAndAddError( - ctx, - &resp.Diagnostics, - "Error reading instance", - fmt.Sprintf("Processing API payload: %v", err), - ) + core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", fmt.Sprintf("Calling API: %v", err)) return } + // Set refreshed state diags = resp.State.Set(ctx, model) resp.Diagnostics.Append(diags...) diff --git a/stackit/internal/services/postgresflexalpha/instance/datasources_gen/instance_data_source_gen.go b/stackit/internal/services/postgresflexalpha/instance/datasources_gen/instance_data_source_gen.go new file mode 100644 index 00000000..959e2060 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/instance/datasources_gen/instance_data_source_gen.go @@ -0,0 +1,1055 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package postgresflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func InstanceDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "backup_schedule": schema.StringAttribute{ + Computed: true, + Description: "The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.", + MarkdownDescription: "The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.", + }, + "flavor_id": schema.StringAttribute{ + Computed: true, + Description: "The id of the instance flavor.", + MarkdownDescription: "The id of the instance flavor.", + }, + "id": schema.StringAttribute{ + Computed: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "instance_id": schema.StringAttribute{ + Required: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "is_deletable": schema.BoolAttribute{ + Computed: true, + Description: "Whether the instance can be deleted or not.", + MarkdownDescription: "Whether the instance can be deleted or not.", + }, + "name": schema.StringAttribute{ + Computed: true, + Description: "The name of the instance.", + MarkdownDescription: "The name of the instance.", + }, + "network": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "access_scope": schema.StringAttribute{ + Computed: true, + Description: "The access scope of the instance. It defines if the instance is public or airgapped.", + MarkdownDescription: "The access scope of the instance. It defines if the instance is public or airgapped.", + }, + "acl": schema.ListAttribute{ + ElementType: types.StringType, + Computed: true, + Description: "List of IPV4 cidr.", + MarkdownDescription: "List of IPV4 cidr.", + }, + "instance_address": schema.StringAttribute{ + Computed: true, + }, + "router_address": schema.StringAttribute{ + Computed: true, + }, + }, + CustomType: NetworkType{ + ObjectType: types.ObjectType{ + AttrTypes: NetworkValue{}.AttributeTypes(ctx), + }, + }, + Computed: true, + Description: "The access configuration of the instance", + MarkdownDescription: "The access configuration of the instance", + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "replicas": schema.Int64Attribute{ + Computed: true, + Description: "How many replicas the instance should have.", + MarkdownDescription: "How many replicas the instance should have.", + }, + "retention_days": schema.Int64Attribute{ + Computed: true, + Description: "How long backups are retained. The value can only be between 32 and 365 days.", + MarkdownDescription: "How long backups are retained. The value can only be between 32 and 365 days.", + }, + "status": schema.StringAttribute{ + Computed: true, + Description: "The current status of the instance.", + MarkdownDescription: "The current status of the instance.", + }, + "storage": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "performance_class": schema.StringAttribute{ + Computed: true, + Description: "The storage class for the storage.", + MarkdownDescription: "The storage class for the storage.", + }, + "size": schema.Int64Attribute{ + Computed: true, + Description: "The storage size in Gigabytes.", + MarkdownDescription: "The storage size in Gigabytes.", + }, + }, + CustomType: StorageType{ + ObjectType: types.ObjectType{ + AttrTypes: StorageValue{}.AttributeTypes(ctx), + }, + }, + Computed: true, + Description: "The object containing information about the storage size and class.", + MarkdownDescription: "The object containing information about the storage size and class.", + }, + "version": schema.StringAttribute{ + Computed: true, + Description: "The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3alpha1#tag/Version) for supported version parameters.", + MarkdownDescription: "The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3alpha1#tag/Version) for supported version parameters.", + }, + }, + } +} + +type InstanceModel struct { + BackupSchedule types.String `tfsdk:"backup_schedule"` + FlavorId types.String `tfsdk:"flavor_id"` + Id types.String `tfsdk:"id"` + InstanceId types.String `tfsdk:"instance_id"` + IsDeletable types.Bool `tfsdk:"is_deletable"` + Name types.String `tfsdk:"name"` + Network NetworkValue `tfsdk:"network"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Replicas types.Int64 `tfsdk:"replicas"` + RetentionDays types.Int64 `tfsdk:"retention_days"` + Status types.String `tfsdk:"status"` + Storage StorageValue `tfsdk:"storage"` + Version types.String `tfsdk:"version"` +} + +var _ basetypes.ObjectTypable = NetworkType{} + +type NetworkType struct { + basetypes.ObjectType +} + +func (t NetworkType) Equal(o attr.Type) bool { + other, ok := o.(NetworkType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t NetworkType) String() string { + return "NetworkType" +} + +func (t NetworkType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + accessScopeAttribute, ok := attributes["access_scope"] + + if !ok { + diags.AddError( + "Attribute Missing", + `access_scope is missing from object`) + + return nil, diags + } + + accessScopeVal, ok := accessScopeAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`access_scope expected to be basetypes.StringValue, was: %T`, accessScopeAttribute)) + } + + aclAttribute, ok := attributes["acl"] + + if !ok { + diags.AddError( + "Attribute Missing", + `acl is missing from object`) + + return nil, diags + } + + aclVal, ok := aclAttribute.(basetypes.ListValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`acl expected to be basetypes.ListValue, was: %T`, aclAttribute)) + } + + instanceAddressAttribute, ok := attributes["instance_address"] + + if !ok { + diags.AddError( + "Attribute Missing", + `instance_address is missing from object`) + + return nil, diags + } + + instanceAddressVal, ok := instanceAddressAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`instance_address expected to be basetypes.StringValue, was: %T`, instanceAddressAttribute)) + } + + routerAddressAttribute, ok := attributes["router_address"] + + if !ok { + diags.AddError( + "Attribute Missing", + `router_address is missing from object`) + + return nil, diags + } + + routerAddressVal, ok := routerAddressAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`router_address expected to be basetypes.StringValue, was: %T`, routerAddressAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return NetworkValue{ + AccessScope: accessScopeVal, + Acl: aclVal, + InstanceAddress: instanceAddressVal, + RouterAddress: routerAddressVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewNetworkValueNull() NetworkValue { + return NetworkValue{ + state: attr.ValueStateNull, + } +} + +func NewNetworkValueUnknown() NetworkValue { + return NetworkValue{ + state: attr.ValueStateUnknown, + } +} + +func NewNetworkValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (NetworkValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing NetworkValue Attribute Value", + "While creating a NetworkValue value, a missing attribute value was detected. "+ + "A NetworkValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("NetworkValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid NetworkValue Attribute Type", + "While creating a NetworkValue value, an invalid attribute value was detected. "+ + "A NetworkValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("NetworkValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("NetworkValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra NetworkValue Attribute Value", + "While creating a NetworkValue value, an extra attribute value was detected. "+ + "A NetworkValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra NetworkValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewNetworkValueUnknown(), diags + } + + accessScopeAttribute, ok := attributes["access_scope"] + + if !ok { + diags.AddError( + "Attribute Missing", + `access_scope is missing from object`) + + return NewNetworkValueUnknown(), diags + } + + accessScopeVal, ok := accessScopeAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`access_scope expected to be basetypes.StringValue, was: %T`, accessScopeAttribute)) + } + + aclAttribute, ok := attributes["acl"] + + if !ok { + diags.AddError( + "Attribute Missing", + `acl is missing from object`) + + return NewNetworkValueUnknown(), diags + } + + aclVal, ok := aclAttribute.(basetypes.ListValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`acl expected to be basetypes.ListValue, was: %T`, aclAttribute)) + } + + instanceAddressAttribute, ok := attributes["instance_address"] + + if !ok { + diags.AddError( + "Attribute Missing", + `instance_address is missing from object`) + + return NewNetworkValueUnknown(), diags + } + + instanceAddressVal, ok := instanceAddressAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`instance_address expected to be basetypes.StringValue, was: %T`, instanceAddressAttribute)) + } + + routerAddressAttribute, ok := attributes["router_address"] + + if !ok { + diags.AddError( + "Attribute Missing", + `router_address is missing from object`) + + return NewNetworkValueUnknown(), diags + } + + routerAddressVal, ok := routerAddressAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`router_address expected to be basetypes.StringValue, was: %T`, routerAddressAttribute)) + } + + if diags.HasError() { + return NewNetworkValueUnknown(), diags + } + + return NetworkValue{ + AccessScope: accessScopeVal, + Acl: aclVal, + InstanceAddress: instanceAddressVal, + RouterAddress: routerAddressVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewNetworkValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) NetworkValue { + object, diags := NewNetworkValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewNetworkValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t NetworkType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewNetworkValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewNetworkValueUnknown(), nil + } + + if in.IsNull() { + return NewNetworkValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewNetworkValueMust(NetworkValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t NetworkType) ValueType(ctx context.Context) attr.Value { + return NetworkValue{} +} + +var _ basetypes.ObjectValuable = NetworkValue{} + +type NetworkValue struct { + AccessScope basetypes.StringValue `tfsdk:"access_scope"` + Acl basetypes.ListValue `tfsdk:"acl"` + InstanceAddress basetypes.StringValue `tfsdk:"instance_address"` + RouterAddress basetypes.StringValue `tfsdk:"router_address"` + state attr.ValueState +} + +func (v NetworkValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 4) + + var val tftypes.Value + var err error + + attrTypes["access_scope"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["acl"] = basetypes.ListType{ + ElemType: types.StringType, + }.TerraformType(ctx) + attrTypes["instance_address"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["router_address"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 4) + + val, err = v.AccessScope.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["access_scope"] = val + + val, err = v.Acl.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["acl"] = val + + val, err = v.InstanceAddress.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["instance_address"] = val + + val, err = v.RouterAddress.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["router_address"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v NetworkValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v NetworkValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v NetworkValue) String() string { + return "NetworkValue" +} + +func (v NetworkValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + var aclVal basetypes.ListValue + switch { + case v.Acl.IsUnknown(): + aclVal = types.ListUnknown(types.StringType) + case v.Acl.IsNull(): + aclVal = types.ListNull(types.StringType) + default: + var d diag.Diagnostics + aclVal, d = types.ListValue(types.StringType, v.Acl.Elements()) + diags.Append(d...) + } + + if diags.HasError() { + return types.ObjectUnknown(map[string]attr.Type{ + "access_scope": basetypes.StringType{}, + "acl": basetypes.ListType{ + ElemType: types.StringType, + }, + "instance_address": basetypes.StringType{}, + "router_address": basetypes.StringType{}, + }), diags + } + + attributeTypes := map[string]attr.Type{ + "access_scope": basetypes.StringType{}, + "acl": basetypes.ListType{ + ElemType: types.StringType, + }, + "instance_address": basetypes.StringType{}, + "router_address": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "access_scope": v.AccessScope, + "acl": aclVal, + "instance_address": v.InstanceAddress, + "router_address": v.RouterAddress, + }) + + return objVal, diags +} + +func (v NetworkValue) Equal(o attr.Value) bool { + other, ok := o.(NetworkValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.AccessScope.Equal(other.AccessScope) { + return false + } + + if !v.Acl.Equal(other.Acl) { + return false + } + + if !v.InstanceAddress.Equal(other.InstanceAddress) { + return false + } + + if !v.RouterAddress.Equal(other.RouterAddress) { + return false + } + + return true +} + +func (v NetworkValue) Type(ctx context.Context) attr.Type { + return NetworkType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v NetworkValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "access_scope": basetypes.StringType{}, + "acl": basetypes.ListType{ + ElemType: types.StringType, + }, + "instance_address": basetypes.StringType{}, + "router_address": basetypes.StringType{}, + } +} + +var _ basetypes.ObjectTypable = StorageType{} + +type StorageType struct { + basetypes.ObjectType +} + +func (t StorageType) Equal(o attr.Type) bool { + other, ok := o.(StorageType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t StorageType) String() string { + return "StorageType" +} + +func (t StorageType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + performanceClassAttribute, ok := attributes["performance_class"] + + if !ok { + diags.AddError( + "Attribute Missing", + `performance_class is missing from object`) + + return nil, diags + } + + performanceClassVal, ok := performanceClassAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`performance_class expected to be basetypes.StringValue, was: %T`, performanceClassAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return nil, diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return StorageValue{ + PerformanceClass: performanceClassVal, + Size: sizeVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewStorageValueNull() StorageValue { + return StorageValue{ + state: attr.ValueStateNull, + } +} + +func NewStorageValueUnknown() StorageValue { + return StorageValue{ + state: attr.ValueStateUnknown, + } +} + +func NewStorageValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (StorageValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing StorageValue Attribute Value", + "While creating a StorageValue value, a missing attribute value was detected. "+ + "A StorageValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("StorageValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid StorageValue Attribute Type", + "While creating a StorageValue value, an invalid attribute value was detected. "+ + "A StorageValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("StorageValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("StorageValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra StorageValue Attribute Value", + "While creating a StorageValue value, an extra attribute value was detected. "+ + "A StorageValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra StorageValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewStorageValueUnknown(), diags + } + + performanceClassAttribute, ok := attributes["performance_class"] + + if !ok { + diags.AddError( + "Attribute Missing", + `performance_class is missing from object`) + + return NewStorageValueUnknown(), diags + } + + performanceClassVal, ok := performanceClassAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`performance_class expected to be basetypes.StringValue, was: %T`, performanceClassAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return NewStorageValueUnknown(), diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + if diags.HasError() { + return NewStorageValueUnknown(), diags + } + + return StorageValue{ + PerformanceClass: performanceClassVal, + Size: sizeVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewStorageValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) StorageValue { + object, diags := NewStorageValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewStorageValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t StorageType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewStorageValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewStorageValueUnknown(), nil + } + + if in.IsNull() { + return NewStorageValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewStorageValueMust(StorageValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t StorageType) ValueType(ctx context.Context) attr.Value { + return StorageValue{} +} + +var _ basetypes.ObjectValuable = StorageValue{} + +type StorageValue struct { + PerformanceClass basetypes.StringValue `tfsdk:"performance_class"` + Size basetypes.Int64Value `tfsdk:"size"` + state attr.ValueState +} + +func (v StorageValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 2) + + var val tftypes.Value + var err error + + attrTypes["performance_class"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["size"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 2) + + val, err = v.PerformanceClass.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["performance_class"] = val + + val, err = v.Size.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["size"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v StorageValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v StorageValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v StorageValue) String() string { + return "StorageValue" +} + +func (v StorageValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "performance_class": basetypes.StringType{}, + "size": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "performance_class": v.PerformanceClass, + "size": v.Size, + }) + + return objVal, diags +} + +func (v StorageValue) Equal(o attr.Value) bool { + other, ok := o.(StorageValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.PerformanceClass.Equal(other.PerformanceClass) { + return false + } + + if !v.Size.Equal(other.Size) { + return false + } + + return true +} + +func (v StorageValue) Type(ctx context.Context) attr.Type { + return StorageType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v StorageValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "performance_class": basetypes.StringType{}, + "size": basetypes.Int64Type{}, + } +} diff --git a/stackit/internal/services/postgresflexalpha/instance/datasources_gen/instances_data_source_gen.go b/stackit/internal/services/postgresflexalpha/instance/datasources_gen/instances_data_source_gen.go new file mode 100644 index 00000000..beb620dd --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/instance/datasources_gen/instances_data_source_gen.go @@ -0,0 +1,1174 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package postgresflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func InstancesDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "instances": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "is_deletable": schema.BoolAttribute{ + Computed: true, + Description: "Whether the instance can be deleted or not.", + MarkdownDescription: "Whether the instance can be deleted or not.", + }, + "name": schema.StringAttribute{ + Computed: true, + Description: "The name of the instance.", + MarkdownDescription: "The name of the instance.", + }, + "status": schema.StringAttribute{ + Computed: true, + Description: "The current status of the instance.", + MarkdownDescription: "The current status of the instance.", + }, + }, + CustomType: InstancesType{ + ObjectType: types.ObjectType{ + AttrTypes: InstancesValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "List of owned instances and their current status.", + MarkdownDescription: "List of owned instances and their current status.", + }, + "page": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of the page of items list to be returned.", + MarkdownDescription: "Number of the page of items list to be returned.", + }, + "pagination": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "page": schema.Int64Attribute{ + Computed: true, + }, + "size": schema.Int64Attribute{ + Computed: true, + }, + "sort": schema.StringAttribute{ + Computed: true, + }, + "total_pages": schema.Int64Attribute{ + Computed: true, + }, + "total_rows": schema.Int64Attribute{ + Computed: true, + }, + }, + CustomType: PaginationType{ + ObjectType: types.ObjectType{ + AttrTypes: PaginationValue{}.AttributeTypes(ctx), + }, + }, + Computed: true, + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "size": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of items to be returned on each page.", + MarkdownDescription: "Number of items to be returned on each page.", + }, + "sort": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "Sorting of the items to be returned on each page.", + MarkdownDescription: "Sorting of the items to be returned on each page.", + Validators: []validator.String{ + stringvalidator.OneOf( + "index.desc", + "index.asc", + "id.desc", + "id.asc", + "is_deletable.desc", + "is_deletable.asc", + "name.asc", + "name.desc", + "status.asc", + "status.desc", + ), + }, + }, + }, + } +} + +type InstancesModel struct { + Instances types.List `tfsdk:"instances"` + Page types.Int64 `tfsdk:"page"` + Pagination PaginationValue `tfsdk:"pagination"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Size types.Int64 `tfsdk:"size"` + Sort types.String `tfsdk:"sort"` +} + +var _ basetypes.ObjectTypable = InstancesType{} + +type InstancesType struct { + basetypes.ObjectType +} + +func (t InstancesType) Equal(o attr.Type) bool { + other, ok := o.(InstancesType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t InstancesType) String() string { + return "InstancesType" +} + +func (t InstancesType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return nil, diags + } + + idVal, ok := idAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.StringValue, was: %T`, idAttribute)) + } + + isDeletableAttribute, ok := attributes["is_deletable"] + + if !ok { + diags.AddError( + "Attribute Missing", + `is_deletable is missing from object`) + + return nil, diags + } + + isDeletableVal, ok := isDeletableAttribute.(basetypes.BoolValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`is_deletable expected to be basetypes.BoolValue, was: %T`, isDeletableAttribute)) + } + + nameAttribute, ok := attributes["name"] + + if !ok { + diags.AddError( + "Attribute Missing", + `name is missing from object`) + + return nil, diags + } + + nameVal, ok := nameAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute)) + } + + statusAttribute, ok := attributes["status"] + + if !ok { + diags.AddError( + "Attribute Missing", + `status is missing from object`) + + return nil, diags + } + + statusVal, ok := statusAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`status expected to be basetypes.StringValue, was: %T`, statusAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return InstancesValue{ + Id: idVal, + IsDeletable: isDeletableVal, + Name: nameVal, + Status: statusVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewInstancesValueNull() InstancesValue { + return InstancesValue{ + state: attr.ValueStateNull, + } +} + +func NewInstancesValueUnknown() InstancesValue { + return InstancesValue{ + state: attr.ValueStateUnknown, + } +} + +func NewInstancesValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (InstancesValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing InstancesValue Attribute Value", + "While creating a InstancesValue value, a missing attribute value was detected. "+ + "A InstancesValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("InstancesValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid InstancesValue Attribute Type", + "While creating a InstancesValue value, an invalid attribute value was detected. "+ + "A InstancesValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("InstancesValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("InstancesValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra InstancesValue Attribute Value", + "While creating a InstancesValue value, an extra attribute value was detected. "+ + "A InstancesValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra InstancesValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewInstancesValueUnknown(), diags + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return NewInstancesValueUnknown(), diags + } + + idVal, ok := idAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.StringValue, was: %T`, idAttribute)) + } + + isDeletableAttribute, ok := attributes["is_deletable"] + + if !ok { + diags.AddError( + "Attribute Missing", + `is_deletable is missing from object`) + + return NewInstancesValueUnknown(), diags + } + + isDeletableVal, ok := isDeletableAttribute.(basetypes.BoolValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`is_deletable expected to be basetypes.BoolValue, was: %T`, isDeletableAttribute)) + } + + nameAttribute, ok := attributes["name"] + + if !ok { + diags.AddError( + "Attribute Missing", + `name is missing from object`) + + return NewInstancesValueUnknown(), diags + } + + nameVal, ok := nameAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute)) + } + + statusAttribute, ok := attributes["status"] + + if !ok { + diags.AddError( + "Attribute Missing", + `status is missing from object`) + + return NewInstancesValueUnknown(), diags + } + + statusVal, ok := statusAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`status expected to be basetypes.StringValue, was: %T`, statusAttribute)) + } + + if diags.HasError() { + return NewInstancesValueUnknown(), diags + } + + return InstancesValue{ + Id: idVal, + IsDeletable: isDeletableVal, + Name: nameVal, + Status: statusVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewInstancesValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) InstancesValue { + object, diags := NewInstancesValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewInstancesValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t InstancesType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewInstancesValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewInstancesValueUnknown(), nil + } + + if in.IsNull() { + return NewInstancesValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewInstancesValueMust(InstancesValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t InstancesType) ValueType(ctx context.Context) attr.Value { + return InstancesValue{} +} + +var _ basetypes.ObjectValuable = InstancesValue{} + +type InstancesValue struct { + Id basetypes.StringValue `tfsdk:"id"` + IsDeletable basetypes.BoolValue `tfsdk:"is_deletable"` + Name basetypes.StringValue `tfsdk:"name"` + Status basetypes.StringValue `tfsdk:"status"` + state attr.ValueState +} + +func (v InstancesValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 4) + + var val tftypes.Value + var err error + + attrTypes["id"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["is_deletable"] = basetypes.BoolType{}.TerraformType(ctx) + attrTypes["name"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["status"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 4) + + val, err = v.Id.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["id"] = val + + val, err = v.IsDeletable.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["is_deletable"] = val + + val, err = v.Name.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["name"] = val + + val, err = v.Status.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["status"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v InstancesValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v InstancesValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v InstancesValue) String() string { + return "InstancesValue" +} + +func (v InstancesValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "id": basetypes.StringType{}, + "is_deletable": basetypes.BoolType{}, + "name": basetypes.StringType{}, + "status": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "id": v.Id, + "is_deletable": v.IsDeletable, + "name": v.Name, + "status": v.Status, + }) + + return objVal, diags +} + +func (v InstancesValue) Equal(o attr.Value) bool { + other, ok := o.(InstancesValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Id.Equal(other.Id) { + return false + } + + if !v.IsDeletable.Equal(other.IsDeletable) { + return false + } + + if !v.Name.Equal(other.Name) { + return false + } + + if !v.Status.Equal(other.Status) { + return false + } + + return true +} + +func (v InstancesValue) Type(ctx context.Context) attr.Type { + return InstancesType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v InstancesValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "id": basetypes.StringType{}, + "is_deletable": basetypes.BoolType{}, + "name": basetypes.StringType{}, + "status": basetypes.StringType{}, + } +} + +var _ basetypes.ObjectTypable = PaginationType{} + +type PaginationType struct { + basetypes.ObjectType +} + +func (t PaginationType) Equal(o attr.Type) bool { + other, ok := o.(PaginationType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t PaginationType) String() string { + return "PaginationType" +} + +func (t PaginationType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return nil, diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return nil, diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return nil, diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return nil, diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return nil, diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueNull() PaginationValue { + return PaginationValue{ + state: attr.ValueStateNull, + } +} + +func NewPaginationValueUnknown() PaginationValue { + return PaginationValue{ + state: attr.ValueStateUnknown, + } +} + +func NewPaginationValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (PaginationValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing PaginationValue Attribute Value", + "While creating a PaginationValue value, a missing attribute value was detected. "+ + "A PaginationValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid PaginationValue Attribute Type", + "While creating a PaginationValue value, an invalid attribute value was detected. "+ + "A PaginationValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra PaginationValue Attribute Value", + "While creating a PaginationValue value, an extra attribute value was detected. "+ + "A PaginationValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra PaginationValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) PaginationValue { + object, diags := NewPaginationValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewPaginationValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t PaginationType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewPaginationValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewPaginationValueUnknown(), nil + } + + if in.IsNull() { + return NewPaginationValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewPaginationValueMust(PaginationValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t PaginationType) ValueType(ctx context.Context) attr.Value { + return PaginationValue{} +} + +var _ basetypes.ObjectValuable = PaginationValue{} + +type PaginationValue struct { + Page basetypes.Int64Value `tfsdk:"page"` + Size basetypes.Int64Value `tfsdk:"size"` + Sort basetypes.StringValue `tfsdk:"sort"` + TotalPages basetypes.Int64Value `tfsdk:"total_pages"` + TotalRows basetypes.Int64Value `tfsdk:"total_rows"` + state attr.ValueState +} + +func (v PaginationValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 5) + + var val tftypes.Value + var err error + + attrTypes["page"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["size"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["sort"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["total_pages"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["total_rows"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 5) + + val, err = v.Page.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["page"] = val + + val, err = v.Size.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["size"] = val + + val, err = v.Sort.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["sort"] = val + + val, err = v.TotalPages.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_pages"] = val + + val, err = v.TotalRows.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_rows"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v PaginationValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v PaginationValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v PaginationValue) String() string { + return "PaginationValue" +} + +func (v PaginationValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "page": v.Page, + "size": v.Size, + "sort": v.Sort, + "total_pages": v.TotalPages, + "total_rows": v.TotalRows, + }) + + return objVal, diags +} + +func (v PaginationValue) Equal(o attr.Value) bool { + other, ok := o.(PaginationValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Page.Equal(other.Page) { + return false + } + + if !v.Size.Equal(other.Size) { + return false + } + + if !v.Sort.Equal(other.Sort) { + return false + } + + if !v.TotalPages.Equal(other.TotalPages) { + return false + } + + if !v.TotalRows.Equal(other.TotalRows) { + return false + } + + return true +} + +func (v PaginationValue) Type(ctx context.Context) attr.Type { + return PaginationType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v PaginationValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } +} diff --git a/stackit/internal/services/postgresflexalpha/instance/functions.go b/stackit/internal/services/postgresflexalpha/instance/functions.go index 968eb2da..6fa4ad07 100644 --- a/stackit/internal/services/postgresflexalpha/instance/functions.go +++ b/stackit/internal/services/postgresflexalpha/instance/functions.go @@ -3,217 +3,165 @@ package postgresflexalpha import ( "context" "fmt" - "math" "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" postgresflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" + postgresflexalphadatasource "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance/datasources_gen" + postgresflexalpharesource "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance/resources_gen" "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/utils" ) -func mapFields( - ctx context.Context, - resp *postgresflex.GetInstanceResponse, - model *Model, - storage *storageModel, - encryption *encryptionModel, - network *networkModel, - region string, -) error { - if resp == nil { - return fmt.Errorf("response input is nil") - } - if model == nil { - return fmt.Errorf("model input is nil") - } - instance := resp +func mapGetInstanceResponseToModel(ctx context.Context, m *postgresflexalpharesource.InstanceModel, resp *postgresflex.GetInstanceResponse) error { + tflog.Info(ctx, ">>>> MSH DEBUG <<<<", map[string]interface{}{ + "id": m.Id.ValueString(), + "instance_id": m.InstanceId.ValueString(), + "backup_schedule": m.BackupSchedule.ValueString(), + "flavor_id": m.FlavorId.ValueString(), + "encryption.kek_key_id": m.Encryption.KekKeyId.ValueString(), + "encryption.kek_key_ring_id": m.Encryption.KekKeyRingId.ValueString(), + "encryption.kek_key_version": m.Encryption.KekKeyVersion.ValueString(), + "encryption.service_account": m.Encryption.ServiceAccount.ValueString(), + "is_deletable": m.IsDeletable.ValueBool(), + "name": m.Name.ValueString(), + "status": m.Status.ValueString(), + "retention_days": m.RetentionDays.ValueInt64(), + "replicas": m.Replicas.ValueInt64(), + "network.instance_address": m.Network.InstanceAddress.ValueString(), + "network.router_address": m.Network.RouterAddress.ValueString(), + "version": m.Version.ValueString(), + "network.acl": m.Network.Acl.String(), + }) - var instanceId string - if model.InstanceId.ValueString() != "" { - instanceId = model.InstanceId.ValueString() - } else if instance.Id != nil { - instanceId = *instance.Id - } else { - return fmt.Errorf("instance id not present") + m.BackupSchedule = types.StringValue(resp.GetBackupSchedule()) + if resp.HasEncryption() { + m.Encryption = postgresflexalpharesource.NewEncryptionValueMust( + m.Encryption.AttributeTypes(ctx), + map[string]attr.Value{ + "kek_key_id": types.StringValue(resp.Encryption.GetKekKeyId()), + "kek_key_ring_id": types.StringValue(resp.Encryption.GetKekKeyRingId()), + "kek_key_version": types.StringValue(resp.Encryption.GetKekKeyVersion()), + "service_account": types.StringValue(resp.Encryption.GetServiceAccount()), + }, + ) } + m.FlavorId = types.StringValue(resp.GetFlavorId()) + if m.Id.IsNull() || m.Id.IsUnknown() { + m.Id = utils.BuildInternalTerraformId(m.ProjectId.ValueString(), m.Region.ValueString(), m.InstanceId.ValueString()) + } + m.InstanceId = types.StringPointerValue(resp.Id) - var encryptionValues map[string]attr.Value - if instance.Encryption == nil { - encryptionValues = map[string]attr.Value{ - "keyring_id": encryption.KeyRingId, - "key_id": encryption.KeyId, - "key_version": encryption.KeyVersion, - "service_account": encryption.ServiceAccount, - } - } else { - encryptionValues = map[string]attr.Value{ - "keyring_id": types.StringValue(*instance.Encryption.KekKeyRingId), - "key_id": types.StringValue(*instance.Encryption.KekKeyId), - "key_version": types.StringValue(*instance.Encryption.KekKeyVersion), - "service_account": types.StringValue(*instance.Encryption.ServiceAccount), - } - } - encryptionObject, diags := types.ObjectValue(encryptionTypes, encryptionValues) + //m.IsDeletable = types.BoolUnknown() + //if isDel, ok := resp.GetIsDeletableOk(); ok { + // m.IsDeletable = types.BoolValue(isDel) + m.IsDeletable = types.BoolValue(resp.GetIsDeletable()) + //} + + netAcl, diags := types.ListValueFrom(ctx, types.StringType, resp.Network.GetAcl()) if diags.HasError() { - return fmt.Errorf("creating encryption: %w", core.DiagsToError(diags)) + return fmt.Errorf("failed converting network acl from response") } - var networkValues map[string]attr.Value - if instance.Network == nil { - networkValues = map[string]attr.Value{ - "acl": network.ACL, - "access_scope": network.AccessScope, - "instance_address": network.InstanceAddress, - "router_address": network.RouterAddress, - } - } else { - aclList, diags := types.ListValueFrom(ctx, types.StringType, *instance.Network.Acl) - if diags.HasError() { - return fmt.Errorf("creating network (acl list): %w", core.DiagsToError(diags)) - } - - networkValues = map[string]attr.Value{ - "acl": aclList, - "access_scope": types.StringPointerValue((*string)(instance.Network.AccessScope)), - "instance_address": types.StringPointerValue(instance.Network.InstanceAddress), - "router_address": types.StringPointerValue(instance.Network.RouterAddress), - } + netInstAdd := types.StringValue("") + if instAdd, ok := resp.Network.GetInstanceAddressOk(); ok { + netInstAdd = types.StringValue(instAdd) } - networkObject, diags := types.ObjectValue(networkTypes, networkValues) + + netRtrAdd := types.StringValue("") + if rtrAdd, ok := resp.Network.GetRouterAddressOk(); ok { + netRtrAdd = types.StringValue(rtrAdd) + } + + net, diags := postgresflexalpharesource.NewNetworkValue( + postgresflexalpharesource.NetworkValue{}.AttributeTypes(ctx), + map[string]attr.Value{ + "access_scope": basetypes.NewStringValue(string(resp.Network.GetAccessScope())), + "acl": netAcl, + "instance_address": netInstAdd, + "router_address": netRtrAdd, + }, + ) if diags.HasError() { - return fmt.Errorf("creating network: %w", core.DiagsToError(diags)) + return fmt.Errorf("failed converting network from response") } - var storageValues map[string]attr.Value - if instance.Storage == nil { - storageValues = map[string]attr.Value{ - "class": storage.Class, - "size": storage.Size, - } - } else { - storageValues = map[string]attr.Value{ - "class": types.StringValue(*instance.Storage.PerformanceClass), - "size": types.Int64PointerValue(instance.Storage.Size), - } - } - storageObject, diags := types.ObjectValue(storageTypes, storageValues) + m.Network = net + m.Replicas = types.Int64Value(int64(resp.GetReplicas())) + m.RetentionDays = types.Int64Value(resp.GetRetentionDays()) + + m.Name = types.StringValue(resp.GetName()) + + //m.Status = types.StringUnknown() + //if status, ok := resp.GetStatusOk(); ok { + // m.Status = types.StringValue(string(status)) + //} + m.Status = types.StringValue(string(resp.GetStatus())) + + storage, diags := postgresflexalpharesource.NewStorageValue( + postgresflexalpharesource.StorageValue{}.AttributeTypes(ctx), + map[string]attr.Value{ + "performance_class": types.StringValue(resp.Storage.GetPerformanceClass()), + "size": types.Int64Value(resp.Storage.GetSize()), + }, + ) if diags.HasError() { - return fmt.Errorf("creating storage: %w", core.DiagsToError(diags)) + return fmt.Errorf("failed converting storage from response") } + m.Storage = storage - if instance.Replicas == nil { - diags.AddError("error mapping fields", "replicas is nil") - return fmt.Errorf("replicas is nil") - } - - model.Id = utils.BuildInternalTerraformId(model.ProjectId.ValueString(), region, instanceId) - model.InstanceId = types.StringValue(instanceId) - model.Name = types.StringPointerValue(instance.Name) - model.BackupSchedule = types.StringPointerValue(instance.BackupSchedule) - model.FlavorId = types.StringPointerValue(instance.FlavorId) - model.Replicas = types.Int64Value(int64(*instance.Replicas)) - model.Storage = storageObject - model.Version = types.StringPointerValue(instance.Version) - model.Region = types.StringValue(region) - model.Encryption = encryptionObject - model.Network = networkObject + m.Version = types.StringValue(resp.GetVersion()) return nil } -func toCreatePayload( - model *Model, - storage *storageModel, - enc *encryptionModel, - net *networkModel, -) (*postgresflex.CreateInstanceRequestPayload, error) { - if model == nil { - return nil, fmt.Errorf("nil model") - } - if storage == nil { - return nil, fmt.Errorf("nil storage") +func mapGetDataInstanceResponseToModel(ctx context.Context, m *postgresflexalphadatasource.InstanceModel, resp *postgresflex.GetInstanceResponse) error { + m.BackupSchedule = types.StringValue(resp.GetBackupSchedule()) + //nolint:gocritic + // m.Encryption = postgresflexalpharesource.EncryptionValue{ + // KekKeyId: types.StringValue(resp.Encryption.GetKekKeyId()), + // KekKeyRingId: types.StringValue(resp.Encryption.GetKekKeyRingId()), + // KekKeyVersion: types.StringValue(resp.Encryption.GetKekKeyVersion()), + // ServiceAccount: types.StringValue(resp.Encryption.GetServiceAccount()), + // } + m.FlavorId = types.StringValue(resp.GetFlavorId()) + m.Id = utils.BuildInternalTerraformId(m.ProjectId.ValueString(), m.Region.ValueString(), m.InstanceId.ValueString()) + m.InstanceId = types.StringPointerValue(resp.Id) + m.IsDeletable = types.BoolValue(resp.GetIsDeletable()) + m.Name = types.StringValue(resp.GetName()) + netAcl, diags := types.ListValueFrom(ctx, types.StringType, resp.Network.GetAcl()) + if diags.HasError() { + return fmt.Errorf("failed converting network acl from response") } - var replVal int32 - if !model.Replicas.IsNull() && !model.Replicas.IsUnknown() { - if model.Replicas.ValueInt64() > math.MaxInt32 { - return nil, fmt.Errorf("replica count too big: %d", model.Replicas.ValueInt64()) - } - replVal = int32(model.Replicas.ValueInt64()) // nolint:gosec // check is performed above - } - - storagePayload := &postgresflex.CreateInstanceRequestPayloadGetStorageArgType{ - PerformanceClass: conversion.StringValueToPointer(storage.Class), - Size: conversion.Int64ValueToPointer(storage.Size), - } - - encryptionPayload := &postgresflex.CreateInstanceRequestPayloadGetEncryptionArgType{} - if enc != nil { - encryptionPayload.KekKeyId = conversion.StringValueToPointer(enc.KeyId) - encryptionPayload.KekKeyVersion = conversion.StringValueToPointer(enc.KeyVersion) - encryptionPayload.KekKeyRingId = conversion.StringValueToPointer(enc.KeyRingId) - encryptionPayload.ServiceAccount = conversion.StringValueToPointer(enc.ServiceAccount) - } - - var aclElements []string - if net != nil && !net.ACL.IsNull() && !net.ACL.IsUnknown() { - aclElements = make([]string, 0, len(net.ACL.Elements())) - diags := net.ACL.ElementsAs(context.TODO(), &aclElements, false) - if diags.HasError() { - return nil, fmt.Errorf("creating network: %w", core.DiagsToError(diags)) - } - } - - if len(aclElements) < 1 { - return nil, fmt.Errorf("no acl elements found") - } - - networkPayload := &postgresflex.CreateInstanceRequestPayloadGetNetworkArgType{} - if net != nil { - networkPayload = &postgresflex.CreateInstanceRequestPayloadGetNetworkArgType{ - AccessScope: postgresflex.InstanceNetworkGetAccessScopeAttributeType(conversion.StringValueToPointer(net.AccessScope)), - Acl: &aclElements, - } - } - - return &postgresflex.CreateInstanceRequestPayload{ - Acl: &aclElements, - BackupSchedule: conversion.StringValueToPointer(model.BackupSchedule), - Encryption: encryptionPayload, - FlavorId: conversion.StringValueToPointer(model.FlavorId), - Name: conversion.StringValueToPointer(model.Name), - Network: networkPayload, - Replicas: postgresflex.CreateInstanceRequestPayloadGetReplicasAttributeType(&replVal), - RetentionDays: conversion.Int64ValueToPointer(model.RetentionDays), - Storage: storagePayload, - Version: conversion.StringValueToPointer(model.Version), - }, nil -} - -func toUpdatePayload( - model *Model, - storage *storageModel, - _ *networkModel, -) (*postgresflex.UpdateInstancePartiallyRequestPayload, error) { - if model == nil { - return nil, fmt.Errorf("nil model") - } - if storage == nil { - return nil, fmt.Errorf("nil storage") - } - - return &postgresflex.UpdateInstancePartiallyRequestPayload{ - // Acl: postgresflexalpha.UpdateInstancePartiallyRequestPayloadGetAclAttributeType{ - // Items: &acl, - // }, - BackupSchedule: conversion.StringValueToPointer(model.BackupSchedule), - FlavorId: conversion.StringValueToPointer(model.FlavorId), - Name: conversion.StringValueToPointer(model.Name), - // Replicas: conversion.Int64ValueToPointer(model.Replicas), - Storage: &postgresflex.StorageUpdate{ - Size: conversion.Int64ValueToPointer(storage.Size), + net, diags := postgresflexalphadatasource.NewNetworkValue( + postgresflexalphadatasource.NetworkValue{}.AttributeTypes(ctx), + map[string]attr.Value{ + "access_scope": types.StringValue(string(resp.Network.GetAccessScope())), + "acl": netAcl, + "instance_address": types.StringValue(resp.Network.GetInstanceAddress()), + "router_address": types.StringValue(resp.Network.GetRouterAddress()), }, - Version: conversion.StringValueToPointer(model.Version), - }, nil + ) + if diags.HasError() { + return fmt.Errorf("failed converting network from response") + } + + m.Network = net + m.Replicas = types.Int64Value(int64(resp.GetReplicas())) + m.RetentionDays = types.Int64Value(resp.GetRetentionDays()) + m.Status = types.StringValue(string(resp.GetStatus())) + storage, diags := postgresflexalphadatasource.NewStorageValue( + postgresflexalphadatasource.StorageValue{}.AttributeTypes(ctx), + map[string]attr.Value{ + "performance_class": types.StringValue(resp.Storage.GetPerformanceClass()), + "size": types.Int64Value(resp.Storage.GetSize()), + }, + ) + if diags.HasError() { + return fmt.Errorf("failed converting storage from response") + } + m.Storage = storage + m.Version = types.StringValue(resp.GetVersion()) + return nil } diff --git a/stackit/internal/services/postgresflexalpha/instance/models.go b/stackit/internal/services/postgresflexalpha/instance/models.go deleted file mode 100644 index 708e5875..00000000 --- a/stackit/internal/services/postgresflexalpha/instance/models.go +++ /dev/null @@ -1,63 +0,0 @@ -package postgresflexalpha - -import ( - "github.com/hashicorp/terraform-plugin-framework/attr" - "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" -) - -type Model struct { - Id types.String `tfsdk:"id"` // needed by TF - InstanceId types.String `tfsdk:"instance_id"` - ProjectId types.String `tfsdk:"project_id"` - Name types.String `tfsdk:"name"` - BackupSchedule types.String `tfsdk:"backup_schedule"` - FlavorId types.String `tfsdk:"flavor_id"` - Replicas types.Int64 `tfsdk:"replicas"` - RetentionDays types.Int64 `tfsdk:"retention_days"` - Storage types.Object `tfsdk:"storage"` - Version types.String `tfsdk:"version"` - Region types.String `tfsdk:"region"` - Encryption types.Object `tfsdk:"encryption"` - Network types.Object `tfsdk:"network"` -} - -type encryptionModel struct { - KeyRingId types.String `tfsdk:"keyring_id"` - KeyId types.String `tfsdk:"key_id"` - KeyVersion types.String `tfsdk:"key_version"` - ServiceAccount types.String `tfsdk:"service_account"` -} - -var encryptionTypes = map[string]attr.Type{ - "keyring_id": basetypes.StringType{}, - "key_id": basetypes.StringType{}, - "key_version": basetypes.StringType{}, - "service_account": basetypes.StringType{}, -} - -type networkModel struct { - ACL types.List `tfsdk:"acl"` - AccessScope types.String `tfsdk:"access_scope"` - InstanceAddress types.String `tfsdk:"instance_address"` - RouterAddress types.String `tfsdk:"router_address"` -} - -var networkTypes = map[string]attr.Type{ - "acl": basetypes.ListType{ElemType: types.StringType}, - "access_scope": basetypes.StringType{}, - "instance_address": basetypes.StringType{}, - "router_address": basetypes.StringType{}, -} - -// Struct corresponding to Model.Storage -type storageModel struct { - Class types.String `tfsdk:"class"` - Size types.Int64 `tfsdk:"size"` -} - -// Types corresponding to storageModel -var storageTypes = map[string]attr.Type{ - "class": basetypes.StringType{}, - "size": basetypes.Int64Type{}, -} diff --git a/stackit/internal/services/postgresflexalpha/instance/planModifiers.yaml b/stackit/internal/services/postgresflexalpha/instance/planModifiers.yaml new file mode 100644 index 00000000..4843c9ea --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/instance/planModifiers.yaml @@ -0,0 +1,112 @@ +fields: + - name: 'backup_schedule' + modifiers: + - 'UseStateForUnknown' + + - name: 'encryption.kek_key_id' + validators: + - validate.NoSeparator + modifiers: + - 'RequiresReplace' + + - name: 'encryption.kek_key_ring_id' + validators: + - validate.NoSeparator + modifiers: + - 'RequiresReplace' + + - name: 'encryption.kek_key_version' + validators: + - validate.NoSeparator + modifiers: + - 'RequiresReplace' + + - name: 'encryption.service_account' + validators: + - validate.NoSeparator + modifiers: + - 'RequiresReplace' + + - name: 'flavor_id' + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'id' + modifiers: + - 'UseStateForUnknown' + + - name: 'instance_id' + validators: + - validate.NoSeparator + - validate.UUID + modifiers: + - 'UseStateForUnknown' + + - name: 'is_deletable' + modifiers: + - 'UseStateForUnknown' + + - name: 'name' + modifiers: + - 'UseStateForUnknown' + + - name: 'network.access_scope' + validators: + - validate.NoSeparator + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'network.acl' + modifiers: + - 'UseStateForUnknown' + + - name: 'network.instance_address' + modifiers: + - 'UseStateForUnknown' + + - name: 'network.router_address' + modifiers: + - 'UseStateForUnknown' + + - name: 'project_id' + validators: + - validate.NoSeparator + - validate.UUID + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'region' + modifiers: + - 'RequiresReplace' + + - name: 'replicas' + modifiers: + - 'UseStateForUnknown' + + - name: 'retention_days' + modifiers: + - 'UseStateForUnknown' + + - name: 'status' + modifiers: + - 'UseStateForUnknown' + + - name: 'storage' + modifiers: + - 'UseStateForUnknown' + + - name: 'storage.performance_class' + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'storage.size' + modifiers: + - 'UseStateForUnknown' + + - name: 'version' + modifiers: + - 'UseStateForUnknown' diff --git a/stackit/internal/services/postgresflexalpha/instance/resource.go b/stackit/internal/services/postgresflexalpha/instance/resource.go index 1c243826..197c2e2d 100644 --- a/stackit/internal/services/postgresflexalpha/instance/resource.go +++ b/stackit/internal/services/postgresflexalpha/instance/resource.go @@ -2,36 +2,29 @@ package postgresflexalpha import ( "context" + _ "embed" "fmt" + "math" "net/http" - "regexp" "strings" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier" - postgresflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha/wait" - postgresflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils" - - "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" - "github.com/hashicorp/terraform-plugin-framework/schema/validator" - "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - "github.com/hashicorp/terraform-plugin-log/tflog" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/utils" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/validate" - "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/resource/schema" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" - "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/identityschema" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" + postgresflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" + postgresflexalpha "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance/resources_gen" + postgresflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/utils" + wait "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/wait/postgresflexalpha" "github.com/stackitcloud/stackit-sdk-go/core/oapierror" ) +const packageName = "postgresflexalpha" + // Ensure the implementation satisfies the expected interfaces. var ( _ resource.Resource = &instanceResource{} @@ -39,7 +32,7 @@ var ( _ resource.ResourceWithImportState = &instanceResource{} _ resource.ResourceWithModifyPlan = &instanceResource{} _ resource.ResourceWithValidateConfig = &instanceResource{} - // _ resource.ResourceWithIdentity = &instanceResource{} + _ resource.ResourceWithIdentity = &instanceResource{} ) // NewInstanceResource is a helper function to simplify the provider implementation. @@ -53,12 +46,14 @@ type instanceResource struct { providerData core.ProviderData } -func (r *instanceResource) ValidateConfig( - ctx context.Context, - req resource.ValidateConfigRequest, - resp *resource.ValidateConfigResponse, -) { - var data Model +type InstanceResourceIdentityModel struct { + ProjectID types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + InstanceID types.String `tfsdk:"instance_id"` +} + +func (r *instanceResource) ValidateConfig(ctx context.Context, req resource.ValidateConfigRequest, resp *resource.ValidateConfigResponse) { + var data postgresflexalpha.InstanceModel resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) if resp.Diagnostics.HasError() { @@ -77,12 +72,8 @@ func (r *instanceResource) ValidateConfig( // ModifyPlan implements resource.ResourceWithModifyPlan. // Use the modifier to set the effective region in the current plan. -func (r *instanceResource) ModifyPlan( - ctx context.Context, - req resource.ModifyPlanRequest, - resp *resource.ModifyPlanResponse, -) { // nolint:gocritic // function signature required by Terraform - var configModel Model +func (r *instanceResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { // nolint:gocritic // function signature required by Terraform + var configModel postgresflexalpha.InstanceModel // skip initial empty configuration to avoid follow-up errors if req.Config.Raw.IsNull() { return @@ -92,7 +83,7 @@ func (r *instanceResource) ModifyPlan( return } - var planModel Model + var planModel postgresflexalpha.InstanceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &planModel)...) if resp.Diagnostics.HasError() { return @@ -134,252 +125,54 @@ func (r *instanceResource) Configure( tflog.Info(ctx, "Postgres Flex instance client configured") } +/* + until tfplugingen framework can handle plan modifiers, we use a function to add them +*/ + +//go:embed planModifiers.yaml +var modifiersFileByte []byte + // Schema defines the schema for the resource. -func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { - descriptions := map[string]string{ - "main": "Postgres Flex instance resource schema. Must have a `region` specified in the provider configuration.", - "id": "Terraform's internal resource ID. It is structured as \"`project_id`,`region`,`instance_id`\".", - "instance_id": "ID of the PostgresFlex instance.", - "project_id": "STACKIT project ID to which the instance is associated.", - "name": "Instance name.", - "backup_schedule": "The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.", - "retention_days": "The days of the retention period.", - "flavor_id": "The ID of the flavor.", - "replicas": "The number of replicas.", - "storage": "The block of the storage configuration.", - "storage_class": "The storage class used.", - "storage_size": "The disk size of the storage.", - "region": "The resource region. If not defined, the provider region is used.", - "version": "The database version used.", - "encryption": "The encryption block.", - "keyring_id": "KeyRing ID of the encryption key.", - "key_id": "Key ID of the encryption key.", - "key_version": "Key version of the encryption key.", - "service_account": "The service account ID of the service account.", - "network": "The network block configuration.", - "access_scope": "The access scope. (Either SNA or PUBLIC)", - "acl": "The Access Control List (ACL) for the PostgresFlex instance.", - "instance_address": "The returned instance address.", - "router_address": "The returned router address.", +func (r *instanceResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { + schema := postgresflexalpha.InstanceResourceSchema(ctx) + fields, err := postgresflexUtils.ReadModifiersConfig(modifiersFileByte) + if err != nil { + resp.Diagnostics.AddError("error during read modifiers config file", err.Error()) + return } - resp.Schema = schema.Schema{ - Description: descriptions["main"], - Attributes: map[string]schema.Attribute{ - "id": schema.StringAttribute{ - Description: descriptions["id"], - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, + err = postgresflexUtils.AddPlanModifiersToResourceSchema(fields, &schema) + if err != nil { + resp.Diagnostics.AddError("error adding plan modifiers", err.Error()) + return + } + resp.Schema = schema +} + +func (r *instanceResource) IdentitySchema(_ context.Context, _ resource.IdentitySchemaRequest, resp *resource.IdentitySchemaResponse) { + resp.IdentitySchema = identityschema.Schema{ + Attributes: map[string]identityschema.Attribute{ + "project_id": identityschema.StringAttribute{ + RequiredForImport: true, // must be set during import by the practitioner }, - "instance_id": schema.StringAttribute{ - Description: descriptions["instance_id"], - Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, - Validators: []validator.String{ - validate.UUID(), - validate.NoSeparator(), - }, + "region": identityschema.StringAttribute{ + RequiredForImport: true, // can be defaulted by the provider configuration }, - "project_id": schema.StringAttribute{ - Description: descriptions["project_id"], - Required: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplace(), - stringplanmodifier.UseStateForUnknown(), - }, - Validators: []validator.String{ - validate.UUID(), - validate.NoSeparator(), - }, - }, - "name": schema.StringAttribute{ - Description: descriptions["name"], - Required: true, - Validators: []validator.String{ - stringvalidator.LengthAtLeast(1), - stringvalidator.RegexMatches( - regexp.MustCompile("^[a-z]([-a-z0-9]*[a-z0-9])?$"), - "must start with a letter, must have lower case letters, numbers or hyphens, and no hyphen at the end", - ), - }, - }, - "backup_schedule": schema.StringAttribute{ - Required: true, - }, - "retention_days": schema.Int64Attribute{ - Description: descriptions["retention_days"], - Required: true, - }, - "flavor_id": schema.StringAttribute{ - Required: true, - }, - "replicas": schema.Int64Attribute{ - Required: true, - PlanModifiers: []planmodifier.Int64{ - int64planmodifier.RequiresReplace(), - }, - }, - "storage": schema.SingleNestedAttribute{ - Required: true, - Attributes: map[string]schema.Attribute{ - "class": schema.StringAttribute{ - Required: true, - Description: descriptions["storage_class"], - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplace(), - }, - }, - "size": schema.Int64Attribute{ - Description: descriptions["storage_size"], - Required: true, - // PlanModifiers: []planmodifier.Int64{ - // TODO - req replace if new size smaller than state size - // int64planmodifier.RequiresReplaceIf(), - // }, - }, - }, - }, - "version": schema.StringAttribute{ - Description: descriptions["version"], - Required: true, - }, - "region": schema.StringAttribute{ - Optional: true, - // must be computed to allow for storing the override value from the provider - Computed: true, - Description: descriptions["region"], - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplace(), - }, - }, - "encryption": schema.SingleNestedAttribute{ - Required: true, - Attributes: map[string]schema.Attribute{ - "key_id": schema.StringAttribute{ - Description: descriptions["key_id"], - Required: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplace(), - }, - Validators: []validator.String{ - validate.NoSeparator(), - }, - }, - "key_version": schema.StringAttribute{ - Description: descriptions["key_version"], - Required: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplace(), - }, - Validators: []validator.String{ - validate.NoSeparator(), - }, - }, - "keyring_id": schema.StringAttribute{ - Description: descriptions["keyring_id"], - Required: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplace(), - }, - Validators: []validator.String{ - validate.NoSeparator(), - }, - }, - "service_account": schema.StringAttribute{ - Description: descriptions["service_account"], - Required: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplace(), - }, - Validators: []validator.String{ - validate.NoSeparator(), - }, - }, - }, - Description: descriptions["encryption"], - //Validators: nil, - PlanModifiers: []planmodifier.Object{}, - }, - "network": schema.SingleNestedAttribute{ - Required: true, - Attributes: map[string]schema.Attribute{ - "access_scope": schema.StringAttribute{ - Default: stringdefault.StaticString( - "PUBLIC", - ), - Description: descriptions["access_scope"], - Computed: true, - Optional: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplace(), - stringplanmodifier.UseStateForUnknown(), - }, - Validators: []validator.String{ - validate.NoSeparator(), - stringvalidator.OneOf("SNA", "PUBLIC"), - }, - }, - "acl": schema.ListAttribute{ - Description: descriptions["acl"], - ElementType: types.StringType, - Required: true, - PlanModifiers: []planmodifier.List{ - listplanmodifier.UseStateForUnknown(), - }, - }, - "instance_address": schema.StringAttribute{ - Description: descriptions["instance_address"], - Computed: true, - Optional: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, - }, - "router_address": schema.StringAttribute{ - Description: descriptions["router_address"], - Computed: true, - Optional: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, - }, - }, - Description: descriptions["network"], - //MarkdownDescription: "", - //Validators: nil, - PlanModifiers: []planmodifier.Object{}, + "instance_id": identityschema.StringAttribute{ + RequiredForImport: true, // can be defaulted by the provider configuration }, }, } } -// func (r *instanceResource) IdentitySchema(_ context.Context, _ resource.IdentitySchemaRequest, resp *resource.IdentitySchemaResponse) { -// resp.IdentitySchema = identityschema.Schema{ -// Attributes: map[string]identityschema.Attribute{ -// "project_id": identityschema.StringAttribute{ -// RequiredForImport: true, // must be set during import by the practitioner -// }, -// "region": identityschema.StringAttribute{ -// RequiredForImport: true, // must be set during import by the practitioner -// }, -// "instance_id": identityschema.StringAttribute{ -// RequiredForImport: true, // must be set during import by the practitioner -// }, -// }, -// } -//} - // Create creates the resource and sets the initial Terraform state. func (r *instanceResource) Create( ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse, ) { // nolint:gocritic // function signature required by Terraform - var model Model + var model postgresflexalpha.InstanceModel + diags := req.Plan.Get(ctx, &model) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { @@ -393,96 +186,57 @@ func (r *instanceResource) Create( ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "region", region) - var storage = &storageModel{} - if !model.Storage.IsNull() && !model.Storage.IsUnknown() { - diags = model.Storage.As(ctx, storage, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var encryption = &encryptionModel{} - if !model.Encryption.IsNull() && !model.Encryption.IsUnknown() { - diags = model.Encryption.As(ctx, encryption, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var network = &networkModel{} - if !model.Network.IsNull() && !model.Network.IsUnknown() { - diags = model.Network.As(ctx, network, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var acl []string - if !network.ACL.IsNull() && !network.ACL.IsUnknown() { - diags = network.ACL.ElementsAs(ctx, &acl, false) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - // Generate API request body from model - payload, err := toCreatePayload(&model, storage, encryption, network) - if err != nil { - core.LogAndAddError( - ctx, - &resp.Diagnostics, - "Error creating instance", - fmt.Sprintf("Creating API payload: %v", err), - ) + var netAcl []string + diag := model.Network.Acl.ElementsAs(ctx, &netAcl, false) + resp.Diagnostics.Append(diags...) + if diag.HasError() { return } + + if model.Replicas.ValueInt64() > math.MaxInt32 { + resp.Diagnostics.AddError("invalid int32 value", "provided int64 value does not fit into int32") + return + } + replVal := int32(model.Replicas.ValueInt64()) // nolint:gosec // check is performed above + payload := modelToCreateInstancePayload(netAcl, model, replVal) + // Create new instance - createResp, err := r.client.CreateInstanceRequest( - ctx, - projectId, - region, - ).CreateInstanceRequestPayload(*payload).Execute() + createResp, err := r.client.CreateInstanceRequest(ctx, projectId, region).CreateInstanceRequestPayload(payload).Execute() if err != nil { - core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Calling API: %v", err)) + core.LogAndAddError(ctx, &resp.Diagnostics, "error creating instance", fmt.Sprintf("Calling API: %v", err)) return } ctx = core.LogResponse(ctx) - instanceId := *createResp.Id + instanceId, ok := createResp.GetIdOk() + if !ok { + core.LogAndAddError(ctx, &resp.Diagnostics, "error creating instance", "could not find instance id in response") + return + } - model.InstanceId = types.StringValue(instanceId) - model.Id = utils.BuildInternalTerraformId(projectId, region, instanceId) - resp.Diagnostics.Append(resp.State.Set(ctx, &model)...) + // Set data returned by API in identity + identity := InstanceResourceIdentityModel{ + ProjectID: types.StringValue(projectId), + Region: types.StringValue(region), + InstanceID: types.StringValue(instanceId), + } + resp.Diagnostics.Append(resp.Identity.Set(ctx, identity)...) if resp.Diagnostics.HasError() { return } waitResp, err := wait.CreateInstanceWaitHandler(ctx, r.client, projectId, region, instanceId).WaitWithContext(ctx) if err != nil { - core.LogAndAddError( - ctx, - &resp.Diagnostics, - "Error creating instance", - fmt.Sprintf("Wait handler error: %v", err), - ) + core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Wait handler error: %v", err)) return } - // Map response body to schema - err = mapFields(ctx, waitResp, &model, storage, encryption, network, region) + err = mapGetInstanceResponseToModel(ctx, &model, waitResp) if err != nil { - core.LogAndAddError( - ctx, - &resp.Diagnostics, - "Error creating instance", - fmt.Sprintf("Processing API payload: %v", err), - ) + core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating instance", fmt.Sprintf("Error creating model: %v", err)) return } + // Set state to fully populated data diags = resp.State.Set(ctx, model) resp.Diagnostics.Append(diags...) @@ -492,55 +246,97 @@ func (r *instanceResource) Create( tflog.Info(ctx, "Postgres Flex instance created") } +func modelToCreateInstancePayload(netAcl []string, model postgresflexalpha.InstanceModel, replVal int32) postgresflex.CreateInstanceRequestPayload { + payload := postgresflex.CreateInstanceRequestPayload{ + BackupSchedule: model.BackupSchedule.ValueStringPointer(), + Encryption: &postgresflex.InstanceEncryption{ + KekKeyId: model.Encryption.KekKeyId.ValueStringPointer(), + KekKeyRingId: model.Encryption.KekKeyRingId.ValueStringPointer(), + KekKeyVersion: model.Encryption.KekKeyVersion.ValueStringPointer(), + ServiceAccount: model.Encryption.ServiceAccount.ValueStringPointer(), + }, + FlavorId: model.FlavorId.ValueStringPointer(), + Name: model.Name.ValueStringPointer(), + Network: &postgresflex.InstanceNetwork{ + AccessScope: postgresflex.InstanceNetworkGetAccessScopeAttributeType( + model.Network.AccessScope.ValueStringPointer(), + ), + Acl: &netAcl, + InstanceAddress: model.Network.InstanceAddress.ValueStringPointer(), + RouterAddress: model.Network.RouterAddress.ValueStringPointer(), + }, + Replicas: postgresflex.CreateInstanceRequestPayloadGetReplicasAttributeType(&replVal), + RetentionDays: model.RetentionDays.ValueInt64Pointer(), + Storage: &postgresflex.StorageCreate{ + PerformanceClass: model.Storage.PerformanceClass.ValueStringPointer(), + Size: model.Storage.Size.ValueInt64Pointer(), + }, + Version: model.Version.ValueStringPointer(), + } + return payload +} + // Read refreshes the Terraform state with the latest data. -func (r *instanceResource) Read( - ctx context.Context, - req resource.ReadRequest, - resp *resource.ReadResponse, -) { // nolint:gocritic // function signature required by Terraform - var model Model +func (r *instanceResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { // nolint:gocritic // function signature required by Terraform + functionErrorSummary := "read instance failed" + + var model postgresflexalpha.InstanceModel diags := req.State.Get(ctx, &model) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { return } + // Read identity data + var identityData InstanceResourceIdentityModel + resp.Diagnostics.Append(req.Identity.Get(ctx, &identityData)...) + if resp.Diagnostics.HasError() { + return + } + ctx = core.InitProviderContext(ctx) - projectId := model.ProjectId.ValueString() - instanceId := model.InstanceId.ValueString() - region := r.providerData.GetRegionWithOverride(model.Region) + // projectId := model.ProjectId.ValueString() + // region := r.providerData.GetRegionWithOverride(model.Region) + // instanceId := model.InstanceId.ValueString() + + var projectId string + if !model.ProjectId.IsNull() && !model.ProjectId.IsUnknown() { + projectId = model.ProjectId.ValueString() + } else { + if identityData.ProjectID.IsNull() || identityData.ProjectID.IsUnknown() { + core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, "project_id not found in config") + return + } + projectId = identityData.ProjectID.ValueString() + } + + var region string + if !model.Region.IsNull() && !model.Region.IsUnknown() { + region = r.providerData.GetRegionWithOverride(model.Region) + } else { + if identityData.Region.IsNull() || identityData.Region.IsUnknown() { + core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, "region not found in config") + return + } + region = r.providerData.GetRegionWithOverride(identityData.Region) + } + + var instanceId string + if !model.InstanceId.IsNull() && !model.InstanceId.IsUnknown() { + instanceId = model.InstanceId.ValueString() + } else { + if identityData.InstanceID.IsNull() || identityData.InstanceID.IsUnknown() { + core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, "instance_id not found in config") + return + } + instanceId = identityData.InstanceID.ValueString() + } + ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "instance_id", instanceId) ctx = tflog.SetField(ctx, "region", region) - var storage = storageModel{} - if !model.Storage.IsNull() && !model.Storage.IsUnknown() { - diags = model.Storage.As(ctx, &storage, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var network = networkModel{} - if !model.Network.IsNull() && !model.Network.IsUnknown() { - diags = model.Network.As(ctx, &network, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var encryption = encryptionModel{} - if !model.Encryption.IsNull() && !model.Encryption.IsUnknown() { - diags = model.Encryption.As(ctx, &encryption, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - instanceResp, err := r.client.GetInstanceRequest(ctx, projectId, region, instanceId).Execute() if err != nil { oapiErr, ok := err.(*oapierror.GenericOpenAPIError) //nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped @@ -548,21 +344,32 @@ func (r *instanceResource) Read( resp.State.RemoveResource(ctx) return } - core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading instance", err.Error()) + core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, err.Error()) return } ctx = core.LogResponse(ctx) - // Map response body to schema - err = mapFields(ctx, instanceResp, &model, &storage, &encryption, &network, region) + respInstanceID, ok := instanceResp.GetIdOk() + if !ok { + core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, "response provided no ID") + return + } + if !model.InstanceId.IsUnknown() && !model.InstanceId.IsNull() { + if respInstanceID != instanceId { + core.LogAndAddError( + ctx, + &resp.Diagnostics, + functionErrorSummary, + "ID in response did not match ID in state", + ) + return + } + } + + err = mapGetInstanceResponseToModel(ctx, &model, instanceResp) if err != nil { - core.LogAndAddError( - ctx, - &resp.Diagnostics, - "Error reading instance", - fmt.Sprintf("Processing API payload: %v", err), - ) + core.LogAndAddError(ctx, &resp.Diagnostics, functionErrorSummary, fmt.Sprintf("Processing API payload: %v", err)) return } @@ -572,16 +379,24 @@ func (r *instanceResource) Read( return } + // Set data returned by API in identity + identity := InstanceResourceIdentityModel{ + ProjectID: types.StringValue(projectId), + Region: types.StringValue(region), + InstanceID: types.StringValue(instanceId), + } + resp.Diagnostics.Append(resp.Identity.Set(ctx, identity)...) + if resp.Diagnostics.HasError() { + return + } + tflog.Info(ctx, "Postgres Flex instance read") } // Update updates the resource and sets the updated Terraform state on success. -func (r *instanceResource) Update( - ctx context.Context, - req resource.UpdateRequest, - resp *resource.UpdateResponse, -) { // nolint:gocritic // function signature required by Terraform - var model Model +func (r *instanceResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // nolint:gocritic // function signature required by Terraform + var model postgresflexalpha.InstanceModel + diags := req.Plan.Get(ctx, &model) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { @@ -590,68 +405,70 @@ func (r *instanceResource) Update( ctx = core.InitProviderContext(ctx) - projectId := model.ProjectId.ValueString() - instanceId := model.InstanceId.ValueString() + // Read identity data + var identityData InstanceResourceIdentityModel + resp.Diagnostics.Append(req.Identity.Get(ctx, &identityData)...) + if resp.Diagnostics.HasError() { + return + } + + //if model.InstanceId.IsNull() || model.InstanceId.IsUnknown() { + // core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", "instanceId is null or unknown") + // return + //} + // + //if model.ProjectId.IsNull() || model.ProjectId.IsUnknown() { + // core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", "projectId is null or unknown") + // return + //} + + //projectId := model.ProjectId.ValueString() + //instanceId := model.InstanceId.ValueString() + projectId := identityData.ProjectID.ValueString() + instanceId := identityData.InstanceID.ValueString() region := model.Region.ValueString() ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "instance_id", instanceId) ctx = tflog.SetField(ctx, "region", region) - // nolint:gocritic // need that code later - // var acl []string - // if !(model.ACL.IsNull() || model.ACL.IsUnknown()) { - // diags = model.ACL.ElementsAs(ctx, &acl, false) - // resp.Diagnostics.Append(diags...) - // if resp.Diagnostics.HasError() { - // return - // } - // } - - var storage = &storageModel{} - if !model.Storage.IsNull() && !model.Storage.IsUnknown() { - diags = model.Storage.As(ctx, storage, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var network = &networkModel{} - if !model.Network.IsNull() && !model.Network.IsUnknown() { - diags = model.Network.As(ctx, network, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - var encryption = &encryptionModel{} - if !model.Encryption.IsNull() && !model.Encryption.IsUnknown() { - diags = model.Encryption.As(ctx, encryption, basetypes.ObjectAsOptions{}) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - } - - // Generate API request body from model - payload, err := toUpdatePayload(&model, storage, network) - if err != nil { - core.LogAndAddError( - ctx, - &resp.Diagnostics, - "Error updating instance", - fmt.Sprintf("Creating API payload: %v", err), - ) + var netAcl []string + diag := model.Network.Acl.ElementsAs(ctx, &netAcl, false) + resp.Diagnostics.Append(diags...) + if diag.HasError() { return } + + if model.Replicas.ValueInt64() > math.MaxInt32 { + resp.Diagnostics.AddError("invalid int32 value", "provided int64 value does not fit into int32") + return + } + replInt32 := int32(model.Replicas.ValueInt64()) // nolint:gosec // check is performed above + + payload := postgresflex.UpdateInstanceRequestPayload{ + BackupSchedule: model.BackupSchedule.ValueStringPointer(), + FlavorId: model.FlavorId.ValueStringPointer(), + Name: model.Name.ValueStringPointer(), + Network: &postgresflex.InstanceNetwork{ + AccessScope: postgresflex.InstanceNetworkGetAccessScopeAttributeType( + model.Network.AccessScope.ValueStringPointer(), + ), + Acl: &netAcl, + }, + Replicas: postgresflex.UpdateInstanceRequestPayloadGetReplicasAttributeType(&replInt32), + RetentionDays: model.RetentionDays.ValueInt64Pointer(), + Storage: &postgresflex.StorageUpdate{ + Size: model.Storage.Size.ValueInt64Pointer(), + }, + Version: model.Version.ValueStringPointer(), + } + // Update existing instance - err = r.client.UpdateInstancePartiallyRequest( + err := r.client.UpdateInstanceRequest( ctx, projectId, region, instanceId, - ).UpdateInstancePartiallyRequestPayload(*payload).Execute() + ).UpdateInstanceRequestPayload(payload).Execute() if err != nil { core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", err.Error()) return @@ -659,34 +476,18 @@ func (r *instanceResource) Update( ctx = core.LogResponse(ctx) - waitResp, err := wait.PartialUpdateInstanceWaitHandler( - ctx, - r.client, - projectId, - region, - instanceId, - ).WaitWithContext(ctx) + waitResp, err := wait.PartialUpdateInstanceWaitHandler(ctx, r.client, projectId, region, instanceId).WaitWithContext(ctx) if err != nil { - core.LogAndAddError( - ctx, - &resp.Diagnostics, - "Error updating instance", - fmt.Sprintf("Instance update waiting: %v", err), - ) + core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Instance update waiting: %v", err)) return } - // Map response body to schema - err = mapFields(ctx, waitResp, &model, storage, encryption, network, region) + err = mapGetInstanceResponseToModel(ctx, &model, waitResp) if err != nil { - core.LogAndAddError( - ctx, - &resp.Diagnostics, - "Error updating instance", - fmt.Sprintf("Processing API payload: %v", err), - ) + core.LogAndAddError(ctx, &resp.Diagnostics, "Error updating instance", fmt.Sprintf("Processing API payload: %v", err)) return } + diags = resp.State.Set(ctx, model) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { @@ -696,12 +497,9 @@ func (r *instanceResource) Update( } // Delete deletes the resource and removes the Terraform state on success. -func (r *instanceResource) Delete( - ctx context.Context, - req resource.DeleteRequest, - resp *resource.DeleteResponse, -) { // nolint:gocritic // function signature required by Terraform - var model Model +func (r *instanceResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { // nolint:gocritic // function signature required by Terraform + var model postgresflexalpha.InstanceModel + diags := req.State.Get(ctx, &model) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { @@ -740,25 +538,46 @@ func (r *instanceResource) Delete( } // ImportState imports a resource into the Terraform state on success. -// The expected format of the resource import identifier is: project_id,instance_id -func (r *instanceResource) ImportState( - ctx context.Context, - req resource.ImportStateRequest, - resp *resource.ImportStateResponse, -) { - idParts := strings.Split(req.ID, core.Separator) +// The expected format of the resource import identifier is: project_id,region,instance_id +func (r *instanceResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + ctx = core.InitProviderContext(ctx) - if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" { - core.LogAndAddError( - ctx, &resp.Diagnostics, - "Error importing instance", - fmt.Sprintf("Expected import identifier with format: [project_id],[region],[instance_id] Got: %q", req.ID), - ) + if req.ID != "" { + idParts := strings.Split(req.ID, core.Separator) + + if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" { + core.LogAndAddError(ctx, &resp.Diagnostics, + "Error importing instance", + fmt.Sprintf("Expected import identifier with format: [project_id],[region],[instance_id] Got: %q", req.ID), + ) + return + } + + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), idParts[0])...) + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), idParts[1])...) + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), idParts[2])...) return } - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), idParts[0])...) - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), idParts[1])...) - resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), idParts[2])...) + var identityData InstanceResourceIdentityModel + resp.Diagnostics.Append(req.Identity.Get(ctx, &identityData)...) + if resp.Diagnostics.HasError() { + return + } + + resp.Diagnostics.Append( + resp.State.SetAttribute( + ctx, + path.Root("id"), + utils.BuildInternalTerraformId( + identityData.ProjectID.ValueString(), + identityData.Region.ValueString(), + identityData.InstanceID.ValueString(), + ), + )...) + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), identityData.ProjectID.ValueString())...) + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), identityData.Region.ValueString())...) + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("instance_id"), identityData.InstanceID.ValueString())...) + tflog.Info(ctx, "Postgres Flex instance state imported") } diff --git a/stackit/internal/services/postgresflexalpha/instance/resource_test.go b/stackit/internal/services/postgresflexalpha/instance/resource_test.go index 781a96be..46d935a5 100644 --- a/stackit/internal/services/postgresflexalpha/instance/resource_test.go +++ b/stackit/internal/services/postgresflexalpha/instance/resource_test.go @@ -1,16 +1,10 @@ package postgresflexalpha import ( - "context" "reflect" "testing" - "github.com/google/go-cmp/cmp" - "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/resource" - "github.com/hashicorp/terraform-plugin-framework/types" - postgresflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha" - "github.com/stackitcloud/stackit-sdk-go/core/utils" ) // type postgresFlexClientMocked struct { @@ -26,608 +20,6 @@ import ( // return c.getFlavorsResp, nil // } -func TestMapFields(t *testing.T) { - const testRegion = "region" - tests := []struct { - description string - state Model - input *postgresflex.GetInstanceResponse - storage *storageModel - encryption *encryptionModel - network *networkModel - region string - expected Model - isValid bool - }{ - { - "default_values does exactly mean what?", - Model{ - InstanceId: types.StringValue("iid"), - ProjectId: types.StringValue("pid"), - Replicas: types.Int64Value(1), - }, - &postgresflex.GetInstanceResponse{ - FlavorId: utils.Ptr("flavor_id"), - Replicas: postgresflex.GetInstanceResponseGetReplicasAttributeType(utils.Ptr(int32(1))), - }, - &storageModel{}, - &encryptionModel{}, - &networkModel{ - ACL: types.ListValueMust( - types.StringType, []attr.Value{ - types.StringValue("0.0.0.0/0"), - }, - ), - }, - testRegion, - Model{ - Id: types.StringValue("pid,region,iid"), - InstanceId: types.StringValue("iid"), - ProjectId: types.StringValue("pid"), - Name: types.StringNull(), - FlavorId: types.StringValue("flavor_id"), - //ACL: types.ListNull(types.StringType), - BackupSchedule: types.StringNull(), - Replicas: types.Int64Value(1), - Encryption: types.ObjectValueMust( - encryptionTypes, map[string]attr.Value{ - "keyring_id": types.StringNull(), - "key_id": types.StringNull(), - "key_version": types.StringNull(), - "service_account": types.StringNull(), - }, - ), - Storage: types.ObjectValueMust( - storageTypes, map[string]attr.Value{ - "class": types.StringNull(), - "size": types.Int64Null(), - }, - ), - Network: types.ObjectValueMust( - networkTypes, map[string]attr.Value{ - "acl": types.ListValueMust( - types.StringType, []attr.Value{ - types.StringValue("0.0.0.0/0"), - }, - ), - "access_scope": types.StringNull(), - "instance_address": types.StringNull(), - "router_address": types.StringNull(), - }, - ), - Version: types.StringNull(), - Region: types.StringValue(testRegion), - }, - true, - }, - // { - // "acl_unordered", - // Model{ - // InstanceId: types.StringValue("iid"), - // ProjectId: types.StringValue("pid"), - // // ACL: types.ListValueMust(types.StringType, []attr.Value{ - // // types.StringValue("ip2"), - // // types.StringValue(""), - // // types.StringValue("ip1"), - // // }), - // }, - // &postgresflex.GetInstanceResponse{ - // // Acl: &[]string{ - // // "", - // // "ip1", - // // "ip2", - // // }, - // BackupSchedule: utils.Ptr("schedule"), - // FlavorId: nil, - // Id: utils.Ptr("iid"), - // Name: utils.Ptr("name"), - // Replicas: postgresflex.GetInstanceResponseGetReplicasAttributeType(utils.Ptr(int32(56))), - // Status: postgresflex.GetInstanceResponseGetStatusAttributeType(utils.Ptr("status")), - // Storage: nil, - // Version: utils.Ptr("version"), - // }, - // &flavorModel{ - // CPU: types.Int64Value(12), - // RAM: types.Int64Value(34), - // }, - // &storageModel{ - // Class: types.StringValue("class"), - // Size: types.Int64Value(78), - // }, - // &encryptionModel{}, - // &networkModel{}, - // testRegion, - // Model{ - // Id: types.StringValue("pid,region,iid"), - // InstanceId: types.StringValue("iid"), - // ProjectId: types.StringValue("pid"), - // Name: types.StringValue("name"), - // // ACL: types.ListValueMust(types.StringType, []attr.Value{ - // // types.StringValue("ip2"), - // // types.StringValue(""), - // // types.StringValue("ip1"), - // // }), - // BackupSchedule: types.StringValue("schedule"), - // Flavor: types.ObjectValueMust(flavorTypes, map[string]attr.Value{ - // "id": types.StringNull(), - // "description": types.StringNull(), - // "cpu": types.Int64Value(12), - // "ram": types.Int64Value(34), - // }), - // Replicas: types.Int64Value(56), - // Storage: types.ObjectValueMust(storageTypes, map[string]attr.Value{ - // "class": types.StringValue("class"), - // "size": types.Int64Value(78), - // }), - // Version: types.StringValue("version"), - // Region: types.StringValue(testRegion), - // }, - // true, - // }, - { - "nil_response", - Model{ - InstanceId: types.StringValue("iid"), - ProjectId: types.StringValue("pid"), - }, - nil, - &storageModel{}, - &encryptionModel{}, - &networkModel{}, - testRegion, - Model{}, - false, - }, - { - "no_resource_id", - Model{ - InstanceId: types.StringValue("iid"), - ProjectId: types.StringValue("pid"), - }, - &postgresflex.GetInstanceResponse{}, - &storageModel{}, - &encryptionModel{}, - &networkModel{}, - testRegion, - Model{}, - false, - }, - } - for _, tt := range tests { - t.Run( - tt.description, func(t *testing.T) { - err := mapFields( - context.Background(), - tt.input, - &tt.state, - tt.storage, - tt.encryption, - tt.network, - tt.region, - ) - if !tt.isValid && err == nil { - t.Fatalf("Should have failed") - } - if tt.isValid && err != nil { - t.Fatalf("Should not have failed: %v", err) - } - if tt.isValid { - diff := cmp.Diff(tt.expected, tt.state) - if diff != "" { - t.Fatalf("Data does not match: %s", diff) - } - } - }, - ) - } -} - -func TestToCreatePayload(t *testing.T) { - tests := []struct { - description string - input *Model - inputAcl []string - inputStorage *storageModel - inputEncryption *encryptionModel - inputNetwork *networkModel - expected *postgresflex.CreateInstanceRequestPayload - isValid bool - }{ - { - "default_values", - &Model{ - Replicas: types.Int64Value(1), - }, - []string{}, - &storageModel{}, - &encryptionModel{}, - &networkModel{ - ACL: types.ListValueMust( - types.StringType, []attr.Value{ - types.StringValue("0.0.0.0/0"), - }, - ), - }, - &postgresflex.CreateInstanceRequestPayload{ - Acl: &[]string{"0.0.0.0/0"}, - Storage: postgresflex.CreateInstanceRequestPayloadGetStorageAttributeType(&postgresflex.Storage{}), - Encryption: &postgresflex.InstanceEncryption{}, - Network: &postgresflex.InstanceNetwork{ - Acl: &[]string{"0.0.0.0/0"}, - }, - Replicas: postgresflex.CreateInstanceRequestPayloadGetReplicasAttributeType(utils.Ptr(int32(1))), - }, - true, - }, - { - "nil_model", - nil, - []string{}, - &storageModel{}, - &encryptionModel{}, - &networkModel{}, - nil, - false, - }, - { - "nil_acl", - &Model{}, - nil, - &storageModel{}, - &encryptionModel{}, - &networkModel{}, - nil, - false, - }, - { - "nil_flavor", - &Model{}, - []string{}, - &storageModel{}, - &encryptionModel{}, - &networkModel{}, - nil, - false, - }, - { - "nil_storage", - &Model{}, - []string{}, - nil, - &encryptionModel{}, - &networkModel{}, - nil, - false, - }, - } - for _, tt := range tests { - t.Run( - tt.description, func(t *testing.T) { - output, err := toCreatePayload(tt.input, tt.inputStorage, tt.inputEncryption, tt.inputNetwork) - if !tt.isValid && err == nil { - t.Fatalf("Should have failed") - } - if tt.isValid && err != nil { - t.Fatalf("Should not have failed: %v", err) - } - if tt.isValid { - diff := cmp.Diff(tt.expected, output) - if diff != "" { - t.Fatalf("Data does not match: %s", diff) - } - } - }, - ) - } -} - -// func TestToUpdatePayload(t *testing.T) { -// tests := []struct { -// description string -// input *Model -// inputAcl []string -// inputFlavor *flavorModel -// inputStorage *storageModel -// expected *postgresflex.PartialUpdateInstancePayload -// isValid bool -// }{ -// { -// "default_values", -// &Model{}, -// []string{}, -// &flavorModel{}, -// &storageModel{}, -// &postgresflex.PartialUpdateInstancePayload{ -// Acl: &postgresflex.ACL{ -// Items: &[]string{}, -// }, -// Storage: &postgresflex.Storage{}, -// }, -// true, -// }, -// { -// "simple_values", -// &Model{ -// BackupSchedule: types.StringValue("schedule"), -// Name: types.StringValue("name"), -// Replicas: types.Int64Value(12), -// Version: types.StringValue("version"), -// }, -// []string{ -// "ip_1", -// "ip_2", -// }, -// &flavorModel{ -// Id: types.StringValue("flavor_id"), -// }, -// &storageModel{ -// Class: types.StringValue("class"), -// Size: types.Int64Value(34), -// }, -// &postgresflex.PartialUpdateInstancePayload{ -// Acl: &postgresflex.ACL{ -// Items: &[]string{ -// "ip_1", -// "ip_2", -// }, -// }, -// BackupSchedule: utils.Ptr("schedule"), -// FlavorId: utils.Ptr("flavor_id"), -// Name: utils.Ptr("name"), -// Replicas: utils.Ptr(int64(12)), -// Storage: &postgresflex.Storage{ -// Class: utils.Ptr("class"), -// Size: utils.Ptr(int64(34)), -// }, -// Version: utils.Ptr("version"), -// }, -// true, -// }, -// { -// "null_fields_and_int_conversions", -// &Model{ -// BackupSchedule: types.StringNull(), -// Name: types.StringNull(), -// Replicas: types.Int64Value(2123456789), -// Version: types.StringNull(), -// }, -// []string{ -// "", -// }, -// &flavorModel{ -// Id: types.StringNull(), -// }, -// &storageModel{ -// Class: types.StringNull(), -// Size: types.Int64Null(), -// }, -// &postgresflex.PartialUpdateInstancePayload{ -// Acl: &postgresflex.ACL{ -// Items: &[]string{ -// "", -// }, -// }, -// BackupSchedule: nil, -// FlavorId: nil, -// Name: nil, -// Replicas: utils.Ptr(int64(2123456789)), -// Storage: &postgresflex.Storage{ -// Class: nil, -// Size: nil, -// }, -// Version: nil, -// }, -// true, -// }, -// { -// "nil_model", -// nil, -// []string{}, -// &flavorModel{}, -// &storageModel{}, -// nil, -// false, -// }, -// { -// "nil_acl", -// &Model{}, -// nil, -// &flavorModel{}, -// &storageModel{}, -// nil, -// false, -// }, -// { -// "nil_flavor", -// &Model{}, -// []string{}, -// nil, -// &storageModel{}, -// nil, -// false, -// }, -// { -// "nil_storage", -// &Model{}, -// []string{}, -// &flavorModel{}, -// nil, -// nil, -// false, -// }, -// } -// for _, tt := range tests { -// t.Run(tt.description, func(t *testing.T) { -// output, err := toUpdatePayload(tt.input, tt.inputAcl, tt.inputFlavor, tt.inputStorage) -// if !tt.isValid && err == nil { -// t.Fatalf("Should have failed") -// } -// if tt.isValid && err != nil { -// t.Fatalf("Should not have failed: %v", err) -// } -// if tt.isValid { -// diff := cmp.Diff(output, tt.expected) -// if diff != "" { -// t.Fatalf("Data does not match: %s", diff) -// } -// } -// }) -// } -// } -// -// func TestLoadFlavorId(t *testing.T) { -// tests := []struct { -// description string -// inputFlavor *flavorModel -// mockedResp *postgresflex.ListFlavorsResponse -// expected *flavorModel -// getFlavorsFails bool -// isValid bool -// }{ -// { -// "ok_flavor", -// &flavorModel{ -// CPU: types.Int64Value(2), -// RAM: types.Int64Value(8), -// }, -// &postgresflex.ListFlavorsResponse{ -// Flavors: &[]postgresflex.Flavor{ -// { -// Id: utils.Ptr("fid-1"), -// Cpu: utils.Ptr(int64(2)), -// Description: utils.Ptr("description"), -// Ram: utils.Ptr(int64(8)), -// }, -// }, -// }, -// &flavorModel{ -// Id: types.StringValue("fid-1"), -// Description: types.StringValue("description"), -// CPU: types.Int64Value(2), -// RAM: types.Int64Value(8), -// }, -// false, -// true, -// }, -// { -// "ok_flavor_2", -// &flavorModel{ -// CPU: types.Int64Value(2), -// RAM: types.Int64Value(8), -// }, -// &postgresflex.ListFlavorsResponse{ -// Flavors: &[]postgresflex.Flavor{ -// { -// Id: utils.Ptr("fid-1"), -// Cpu: utils.Ptr(int64(2)), -// Description: utils.Ptr("description"), -// Ram: utils.Ptr(int64(8)), -// }, -// { -// Id: utils.Ptr("fid-2"), -// Cpu: utils.Ptr(int64(1)), -// Description: utils.Ptr("description"), -// Ram: utils.Ptr(int64(4)), -// }, -// }, -// }, -// &flavorModel{ -// Id: types.StringValue("fid-1"), -// Description: types.StringValue("description"), -// CPU: types.Int64Value(2), -// RAM: types.Int64Value(8), -// }, -// false, -// true, -// }, -// { -// "no_matching_flavor", -// &flavorModel{ -// CPU: types.Int64Value(2), -// RAM: types.Int64Value(8), -// }, -// &postgresflex.ListFlavorsResponse{ -// Flavors: &[]postgresflex.Flavor{ -// { -// Id: utils.Ptr("fid-1"), -// Cpu: utils.Ptr(int64(1)), -// Description: utils.Ptr("description"), -// Ram: utils.Ptr(int64(8)), -// }, -// { -// Id: utils.Ptr("fid-2"), -// Cpu: utils.Ptr(int64(1)), -// Description: utils.Ptr("description"), -// Ram: utils.Ptr(int64(4)), -// }, -// }, -// }, -// &flavorModel{ -// CPU: types.Int64Value(2), -// RAM: types.Int64Value(8), -// }, -// false, -// false, -// }, -// { -// "nil_response", -// &flavorModel{ -// CPU: types.Int64Value(2), -// RAM: types.Int64Value(8), -// }, -// &postgresflex.ListFlavorsResponse{}, -// &flavorModel{ -// CPU: types.Int64Value(2), -// RAM: types.Int64Value(8), -// }, -// false, -// false, -// }, -// { -// "error_response", -// &flavorModel{ -// CPU: types.Int64Value(2), -// RAM: types.Int64Value(8), -// }, -// &postgresflex.ListFlavorsResponse{}, -// &flavorModel{ -// CPU: types.Int64Value(2), -// RAM: types.Int64Value(8), -// }, -// true, -// false, -// }, -// } -// for _, tt := range tests { -// t.Run(tt.description, func(t *testing.T) { -// client := &postgresFlexClientMocked{ -// returnError: tt.getFlavorsFails, -// getFlavorsResp: tt.mockedResp, -// } -// model := &Model{ -// ProjectId: types.StringValue("pid"), -// } -// flavorModel := &flavorModel{ -// CPU: tt.inputFlavor.CPU, -// RAM: tt.inputFlavor.RAM, -// } -// err := loadFlavorId(context.Background(), client, model, flavorModel) -// if !tt.isValid && err == nil { -// t.Fatalf("Should have failed") -// } -// if tt.isValid && err != nil { -// t.Fatalf("Should not have failed: %v", err) -// } -// if tt.isValid { -// diff := cmp.Diff(flavorModel, tt.expected) -// if diff != "" { -// t.Fatalf("Data does not match: %s", diff) -// } -// } -// }) -// } -// } - func TestNewInstanceResource(t *testing.T) { tests := []struct { name string @@ -639,12 +31,10 @@ func TestNewInstanceResource(t *testing.T) { }, } for _, tt := range tests { - t.Run( - tt.name, func(t *testing.T) { - if got := NewInstanceResource(); !reflect.DeepEqual(got, tt.want) { - t.Errorf("NewInstanceResource() = %v, want %v", got, tt.want) - } - }, - ) + t.Run(tt.name, func(t *testing.T) { + if got := NewInstanceResource(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("NewInstanceResource() = %v, want %v", got, tt.want) + } + }) } } diff --git a/stackit/internal/services/postgresflexalpha/instance/resources_gen/instance_resource_gen.go b/stackit/internal/services/postgresflexalpha/instance/resources_gen/instance_resource_gen.go new file mode 100644 index 00000000..3525a349 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/instance/resources_gen/instance_resource_gen.go @@ -0,0 +1,1597 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package postgresflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/resource/schema" +) + +func InstanceResourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "backup_schedule": schema.StringAttribute{ + Required: true, + Description: "The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.", + MarkdownDescription: "The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.", + }, + "encryption": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "kek_key_id": schema.StringAttribute{ + Required: true, + Description: "The encryption-key key identifier", + MarkdownDescription: "The encryption-key key identifier", + }, + "kek_key_ring_id": schema.StringAttribute{ + Required: true, + Description: "The encryption-key keyring identifier", + MarkdownDescription: "The encryption-key keyring identifier", + }, + "kek_key_version": schema.StringAttribute{ + Required: true, + Description: "The encryption-key version", + MarkdownDescription: "The encryption-key version", + }, + "service_account": schema.StringAttribute{ + Required: true, + }, + }, + CustomType: EncryptionType{ + ObjectType: types.ObjectType{ + AttrTypes: EncryptionValue{}.AttributeTypes(ctx), + }, + }, + Optional: true, + Computed: true, + Description: "The configuration for instance's volume and backup storage encryption.\n\n⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected.\n", + MarkdownDescription: "The configuration for instance's volume and backup storage encryption.\n\n⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected.\n", + }, + "flavor_id": schema.StringAttribute{ + Required: true, + Description: "The id of the instance flavor.", + MarkdownDescription: "The id of the instance flavor.", + }, + "id": schema.StringAttribute{ + Computed: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "instance_id": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "is_deletable": schema.BoolAttribute{ + Computed: true, + Description: "Whether the instance can be deleted or not.", + MarkdownDescription: "Whether the instance can be deleted or not.", + }, + "name": schema.StringAttribute{ + Required: true, + Description: "The name of the instance.", + MarkdownDescription: "The name of the instance.", + }, + "network": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "access_scope": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The access scope of the instance. It defines if the instance is public or airgapped.", + MarkdownDescription: "The access scope of the instance. It defines if the instance is public or airgapped.", + Validators: []validator.String{ + stringvalidator.OneOf( + "PUBLIC", + "SNA", + ), + }, + Default: stringdefault.StaticString("PUBLIC"), + }, + "acl": schema.ListAttribute{ + ElementType: types.StringType, + Required: true, + Description: "List of IPV4 cidr.", + MarkdownDescription: "List of IPV4 cidr.", + }, + "instance_address": schema.StringAttribute{ + Optional: true, + Computed: true, + }, + "router_address": schema.StringAttribute{ + Optional: true, + Computed: true, + }, + }, + CustomType: NetworkType{ + ObjectType: types.ObjectType{ + AttrTypes: NetworkValue{}.AttributeTypes(ctx), + }, + }, + Required: true, + Description: "The access configuration of the instance", + MarkdownDescription: "The access configuration of the instance", + }, + "project_id": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "replicas": schema.Int64Attribute{ + Required: true, + Description: "How many replicas the instance should have.", + MarkdownDescription: "How many replicas the instance should have.", + Validators: []validator.Int64{ + int64validator.OneOf( + 1, + 3, + ), + }, + }, + "retention_days": schema.Int64Attribute{ + Required: true, + Description: "How long backups are retained. The value can only be between 32 and 365 days.", + MarkdownDescription: "How long backups are retained. The value can only be between 32 and 365 days.", + }, + "status": schema.StringAttribute{ + Computed: true, + Description: "The current status of the instance.", + MarkdownDescription: "The current status of the instance.", + }, + "storage": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "performance_class": schema.StringAttribute{ + Required: true, + Description: "The storage class for the storage.", + MarkdownDescription: "The storage class for the storage.", + }, + "size": schema.Int64Attribute{ + Required: true, + Description: "The storage size in Gigabytes.", + MarkdownDescription: "The storage size in Gigabytes.", + }, + }, + CustomType: StorageType{ + ObjectType: types.ObjectType{ + AttrTypes: StorageValue{}.AttributeTypes(ctx), + }, + }, + Required: true, + Description: "The object containing information about the storage size and class.", + MarkdownDescription: "The object containing information about the storage size and class.", + }, + "version": schema.StringAttribute{ + Required: true, + Description: "The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3alpha1#tag/Version) for supported version parameters.", + MarkdownDescription: "The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3alpha1#tag/Version) for supported version parameters.", + }, + }, + } +} + +type InstanceModel struct { + BackupSchedule types.String `tfsdk:"backup_schedule"` + Encryption EncryptionValue `tfsdk:"encryption"` + FlavorId types.String `tfsdk:"flavor_id"` + Id types.String `tfsdk:"id"` + InstanceId types.String `tfsdk:"instance_id"` + IsDeletable types.Bool `tfsdk:"is_deletable"` + Name types.String `tfsdk:"name"` + Network NetworkValue `tfsdk:"network"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Replicas types.Int64 `tfsdk:"replicas"` + RetentionDays types.Int64 `tfsdk:"retention_days"` + Status types.String `tfsdk:"status"` + Storage StorageValue `tfsdk:"storage"` + Version types.String `tfsdk:"version"` +} + +var _ basetypes.ObjectTypable = EncryptionType{} + +type EncryptionType struct { + basetypes.ObjectType +} + +func (t EncryptionType) Equal(o attr.Type) bool { + other, ok := o.(EncryptionType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t EncryptionType) String() string { + return "EncryptionType" +} + +func (t EncryptionType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + kekKeyIdAttribute, ok := attributes["kek_key_id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_id is missing from object`) + + return nil, diags + } + + kekKeyIdVal, ok := kekKeyIdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_id expected to be basetypes.StringValue, was: %T`, kekKeyIdAttribute)) + } + + kekKeyRingIdAttribute, ok := attributes["kek_key_ring_id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_ring_id is missing from object`) + + return nil, diags + } + + kekKeyRingIdVal, ok := kekKeyRingIdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_ring_id expected to be basetypes.StringValue, was: %T`, kekKeyRingIdAttribute)) + } + + kekKeyVersionAttribute, ok := attributes["kek_key_version"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_version is missing from object`) + + return nil, diags + } + + kekKeyVersionVal, ok := kekKeyVersionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_version expected to be basetypes.StringValue, was: %T`, kekKeyVersionAttribute)) + } + + serviceAccountAttribute, ok := attributes["service_account"] + + if !ok { + diags.AddError( + "Attribute Missing", + `service_account is missing from object`) + + return nil, diags + } + + serviceAccountVal, ok := serviceAccountAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`service_account expected to be basetypes.StringValue, was: %T`, serviceAccountAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return EncryptionValue{ + KekKeyId: kekKeyIdVal, + KekKeyRingId: kekKeyRingIdVal, + KekKeyVersion: kekKeyVersionVal, + ServiceAccount: serviceAccountVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewEncryptionValueNull() EncryptionValue { + return EncryptionValue{ + state: attr.ValueStateNull, + } +} + +func NewEncryptionValueUnknown() EncryptionValue { + return EncryptionValue{ + state: attr.ValueStateUnknown, + } +} + +func NewEncryptionValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (EncryptionValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing EncryptionValue Attribute Value", + "While creating a EncryptionValue value, a missing attribute value was detected. "+ + "A EncryptionValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("EncryptionValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid EncryptionValue Attribute Type", + "While creating a EncryptionValue value, an invalid attribute value was detected. "+ + "A EncryptionValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("EncryptionValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("EncryptionValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra EncryptionValue Attribute Value", + "While creating a EncryptionValue value, an extra attribute value was detected. "+ + "A EncryptionValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra EncryptionValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewEncryptionValueUnknown(), diags + } + + kekKeyIdAttribute, ok := attributes["kek_key_id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_id is missing from object`) + + return NewEncryptionValueUnknown(), diags + } + + kekKeyIdVal, ok := kekKeyIdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_id expected to be basetypes.StringValue, was: %T`, kekKeyIdAttribute)) + } + + kekKeyRingIdAttribute, ok := attributes["kek_key_ring_id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_ring_id is missing from object`) + + return NewEncryptionValueUnknown(), diags + } + + kekKeyRingIdVal, ok := kekKeyRingIdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_ring_id expected to be basetypes.StringValue, was: %T`, kekKeyRingIdAttribute)) + } + + kekKeyVersionAttribute, ok := attributes["kek_key_version"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_version is missing from object`) + + return NewEncryptionValueUnknown(), diags + } + + kekKeyVersionVal, ok := kekKeyVersionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_version expected to be basetypes.StringValue, was: %T`, kekKeyVersionAttribute)) + } + + serviceAccountAttribute, ok := attributes["service_account"] + + if !ok { + diags.AddError( + "Attribute Missing", + `service_account is missing from object`) + + return NewEncryptionValueUnknown(), diags + } + + serviceAccountVal, ok := serviceAccountAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`service_account expected to be basetypes.StringValue, was: %T`, serviceAccountAttribute)) + } + + if diags.HasError() { + return NewEncryptionValueUnknown(), diags + } + + return EncryptionValue{ + KekKeyId: kekKeyIdVal, + KekKeyRingId: kekKeyRingIdVal, + KekKeyVersion: kekKeyVersionVal, + ServiceAccount: serviceAccountVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewEncryptionValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) EncryptionValue { + object, diags := NewEncryptionValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewEncryptionValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t EncryptionType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewEncryptionValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewEncryptionValueUnknown(), nil + } + + if in.IsNull() { + return NewEncryptionValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewEncryptionValueMust(EncryptionValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t EncryptionType) ValueType(ctx context.Context) attr.Value { + return EncryptionValue{} +} + +var _ basetypes.ObjectValuable = EncryptionValue{} + +type EncryptionValue struct { + KekKeyId basetypes.StringValue `tfsdk:"kek_key_id"` + KekKeyRingId basetypes.StringValue `tfsdk:"kek_key_ring_id"` + KekKeyVersion basetypes.StringValue `tfsdk:"kek_key_version"` + ServiceAccount basetypes.StringValue `tfsdk:"service_account"` + state attr.ValueState +} + +func (v EncryptionValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 4) + + var val tftypes.Value + var err error + + attrTypes["kek_key_id"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["kek_key_ring_id"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["kek_key_version"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["service_account"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 4) + + val, err = v.KekKeyId.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["kek_key_id"] = val + + val, err = v.KekKeyRingId.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["kek_key_ring_id"] = val + + val, err = v.KekKeyVersion.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["kek_key_version"] = val + + val, err = v.ServiceAccount.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["service_account"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v EncryptionValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v EncryptionValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v EncryptionValue) String() string { + return "EncryptionValue" +} + +func (v EncryptionValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "kek_key_id": basetypes.StringType{}, + "kek_key_ring_id": basetypes.StringType{}, + "kek_key_version": basetypes.StringType{}, + "service_account": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "kek_key_id": v.KekKeyId, + "kek_key_ring_id": v.KekKeyRingId, + "kek_key_version": v.KekKeyVersion, + "service_account": v.ServiceAccount, + }) + + return objVal, diags +} + +func (v EncryptionValue) Equal(o attr.Value) bool { + other, ok := o.(EncryptionValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.KekKeyId.Equal(other.KekKeyId) { + return false + } + + if !v.KekKeyRingId.Equal(other.KekKeyRingId) { + return false + } + + if !v.KekKeyVersion.Equal(other.KekKeyVersion) { + return false + } + + if !v.ServiceAccount.Equal(other.ServiceAccount) { + return false + } + + return true +} + +func (v EncryptionValue) Type(ctx context.Context) attr.Type { + return EncryptionType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v EncryptionValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "kek_key_id": basetypes.StringType{}, + "kek_key_ring_id": basetypes.StringType{}, + "kek_key_version": basetypes.StringType{}, + "service_account": basetypes.StringType{}, + } +} + +var _ basetypes.ObjectTypable = NetworkType{} + +type NetworkType struct { + basetypes.ObjectType +} + +func (t NetworkType) Equal(o attr.Type) bool { + other, ok := o.(NetworkType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t NetworkType) String() string { + return "NetworkType" +} + +func (t NetworkType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + accessScopeAttribute, ok := attributes["access_scope"] + + if !ok { + diags.AddError( + "Attribute Missing", + `access_scope is missing from object`) + + return nil, diags + } + + accessScopeVal, ok := accessScopeAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`access_scope expected to be basetypes.StringValue, was: %T`, accessScopeAttribute)) + } + + aclAttribute, ok := attributes["acl"] + + if !ok { + diags.AddError( + "Attribute Missing", + `acl is missing from object`) + + return nil, diags + } + + aclVal, ok := aclAttribute.(basetypes.ListValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`acl expected to be basetypes.ListValue, was: %T`, aclAttribute)) + } + + instanceAddressAttribute, ok := attributes["instance_address"] + + if !ok { + diags.AddError( + "Attribute Missing", + `instance_address is missing from object`) + + return nil, diags + } + + instanceAddressVal, ok := instanceAddressAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`instance_address expected to be basetypes.StringValue, was: %T`, instanceAddressAttribute)) + } + + routerAddressAttribute, ok := attributes["router_address"] + + if !ok { + diags.AddError( + "Attribute Missing", + `router_address is missing from object`) + + return nil, diags + } + + routerAddressVal, ok := routerAddressAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`router_address expected to be basetypes.StringValue, was: %T`, routerAddressAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return NetworkValue{ + AccessScope: accessScopeVal, + Acl: aclVal, + InstanceAddress: instanceAddressVal, + RouterAddress: routerAddressVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewNetworkValueNull() NetworkValue { + return NetworkValue{ + state: attr.ValueStateNull, + } +} + +func NewNetworkValueUnknown() NetworkValue { + return NetworkValue{ + state: attr.ValueStateUnknown, + } +} + +func NewNetworkValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (NetworkValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing NetworkValue Attribute Value", + "While creating a NetworkValue value, a missing attribute value was detected. "+ + "A NetworkValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("NetworkValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid NetworkValue Attribute Type", + "While creating a NetworkValue value, an invalid attribute value was detected. "+ + "A NetworkValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("NetworkValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("NetworkValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra NetworkValue Attribute Value", + "While creating a NetworkValue value, an extra attribute value was detected. "+ + "A NetworkValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra NetworkValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewNetworkValueUnknown(), diags + } + + accessScopeAttribute, ok := attributes["access_scope"] + + if !ok { + diags.AddError( + "Attribute Missing", + `access_scope is missing from object`) + + return NewNetworkValueUnknown(), diags + } + + accessScopeVal, ok := accessScopeAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`access_scope expected to be basetypes.StringValue, was: %T`, accessScopeAttribute)) + } + + aclAttribute, ok := attributes["acl"] + + if !ok { + diags.AddError( + "Attribute Missing", + `acl is missing from object`) + + return NewNetworkValueUnknown(), diags + } + + aclVal, ok := aclAttribute.(basetypes.ListValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`acl expected to be basetypes.ListValue, was: %T`, aclAttribute)) + } + + instanceAddressAttribute, ok := attributes["instance_address"] + + if !ok { + diags.AddError( + "Attribute Missing", + `instance_address is missing from object`) + + return NewNetworkValueUnknown(), diags + } + + instanceAddressVal, ok := instanceAddressAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`instance_address expected to be basetypes.StringValue, was: %T`, instanceAddressAttribute)) + } + + routerAddressAttribute, ok := attributes["router_address"] + + if !ok { + diags.AddError( + "Attribute Missing", + `router_address is missing from object`) + + return NewNetworkValueUnknown(), diags + } + + routerAddressVal, ok := routerAddressAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`router_address expected to be basetypes.StringValue, was: %T`, routerAddressAttribute)) + } + + if diags.HasError() { + return NewNetworkValueUnknown(), diags + } + + return NetworkValue{ + AccessScope: accessScopeVal, + Acl: aclVal, + InstanceAddress: instanceAddressVal, + RouterAddress: routerAddressVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewNetworkValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) NetworkValue { + object, diags := NewNetworkValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewNetworkValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t NetworkType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewNetworkValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewNetworkValueUnknown(), nil + } + + if in.IsNull() { + return NewNetworkValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewNetworkValueMust(NetworkValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t NetworkType) ValueType(ctx context.Context) attr.Value { + return NetworkValue{} +} + +var _ basetypes.ObjectValuable = NetworkValue{} + +type NetworkValue struct { + AccessScope basetypes.StringValue `tfsdk:"access_scope"` + Acl basetypes.ListValue `tfsdk:"acl"` + InstanceAddress basetypes.StringValue `tfsdk:"instance_address"` + RouterAddress basetypes.StringValue `tfsdk:"router_address"` + state attr.ValueState +} + +func (v NetworkValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 4) + + var val tftypes.Value + var err error + + attrTypes["access_scope"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["acl"] = basetypes.ListType{ + ElemType: types.StringType, + }.TerraformType(ctx) + attrTypes["instance_address"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["router_address"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 4) + + val, err = v.AccessScope.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["access_scope"] = val + + val, err = v.Acl.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["acl"] = val + + val, err = v.InstanceAddress.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["instance_address"] = val + + val, err = v.RouterAddress.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["router_address"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v NetworkValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v NetworkValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v NetworkValue) String() string { + return "NetworkValue" +} + +func (v NetworkValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + var aclVal basetypes.ListValue + switch { + case v.Acl.IsUnknown(): + aclVal = types.ListUnknown(types.StringType) + case v.Acl.IsNull(): + aclVal = types.ListNull(types.StringType) + default: + var d diag.Diagnostics + aclVal, d = types.ListValue(types.StringType, v.Acl.Elements()) + diags.Append(d...) + } + + if diags.HasError() { + return types.ObjectUnknown(map[string]attr.Type{ + "access_scope": basetypes.StringType{}, + "acl": basetypes.ListType{ + ElemType: types.StringType, + }, + "instance_address": basetypes.StringType{}, + "router_address": basetypes.StringType{}, + }), diags + } + + attributeTypes := map[string]attr.Type{ + "access_scope": basetypes.StringType{}, + "acl": basetypes.ListType{ + ElemType: types.StringType, + }, + "instance_address": basetypes.StringType{}, + "router_address": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "access_scope": v.AccessScope, + "acl": aclVal, + "instance_address": v.InstanceAddress, + "router_address": v.RouterAddress, + }) + + return objVal, diags +} + +func (v NetworkValue) Equal(o attr.Value) bool { + other, ok := o.(NetworkValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.AccessScope.Equal(other.AccessScope) { + return false + } + + if !v.Acl.Equal(other.Acl) { + return false + } + + if !v.InstanceAddress.Equal(other.InstanceAddress) { + return false + } + + if !v.RouterAddress.Equal(other.RouterAddress) { + return false + } + + return true +} + +func (v NetworkValue) Type(ctx context.Context) attr.Type { + return NetworkType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v NetworkValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "access_scope": basetypes.StringType{}, + "acl": basetypes.ListType{ + ElemType: types.StringType, + }, + "instance_address": basetypes.StringType{}, + "router_address": basetypes.StringType{}, + } +} + +var _ basetypes.ObjectTypable = StorageType{} + +type StorageType struct { + basetypes.ObjectType +} + +func (t StorageType) Equal(o attr.Type) bool { + other, ok := o.(StorageType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t StorageType) String() string { + return "StorageType" +} + +func (t StorageType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + performanceClassAttribute, ok := attributes["performance_class"] + + if !ok { + diags.AddError( + "Attribute Missing", + `performance_class is missing from object`) + + return nil, diags + } + + performanceClassVal, ok := performanceClassAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`performance_class expected to be basetypes.StringValue, was: %T`, performanceClassAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return nil, diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return StorageValue{ + PerformanceClass: performanceClassVal, + Size: sizeVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewStorageValueNull() StorageValue { + return StorageValue{ + state: attr.ValueStateNull, + } +} + +func NewStorageValueUnknown() StorageValue { + return StorageValue{ + state: attr.ValueStateUnknown, + } +} + +func NewStorageValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (StorageValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing StorageValue Attribute Value", + "While creating a StorageValue value, a missing attribute value was detected. "+ + "A StorageValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("StorageValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid StorageValue Attribute Type", + "While creating a StorageValue value, an invalid attribute value was detected. "+ + "A StorageValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("StorageValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("StorageValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra StorageValue Attribute Value", + "While creating a StorageValue value, an extra attribute value was detected. "+ + "A StorageValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra StorageValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewStorageValueUnknown(), diags + } + + performanceClassAttribute, ok := attributes["performance_class"] + + if !ok { + diags.AddError( + "Attribute Missing", + `performance_class is missing from object`) + + return NewStorageValueUnknown(), diags + } + + performanceClassVal, ok := performanceClassAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`performance_class expected to be basetypes.StringValue, was: %T`, performanceClassAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return NewStorageValueUnknown(), diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + if diags.HasError() { + return NewStorageValueUnknown(), diags + } + + return StorageValue{ + PerformanceClass: performanceClassVal, + Size: sizeVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewStorageValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) StorageValue { + object, diags := NewStorageValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewStorageValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t StorageType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewStorageValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewStorageValueUnknown(), nil + } + + if in.IsNull() { + return NewStorageValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewStorageValueMust(StorageValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t StorageType) ValueType(ctx context.Context) attr.Value { + return StorageValue{} +} + +var _ basetypes.ObjectValuable = StorageValue{} + +type StorageValue struct { + PerformanceClass basetypes.StringValue `tfsdk:"performance_class"` + Size basetypes.Int64Value `tfsdk:"size"` + state attr.ValueState +} + +func (v StorageValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 2) + + var val tftypes.Value + var err error + + attrTypes["performance_class"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["size"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 2) + + val, err = v.PerformanceClass.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["performance_class"] = val + + val, err = v.Size.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["size"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v StorageValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v StorageValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v StorageValue) String() string { + return "StorageValue" +} + +func (v StorageValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "performance_class": basetypes.StringType{}, + "size": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "performance_class": v.PerformanceClass, + "size": v.Size, + }) + + return objVal, diags +} + +func (v StorageValue) Equal(o attr.Value) bool { + other, ok := o.(StorageValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.PerformanceClass.Equal(other.PerformanceClass) { + return false + } + + if !v.Size.Equal(other.Size) { + return false + } + + return true +} + +func (v StorageValue) Type(ctx context.Context) attr.Type { + return StorageType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v StorageValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "performance_class": basetypes.StringType{}, + "size": basetypes.Int64Type{}, + } +} diff --git a/stackit/internal/services/postgresflexalpha/instance/schema_test.go b/stackit/internal/services/postgresflexalpha/instance/schema_test.go new file mode 100644 index 00000000..ec567d75 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/instance/schema_test.go @@ -0,0 +1,33 @@ +package postgresflexalpha + +import ( + "context" + "testing" + + // The fwresource import alias is so there is no collision + // with the more typical acceptance testing import: + // "github.com/hashicorp/terraform-plugin-testing/helper/resource" + fwresource "github.com/hashicorp/terraform-plugin-framework/resource" +) + +func TestInstanceResourceSchema(t *testing.T) { + t.Parallel() + + ctx := context.Background() + schemaRequest := fwresource.SchemaRequest{} + schemaResponse := &fwresource.SchemaResponse{} + + // Instantiate the resource.Resource and call its Schema method + NewInstanceResource().Schema(ctx, schemaRequest, schemaResponse) + + if schemaResponse.Diagnostics.HasError() { + t.Fatalf("Schema method diagnostics: %+v", schemaResponse.Diagnostics) + } + + // Validate the schema + diagnostics := schemaResponse.Schema.ValidateImplementation(ctx) + + if diagnostics.HasError() { + t.Fatalf("Schema validation diagnostics: %+v", diagnostics) + } +} diff --git a/stackit/internal/services/postgresflexalpha/main.go b/stackit/internal/services/postgresflexalpha/main.go new file mode 100644 index 00000000..5e20f208 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/main.go @@ -0,0 +1 @@ +package postgresflexalpha diff --git a/stackit/internal/services/postgresflexalpha/postgresflex_acc_test.go b/stackit/internal/services/postgresflexalpha/postgresflex_acc_test.go index 9c2f9214..e79cf893 100644 --- a/stackit/internal/services/postgresflexalpha/postgresflex_acc_test.go +++ b/stackit/internal/services/postgresflexalpha/postgresflex_acc_test.go @@ -1,9 +1,10 @@ // Copyright (c) STACKIT -package postgresflex_test +package postgresflexalpha_test import ( "context" + _ "embed" "fmt" "strings" "testing" @@ -20,6 +21,11 @@ import ( postgresflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha" ) +var ( + //go:embed testdata/resource-complete.tf + resourceSecurityGroupMinConfig string //nolint:unused // needs implementation +) + // Instance resource data var instanceResource = map[string]string{ "project_id": testutil.ProjectId, diff --git a/stackit/internal/services/postgresflexalpha/role/datasources_gen/roles_data_source_gen.go b/stackit/internal/services/postgresflexalpha/role/datasources_gen/roles_data_source_gen.go new file mode 100644 index 00000000..415f0647 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/role/datasources_gen/roles_data_source_gen.go @@ -0,0 +1,52 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package postgresflexalpha + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func RolesDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "instance_id": schema.StringAttribute{ + Required: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "roles": schema.ListAttribute{ + ElementType: types.StringType, + Computed: true, + Description: "List of all role names available in the instance", + MarkdownDescription: "List of all role names available in the instance", + }, + }, + } +} + +type RolesModel struct { + InstanceId types.String `tfsdk:"instance_id"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Roles types.List `tfsdk:"roles"` +} diff --git a/stackit/internal/services/postgresflexalpha/testdata/resource-complete.tf b/stackit/internal/services/postgresflexalpha/testdata/resource-complete.tf new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/testdata/resource-complete.tf @@ -0,0 +1 @@ + diff --git a/stackit/internal/services/postgresflexalpha/user/datasources_gen/user_data_source_gen.go b/stackit/internal/services/postgresflexalpha/user/datasources_gen/user_data_source_gen.go new file mode 100644 index 00000000..fb2a7644 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/user/datasources_gen/user_data_source_gen.go @@ -0,0 +1,94 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package postgresflexalpha + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func UserDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "connection_string": schema.StringAttribute{ + Computed: true, + Description: "The connection string for the user to the instance.", + MarkdownDescription: "The connection string for the user to the instance.", + }, + "host": schema.StringAttribute{ + Computed: true, + Description: "The host of the instance in which the user belongs to.", + MarkdownDescription: "The host of the instance in which the user belongs to.", + }, + "id": schema.Int64Attribute{ + Computed: true, + Description: "The ID of the user.", + MarkdownDescription: "The ID of the user.", + }, + "instance_id": schema.StringAttribute{ + Required: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "name": schema.StringAttribute{ + Computed: true, + Description: "The name of the user.", + MarkdownDescription: "The name of the user.", + }, + "port": schema.Int64Attribute{ + Computed: true, + Description: "The port of the instance in which the user belongs to.", + MarkdownDescription: "The port of the instance in which the user belongs to.", + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "roles": schema.ListAttribute{ + ElementType: types.StringType, + Computed: true, + Description: "A list of user roles.", + MarkdownDescription: "A list of user roles.", + }, + "status": schema.StringAttribute{ + Computed: true, + Description: "The current status of the user.", + MarkdownDescription: "The current status of the user.", + }, + "user_id": schema.Int64Attribute{ + Required: true, + Description: "The ID of the user.", + MarkdownDescription: "The ID of the user.", + }, + }, + } +} + +type UserModel struct { + ConnectionString types.String `tfsdk:"connection_string"` + Host types.String `tfsdk:"host"` + Id types.Int64 `tfsdk:"id"` + InstanceId types.String `tfsdk:"instance_id"` + Name types.String `tfsdk:"name"` + Port types.Int64 `tfsdk:"port"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Roles types.List `tfsdk:"roles"` + Status types.String `tfsdk:"status"` + UserId types.Int64 `tfsdk:"user_id"` +} diff --git a/stackit/internal/services/postgresflexalpha/user/datasources_gen/users_data_source_gen.go b/stackit/internal/services/postgresflexalpha/user/datasources_gen/users_data_source_gen.go new file mode 100644 index 00000000..b54a5dd6 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/user/datasources_gen/users_data_source_gen.go @@ -0,0 +1,1118 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package postgresflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func UsersDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "instance_id": schema.StringAttribute{ + Required: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "page": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of the page of items list to be returned.", + MarkdownDescription: "Number of the page of items list to be returned.", + }, + "pagination": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "page": schema.Int64Attribute{ + Computed: true, + }, + "size": schema.Int64Attribute{ + Computed: true, + }, + "sort": schema.StringAttribute{ + Computed: true, + }, + "total_pages": schema.Int64Attribute{ + Computed: true, + }, + "total_rows": schema.Int64Attribute{ + Computed: true, + }, + }, + CustomType: PaginationType{ + ObjectType: types.ObjectType{ + AttrTypes: PaginationValue{}.AttributeTypes(ctx), + }, + }, + Computed: true, + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "size": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of items to be returned on each page.", + MarkdownDescription: "Number of items to be returned on each page.", + }, + "sort": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "Sorting of the users to be returned on each page.", + MarkdownDescription: "Sorting of the users to be returned on each page.", + Validators: []validator.String{ + stringvalidator.OneOf( + "id.asc", + "id.desc", + "index.desc", + "index.asc", + "name.desc", + "name.asc", + "status.desc", + "status.asc", + ), + }, + }, + "users": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "id": schema.Int64Attribute{ + Computed: true, + Description: "The ID of the user.", + MarkdownDescription: "The ID of the user.", + }, + "name": schema.StringAttribute{ + Computed: true, + Description: "The name of the user.", + MarkdownDescription: "The name of the user.", + }, + "status": schema.StringAttribute{ + Computed: true, + Description: "The current status of the user.", + MarkdownDescription: "The current status of the user.", + }, + }, + CustomType: UsersType{ + ObjectType: types.ObjectType{ + AttrTypes: UsersValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "List of all users inside an instance", + MarkdownDescription: "List of all users inside an instance", + }, + }, + } +} + +type UsersModel struct { + InstanceId types.String `tfsdk:"instance_id"` + Page types.Int64 `tfsdk:"page"` + Pagination PaginationValue `tfsdk:"pagination"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Size types.Int64 `tfsdk:"size"` + Sort types.String `tfsdk:"sort"` + Users types.List `tfsdk:"users"` +} + +var _ basetypes.ObjectTypable = PaginationType{} + +type PaginationType struct { + basetypes.ObjectType +} + +func (t PaginationType) Equal(o attr.Type) bool { + other, ok := o.(PaginationType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t PaginationType) String() string { + return "PaginationType" +} + +func (t PaginationType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return nil, diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return nil, diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return nil, diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return nil, diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return nil, diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueNull() PaginationValue { + return PaginationValue{ + state: attr.ValueStateNull, + } +} + +func NewPaginationValueUnknown() PaginationValue { + return PaginationValue{ + state: attr.ValueStateUnknown, + } +} + +func NewPaginationValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (PaginationValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing PaginationValue Attribute Value", + "While creating a PaginationValue value, a missing attribute value was detected. "+ + "A PaginationValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid PaginationValue Attribute Type", + "While creating a PaginationValue value, an invalid attribute value was detected. "+ + "A PaginationValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra PaginationValue Attribute Value", + "While creating a PaginationValue value, an extra attribute value was detected. "+ + "A PaginationValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra PaginationValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) PaginationValue { + object, diags := NewPaginationValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewPaginationValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t PaginationType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewPaginationValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewPaginationValueUnknown(), nil + } + + if in.IsNull() { + return NewPaginationValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewPaginationValueMust(PaginationValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t PaginationType) ValueType(ctx context.Context) attr.Value { + return PaginationValue{} +} + +var _ basetypes.ObjectValuable = PaginationValue{} + +type PaginationValue struct { + Page basetypes.Int64Value `tfsdk:"page"` + Size basetypes.Int64Value `tfsdk:"size"` + Sort basetypes.StringValue `tfsdk:"sort"` + TotalPages basetypes.Int64Value `tfsdk:"total_pages"` + TotalRows basetypes.Int64Value `tfsdk:"total_rows"` + state attr.ValueState +} + +func (v PaginationValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 5) + + var val tftypes.Value + var err error + + attrTypes["page"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["size"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["sort"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["total_pages"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["total_rows"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 5) + + val, err = v.Page.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["page"] = val + + val, err = v.Size.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["size"] = val + + val, err = v.Sort.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["sort"] = val + + val, err = v.TotalPages.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_pages"] = val + + val, err = v.TotalRows.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_rows"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v PaginationValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v PaginationValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v PaginationValue) String() string { + return "PaginationValue" +} + +func (v PaginationValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "page": v.Page, + "size": v.Size, + "sort": v.Sort, + "total_pages": v.TotalPages, + "total_rows": v.TotalRows, + }) + + return objVal, diags +} + +func (v PaginationValue) Equal(o attr.Value) bool { + other, ok := o.(PaginationValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Page.Equal(other.Page) { + return false + } + + if !v.Size.Equal(other.Size) { + return false + } + + if !v.Sort.Equal(other.Sort) { + return false + } + + if !v.TotalPages.Equal(other.TotalPages) { + return false + } + + if !v.TotalRows.Equal(other.TotalRows) { + return false + } + + return true +} + +func (v PaginationValue) Type(ctx context.Context) attr.Type { + return PaginationType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v PaginationValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } +} + +var _ basetypes.ObjectTypable = UsersType{} + +type UsersType struct { + basetypes.ObjectType +} + +func (t UsersType) Equal(o attr.Type) bool { + other, ok := o.(UsersType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t UsersType) String() string { + return "UsersType" +} + +func (t UsersType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return nil, diags + } + + idVal, ok := idAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute)) + } + + nameAttribute, ok := attributes["name"] + + if !ok { + diags.AddError( + "Attribute Missing", + `name is missing from object`) + + return nil, diags + } + + nameVal, ok := nameAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute)) + } + + statusAttribute, ok := attributes["status"] + + if !ok { + diags.AddError( + "Attribute Missing", + `status is missing from object`) + + return nil, diags + } + + statusVal, ok := statusAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`status expected to be basetypes.StringValue, was: %T`, statusAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return UsersValue{ + Id: idVal, + Name: nameVal, + Status: statusVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewUsersValueNull() UsersValue { + return UsersValue{ + state: attr.ValueStateNull, + } +} + +func NewUsersValueUnknown() UsersValue { + return UsersValue{ + state: attr.ValueStateUnknown, + } +} + +func NewUsersValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (UsersValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing UsersValue Attribute Value", + "While creating a UsersValue value, a missing attribute value was detected. "+ + "A UsersValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("UsersValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid UsersValue Attribute Type", + "While creating a UsersValue value, an invalid attribute value was detected. "+ + "A UsersValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("UsersValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("UsersValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra UsersValue Attribute Value", + "While creating a UsersValue value, an extra attribute value was detected. "+ + "A UsersValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra UsersValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewUsersValueUnknown(), diags + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return NewUsersValueUnknown(), diags + } + + idVal, ok := idAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute)) + } + + nameAttribute, ok := attributes["name"] + + if !ok { + diags.AddError( + "Attribute Missing", + `name is missing from object`) + + return NewUsersValueUnknown(), diags + } + + nameVal, ok := nameAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute)) + } + + statusAttribute, ok := attributes["status"] + + if !ok { + diags.AddError( + "Attribute Missing", + `status is missing from object`) + + return NewUsersValueUnknown(), diags + } + + statusVal, ok := statusAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`status expected to be basetypes.StringValue, was: %T`, statusAttribute)) + } + + if diags.HasError() { + return NewUsersValueUnknown(), diags + } + + return UsersValue{ + Id: idVal, + Name: nameVal, + Status: statusVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewUsersValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) UsersValue { + object, diags := NewUsersValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewUsersValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t UsersType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewUsersValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewUsersValueUnknown(), nil + } + + if in.IsNull() { + return NewUsersValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewUsersValueMust(UsersValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t UsersType) ValueType(ctx context.Context) attr.Value { + return UsersValue{} +} + +var _ basetypes.ObjectValuable = UsersValue{} + +type UsersValue struct { + Id basetypes.Int64Value `tfsdk:"id"` + Name basetypes.StringValue `tfsdk:"name"` + Status basetypes.StringValue `tfsdk:"status"` + state attr.ValueState +} + +func (v UsersValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 3) + + var val tftypes.Value + var err error + + attrTypes["id"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["name"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["status"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 3) + + val, err = v.Id.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["id"] = val + + val, err = v.Name.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["name"] = val + + val, err = v.Status.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["status"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v UsersValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v UsersValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v UsersValue) String() string { + return "UsersValue" +} + +func (v UsersValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "id": basetypes.Int64Type{}, + "name": basetypes.StringType{}, + "status": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "id": v.Id, + "name": v.Name, + "status": v.Status, + }) + + return objVal, diags +} + +func (v UsersValue) Equal(o attr.Value) bool { + other, ok := o.(UsersValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Id.Equal(other.Id) { + return false + } + + if !v.Name.Equal(other.Name) { + return false + } + + if !v.Status.Equal(other.Status) { + return false + } + + return true +} + +func (v UsersValue) Type(ctx context.Context) attr.Type { + return UsersType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v UsersValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "id": basetypes.Int64Type{}, + "name": basetypes.StringType{}, + "status": basetypes.StringType{}, + } +} diff --git a/stackit/internal/services/postgresflexalpha/user/resources_gen/user_resource_gen.go b/stackit/internal/services/postgresflexalpha/user/resources_gen/user_resource_gen.go new file mode 100644 index 00000000..9734c2a9 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/user/resources_gen/user_resource_gen.go @@ -0,0 +1,105 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package postgresflexalpha + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + + "github.com/hashicorp/terraform-plugin-framework/resource/schema" +) + +func UserResourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "connection_string": schema.StringAttribute{ + Computed: true, + Description: "The connection string for the user to the instance.", + MarkdownDescription: "The connection string for the user to the instance.", + }, + "host": schema.StringAttribute{ + Computed: true, + Description: "The host of the instance in which the user belongs to.", + MarkdownDescription: "The host of the instance in which the user belongs to.", + }, + "id": schema.Int64Attribute{ + Computed: true, + Description: "The ID of the user.", + MarkdownDescription: "The ID of the user.", + }, + "instance_id": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "name": schema.StringAttribute{ + Required: true, + Description: "The name of the user.", + MarkdownDescription: "The name of the user.", + }, + "password": schema.StringAttribute{ + Computed: true, + Description: "The password for the user.", + MarkdownDescription: "The password for the user.", + }, + "port": schema.Int64Attribute{ + Computed: true, + Description: "The port of the instance in which the user belongs to.", + MarkdownDescription: "The port of the instance in which the user belongs to.", + }, + "project_id": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "roles": schema.ListAttribute{ + ElementType: types.StringType, + Optional: true, + Computed: true, + Description: "A list containing the user roles for the instance.", + MarkdownDescription: "A list containing the user roles for the instance.", + }, + "status": schema.StringAttribute{ + Computed: true, + Description: "The current status of the user.", + MarkdownDescription: "The current status of the user.", + }, + "user_id": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "The ID of the user.", + MarkdownDescription: "The ID of the user.", + }, + }, + } +} + +type UserModel struct { + ConnectionString types.String `tfsdk:"connection_string"` + Host types.String `tfsdk:"host"` + Id types.Int64 `tfsdk:"id"` + InstanceId types.String `tfsdk:"instance_id"` + Name types.String `tfsdk:"name"` + Password types.String `tfsdk:"password"` + Port types.Int64 `tfsdk:"port"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Roles types.List `tfsdk:"roles"` + Status types.String `tfsdk:"status"` + UserId types.Int64 `tfsdk:"user_id"` +} diff --git a/stackit/internal/services/postgresflexalpha/utils/planModifiers.go b/stackit/internal/services/postgresflexalpha/utils/planModifiers.go new file mode 100644 index 00000000..ee9b35f3 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/utils/planModifiers.go @@ -0,0 +1,229 @@ +package utils + +import ( + "fmt" + "log/slog" + "reflect" + "slices" + + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/iancoleman/strcase" + + "gopkg.in/yaml.v3" +) + +type Field struct { + Name string `yaml:"name"` + Modifiers []*string `yaml:"modifiers"` +} + +type Fields struct { + Fields []*Field `yaml:"fields"` +} + +var validModifiers = []string{ + "UseStateForUnknown", + "RequiresReplace", +} + +func ReadModifiersConfig(content []byte) (*Fields, error) { + var fields Fields + err := yaml.Unmarshal(content, &fields) + if err != nil { + return nil, err + } + return &fields, nil +} + +func AddPlanModifiersToResourceSchema(fields *Fields, s *schema.Schema) error { + err := validateFields(fields) + if err != nil { + return err + } + + resAttr, err := handleAttributes("", s.Attributes, fields) + if err != nil { + return err + } + s.Attributes = resAttr + + return nil +} + +func handleAttributes(prefix string, attributes map[string]schema.Attribute, fields *Fields) (map[string]schema.Attribute, error) { + fieldMap := fieldListToMap(fields) + for attrName, attrValue := range attributes { + attrNameSnake := strcase.ToSnake(attrName) + if prefix != "" { + attrNameSnake = prefix + "." + attrNameSnake + } + switch reflect.TypeOf(attrValue).String() { + case "schema.BoolAttribute": + if field, ok := fieldMap[attrNameSnake]; ok { + res, err := handleBoolPlanModifiers(attrValue, field) + if err != nil { + return nil, err + } + attributes[attrName] = res + } + case "schema.Int64Attribute": + if field, ok := fieldMap[attrNameSnake]; ok { + res, err := handleInt64PlanModifiers(attrValue, field) + if err != nil { + return nil, err + } + attributes[attrName] = res + } + case "schema.StringAttribute": + if field, ok := fieldMap[attrNameSnake]; ok { + res, err := handleStringPlanModifiers(attrValue, field) + if err != nil { + return nil, err + } + attributes[attrName] = res + } + case "schema.ListAttribute": + if field, ok := fieldMap[attrNameSnake]; ok { + res, err := handleListPlanModifiers(attrValue, field) + if err != nil { + return nil, err + } + attributes[attrName] = res + } + case "schema.SingleNestedAttribute": + nested, ok := attrValue.(schema.SingleNestedAttribute) + if !ok { + if _, ok := attrValue.(interface { + GetAttributes() map[string]schema.Attribute + }); ok { + return nil, fmt.Errorf("unsupported type for single nested attribute") + } + } + + res, err := handleAttributes(attrName, nested.Attributes, fields) + if err != nil { + return nil, err + } + nested.Attributes = res + attributes[attrName] = nested + default: + slog.Warn("type currently not supported", "type", reflect.TypeOf(attrValue).String()) + } + } + return attributes, nil +} + +func handleBoolPlanModifiers( + attr schema.Attribute, + fields []*string, +) (schema.Attribute, error) { + a, ok := attr.(schema.BoolAttribute) + if !ok { + return nil, fmt.Errorf("field is not a string attribute") + } + + for _, v := range fields { + switch *v { + case "RequiresReplace": + a.PlanModifiers = append(a.PlanModifiers, boolplanmodifier.RequiresReplace()) + case "UseStateForUnknown": + a.PlanModifiers = append(a.PlanModifiers, boolplanmodifier.UseStateForUnknown()) + } + } + return a, nil +} + +func handleStringPlanModifiers( + attr schema.Attribute, + fields []*string, +) (schema.Attribute, error) { + a, ok := attr.(schema.StringAttribute) + if !ok { + return nil, fmt.Errorf("field is not a string attribute") + } + + for _, v := range fields { + switch *v { + case "RequiresReplace": + a.PlanModifiers = append(a.PlanModifiers, stringplanmodifier.RequiresReplace()) + case "UseStateForUnknown": + a.PlanModifiers = append(a.PlanModifiers, stringplanmodifier.UseStateForUnknown()) + } + } + return a, nil +} + +func handleInt64PlanModifiers( + attr schema.Attribute, + fields []*string, +) (schema.Attribute, error) { + a, ok := attr.(schema.Int64Attribute) + if !ok { + return nil, fmt.Errorf("field is not a string attribute") + } + + for _, v := range fields { + switch *v { + case "RequiresReplace": + a.PlanModifiers = append(a.PlanModifiers, int64planmodifier.RequiresReplace()) + case "UseStateForUnknown": + a.PlanModifiers = append(a.PlanModifiers, int64planmodifier.UseStateForUnknown()) + } + } + return a, nil +} + +func handleListPlanModifiers( + attr schema.Attribute, + fields []*string, +) (schema.Attribute, error) { + a, ok := attr.(schema.ListAttribute) + if !ok { + return nil, fmt.Errorf("field is not a string attribute") + } + + for _, v := range fields { + switch *v { + case "RequiresReplace": + a.PlanModifiers = append(a.PlanModifiers, listplanmodifier.RequiresReplace()) + case "UseStateForUnknown": + a.PlanModifiers = append(a.PlanModifiers, listplanmodifier.UseStateForUnknown()) + } + } + return a, nil +} + +func validateFields(fields *Fields) error { + if fields == nil { + return nil + } + for _, field := range fields.Fields { + for _, modifier := range field.Modifiers { + if *modifier == "" { + return fmt.Errorf("modifier %s is required", *modifier) + } + if !slices.Contains(validModifiers, *modifier) { + return fmt.Errorf("modifier %s is invalid", *modifier) + } + } + } + return nil +} + +func fieldListToMap(fields *Fields) map[string][]*string { + res := make(map[string][]*string) + + if fields != nil { + for _, field := range fields.Fields { + res[field.Name] = field.Modifiers + } + } else { + slog.Warn("no fields available") + } + + return res +} diff --git a/stackit/internal/services/postgresflexalpha/version/datasources_gen/versions_data_source_gen.go b/stackit/internal/services/postgresflexalpha/version/datasources_gen/versions_data_source_gen.go new file mode 100644 index 00000000..03530869 --- /dev/null +++ b/stackit/internal/services/postgresflexalpha/version/datasources_gen/versions_data_source_gen.go @@ -0,0 +1,569 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package postgresflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func VersionsDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "versions": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "beta": schema.BoolAttribute{ + Computed: true, + Description: "Flag if the version is a beta version. If set the version may contain bugs and is not fully tested.", + MarkdownDescription: "Flag if the version is a beta version. If set the version may contain bugs and is not fully tested.", + }, + "deprecated": schema.StringAttribute{ + Computed: true, + Description: "Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT.", + MarkdownDescription: "Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT.", + }, + "recommend": schema.BoolAttribute{ + Computed: true, + Description: "Flag if the version is recommend by the STACKIT Team.", + MarkdownDescription: "Flag if the version is recommend by the STACKIT Team.", + }, + "version": schema.StringAttribute{ + Computed: true, + Description: "The postgres version used for the instance.", + MarkdownDescription: "The postgres version used for the instance.", + }, + }, + CustomType: VersionsType{ + ObjectType: types.ObjectType{ + AttrTypes: VersionsValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "A list containing available postgres versions.", + MarkdownDescription: "A list containing available postgres versions.", + }, + }, + } +} + +type VersionsModel struct { + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Versions types.List `tfsdk:"versions"` +} + +var _ basetypes.ObjectTypable = VersionsType{} + +type VersionsType struct { + basetypes.ObjectType +} + +func (t VersionsType) Equal(o attr.Type) bool { + other, ok := o.(VersionsType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t VersionsType) String() string { + return "VersionsType" +} + +func (t VersionsType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + betaAttribute, ok := attributes["beta"] + + if !ok { + diags.AddError( + "Attribute Missing", + `beta is missing from object`) + + return nil, diags + } + + betaVal, ok := betaAttribute.(basetypes.BoolValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`beta expected to be basetypes.BoolValue, was: %T`, betaAttribute)) + } + + deprecatedAttribute, ok := attributes["deprecated"] + + if !ok { + diags.AddError( + "Attribute Missing", + `deprecated is missing from object`) + + return nil, diags + } + + deprecatedVal, ok := deprecatedAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`deprecated expected to be basetypes.StringValue, was: %T`, deprecatedAttribute)) + } + + recommendAttribute, ok := attributes["recommend"] + + if !ok { + diags.AddError( + "Attribute Missing", + `recommend is missing from object`) + + return nil, diags + } + + recommendVal, ok := recommendAttribute.(basetypes.BoolValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`recommend expected to be basetypes.BoolValue, was: %T`, recommendAttribute)) + } + + versionAttribute, ok := attributes["version"] + + if !ok { + diags.AddError( + "Attribute Missing", + `version is missing from object`) + + return nil, diags + } + + versionVal, ok := versionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`version expected to be basetypes.StringValue, was: %T`, versionAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return VersionsValue{ + Beta: betaVal, + Deprecated: deprecatedVal, + Recommend: recommendVal, + Version: versionVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewVersionsValueNull() VersionsValue { + return VersionsValue{ + state: attr.ValueStateNull, + } +} + +func NewVersionsValueUnknown() VersionsValue { + return VersionsValue{ + state: attr.ValueStateUnknown, + } +} + +func NewVersionsValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (VersionsValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing VersionsValue Attribute Value", + "While creating a VersionsValue value, a missing attribute value was detected. "+ + "A VersionsValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("VersionsValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid VersionsValue Attribute Type", + "While creating a VersionsValue value, an invalid attribute value was detected. "+ + "A VersionsValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("VersionsValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("VersionsValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra VersionsValue Attribute Value", + "While creating a VersionsValue value, an extra attribute value was detected. "+ + "A VersionsValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra VersionsValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewVersionsValueUnknown(), diags + } + + betaAttribute, ok := attributes["beta"] + + if !ok { + diags.AddError( + "Attribute Missing", + `beta is missing from object`) + + return NewVersionsValueUnknown(), diags + } + + betaVal, ok := betaAttribute.(basetypes.BoolValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`beta expected to be basetypes.BoolValue, was: %T`, betaAttribute)) + } + + deprecatedAttribute, ok := attributes["deprecated"] + + if !ok { + diags.AddError( + "Attribute Missing", + `deprecated is missing from object`) + + return NewVersionsValueUnknown(), diags + } + + deprecatedVal, ok := deprecatedAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`deprecated expected to be basetypes.StringValue, was: %T`, deprecatedAttribute)) + } + + recommendAttribute, ok := attributes["recommend"] + + if !ok { + diags.AddError( + "Attribute Missing", + `recommend is missing from object`) + + return NewVersionsValueUnknown(), diags + } + + recommendVal, ok := recommendAttribute.(basetypes.BoolValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`recommend expected to be basetypes.BoolValue, was: %T`, recommendAttribute)) + } + + versionAttribute, ok := attributes["version"] + + if !ok { + diags.AddError( + "Attribute Missing", + `version is missing from object`) + + return NewVersionsValueUnknown(), diags + } + + versionVal, ok := versionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`version expected to be basetypes.StringValue, was: %T`, versionAttribute)) + } + + if diags.HasError() { + return NewVersionsValueUnknown(), diags + } + + return VersionsValue{ + Beta: betaVal, + Deprecated: deprecatedVal, + Recommend: recommendVal, + Version: versionVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewVersionsValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) VersionsValue { + object, diags := NewVersionsValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewVersionsValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t VersionsType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewVersionsValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewVersionsValueUnknown(), nil + } + + if in.IsNull() { + return NewVersionsValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewVersionsValueMust(VersionsValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t VersionsType) ValueType(ctx context.Context) attr.Value { + return VersionsValue{} +} + +var _ basetypes.ObjectValuable = VersionsValue{} + +type VersionsValue struct { + Beta basetypes.BoolValue `tfsdk:"beta"` + Deprecated basetypes.StringValue `tfsdk:"deprecated"` + Recommend basetypes.BoolValue `tfsdk:"recommend"` + Version basetypes.StringValue `tfsdk:"version"` + state attr.ValueState +} + +func (v VersionsValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 4) + + var val tftypes.Value + var err error + + attrTypes["beta"] = basetypes.BoolType{}.TerraformType(ctx) + attrTypes["deprecated"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["recommend"] = basetypes.BoolType{}.TerraformType(ctx) + attrTypes["version"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 4) + + val, err = v.Beta.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["beta"] = val + + val, err = v.Deprecated.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["deprecated"] = val + + val, err = v.Recommend.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["recommend"] = val + + val, err = v.Version.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["version"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v VersionsValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v VersionsValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v VersionsValue) String() string { + return "VersionsValue" +} + +func (v VersionsValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "beta": basetypes.BoolType{}, + "deprecated": basetypes.StringType{}, + "recommend": basetypes.BoolType{}, + "version": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "beta": v.Beta, + "deprecated": v.Deprecated, + "recommend": v.Recommend, + "version": v.Version, + }) + + return objVal, diags +} + +func (v VersionsValue) Equal(o attr.Value) bool { + other, ok := o.(VersionsValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Beta.Equal(other.Beta) { + return false + } + + if !v.Deprecated.Equal(other.Deprecated) { + return false + } + + if !v.Recommend.Equal(other.Recommend) { + return false + } + + if !v.Version.Equal(other.Version) { + return false + } + + return true +} + +func (v VersionsValue) Type(ctx context.Context) attr.Type { + return VersionsType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v VersionsValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "beta": basetypes.BoolType{}, + "deprecated": basetypes.StringType{}, + "recommend": basetypes.BoolType{}, + "version": basetypes.StringType{}, + } +} diff --git a/stackit/internal/services/sqlserverflexalpha/database/datasource.go b/stackit/internal/services/sqlserverflexalpha/database/datasource.go new file mode 100644 index 00000000..338e7b88 --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/database/datasource.go @@ -0,0 +1,67 @@ +package sqlserverflexalpha + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/sqlserverflexalpha" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" + sqlserverflexalphaGen "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/database/datasources_gen" + sqlserverflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/utils" +) + +var _ datasource.DataSource = (*databaseDataSource)(nil) + +func NewDatabaseDataSource() datasource.DataSource { + return &databaseDataSource{} +} + +type databaseDataSource struct { + client *sqlserverflexalpha.APIClient + providerData core.ProviderData +} + +func (d *databaseDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_sqlserverflexalpha_database" +} + +func (d *databaseDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = sqlserverflexalphaGen.DatabaseDataSourceSchema(ctx) +} + +// Configure adds the provider configured client to the data source. +func (d *databaseDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + var ok bool + d.providerData, ok = conversion.ParseProviderData(ctx, req.ProviderData, &resp.Diagnostics) + if !ok { + return + } + + apiClient := sqlserverflexUtils.ConfigureClient(ctx, &d.providerData, &resp.Diagnostics) + if resp.Diagnostics.HasError() { + return + } + d.client = apiClient + tflog.Info(ctx, "SQL SERVER Flex database client configured") +} + +func (d *databaseDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + var data sqlserverflexalphaGen.DatabaseModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Read API call logic + + // Example data value setting + // data.Id = types.StringValue("example-id") + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} diff --git a/stackit/internal/services/sqlserverflexalpha/database/datasources_gen/database_data_source_gen.go b/stackit/internal/services/sqlserverflexalpha/database/datasources_gen/database_data_source_gen.go new file mode 100644 index 00000000..25406f5f --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/database/datasources_gen/database_data_source_gen.go @@ -0,0 +1,81 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func DatabaseDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "collation_name": schema.StringAttribute{ + Computed: true, + Description: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.", + MarkdownDescription: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.", + }, + "compatibility_level": schema.Int64Attribute{ + Computed: true, + Description: "CompatibilityLevel of the Database.", + MarkdownDescription: "CompatibilityLevel of the Database.", + }, + "database_name": schema.StringAttribute{ + Required: true, + Description: "The name of the database.", + MarkdownDescription: "The name of the database.", + }, + "id": schema.Int64Attribute{ + Computed: true, + Description: "The id of the database.", + MarkdownDescription: "The id of the database.", + }, + "instance_id": schema.StringAttribute{ + Required: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "name": schema.StringAttribute{ + Computed: true, + Description: "The name of the database.", + MarkdownDescription: "The name of the database.", + }, + "owner": schema.StringAttribute{ + Computed: true, + Description: "The owner of the database.", + MarkdownDescription: "The owner of the database.", + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + }, + } +} + +type DatabaseModel struct { + CollationName types.String `tfsdk:"collation_name"` + CompatibilityLevel types.Int64 `tfsdk:"compatibility_level"` + DatabaseName types.String `tfsdk:"database_name"` + Id types.Int64 `tfsdk:"id"` + InstanceId types.String `tfsdk:"instance_id"` + Name types.String `tfsdk:"name"` + Owner types.String `tfsdk:"owner"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` +} diff --git a/stackit/internal/services/sqlserverflexalpha/database/datasources_gen/databases_data_source_gen.go b/stackit/internal/services/sqlserverflexalpha/database/datasources_gen/databases_data_source_gen.go new file mode 100644 index 00000000..c6b6350a --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/database/datasources_gen/databases_data_source_gen.go @@ -0,0 +1,1180 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func DatabasesDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "databases": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "created": schema.StringAttribute{ + Computed: true, + Description: "The date when the database was created in RFC3339 format.", + MarkdownDescription: "The date when the database was created in RFC3339 format.", + }, + "id": schema.Int64Attribute{ + Computed: true, + Description: "The id of the database.", + MarkdownDescription: "The id of the database.", + }, + "name": schema.StringAttribute{ + Computed: true, + Description: "The name of the database.", + MarkdownDescription: "The name of the database.", + }, + "owner": schema.StringAttribute{ + Computed: true, + Description: "The owner of the database.", + MarkdownDescription: "The owner of the database.", + }, + }, + CustomType: DatabasesType{ + ObjectType: types.ObjectType{ + AttrTypes: DatabasesValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "A list containing all databases for the instance.", + MarkdownDescription: "A list containing all databases for the instance.", + }, + "instance_id": schema.StringAttribute{ + Required: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "page": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of the page of items list to be returned.", + MarkdownDescription: "Number of the page of items list to be returned.", + }, + "pagination": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "page": schema.Int64Attribute{ + Computed: true, + }, + "size": schema.Int64Attribute{ + Computed: true, + }, + "sort": schema.StringAttribute{ + Computed: true, + }, + "total_pages": schema.Int64Attribute{ + Computed: true, + }, + "total_rows": schema.Int64Attribute{ + Computed: true, + }, + }, + CustomType: PaginationType{ + ObjectType: types.ObjectType{ + AttrTypes: PaginationValue{}.AttributeTypes(ctx), + }, + }, + Computed: true, + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "size": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of items to be returned on each page.", + MarkdownDescription: "Number of items to be returned on each page.", + }, + "sort": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "Sorting of the databases to be returned on each page.", + MarkdownDescription: "Sorting of the databases to be returned on each page.", + Validators: []validator.String{ + stringvalidator.OneOf( + "created_at.desc", + "created_at.asc", + "database_id.desc", + "database_id.asc", + "database_name.desc", + "database_name.asc", + "database_owner.desc", + "database_owner.asc", + "index.asc", + "index.desc", + ), + }, + }, + }, + } +} + +type DatabasesModel struct { + Databases types.List `tfsdk:"databases"` + InstanceId types.String `tfsdk:"instance_id"` + Page types.Int64 `tfsdk:"page"` + Pagination PaginationValue `tfsdk:"pagination"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Size types.Int64 `tfsdk:"size"` + Sort types.String `tfsdk:"sort"` +} + +var _ basetypes.ObjectTypable = DatabasesType{} + +type DatabasesType struct { + basetypes.ObjectType +} + +func (t DatabasesType) Equal(o attr.Type) bool { + other, ok := o.(DatabasesType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t DatabasesType) String() string { + return "DatabasesType" +} + +func (t DatabasesType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + createdAttribute, ok := attributes["created"] + + if !ok { + diags.AddError( + "Attribute Missing", + `created is missing from object`) + + return nil, diags + } + + createdVal, ok := createdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`created expected to be basetypes.StringValue, was: %T`, createdAttribute)) + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return nil, diags + } + + idVal, ok := idAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute)) + } + + nameAttribute, ok := attributes["name"] + + if !ok { + diags.AddError( + "Attribute Missing", + `name is missing from object`) + + return nil, diags + } + + nameVal, ok := nameAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute)) + } + + ownerAttribute, ok := attributes["owner"] + + if !ok { + diags.AddError( + "Attribute Missing", + `owner is missing from object`) + + return nil, diags + } + + ownerVal, ok := ownerAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`owner expected to be basetypes.StringValue, was: %T`, ownerAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return DatabasesValue{ + Created: createdVal, + Id: idVal, + Name: nameVal, + Owner: ownerVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewDatabasesValueNull() DatabasesValue { + return DatabasesValue{ + state: attr.ValueStateNull, + } +} + +func NewDatabasesValueUnknown() DatabasesValue { + return DatabasesValue{ + state: attr.ValueStateUnknown, + } +} + +func NewDatabasesValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (DatabasesValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing DatabasesValue Attribute Value", + "While creating a DatabasesValue value, a missing attribute value was detected. "+ + "A DatabasesValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("DatabasesValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid DatabasesValue Attribute Type", + "While creating a DatabasesValue value, an invalid attribute value was detected. "+ + "A DatabasesValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("DatabasesValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("DatabasesValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra DatabasesValue Attribute Value", + "While creating a DatabasesValue value, an extra attribute value was detected. "+ + "A DatabasesValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra DatabasesValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewDatabasesValueUnknown(), diags + } + + createdAttribute, ok := attributes["created"] + + if !ok { + diags.AddError( + "Attribute Missing", + `created is missing from object`) + + return NewDatabasesValueUnknown(), diags + } + + createdVal, ok := createdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`created expected to be basetypes.StringValue, was: %T`, createdAttribute)) + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return NewDatabasesValueUnknown(), diags + } + + idVal, ok := idAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute)) + } + + nameAttribute, ok := attributes["name"] + + if !ok { + diags.AddError( + "Attribute Missing", + `name is missing from object`) + + return NewDatabasesValueUnknown(), diags + } + + nameVal, ok := nameAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`name expected to be basetypes.StringValue, was: %T`, nameAttribute)) + } + + ownerAttribute, ok := attributes["owner"] + + if !ok { + diags.AddError( + "Attribute Missing", + `owner is missing from object`) + + return NewDatabasesValueUnknown(), diags + } + + ownerVal, ok := ownerAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`owner expected to be basetypes.StringValue, was: %T`, ownerAttribute)) + } + + if diags.HasError() { + return NewDatabasesValueUnknown(), diags + } + + return DatabasesValue{ + Created: createdVal, + Id: idVal, + Name: nameVal, + Owner: ownerVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewDatabasesValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) DatabasesValue { + object, diags := NewDatabasesValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewDatabasesValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t DatabasesType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewDatabasesValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewDatabasesValueUnknown(), nil + } + + if in.IsNull() { + return NewDatabasesValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewDatabasesValueMust(DatabasesValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t DatabasesType) ValueType(ctx context.Context) attr.Value { + return DatabasesValue{} +} + +var _ basetypes.ObjectValuable = DatabasesValue{} + +type DatabasesValue struct { + Created basetypes.StringValue `tfsdk:"created"` + Id basetypes.Int64Value `tfsdk:"id"` + Name basetypes.StringValue `tfsdk:"name"` + Owner basetypes.StringValue `tfsdk:"owner"` + state attr.ValueState +} + +func (v DatabasesValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 4) + + var val tftypes.Value + var err error + + attrTypes["created"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["id"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["name"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["owner"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 4) + + val, err = v.Created.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["created"] = val + + val, err = v.Id.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["id"] = val + + val, err = v.Name.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["name"] = val + + val, err = v.Owner.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["owner"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v DatabasesValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v DatabasesValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v DatabasesValue) String() string { + return "DatabasesValue" +} + +func (v DatabasesValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "created": basetypes.StringType{}, + "id": basetypes.Int64Type{}, + "name": basetypes.StringType{}, + "owner": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "created": v.Created, + "id": v.Id, + "name": v.Name, + "owner": v.Owner, + }) + + return objVal, diags +} + +func (v DatabasesValue) Equal(o attr.Value) bool { + other, ok := o.(DatabasesValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Created.Equal(other.Created) { + return false + } + + if !v.Id.Equal(other.Id) { + return false + } + + if !v.Name.Equal(other.Name) { + return false + } + + if !v.Owner.Equal(other.Owner) { + return false + } + + return true +} + +func (v DatabasesValue) Type(ctx context.Context) attr.Type { + return DatabasesType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v DatabasesValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "created": basetypes.StringType{}, + "id": basetypes.Int64Type{}, + "name": basetypes.StringType{}, + "owner": basetypes.StringType{}, + } +} + +var _ basetypes.ObjectTypable = PaginationType{} + +type PaginationType struct { + basetypes.ObjectType +} + +func (t PaginationType) Equal(o attr.Type) bool { + other, ok := o.(PaginationType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t PaginationType) String() string { + return "PaginationType" +} + +func (t PaginationType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return nil, diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return nil, diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return nil, diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return nil, diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return nil, diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueNull() PaginationValue { + return PaginationValue{ + state: attr.ValueStateNull, + } +} + +func NewPaginationValueUnknown() PaginationValue { + return PaginationValue{ + state: attr.ValueStateUnknown, + } +} + +func NewPaginationValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (PaginationValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing PaginationValue Attribute Value", + "While creating a PaginationValue value, a missing attribute value was detected. "+ + "A PaginationValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid PaginationValue Attribute Type", + "While creating a PaginationValue value, an invalid attribute value was detected. "+ + "A PaginationValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra PaginationValue Attribute Value", + "While creating a PaginationValue value, an extra attribute value was detected. "+ + "A PaginationValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra PaginationValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) PaginationValue { + object, diags := NewPaginationValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewPaginationValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t PaginationType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewPaginationValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewPaginationValueUnknown(), nil + } + + if in.IsNull() { + return NewPaginationValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewPaginationValueMust(PaginationValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t PaginationType) ValueType(ctx context.Context) attr.Value { + return PaginationValue{} +} + +var _ basetypes.ObjectValuable = PaginationValue{} + +type PaginationValue struct { + Page basetypes.Int64Value `tfsdk:"page"` + Size basetypes.Int64Value `tfsdk:"size"` + Sort basetypes.StringValue `tfsdk:"sort"` + TotalPages basetypes.Int64Value `tfsdk:"total_pages"` + TotalRows basetypes.Int64Value `tfsdk:"total_rows"` + state attr.ValueState +} + +func (v PaginationValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 5) + + var val tftypes.Value + var err error + + attrTypes["page"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["size"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["sort"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["total_pages"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["total_rows"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 5) + + val, err = v.Page.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["page"] = val + + val, err = v.Size.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["size"] = val + + val, err = v.Sort.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["sort"] = val + + val, err = v.TotalPages.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_pages"] = val + + val, err = v.TotalRows.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_rows"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v PaginationValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v PaginationValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v PaginationValue) String() string { + return "PaginationValue" +} + +func (v PaginationValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "page": v.Page, + "size": v.Size, + "sort": v.Sort, + "total_pages": v.TotalPages, + "total_rows": v.TotalRows, + }) + + return objVal, diags +} + +func (v PaginationValue) Equal(o attr.Value) bool { + other, ok := o.(PaginationValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Page.Equal(other.Page) { + return false + } + + if !v.Size.Equal(other.Size) { + return false + } + + if !v.Sort.Equal(other.Sort) { + return false + } + + if !v.TotalPages.Equal(other.TotalPages) { + return false + } + + if !v.TotalRows.Equal(other.TotalRows) { + return false + } + + return true +} + +func (v PaginationValue) Type(ctx context.Context) attr.Type { + return PaginationType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v PaginationValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } +} diff --git a/stackit/internal/services/sqlserverflexalpha/database/resource.go b/stackit/internal/services/sqlserverflexalpha/database/resource.go new file mode 100644 index 00000000..5536eddc --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/database/resource.go @@ -0,0 +1,217 @@ +package sqlserverflexalpha + +import ( + "context" + "fmt" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/sqlserverflexalpha" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" + "github.com/stackitcloud/stackit-sdk-go/core/config" + + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/utils" + + sqlserverflexalphaGen "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/database/resources_gen" +) + +var ( + _ resource.Resource = &databaseResource{} + _ resource.ResourceWithConfigure = &databaseResource{} + _ resource.ResourceWithImportState = &databaseResource{} + _ resource.ResourceWithModifyPlan = &databaseResource{} +) + +func NewDatabaseResource() resource.Resource { + return &databaseResource{} +} + +type databaseResource struct { + client *sqlserverflexalpha.APIClient + providerData core.ProviderData +} + +func (r *databaseResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_sqlserverflexalpha_database" +} + +func (r *databaseResource) Schema(ctx context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = sqlserverflexalphaGen.DatabaseResourceSchema(ctx) +} + +// Configure adds the provider configured client to the resource. +func (r *databaseResource) Configure( + ctx context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { + var ok bool + r.providerData, ok = conversion.ParseProviderData(ctx, req.ProviderData, &resp.Diagnostics) + if !ok { + return + } + + apiClientConfigOptions := []config.ConfigurationOption{ + config.WithCustomAuth(r.providerData.RoundTripper), + utils.UserAgentConfigOption(r.providerData.Version), + } + if r.providerData.PostgresFlexCustomEndpoint != "" { + apiClientConfigOptions = append(apiClientConfigOptions, config.WithEndpoint(r.providerData.PostgresFlexCustomEndpoint)) + } else { + apiClientConfigOptions = append(apiClientConfigOptions, config.WithRegion(r.providerData.GetRegion())) + } + apiClient, err := sqlserverflexalpha.NewAPIClient(apiClientConfigOptions...) + if err != nil { + resp.Diagnostics.AddError( + "Error configuring API client", + fmt.Sprintf("Configuring client: %v. This is an error related to the provider configuration, not to the resource configuration", err), + ) + return + } + r.client = apiClient + tflog.Info(ctx, "sqlserverflexalpha.Database client configured") +} + +func (r *databaseResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + var data sqlserverflexalphaGen.DatabaseModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // TODO: Create API call logic + + // Example data value setting + // data.DatabaseId = types.StringValue("id-from-response") + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + + tflog.Info(ctx, "sqlserverflexalpha.Database created") +} + +func (r *databaseResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + var data sqlserverflexalphaGen.DatabaseModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Read API call logic + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + + tflog.Info(ctx, "sqlserverflexalpha.Database read") +} + +func (r *databaseResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + var data sqlserverflexalphaGen.DatabaseModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Update API call logic + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + + tflog.Info(ctx, "sqlserverflexalpha.Database updated") +} + +func (r *databaseResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + var data sqlserverflexalphaGen.DatabaseModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Delete API call logic + + tflog.Info(ctx, "sqlserverflexalpha.Database deleted") +} + +// ModifyPlan implements resource.ResourceWithModifyPlan. +// Use the modifier to set the effective region in the current plan. +func (r *databaseResource) ModifyPlan( + ctx context.Context, + req resource.ModifyPlanRequest, + resp *resource.ModifyPlanResponse, +) { // nolint:gocritic // function signature required by Terraform + var configModel sqlserverflexalphaGen.DatabaseModel + // skip initial empty configuration to avoid follow-up errors + if req.Config.Raw.IsNull() { + return + } + resp.Diagnostics.Append(req.Config.Get(ctx, &configModel)...) + if resp.Diagnostics.HasError() { + return + } + + var planModel sqlserverflexalphaGen.DatabaseModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &planModel)...) + if resp.Diagnostics.HasError() { + return + } + + utils.AdaptRegion(ctx, configModel.Region, &planModel.Region, r.providerData.GetRegion(), resp) + if resp.Diagnostics.HasError() { + return + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, planModel)...) + if resp.Diagnostics.HasError() { + return + } +} + +// ImportState imports a resource into the Terraform state on success. +// The expected format of the resource import identifier is: project_id,zone_id,record_set_id +func (r *databaseResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { + idParts := strings.Split(req.ID, core.Separator) + + // Todo: Import logic + if len(idParts) < 2 || idParts[0] == "" || idParts[1] == "" { + core.LogAndAddError( + ctx, &resp.Diagnostics, + "Error importing database", + fmt.Sprintf( + "Expected import identifier with format [project_id],[region],..., got %q", + req.ID, + ), + ) + return + } + + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), idParts[0])...) + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), idParts[1])...) + // ... more ... + + core.LogAndAddWarning( + ctx, + &resp.Diagnostics, + "Sqlserverflexalpha database imported with empty password", + "The database password is not imported as it is only available upon creation of a new database. The password field will be empty.", + ) + tflog.Info(ctx, "Sqlserverflexalpha database state imported") +} diff --git a/stackit/internal/services/sqlserverflexalpha/database/resources_gen/database_resource_gen.go b/stackit/internal/services/sqlserverflexalpha/database/resources_gen/database_resource_gen.go new file mode 100644 index 00000000..8e5886ad --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/database/resources_gen/database_resource_gen.go @@ -0,0 +1,99 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + + "github.com/hashicorp/terraform-plugin-framework/resource/schema" +) + +func DatabaseResourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "collation": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.", + MarkdownDescription: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.", + }, + "collation_name": schema.StringAttribute{ + Computed: true, + Description: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.", + MarkdownDescription: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.", + }, + "compatibility": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "CompatibilityLevel of the Database.", + MarkdownDescription: "CompatibilityLevel of the Database.", + }, + "compatibility_level": schema.Int64Attribute{ + Computed: true, + Description: "CompatibilityLevel of the Database.", + MarkdownDescription: "CompatibilityLevel of the Database.", + }, + "database_name": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The name of the database.", + MarkdownDescription: "The name of the database.", + }, + "id": schema.Int64Attribute{ + Computed: true, + Description: "The id of the database.", + MarkdownDescription: "The id of the database.", + }, + "instance_id": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "name": schema.StringAttribute{ + Required: true, + Description: "The name of the database.", + MarkdownDescription: "The name of the database.", + }, + "owner": schema.StringAttribute{ + Required: true, + Description: "The owner of the database.", + MarkdownDescription: "The owner of the database.", + }, + "project_id": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + }, + } +} + +type DatabaseModel struct { + Collation types.String `tfsdk:"collation"` + CollationName types.String `tfsdk:"collation_name"` + Compatibility types.Int64 `tfsdk:"compatibility"` + CompatibilityLevel types.Int64 `tfsdk:"compatibility_level"` + DatabaseName types.String `tfsdk:"database_name"` + Id types.Int64 `tfsdk:"id"` + InstanceId types.String `tfsdk:"instance_id"` + Name types.String `tfsdk:"name"` + Owner types.String `tfsdk:"owner"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` +} diff --git a/stackit/internal/services/sqlserverflexalpha/flavor/datasource.go b/stackit/internal/services/sqlserverflexalpha/flavor/datasource.go index 46ad0387..8ca63882 100644 --- a/stackit/internal/services/sqlserverflexalpha/flavor/datasource.go +++ b/stackit/internal/services/sqlserverflexalpha/flavor/datasource.go @@ -5,24 +5,25 @@ import ( "fmt" "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/sqlserverflexalpha" "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/utils" - sqlserverflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha" + sqlserverflexalphaGen "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/flavor/datasources_gen" sqlserverflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/utils" - - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-log/tflog" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" ) // Ensure the implementation satisfies the expected interfaces. var ( - _ datasource.DataSource = &flavorDataSource{} + _ datasource.DataSource = &flavorDataSource{} + _ datasource.DataSourceWithConfigure = &flavorDataSource{} ) type FlavorModel struct { @@ -144,9 +145,9 @@ func (r *flavorDataSource) Schema(ctx context.Context, _ datasource.SchemaReques Computed: true, }, }, - CustomType: sqlserverflex.StorageClassesType{ + CustomType: sqlserverflexalphaGen.StorageClassesType{ ObjectType: types.ObjectType{ - AttrTypes: sqlserverflex.StorageClassesValue{}.AttributeTypes(ctx), + AttrTypes: sqlserverflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx), }, }, }, @@ -211,9 +212,9 @@ func (r *flavorDataSource) Read(ctx context.Context, req datasource.ReadRequest, model.MinGb = types.Int64Value(*f.MinGB) if f.StorageClasses == nil { - model.StorageClasses = types.ListNull(sqlserverflex.StorageClassesType{ + model.StorageClasses = types.ListNull(sqlserverflexalphaGen.StorageClassesType{ ObjectType: basetypes.ObjectType{ - AttrTypes: sqlserverflex.StorageClassesValue{}.AttributeTypes(ctx), + AttrTypes: sqlserverflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx), }, }) } else { @@ -221,8 +222,8 @@ func (r *flavorDataSource) Read(ctx context.Context, req datasource.ReadRequest, for _, sc := range *f.StorageClasses { scList = append( scList, - sqlserverflex.NewStorageClassesValueMust( - sqlserverflex.StorageClassesValue{}.AttributeTypes(ctx), + sqlserverflexalphaGen.NewStorageClassesValueMust( + sqlserverflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx), map[string]attr.Value{ "class": types.StringValue(*sc.Class), "max_io_per_sec": types.Int64Value(*sc.MaxIoPerSec), @@ -232,9 +233,9 @@ func (r *flavorDataSource) Read(ctx context.Context, req datasource.ReadRequest, ) } storageClassesList := types.ListValueMust( - sqlserverflex.StorageClassesType{ + sqlserverflexalphaGen.StorageClassesType{ ObjectType: basetypes.ObjectType{ - AttrTypes: sqlserverflex.StorageClassesValue{}.AttributeTypes(ctx), + AttrTypes: sqlserverflexalphaGen.StorageClassesValue{}.AttributeTypes(ctx), }, }, scList, diff --git a/stackit/internal/services/sqlserverflexalpha/flavor/datasources_gen/flavor_data_source_gen.go b/stackit/internal/services/sqlserverflexalpha/flavor/datasources_gen/flavor_data_source_gen.go new file mode 100644 index 00000000..d8654cf4 --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/flavor/datasources_gen/flavor_data_source_gen.go @@ -0,0 +1,1909 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func FlavorDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "flavors": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "cpu": schema.Int64Attribute{ + Computed: true, + Description: "The cpu count of the instance.", + MarkdownDescription: "The cpu count of the instance.", + }, + "description": schema.StringAttribute{ + Computed: true, + Description: "The flavor description.", + MarkdownDescription: "The flavor description.", + }, + "id": schema.StringAttribute{ + Computed: true, + Description: "The id of the instance flavor.", + MarkdownDescription: "The id of the instance flavor.", + }, + "max_gb": schema.Int64Attribute{ + Computed: true, + Description: "maximum storage which can be ordered for the flavor in Gigabyte.", + MarkdownDescription: "maximum storage which can be ordered for the flavor in Gigabyte.", + }, + "memory": schema.Int64Attribute{ + Computed: true, + Description: "The memory of the instance in Gibibyte.", + MarkdownDescription: "The memory of the instance in Gibibyte.", + }, + "min_gb": schema.Int64Attribute{ + Computed: true, + Description: "minimum storage which is required to order in Gigabyte.", + MarkdownDescription: "minimum storage which is required to order in Gigabyte.", + }, + "node_type": schema.StringAttribute{ + Computed: true, + Description: "defines the nodeType it can be either single or HA", + MarkdownDescription: "defines the nodeType it can be either single or HA", + }, + "storage_classes": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "class": schema.StringAttribute{ + Computed: true, + }, + "max_io_per_sec": schema.Int64Attribute{ + Computed: true, + }, + "max_through_in_mb": schema.Int64Attribute{ + Computed: true, + }, + }, + CustomType: StorageClassesType{ + ObjectType: types.ObjectType{ + AttrTypes: StorageClassesValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "maximum storage which can be ordered for the flavor in Gigabyte.", + MarkdownDescription: "maximum storage which can be ordered for the flavor in Gigabyte.", + }, + }, + CustomType: FlavorsType{ + ObjectType: types.ObjectType{ + AttrTypes: FlavorsValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "List of flavors available for the project.", + MarkdownDescription: "List of flavors available for the project.", + }, + "page": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of the page of items list to be returned.", + MarkdownDescription: "Number of the page of items list to be returned.", + }, + "pagination": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "page": schema.Int64Attribute{ + Computed: true, + }, + "size": schema.Int64Attribute{ + Computed: true, + }, + "sort": schema.StringAttribute{ + Computed: true, + }, + "total_pages": schema.Int64Attribute{ + Computed: true, + }, + "total_rows": schema.Int64Attribute{ + Computed: true, + }, + }, + CustomType: PaginationType{ + ObjectType: types.ObjectType{ + AttrTypes: PaginationValue{}.AttributeTypes(ctx), + }, + }, + Computed: true, + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "size": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of items to be returned on each page.", + MarkdownDescription: "Number of items to be returned on each page.", + }, + "sort": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "Sorting of the flavors to be returned on each page.", + MarkdownDescription: "Sorting of the flavors to be returned on each page.", + Validators: []validator.String{ + stringvalidator.OneOf( + "index.desc", + "index.asc", + "cpu.desc", + "cpu.asc", + "flavor_description.asc", + "flavor_description.desc", + "id.desc", + "id.asc", + "size_max.desc", + "size_max.asc", + "ram.desc", + "ram.asc", + "size_min.desc", + "size_min.asc", + "storage_class.asc", + "storage_class.desc", + "node_type.asc", + "node_type.desc", + ), + }, + }, + }, + } +} + +type FlavorModel struct { + Flavors types.List `tfsdk:"flavors"` + Page types.Int64 `tfsdk:"page"` + Pagination PaginationValue `tfsdk:"pagination"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Size types.Int64 `tfsdk:"size"` + Sort types.String `tfsdk:"sort"` +} + +var _ basetypes.ObjectTypable = FlavorsType{} + +type FlavorsType struct { + basetypes.ObjectType +} + +func (t FlavorsType) Equal(o attr.Type) bool { + other, ok := o.(FlavorsType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t FlavorsType) String() string { + return "FlavorsType" +} + +func (t FlavorsType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + cpuAttribute, ok := attributes["cpu"] + + if !ok { + diags.AddError( + "Attribute Missing", + `cpu is missing from object`) + + return nil, diags + } + + cpuVal, ok := cpuAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`cpu expected to be basetypes.Int64Value, was: %T`, cpuAttribute)) + } + + descriptionAttribute, ok := attributes["description"] + + if !ok { + diags.AddError( + "Attribute Missing", + `description is missing from object`) + + return nil, diags + } + + descriptionVal, ok := descriptionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute)) + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return nil, diags + } + + idVal, ok := idAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.StringValue, was: %T`, idAttribute)) + } + + maxGbAttribute, ok := attributes["max_gb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_gb is missing from object`) + + return nil, diags + } + + maxGbVal, ok := maxGbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_gb expected to be basetypes.Int64Value, was: %T`, maxGbAttribute)) + } + + memoryAttribute, ok := attributes["memory"] + + if !ok { + diags.AddError( + "Attribute Missing", + `memory is missing from object`) + + return nil, diags + } + + memoryVal, ok := memoryAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`memory expected to be basetypes.Int64Value, was: %T`, memoryAttribute)) + } + + minGbAttribute, ok := attributes["min_gb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `min_gb is missing from object`) + + return nil, diags + } + + minGbVal, ok := minGbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`min_gb expected to be basetypes.Int64Value, was: %T`, minGbAttribute)) + } + + nodeTypeAttribute, ok := attributes["node_type"] + + if !ok { + diags.AddError( + "Attribute Missing", + `node_type is missing from object`) + + return nil, diags + } + + nodeTypeVal, ok := nodeTypeAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`node_type expected to be basetypes.StringValue, was: %T`, nodeTypeAttribute)) + } + + storageClassesAttribute, ok := attributes["storage_classes"] + + if !ok { + diags.AddError( + "Attribute Missing", + `storage_classes is missing from object`) + + return nil, diags + } + + storageClassesVal, ok := storageClassesAttribute.(basetypes.ListValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`storage_classes expected to be basetypes.ListValue, was: %T`, storageClassesAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return FlavorsValue{ + Cpu: cpuVal, + Description: descriptionVal, + Id: idVal, + MaxGb: maxGbVal, + Memory: memoryVal, + MinGb: minGbVal, + NodeType: nodeTypeVal, + StorageClasses: storageClassesVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewFlavorsValueNull() FlavorsValue { + return FlavorsValue{ + state: attr.ValueStateNull, + } +} + +func NewFlavorsValueUnknown() FlavorsValue { + return FlavorsValue{ + state: attr.ValueStateUnknown, + } +} + +func NewFlavorsValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (FlavorsValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing FlavorsValue Attribute Value", + "While creating a FlavorsValue value, a missing attribute value was detected. "+ + "A FlavorsValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("FlavorsValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid FlavorsValue Attribute Type", + "While creating a FlavorsValue value, an invalid attribute value was detected. "+ + "A FlavorsValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("FlavorsValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("FlavorsValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra FlavorsValue Attribute Value", + "While creating a FlavorsValue value, an extra attribute value was detected. "+ + "A FlavorsValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra FlavorsValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewFlavorsValueUnknown(), diags + } + + cpuAttribute, ok := attributes["cpu"] + + if !ok { + diags.AddError( + "Attribute Missing", + `cpu is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + cpuVal, ok := cpuAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`cpu expected to be basetypes.Int64Value, was: %T`, cpuAttribute)) + } + + descriptionAttribute, ok := attributes["description"] + + if !ok { + diags.AddError( + "Attribute Missing", + `description is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + descriptionVal, ok := descriptionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute)) + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + idVal, ok := idAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.StringValue, was: %T`, idAttribute)) + } + + maxGbAttribute, ok := attributes["max_gb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_gb is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + maxGbVal, ok := maxGbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_gb expected to be basetypes.Int64Value, was: %T`, maxGbAttribute)) + } + + memoryAttribute, ok := attributes["memory"] + + if !ok { + diags.AddError( + "Attribute Missing", + `memory is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + memoryVal, ok := memoryAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`memory expected to be basetypes.Int64Value, was: %T`, memoryAttribute)) + } + + minGbAttribute, ok := attributes["min_gb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `min_gb is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + minGbVal, ok := minGbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`min_gb expected to be basetypes.Int64Value, was: %T`, minGbAttribute)) + } + + nodeTypeAttribute, ok := attributes["node_type"] + + if !ok { + diags.AddError( + "Attribute Missing", + `node_type is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + nodeTypeVal, ok := nodeTypeAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`node_type expected to be basetypes.StringValue, was: %T`, nodeTypeAttribute)) + } + + storageClassesAttribute, ok := attributes["storage_classes"] + + if !ok { + diags.AddError( + "Attribute Missing", + `storage_classes is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + storageClassesVal, ok := storageClassesAttribute.(basetypes.ListValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`storage_classes expected to be basetypes.ListValue, was: %T`, storageClassesAttribute)) + } + + if diags.HasError() { + return NewFlavorsValueUnknown(), diags + } + + return FlavorsValue{ + Cpu: cpuVal, + Description: descriptionVal, + Id: idVal, + MaxGb: maxGbVal, + Memory: memoryVal, + MinGb: minGbVal, + NodeType: nodeTypeVal, + StorageClasses: storageClassesVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewFlavorsValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) FlavorsValue { + object, diags := NewFlavorsValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewFlavorsValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t FlavorsType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewFlavorsValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewFlavorsValueUnknown(), nil + } + + if in.IsNull() { + return NewFlavorsValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewFlavorsValueMust(FlavorsValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t FlavorsType) ValueType(ctx context.Context) attr.Value { + return FlavorsValue{} +} + +var _ basetypes.ObjectValuable = FlavorsValue{} + +type FlavorsValue struct { + Cpu basetypes.Int64Value `tfsdk:"cpu"` + Description basetypes.StringValue `tfsdk:"description"` + Id basetypes.StringValue `tfsdk:"id"` + MaxGb basetypes.Int64Value `tfsdk:"max_gb"` + Memory basetypes.Int64Value `tfsdk:"memory"` + MinGb basetypes.Int64Value `tfsdk:"min_gb"` + NodeType basetypes.StringValue `tfsdk:"node_type"` + StorageClasses basetypes.ListValue `tfsdk:"storage_classes"` + state attr.ValueState +} + +func (v FlavorsValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 8) + + var val tftypes.Value + var err error + + attrTypes["cpu"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["description"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["id"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["max_gb"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["memory"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["min_gb"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["node_type"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["storage_classes"] = basetypes.ListType{ + ElemType: StorageClassesValue{}.Type(ctx), + }.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 8) + + val, err = v.Cpu.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["cpu"] = val + + val, err = v.Description.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["description"] = val + + val, err = v.Id.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["id"] = val + + val, err = v.MaxGb.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["max_gb"] = val + + val, err = v.Memory.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["memory"] = val + + val, err = v.MinGb.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["min_gb"] = val + + val, err = v.NodeType.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["node_type"] = val + + val, err = v.StorageClasses.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["storage_classes"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v FlavorsValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v FlavorsValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v FlavorsValue) String() string { + return "FlavorsValue" +} + +func (v FlavorsValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + storageClasses := types.ListValueMust( + StorageClassesType{ + basetypes.ObjectType{ + AttrTypes: StorageClassesValue{}.AttributeTypes(ctx), + }, + }, + v.StorageClasses.Elements(), + ) + + if v.StorageClasses.IsNull() { + storageClasses = types.ListNull( + StorageClassesType{ + basetypes.ObjectType{ + AttrTypes: StorageClassesValue{}.AttributeTypes(ctx), + }, + }, + ) + } + + if v.StorageClasses.IsUnknown() { + storageClasses = types.ListUnknown( + StorageClassesType{ + basetypes.ObjectType{ + AttrTypes: StorageClassesValue{}.AttributeTypes(ctx), + }, + }, + ) + } + + attributeTypes := map[string]attr.Type{ + "cpu": basetypes.Int64Type{}, + "description": basetypes.StringType{}, + "id": basetypes.StringType{}, + "max_gb": basetypes.Int64Type{}, + "memory": basetypes.Int64Type{}, + "min_gb": basetypes.Int64Type{}, + "node_type": basetypes.StringType{}, + "storage_classes": basetypes.ListType{ + ElemType: StorageClassesValue{}.Type(ctx), + }, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "cpu": v.Cpu, + "description": v.Description, + "id": v.Id, + "max_gb": v.MaxGb, + "memory": v.Memory, + "min_gb": v.MinGb, + "node_type": v.NodeType, + "storage_classes": storageClasses, + }) + + return objVal, diags +} + +func (v FlavorsValue) Equal(o attr.Value) bool { + other, ok := o.(FlavorsValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Cpu.Equal(other.Cpu) { + return false + } + + if !v.Description.Equal(other.Description) { + return false + } + + if !v.Id.Equal(other.Id) { + return false + } + + if !v.MaxGb.Equal(other.MaxGb) { + return false + } + + if !v.Memory.Equal(other.Memory) { + return false + } + + if !v.MinGb.Equal(other.MinGb) { + return false + } + + if !v.NodeType.Equal(other.NodeType) { + return false + } + + if !v.StorageClasses.Equal(other.StorageClasses) { + return false + } + + return true +} + +func (v FlavorsValue) Type(ctx context.Context) attr.Type { + return FlavorsType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v FlavorsValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "cpu": basetypes.Int64Type{}, + "description": basetypes.StringType{}, + "id": basetypes.StringType{}, + "max_gb": basetypes.Int64Type{}, + "memory": basetypes.Int64Type{}, + "min_gb": basetypes.Int64Type{}, + "node_type": basetypes.StringType{}, + "storage_classes": basetypes.ListType{ + ElemType: StorageClassesValue{}.Type(ctx), + }, + } +} + +var _ basetypes.ObjectTypable = StorageClassesType{} + +type StorageClassesType struct { + basetypes.ObjectType +} + +func (t StorageClassesType) Equal(o attr.Type) bool { + other, ok := o.(StorageClassesType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t StorageClassesType) String() string { + return "StorageClassesType" +} + +func (t StorageClassesType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + classAttribute, ok := attributes["class"] + + if !ok { + diags.AddError( + "Attribute Missing", + `class is missing from object`) + + return nil, diags + } + + classVal, ok := classAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`class expected to be basetypes.StringValue, was: %T`, classAttribute)) + } + + maxIoPerSecAttribute, ok := attributes["max_io_per_sec"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_io_per_sec is missing from object`) + + return nil, diags + } + + maxIoPerSecVal, ok := maxIoPerSecAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_io_per_sec expected to be basetypes.Int64Value, was: %T`, maxIoPerSecAttribute)) + } + + maxThroughInMbAttribute, ok := attributes["max_through_in_mb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_through_in_mb is missing from object`) + + return nil, diags + } + + maxThroughInMbVal, ok := maxThroughInMbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_through_in_mb expected to be basetypes.Int64Value, was: %T`, maxThroughInMbAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return StorageClassesValue{ + Class: classVal, + MaxIoPerSec: maxIoPerSecVal, + MaxThroughInMb: maxThroughInMbVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewStorageClassesValueNull() StorageClassesValue { + return StorageClassesValue{ + state: attr.ValueStateNull, + } +} + +func NewStorageClassesValueUnknown() StorageClassesValue { + return StorageClassesValue{ + state: attr.ValueStateUnknown, + } +} + +func NewStorageClassesValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (StorageClassesValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing StorageClassesValue Attribute Value", + "While creating a StorageClassesValue value, a missing attribute value was detected. "+ + "A StorageClassesValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("StorageClassesValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid StorageClassesValue Attribute Type", + "While creating a StorageClassesValue value, an invalid attribute value was detected. "+ + "A StorageClassesValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("StorageClassesValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("StorageClassesValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra StorageClassesValue Attribute Value", + "While creating a StorageClassesValue value, an extra attribute value was detected. "+ + "A StorageClassesValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra StorageClassesValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewStorageClassesValueUnknown(), diags + } + + classAttribute, ok := attributes["class"] + + if !ok { + diags.AddError( + "Attribute Missing", + `class is missing from object`) + + return NewStorageClassesValueUnknown(), diags + } + + classVal, ok := classAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`class expected to be basetypes.StringValue, was: %T`, classAttribute)) + } + + maxIoPerSecAttribute, ok := attributes["max_io_per_sec"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_io_per_sec is missing from object`) + + return NewStorageClassesValueUnknown(), diags + } + + maxIoPerSecVal, ok := maxIoPerSecAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_io_per_sec expected to be basetypes.Int64Value, was: %T`, maxIoPerSecAttribute)) + } + + maxThroughInMbAttribute, ok := attributes["max_through_in_mb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_through_in_mb is missing from object`) + + return NewStorageClassesValueUnknown(), diags + } + + maxThroughInMbVal, ok := maxThroughInMbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_through_in_mb expected to be basetypes.Int64Value, was: %T`, maxThroughInMbAttribute)) + } + + if diags.HasError() { + return NewStorageClassesValueUnknown(), diags + } + + return StorageClassesValue{ + Class: classVal, + MaxIoPerSec: maxIoPerSecVal, + MaxThroughInMb: maxThroughInMbVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewStorageClassesValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) StorageClassesValue { + object, diags := NewStorageClassesValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewStorageClassesValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t StorageClassesType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewStorageClassesValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewStorageClassesValueUnknown(), nil + } + + if in.IsNull() { + return NewStorageClassesValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewStorageClassesValueMust(StorageClassesValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t StorageClassesType) ValueType(ctx context.Context) attr.Value { + return StorageClassesValue{} +} + +var _ basetypes.ObjectValuable = StorageClassesValue{} + +type StorageClassesValue struct { + Class basetypes.StringValue `tfsdk:"class"` + MaxIoPerSec basetypes.Int64Value `tfsdk:"max_io_per_sec"` + MaxThroughInMb basetypes.Int64Value `tfsdk:"max_through_in_mb"` + state attr.ValueState +} + +func (v StorageClassesValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 3) + + var val tftypes.Value + var err error + + attrTypes["class"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["max_io_per_sec"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["max_through_in_mb"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 3) + + val, err = v.Class.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["class"] = val + + val, err = v.MaxIoPerSec.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["max_io_per_sec"] = val + + val, err = v.MaxThroughInMb.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["max_through_in_mb"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v StorageClassesValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v StorageClassesValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v StorageClassesValue) String() string { + return "StorageClassesValue" +} + +func (v StorageClassesValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "class": basetypes.StringType{}, + "max_io_per_sec": basetypes.Int64Type{}, + "max_through_in_mb": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "class": v.Class, + "max_io_per_sec": v.MaxIoPerSec, + "max_through_in_mb": v.MaxThroughInMb, + }) + + return objVal, diags +} + +func (v StorageClassesValue) Equal(o attr.Value) bool { + other, ok := o.(StorageClassesValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Class.Equal(other.Class) { + return false + } + + if !v.MaxIoPerSec.Equal(other.MaxIoPerSec) { + return false + } + + if !v.MaxThroughInMb.Equal(other.MaxThroughInMb) { + return false + } + + return true +} + +func (v StorageClassesValue) Type(ctx context.Context) attr.Type { + return StorageClassesType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v StorageClassesValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "class": basetypes.StringType{}, + "max_io_per_sec": basetypes.Int64Type{}, + "max_through_in_mb": basetypes.Int64Type{}, + } +} + +var _ basetypes.ObjectTypable = PaginationType{} + +type PaginationType struct { + basetypes.ObjectType +} + +func (t PaginationType) Equal(o attr.Type) bool { + other, ok := o.(PaginationType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t PaginationType) String() string { + return "PaginationType" +} + +func (t PaginationType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return nil, diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return nil, diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return nil, diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return nil, diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return nil, diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueNull() PaginationValue { + return PaginationValue{ + state: attr.ValueStateNull, + } +} + +func NewPaginationValueUnknown() PaginationValue { + return PaginationValue{ + state: attr.ValueStateUnknown, + } +} + +func NewPaginationValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (PaginationValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing PaginationValue Attribute Value", + "While creating a PaginationValue value, a missing attribute value was detected. "+ + "A PaginationValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid PaginationValue Attribute Type", + "While creating a PaginationValue value, an invalid attribute value was detected. "+ + "A PaginationValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra PaginationValue Attribute Value", + "While creating a PaginationValue value, an extra attribute value was detected. "+ + "A PaginationValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra PaginationValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) PaginationValue { + object, diags := NewPaginationValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewPaginationValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t PaginationType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewPaginationValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewPaginationValueUnknown(), nil + } + + if in.IsNull() { + return NewPaginationValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewPaginationValueMust(PaginationValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t PaginationType) ValueType(ctx context.Context) attr.Value { + return PaginationValue{} +} + +var _ basetypes.ObjectValuable = PaginationValue{} + +type PaginationValue struct { + Page basetypes.Int64Value `tfsdk:"page"` + Size basetypes.Int64Value `tfsdk:"size"` + Sort basetypes.StringValue `tfsdk:"sort"` + TotalPages basetypes.Int64Value `tfsdk:"total_pages"` + TotalRows basetypes.Int64Value `tfsdk:"total_rows"` + state attr.ValueState +} + +func (v PaginationValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 5) + + var val tftypes.Value + var err error + + attrTypes["page"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["size"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["sort"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["total_pages"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["total_rows"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 5) + + val, err = v.Page.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["page"] = val + + val, err = v.Size.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["size"] = val + + val, err = v.Sort.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["sort"] = val + + val, err = v.TotalPages.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_pages"] = val + + val, err = v.TotalRows.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_rows"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v PaginationValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v PaginationValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v PaginationValue) String() string { + return "PaginationValue" +} + +func (v PaginationValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "page": v.Page, + "size": v.Size, + "sort": v.Sort, + "total_pages": v.TotalPages, + "total_rows": v.TotalRows, + }) + + return objVal, diags +} + +func (v PaginationValue) Equal(o attr.Value) bool { + other, ok := o.(PaginationValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Page.Equal(other.Page) { + return false + } + + if !v.Size.Equal(other.Size) { + return false + } + + if !v.Sort.Equal(other.Sort) { + return false + } + + if !v.TotalPages.Equal(other.TotalPages) { + return false + } + + if !v.TotalRows.Equal(other.TotalRows) { + return false + } + + return true +} + +func (v PaginationValue) Type(ctx context.Context) attr.Type { + return PaginationType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v PaginationValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } +} diff --git a/stackit/internal/services/sqlserverflexalpha/flavor/functions.go b/stackit/internal/services/sqlserverflexalpha/flavor/functions.go index 822f5cfc..b5a7a521 100644 --- a/stackit/internal/services/sqlserverflexalpha/flavor/functions.go +++ b/stackit/internal/services/sqlserverflexalpha/flavor/functions.go @@ -4,201 +4,62 @@ import ( "context" "fmt" - sqlserverflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/sqlserverflexalpha" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/sqlserverflexalpha" ) -type flavorsClient interface { - GetFlavorsRequestExecute( +type flavorsClientReader interface { + GetFlavorsRequest( ctx context.Context, projectId, region string, - page, size *int64, - sort *sqlserverflex.FlavorSort, - ) (*sqlserverflex.GetFlavorsResponse, error) + ) sqlserverflexalpha.ApiGetFlavorsRequestRequest } -// func loadFlavorId(ctx context.Context, client flavorsClient, model *Model, flavor *flavorModel, storage *storageModel) error { -// if model == nil { -// return fmt.Errorf("nil model") -// } -// if flavor == nil { -// return fmt.Errorf("nil flavor") -// } -// cpu := flavor.CPU.ValueInt64() -// if cpu == 0 { -// return fmt.Errorf("nil CPU") -// } -// ram := flavor.RAM.ValueInt64() -// if ram == 0 { -// return fmt.Errorf("nil RAM") -// } -// -// nodeType := flavor.NodeType.ValueString() -// if nodeType == "" { -// if model.Replicas.IsNull() || model.Replicas.IsUnknown() { -// return fmt.Errorf("nil NodeType") -// } -// switch model.Replicas.ValueInt64() { -// case 1: -// nodeType = "Single" -// case 3: -// nodeType = "Replica" -// default: -// return fmt.Errorf("unknown Replicas value: %d", model.Replicas.ValueInt64()) -// } -// } -// -// storageClass := conversion.StringValueToPointer(storage.Class) -// if storageClass == nil { -// return fmt.Errorf("nil StorageClass") -// } -// storageSize := conversion.Int64ValueToPointer(storage.Size) -// if storageSize == nil { -// return fmt.Errorf("nil StorageSize") -// } -// -// projectId := model.ProjectId.ValueString() -// region := model.Region.ValueString() -// -// flavorList, err := getAllFlavors(ctx, client, projectId, region) -// if err != nil { -// return err -// } -// -// avl := "" -// foundFlavorCount := 0 -// var foundFlavors []string -// for _, f := range flavorList { -// if f.Id == nil || f.Cpu == nil || f.Memory == nil { -// continue -// } -// if !strings.EqualFold(*f.NodeType, nodeType) { -// continue -// } -// if *f.Cpu == cpu && *f.Memory == ram { -// var useSc *sqlserverflex.FlavorStorageClassesStorageClass -// for _, sc := range *f.StorageClasses { -// if *sc.Class != *storageClass { -// continue -// } -// if *storageSize < *f.MinGB || *storageSize > *f.MaxGB { -// return fmt.Errorf("storage size %d out of bounds (min: %d - max: %d)", *storageSize, *f.MinGB, *f.MaxGB) -// } -// useSc = &sc -// } -// if useSc == nil { -// return fmt.Errorf("no storage class found for %s", *storageClass) -// } -// -// flavor.Id = types.StringValue(*f.Id) -// flavor.Description = types.StringValue(*f.Description) -// foundFlavors = append(foundFlavors, fmt.Sprintf("%s (%d/%d - %s)", *f.Id, *f.Cpu, *f.Memory, *f.NodeType)) -// foundFlavorCount++ -// } -// for _, cls := range *f.StorageClasses { -// avl = fmt.Sprintf("%s\n- %d CPU, %d GB RAM, storage %s (min: %d - max: %d)", avl, *f.Cpu, *f.Memory, *cls.Class, *f.MinGB, *f.MaxGB) -// } -// } -// if foundFlavorCount > 1 { -// return fmt.Errorf( -// "number of flavors returned: %d\nmultiple flavors found: %d flavors\n %s", -// len(flavorList), -// foundFlavorCount, -// strings.Join(foundFlavors, "\n "), -// ) -// } -// if flavor.Id.ValueString() == "" { -// return fmt.Errorf("couldn't find flavor, available specs are:%s", avl) -// } -// -// return nil -//} - -func getAllFlavors(ctx context.Context, client flavorsClient, projectId, region string) ( - []sqlserverflex.ListFlavors, +func getAllFlavors(ctx context.Context, client flavorsClientReader, projectId, region string) ( + []sqlserverflexalpha.ListFlavors, error, ) { - if projectId == "" || region == "" { - return nil, fmt.Errorf("listing sqlserverflex flavors: projectId and region are required") - } - var flavorList []sqlserverflex.ListFlavors - - page := int64(1) - size := int64(10) - sort := sqlserverflex.FLAVORSORT_INDEX_ASC - counter := 0 - for { - res, err := client.GetFlavorsRequestExecute(ctx, projectId, region, &page, &size, &sort) - if err != nil { - return nil, fmt.Errorf("listing sqlserverflex flavors: %w", err) - } - if res.Flavors == nil { - return nil, fmt.Errorf("finding flavors for project %s", projectId) - } - pagination := res.GetPagination() - flavors := res.GetFlavors() - flavorList = append(flavorList, flavors...) - - if *pagination.TotalRows < int64(len(flavorList)) { - return nil, fmt.Errorf("total rows is smaller than current accumulated list - that should not happen") - } - if *pagination.TotalRows == int64(len(flavorList)) { - break - } - page++ - - if page > *pagination.TotalPages { - break - } - - // implement a breakpoint - counter++ - if counter > 1000 { - panic("too many pagination results") - } + getAllFilter := func(_ sqlserverflexalpha.ListFlavors) bool { return true } + flavorList, err := getFlavorsByFilter(ctx, client, projectId, region, getAllFilter) + if err != nil { + return nil, err } return flavorList, nil } -// func getFlavorModelById(ctx context.Context, client flavorsClient, model *Model, flavor *flavorModel) error { -// if model == nil { -// return fmt.Errorf("nil model") -// } -// if flavor == nil { -// return fmt.Errorf("nil flavor") -// } -// id := conversion.StringValueToPointer(flavor.Id) -// if id == nil { -// return fmt.Errorf("nil flavor ID") -// } -// -// flavor.Id = types.StringValue("") -// -// projectId := model.ProjectId.ValueString() -// region := model.Region.ValueString() -// -// flavorList, err := getAllFlavors(ctx, client, projectId, region) -// if err != nil { -// return err -// } -// -// avl := "" -// for _, f := range flavorList { -// if f.Id == nil || f.Cpu == nil || f.Memory == nil { -// continue -// } -// if *f.Id == *id { -// flavor.Id = types.StringValue(*f.Id) -// flavor.Description = types.StringValue(*f.Description) -// flavor.CPU = types.Int64Value(*f.Cpu) -// flavor.RAM = types.Int64Value(*f.Memory) -// flavor.NodeType = types.StringValue(*f.NodeType) -// break -// } -// avl = fmt.Sprintf("%s\n- %d CPU, %d GB RAM", avl, *f.Cpu, *f.Memory) -// } -// if flavor.Id.ValueString() == "" { -// return fmt.Errorf("couldn't find flavor, available specs are: %s", avl) -// } -// -// return nil -//} +// getFlavorsByFilter is a helper function to retrieve flavors using a filtern function. +// Hint: The API does not have a GetFlavors endpoint, only ListFlavors +func getFlavorsByFilter( + ctx context.Context, + client flavorsClientReader, + projectId, region string, + filter func(db sqlserverflexalpha.ListFlavors) bool, +) ([]sqlserverflexalpha.ListFlavors, error) { + if projectId == "" || region == "" { + return nil, fmt.Errorf("listing sqlserverflexalpha flavors: projectId and region are required") + } + + const pageSize = 25 + + var result = make([]sqlserverflexalpha.ListFlavors, 0) + + for page := int64(1); ; page++ { + res, err := client.GetFlavorsRequest(ctx, projectId, region). + Page(page).Size(pageSize).Sort(sqlserverflexalpha.FLAVORSORT_INDEX_ASC).Execute() + if err != nil { + return nil, fmt.Errorf("requesting flavors list (page %d): %w", page, err) + } + + // If the API returns no flavors, we have reached the end of the list. + if res.Flavors == nil || len(*res.Flavors) == 0 { + break + } + + for _, flavor := range *res.Flavors { + if filter(flavor) { + result = append(result, flavor) + } + } + } + + return result, nil +} diff --git a/stackit/internal/services/sqlserverflexalpha/flavor/functions_test.go b/stackit/internal/services/sqlserverflexalpha/flavor/functions_test.go new file mode 100644 index 00000000..487d8a75 --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/flavor/functions_test.go @@ -0,0 +1,134 @@ +package sqlserverFlexAlphaFlavor + +import ( + "context" + "testing" + + "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/sqlserverflexalpha" + "github.com/stackitcloud/stackit-sdk-go/core/utils" +) + +type mockRequest struct { + executeFunc func() (*sqlserverflexalpha.GetFlavorsResponse, error) +} + +func (m *mockRequest) Page(_ int64) sqlserverflexalpha.ApiGetFlavorsRequestRequest { return m } +func (m *mockRequest) Size(_ int64) sqlserverflexalpha.ApiGetFlavorsRequestRequest { return m } +func (m *mockRequest) Sort(_ sqlserverflexalpha.FlavorSort) sqlserverflexalpha.ApiGetFlavorsRequestRequest { + return m +} +func (m *mockRequest) Execute() (*sqlserverflexalpha.GetFlavorsResponse, error) { + return m.executeFunc() +} + +type mockFlavorsClient struct { + executeRequest func() sqlserverflexalpha.ApiGetFlavorsRequestRequest +} + +func (m *mockFlavorsClient) GetFlavorsRequest(_ context.Context, _, _ string) sqlserverflexalpha.ApiGetFlavorsRequestRequest { + return m.executeRequest() +} + +var mockResp = func(page int64) (*sqlserverflexalpha.GetFlavorsResponse, error) { + if page == 1 { + return &sqlserverflexalpha.GetFlavorsResponse{ + Flavors: &[]sqlserverflexalpha.ListFlavors{ + {Id: utils.Ptr("flavor-1"), Description: utils.Ptr("first")}, + {Id: utils.Ptr("flavor-2"), Description: utils.Ptr("second")}, + }, + }, nil + } + if page == 2 { + return &sqlserverflexalpha.GetFlavorsResponse{ + Flavors: &[]sqlserverflexalpha.ListFlavors{ + {Id: utils.Ptr("flavor-3"), Description: utils.Ptr("three")}, + }, + }, nil + } + + return &sqlserverflexalpha.GetFlavorsResponse{ + Flavors: &[]sqlserverflexalpha.ListFlavors{}, + }, nil +} + +func TestGetFlavorsByFilter(t *testing.T) { + tests := []struct { + description string + projectId string + region string + mockErr error + filter func(sqlserverflexalpha.ListFlavors) bool + wantCount int + wantErr bool + }{ + { + description: "Success - Get all flavors (2 pages)", + projectId: "pid", region: "reg", + filter: func(_ sqlserverflexalpha.ListFlavors) bool { return true }, + wantCount: 3, + wantErr: false, + }, + { + description: "Success - Filter flavors by description", + projectId: "pid", region: "reg", + filter: func(f sqlserverflexalpha.ListFlavors) bool { return *f.Description == "first" }, + wantCount: 1, + wantErr: false, + }, + { + description: "Error - Missing parameters", + projectId: "", region: "reg", + wantErr: true, + }, + } + + for _, tt := range tests { + t.Run( + tt.description, func(t *testing.T) { + var currentPage int64 + client := &mockFlavorsClient{ + executeRequest: func() sqlserverflexalpha.ApiGetFlavorsRequestRequest { + return &mockRequest{ + executeFunc: func() (*sqlserverflexalpha.GetFlavorsResponse, error) { + currentPage++ + return mockResp(currentPage) + }, + } + }, + } + actual, err := getFlavorsByFilter(context.Background(), client, tt.projectId, tt.region, tt.filter) + + if (err != nil) != tt.wantErr { + t.Errorf("getFlavorsByFilter() error = %v, wantErr %v", err, tt.wantErr) + return + } + + if !tt.wantErr && len(actual) != tt.wantCount { + t.Errorf("getFlavorsByFilter() got %d flavors, want %d", len(actual), tt.wantCount) + } + }, + ) + } +} + +func TestGetAllFlavors(t *testing.T) { + var currentPage int64 + client := &mockFlavorsClient{ + executeRequest: func() sqlserverflexalpha.ApiGetFlavorsRequestRequest { + return &mockRequest{ + executeFunc: func() (*sqlserverflexalpha.GetFlavorsResponse, error) { + currentPage++ + return mockResp(currentPage) + }, + } + }, + } + + res, err := getAllFlavors(context.Background(), client, "pid", "reg") + if err != nil { + t.Errorf("getAllFlavors() unexpected error: %v", err) + } + if len(res) != 3 { + t.Errorf("getAllFlavors() expected 3 flavor, got %d", len(res)) + } +} diff --git a/stackit/internal/services/sqlserverflexalpha/flavor/list_datasource.go.bak b/stackit/internal/services/sqlserverflexalpha/flavor/list_datasource.go.bak deleted file mode 100644 index 9c035504..00000000 --- a/stackit/internal/services/sqlserverflexalpha/flavor/list_datasource.go.bak +++ /dev/null @@ -1,79 +0,0 @@ -package postgresFlexAlphaFlavor - -import ( - "context" - - "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/postgresflexalpha" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha" - postgresflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/utils" - - "github.com/hashicorp/terraform-plugin-framework/datasource" - "github.com/hashicorp/terraform-plugin-log/tflog" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" -) - -// Ensure the implementation satisfies the expected interfaces. -var ( - _ datasource.DataSource = &flavorListDataSource{} -) - -// NewFlavorListDataSource is a helper function to simplify the provider implementation. -func NewFlavorListDataSource() datasource.DataSource { - return &flavorListDataSource{} -} - -// flavorDataSource is the data source implementation. -type flavorListDataSource struct { - client *postgresflexalpha.APIClient - providerData core.ProviderData -} - -// Metadata returns the data source type name. -func (r *flavorListDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - resp.TypeName = req.ProviderTypeName + "_postgresflexalpha_flavorlist" -} - -// Configure adds the provider configured client to the data source. -func (r *flavorListDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - var ok bool - r.providerData, ok = conversion.ParseProviderData(ctx, req.ProviderData, &resp.Diagnostics) - if !ok { - return - } - - apiClient := postgresflexUtils.ConfigureClient(ctx, &r.providerData, &resp.Diagnostics) - if resp.Diagnostics.HasError() { - return - } - r.client = apiClient - tflog.Info(ctx, "Postgres Flex flavors client configured") -} - -func (r *flavorListDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { - resp.Schema = postgresflex.FlavorDataSourceSchema(ctx) -} - -func (r *flavorListDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - var model postgresflex.FlavorModel - diags := req.Config.Get(ctx, &model) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - - ctx = core.InitProviderContext(ctx) - - projectId := model.ProjectId.ValueString() - region := r.providerData.GetRegionWithOverride(model.Region) - ctx = tflog.SetField(ctx, "project_id", projectId) - ctx = tflog.SetField(ctx, "region", region) - - // Set refreshed state - diags = resp.State.Set(ctx, model) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { - return - } - tflog.Info(ctx, "Postgres Flex flavors read") -} diff --git a/stackit/internal/services/sqlserverflexalpha/flavors/datasource.go b/stackit/internal/services/sqlserverflexalpha/flavors/datasource.go new file mode 100644 index 00000000..a1beedd8 --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/flavors/datasource.go @@ -0,0 +1,68 @@ +package sqlserverflexalpha + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/sqlserverflexalpha" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" + sqlserverflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/utils" + + sqlserverflexalphaGen "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/flavors/datasources_gen" +) + +var _ datasource.DataSource = (*flavorsDataSource)(nil) + +func NewFlavorsDataSource() datasource.DataSource { + return &flavorsDataSource{} +} + +type flavorsDataSource struct { + client *sqlserverflexalpha.APIClient + providerData core.ProviderData +} + +func (d *flavorsDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_sqlserverflexalpha_flavors" +} + +func (d *flavorsDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = sqlserverflexalphaGen.FlavorsDataSourceSchema(ctx) +} + +// Configure adds the provider configured client to the data source. +func (d *flavorsDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + var ok bool + d.providerData, ok = conversion.ParseProviderData(ctx, req.ProviderData, &resp.Diagnostics) + if !ok { + return + } + + apiClient := sqlserverflexUtils.ConfigureClient(ctx, &d.providerData, &resp.Diagnostics) + if resp.Diagnostics.HasError() { + return + } + d.client = apiClient + tflog.Info(ctx, "SQL SERVER Flex flavors client configured") +} + +func (d *flavorsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + var data sqlserverflexalphaGen.FlavorsModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Read API call logic + + // Example data value setting + // data.Id = types.StringValue("example-id") + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} diff --git a/stackit/internal/services/sqlserverflexalpha/flavors/datasources_gen/flavors_data_source_gen.go b/stackit/internal/services/sqlserverflexalpha/flavors/datasources_gen/flavors_data_source_gen.go new file mode 100644 index 00000000..43ac64f5 --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/flavors/datasources_gen/flavors_data_source_gen.go @@ -0,0 +1,1909 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func FlavorsDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "flavors": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "cpu": schema.Int64Attribute{ + Computed: true, + Description: "The cpu count of the instance.", + MarkdownDescription: "The cpu count of the instance.", + }, + "description": schema.StringAttribute{ + Computed: true, + Description: "The flavor description.", + MarkdownDescription: "The flavor description.", + }, + "id": schema.StringAttribute{ + Computed: true, + Description: "The id of the instance flavor.", + MarkdownDescription: "The id of the instance flavor.", + }, + "max_gb": schema.Int64Attribute{ + Computed: true, + Description: "maximum storage which can be ordered for the flavor in Gigabyte.", + MarkdownDescription: "maximum storage which can be ordered for the flavor in Gigabyte.", + }, + "memory": schema.Int64Attribute{ + Computed: true, + Description: "The memory of the instance in Gibibyte.", + MarkdownDescription: "The memory of the instance in Gibibyte.", + }, + "min_gb": schema.Int64Attribute{ + Computed: true, + Description: "minimum storage which is required to order in Gigabyte.", + MarkdownDescription: "minimum storage which is required to order in Gigabyte.", + }, + "node_type": schema.StringAttribute{ + Computed: true, + Description: "defines the nodeType it can be either single or HA", + MarkdownDescription: "defines the nodeType it can be either single or HA", + }, + "storage_classes": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "class": schema.StringAttribute{ + Computed: true, + }, + "max_io_per_sec": schema.Int64Attribute{ + Computed: true, + }, + "max_through_in_mb": schema.Int64Attribute{ + Computed: true, + }, + }, + CustomType: StorageClassesType{ + ObjectType: types.ObjectType{ + AttrTypes: StorageClassesValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "maximum storage which can be ordered for the flavor in Gigabyte.", + MarkdownDescription: "maximum storage which can be ordered for the flavor in Gigabyte.", + }, + }, + CustomType: FlavorsType{ + ObjectType: types.ObjectType{ + AttrTypes: FlavorsValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "List of flavors available for the project.", + MarkdownDescription: "List of flavors available for the project.", + }, + "page": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of the page of items list to be returned.", + MarkdownDescription: "Number of the page of items list to be returned.", + }, + "pagination": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "page": schema.Int64Attribute{ + Computed: true, + }, + "size": schema.Int64Attribute{ + Computed: true, + }, + "sort": schema.StringAttribute{ + Computed: true, + }, + "total_pages": schema.Int64Attribute{ + Computed: true, + }, + "total_rows": schema.Int64Attribute{ + Computed: true, + }, + }, + CustomType: PaginationType{ + ObjectType: types.ObjectType{ + AttrTypes: PaginationValue{}.AttributeTypes(ctx), + }, + }, + Computed: true, + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "size": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of items to be returned on each page.", + MarkdownDescription: "Number of items to be returned on each page.", + }, + "sort": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "Sorting of the flavors to be returned on each page.", + MarkdownDescription: "Sorting of the flavors to be returned on each page.", + Validators: []validator.String{ + stringvalidator.OneOf( + "index.desc", + "index.asc", + "cpu.desc", + "cpu.asc", + "flavor_description.asc", + "flavor_description.desc", + "id.desc", + "id.asc", + "size_max.desc", + "size_max.asc", + "ram.desc", + "ram.asc", + "size_min.desc", + "size_min.asc", + "storage_class.asc", + "storage_class.desc", + "node_type.asc", + "node_type.desc", + ), + }, + }, + }, + } +} + +type FlavorsModel struct { + Flavors types.List `tfsdk:"flavors"` + Page types.Int64 `tfsdk:"page"` + Pagination PaginationValue `tfsdk:"pagination"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Size types.Int64 `tfsdk:"size"` + Sort types.String `tfsdk:"sort"` +} + +var _ basetypes.ObjectTypable = FlavorsType{} + +type FlavorsType struct { + basetypes.ObjectType +} + +func (t FlavorsType) Equal(o attr.Type) bool { + other, ok := o.(FlavorsType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t FlavorsType) String() string { + return "FlavorsType" +} + +func (t FlavorsType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + cpuAttribute, ok := attributes["cpu"] + + if !ok { + diags.AddError( + "Attribute Missing", + `cpu is missing from object`) + + return nil, diags + } + + cpuVal, ok := cpuAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`cpu expected to be basetypes.Int64Value, was: %T`, cpuAttribute)) + } + + descriptionAttribute, ok := attributes["description"] + + if !ok { + diags.AddError( + "Attribute Missing", + `description is missing from object`) + + return nil, diags + } + + descriptionVal, ok := descriptionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute)) + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return nil, diags + } + + idVal, ok := idAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.StringValue, was: %T`, idAttribute)) + } + + maxGbAttribute, ok := attributes["max_gb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_gb is missing from object`) + + return nil, diags + } + + maxGbVal, ok := maxGbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_gb expected to be basetypes.Int64Value, was: %T`, maxGbAttribute)) + } + + memoryAttribute, ok := attributes["memory"] + + if !ok { + diags.AddError( + "Attribute Missing", + `memory is missing from object`) + + return nil, diags + } + + memoryVal, ok := memoryAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`memory expected to be basetypes.Int64Value, was: %T`, memoryAttribute)) + } + + minGbAttribute, ok := attributes["min_gb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `min_gb is missing from object`) + + return nil, diags + } + + minGbVal, ok := minGbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`min_gb expected to be basetypes.Int64Value, was: %T`, minGbAttribute)) + } + + nodeTypeAttribute, ok := attributes["node_type"] + + if !ok { + diags.AddError( + "Attribute Missing", + `node_type is missing from object`) + + return nil, diags + } + + nodeTypeVal, ok := nodeTypeAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`node_type expected to be basetypes.StringValue, was: %T`, nodeTypeAttribute)) + } + + storageClassesAttribute, ok := attributes["storage_classes"] + + if !ok { + diags.AddError( + "Attribute Missing", + `storage_classes is missing from object`) + + return nil, diags + } + + storageClassesVal, ok := storageClassesAttribute.(basetypes.ListValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`storage_classes expected to be basetypes.ListValue, was: %T`, storageClassesAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return FlavorsValue{ + Cpu: cpuVal, + Description: descriptionVal, + Id: idVal, + MaxGb: maxGbVal, + Memory: memoryVal, + MinGb: minGbVal, + NodeType: nodeTypeVal, + StorageClasses: storageClassesVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewFlavorsValueNull() FlavorsValue { + return FlavorsValue{ + state: attr.ValueStateNull, + } +} + +func NewFlavorsValueUnknown() FlavorsValue { + return FlavorsValue{ + state: attr.ValueStateUnknown, + } +} + +func NewFlavorsValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (FlavorsValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing FlavorsValue Attribute Value", + "While creating a FlavorsValue value, a missing attribute value was detected. "+ + "A FlavorsValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("FlavorsValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid FlavorsValue Attribute Type", + "While creating a FlavorsValue value, an invalid attribute value was detected. "+ + "A FlavorsValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("FlavorsValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("FlavorsValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra FlavorsValue Attribute Value", + "While creating a FlavorsValue value, an extra attribute value was detected. "+ + "A FlavorsValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra FlavorsValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewFlavorsValueUnknown(), diags + } + + cpuAttribute, ok := attributes["cpu"] + + if !ok { + diags.AddError( + "Attribute Missing", + `cpu is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + cpuVal, ok := cpuAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`cpu expected to be basetypes.Int64Value, was: %T`, cpuAttribute)) + } + + descriptionAttribute, ok := attributes["description"] + + if !ok { + diags.AddError( + "Attribute Missing", + `description is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + descriptionVal, ok := descriptionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`description expected to be basetypes.StringValue, was: %T`, descriptionAttribute)) + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + idVal, ok := idAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.StringValue, was: %T`, idAttribute)) + } + + maxGbAttribute, ok := attributes["max_gb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_gb is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + maxGbVal, ok := maxGbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_gb expected to be basetypes.Int64Value, was: %T`, maxGbAttribute)) + } + + memoryAttribute, ok := attributes["memory"] + + if !ok { + diags.AddError( + "Attribute Missing", + `memory is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + memoryVal, ok := memoryAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`memory expected to be basetypes.Int64Value, was: %T`, memoryAttribute)) + } + + minGbAttribute, ok := attributes["min_gb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `min_gb is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + minGbVal, ok := minGbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`min_gb expected to be basetypes.Int64Value, was: %T`, minGbAttribute)) + } + + nodeTypeAttribute, ok := attributes["node_type"] + + if !ok { + diags.AddError( + "Attribute Missing", + `node_type is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + nodeTypeVal, ok := nodeTypeAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`node_type expected to be basetypes.StringValue, was: %T`, nodeTypeAttribute)) + } + + storageClassesAttribute, ok := attributes["storage_classes"] + + if !ok { + diags.AddError( + "Attribute Missing", + `storage_classes is missing from object`) + + return NewFlavorsValueUnknown(), diags + } + + storageClassesVal, ok := storageClassesAttribute.(basetypes.ListValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`storage_classes expected to be basetypes.ListValue, was: %T`, storageClassesAttribute)) + } + + if diags.HasError() { + return NewFlavorsValueUnknown(), diags + } + + return FlavorsValue{ + Cpu: cpuVal, + Description: descriptionVal, + Id: idVal, + MaxGb: maxGbVal, + Memory: memoryVal, + MinGb: minGbVal, + NodeType: nodeTypeVal, + StorageClasses: storageClassesVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewFlavorsValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) FlavorsValue { + object, diags := NewFlavorsValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewFlavorsValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t FlavorsType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewFlavorsValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewFlavorsValueUnknown(), nil + } + + if in.IsNull() { + return NewFlavorsValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewFlavorsValueMust(FlavorsValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t FlavorsType) ValueType(ctx context.Context) attr.Value { + return FlavorsValue{} +} + +var _ basetypes.ObjectValuable = FlavorsValue{} + +type FlavorsValue struct { + Cpu basetypes.Int64Value `tfsdk:"cpu"` + Description basetypes.StringValue `tfsdk:"description"` + Id basetypes.StringValue `tfsdk:"id"` + MaxGb basetypes.Int64Value `tfsdk:"max_gb"` + Memory basetypes.Int64Value `tfsdk:"memory"` + MinGb basetypes.Int64Value `tfsdk:"min_gb"` + NodeType basetypes.StringValue `tfsdk:"node_type"` + StorageClasses basetypes.ListValue `tfsdk:"storage_classes"` + state attr.ValueState +} + +func (v FlavorsValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 8) + + var val tftypes.Value + var err error + + attrTypes["cpu"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["description"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["id"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["max_gb"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["memory"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["min_gb"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["node_type"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["storage_classes"] = basetypes.ListType{ + ElemType: StorageClassesValue{}.Type(ctx), + }.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 8) + + val, err = v.Cpu.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["cpu"] = val + + val, err = v.Description.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["description"] = val + + val, err = v.Id.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["id"] = val + + val, err = v.MaxGb.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["max_gb"] = val + + val, err = v.Memory.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["memory"] = val + + val, err = v.MinGb.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["min_gb"] = val + + val, err = v.NodeType.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["node_type"] = val + + val, err = v.StorageClasses.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["storage_classes"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v FlavorsValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v FlavorsValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v FlavorsValue) String() string { + return "FlavorsValue" +} + +func (v FlavorsValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + storageClasses := types.ListValueMust( + StorageClassesType{ + basetypes.ObjectType{ + AttrTypes: StorageClassesValue{}.AttributeTypes(ctx), + }, + }, + v.StorageClasses.Elements(), + ) + + if v.StorageClasses.IsNull() { + storageClasses = types.ListNull( + StorageClassesType{ + basetypes.ObjectType{ + AttrTypes: StorageClassesValue{}.AttributeTypes(ctx), + }, + }, + ) + } + + if v.StorageClasses.IsUnknown() { + storageClasses = types.ListUnknown( + StorageClassesType{ + basetypes.ObjectType{ + AttrTypes: StorageClassesValue{}.AttributeTypes(ctx), + }, + }, + ) + } + + attributeTypes := map[string]attr.Type{ + "cpu": basetypes.Int64Type{}, + "description": basetypes.StringType{}, + "id": basetypes.StringType{}, + "max_gb": basetypes.Int64Type{}, + "memory": basetypes.Int64Type{}, + "min_gb": basetypes.Int64Type{}, + "node_type": basetypes.StringType{}, + "storage_classes": basetypes.ListType{ + ElemType: StorageClassesValue{}.Type(ctx), + }, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "cpu": v.Cpu, + "description": v.Description, + "id": v.Id, + "max_gb": v.MaxGb, + "memory": v.Memory, + "min_gb": v.MinGb, + "node_type": v.NodeType, + "storage_classes": storageClasses, + }) + + return objVal, diags +} + +func (v FlavorsValue) Equal(o attr.Value) bool { + other, ok := o.(FlavorsValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Cpu.Equal(other.Cpu) { + return false + } + + if !v.Description.Equal(other.Description) { + return false + } + + if !v.Id.Equal(other.Id) { + return false + } + + if !v.MaxGb.Equal(other.MaxGb) { + return false + } + + if !v.Memory.Equal(other.Memory) { + return false + } + + if !v.MinGb.Equal(other.MinGb) { + return false + } + + if !v.NodeType.Equal(other.NodeType) { + return false + } + + if !v.StorageClasses.Equal(other.StorageClasses) { + return false + } + + return true +} + +func (v FlavorsValue) Type(ctx context.Context) attr.Type { + return FlavorsType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v FlavorsValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "cpu": basetypes.Int64Type{}, + "description": basetypes.StringType{}, + "id": basetypes.StringType{}, + "max_gb": basetypes.Int64Type{}, + "memory": basetypes.Int64Type{}, + "min_gb": basetypes.Int64Type{}, + "node_type": basetypes.StringType{}, + "storage_classes": basetypes.ListType{ + ElemType: StorageClassesValue{}.Type(ctx), + }, + } +} + +var _ basetypes.ObjectTypable = StorageClassesType{} + +type StorageClassesType struct { + basetypes.ObjectType +} + +func (t StorageClassesType) Equal(o attr.Type) bool { + other, ok := o.(StorageClassesType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t StorageClassesType) String() string { + return "StorageClassesType" +} + +func (t StorageClassesType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + classAttribute, ok := attributes["class"] + + if !ok { + diags.AddError( + "Attribute Missing", + `class is missing from object`) + + return nil, diags + } + + classVal, ok := classAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`class expected to be basetypes.StringValue, was: %T`, classAttribute)) + } + + maxIoPerSecAttribute, ok := attributes["max_io_per_sec"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_io_per_sec is missing from object`) + + return nil, diags + } + + maxIoPerSecVal, ok := maxIoPerSecAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_io_per_sec expected to be basetypes.Int64Value, was: %T`, maxIoPerSecAttribute)) + } + + maxThroughInMbAttribute, ok := attributes["max_through_in_mb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_through_in_mb is missing from object`) + + return nil, diags + } + + maxThroughInMbVal, ok := maxThroughInMbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_through_in_mb expected to be basetypes.Int64Value, was: %T`, maxThroughInMbAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return StorageClassesValue{ + Class: classVal, + MaxIoPerSec: maxIoPerSecVal, + MaxThroughInMb: maxThroughInMbVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewStorageClassesValueNull() StorageClassesValue { + return StorageClassesValue{ + state: attr.ValueStateNull, + } +} + +func NewStorageClassesValueUnknown() StorageClassesValue { + return StorageClassesValue{ + state: attr.ValueStateUnknown, + } +} + +func NewStorageClassesValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (StorageClassesValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing StorageClassesValue Attribute Value", + "While creating a StorageClassesValue value, a missing attribute value was detected. "+ + "A StorageClassesValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("StorageClassesValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid StorageClassesValue Attribute Type", + "While creating a StorageClassesValue value, an invalid attribute value was detected. "+ + "A StorageClassesValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("StorageClassesValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("StorageClassesValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra StorageClassesValue Attribute Value", + "While creating a StorageClassesValue value, an extra attribute value was detected. "+ + "A StorageClassesValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra StorageClassesValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewStorageClassesValueUnknown(), diags + } + + classAttribute, ok := attributes["class"] + + if !ok { + diags.AddError( + "Attribute Missing", + `class is missing from object`) + + return NewStorageClassesValueUnknown(), diags + } + + classVal, ok := classAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`class expected to be basetypes.StringValue, was: %T`, classAttribute)) + } + + maxIoPerSecAttribute, ok := attributes["max_io_per_sec"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_io_per_sec is missing from object`) + + return NewStorageClassesValueUnknown(), diags + } + + maxIoPerSecVal, ok := maxIoPerSecAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_io_per_sec expected to be basetypes.Int64Value, was: %T`, maxIoPerSecAttribute)) + } + + maxThroughInMbAttribute, ok := attributes["max_through_in_mb"] + + if !ok { + diags.AddError( + "Attribute Missing", + `max_through_in_mb is missing from object`) + + return NewStorageClassesValueUnknown(), diags + } + + maxThroughInMbVal, ok := maxThroughInMbAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`max_through_in_mb expected to be basetypes.Int64Value, was: %T`, maxThroughInMbAttribute)) + } + + if diags.HasError() { + return NewStorageClassesValueUnknown(), diags + } + + return StorageClassesValue{ + Class: classVal, + MaxIoPerSec: maxIoPerSecVal, + MaxThroughInMb: maxThroughInMbVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewStorageClassesValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) StorageClassesValue { + object, diags := NewStorageClassesValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewStorageClassesValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t StorageClassesType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewStorageClassesValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewStorageClassesValueUnknown(), nil + } + + if in.IsNull() { + return NewStorageClassesValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewStorageClassesValueMust(StorageClassesValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t StorageClassesType) ValueType(ctx context.Context) attr.Value { + return StorageClassesValue{} +} + +var _ basetypes.ObjectValuable = StorageClassesValue{} + +type StorageClassesValue struct { + Class basetypes.StringValue `tfsdk:"class"` + MaxIoPerSec basetypes.Int64Value `tfsdk:"max_io_per_sec"` + MaxThroughInMb basetypes.Int64Value `tfsdk:"max_through_in_mb"` + state attr.ValueState +} + +func (v StorageClassesValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 3) + + var val tftypes.Value + var err error + + attrTypes["class"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["max_io_per_sec"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["max_through_in_mb"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 3) + + val, err = v.Class.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["class"] = val + + val, err = v.MaxIoPerSec.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["max_io_per_sec"] = val + + val, err = v.MaxThroughInMb.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["max_through_in_mb"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v StorageClassesValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v StorageClassesValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v StorageClassesValue) String() string { + return "StorageClassesValue" +} + +func (v StorageClassesValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "class": basetypes.StringType{}, + "max_io_per_sec": basetypes.Int64Type{}, + "max_through_in_mb": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "class": v.Class, + "max_io_per_sec": v.MaxIoPerSec, + "max_through_in_mb": v.MaxThroughInMb, + }) + + return objVal, diags +} + +func (v StorageClassesValue) Equal(o attr.Value) bool { + other, ok := o.(StorageClassesValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Class.Equal(other.Class) { + return false + } + + if !v.MaxIoPerSec.Equal(other.MaxIoPerSec) { + return false + } + + if !v.MaxThroughInMb.Equal(other.MaxThroughInMb) { + return false + } + + return true +} + +func (v StorageClassesValue) Type(ctx context.Context) attr.Type { + return StorageClassesType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v StorageClassesValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "class": basetypes.StringType{}, + "max_io_per_sec": basetypes.Int64Type{}, + "max_through_in_mb": basetypes.Int64Type{}, + } +} + +var _ basetypes.ObjectTypable = PaginationType{} + +type PaginationType struct { + basetypes.ObjectType +} + +func (t PaginationType) Equal(o attr.Type) bool { + other, ok := o.(PaginationType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t PaginationType) String() string { + return "PaginationType" +} + +func (t PaginationType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return nil, diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return nil, diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return nil, diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return nil, diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return nil, diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueNull() PaginationValue { + return PaginationValue{ + state: attr.ValueStateNull, + } +} + +func NewPaginationValueUnknown() PaginationValue { + return PaginationValue{ + state: attr.ValueStateUnknown, + } +} + +func NewPaginationValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (PaginationValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing PaginationValue Attribute Value", + "While creating a PaginationValue value, a missing attribute value was detected. "+ + "A PaginationValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid PaginationValue Attribute Type", + "While creating a PaginationValue value, an invalid attribute value was detected. "+ + "A PaginationValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra PaginationValue Attribute Value", + "While creating a PaginationValue value, an extra attribute value was detected. "+ + "A PaginationValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra PaginationValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) PaginationValue { + object, diags := NewPaginationValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewPaginationValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t PaginationType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewPaginationValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewPaginationValueUnknown(), nil + } + + if in.IsNull() { + return NewPaginationValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewPaginationValueMust(PaginationValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t PaginationType) ValueType(ctx context.Context) attr.Value { + return PaginationValue{} +} + +var _ basetypes.ObjectValuable = PaginationValue{} + +type PaginationValue struct { + Page basetypes.Int64Value `tfsdk:"page"` + Size basetypes.Int64Value `tfsdk:"size"` + Sort basetypes.StringValue `tfsdk:"sort"` + TotalPages basetypes.Int64Value `tfsdk:"total_pages"` + TotalRows basetypes.Int64Value `tfsdk:"total_rows"` + state attr.ValueState +} + +func (v PaginationValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 5) + + var val tftypes.Value + var err error + + attrTypes["page"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["size"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["sort"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["total_pages"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["total_rows"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 5) + + val, err = v.Page.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["page"] = val + + val, err = v.Size.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["size"] = val + + val, err = v.Sort.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["sort"] = val + + val, err = v.TotalPages.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_pages"] = val + + val, err = v.TotalRows.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_rows"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v PaginationValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v PaginationValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v PaginationValue) String() string { + return "PaginationValue" +} + +func (v PaginationValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "page": v.Page, + "size": v.Size, + "sort": v.Sort, + "total_pages": v.TotalPages, + "total_rows": v.TotalRows, + }) + + return objVal, diags +} + +func (v PaginationValue) Equal(o attr.Value) bool { + other, ok := o.(PaginationValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Page.Equal(other.Page) { + return false + } + + if !v.Size.Equal(other.Size) { + return false + } + + if !v.Sort.Equal(other.Sort) { + return false + } + + if !v.TotalPages.Equal(other.TotalPages) { + return false + } + + if !v.TotalRows.Equal(other.TotalRows) { + return false + } + + return true +} + +func (v PaginationValue) Type(ctx context.Context) attr.Type { + return PaginationType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v PaginationValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } +} diff --git a/stackit/internal/services/sqlserverflexalpha/instance/planModifiers.yaml b/stackit/internal/services/sqlserverflexalpha/instance/planModifiers.yaml new file mode 100644 index 00000000..2e72ba16 --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/instance/planModifiers.yaml @@ -0,0 +1,120 @@ +fields: + - name: 'id' + modifiers: + - 'UseStateForUnknown' + + - name: 'instance_id' + validators: + - validate.NoSeparator + - validate.UUID + modifiers: + - 'UseStateForUnknown' + + - name: 'project_id' + validators: + - validate.NoSeparator + - validate.UUID + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'name' + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'backup_schedule' + modifiers: + - 'UseStateForUnknown' + + - name: 'encryption.kek_key_id' + validators: + - validate.NoSeparator + modifiers: + - 'RequiresReplace' + + - name: 'encryption.kek_key_version' + validators: + - validate.NoSeparator + modifiers: + - 'RequiresReplace' + + - name: 'encryption.kek_key_ring_id' + validators: + - validate.NoSeparator + modifiers: + - 'RequiresReplace' + + - name: 'encryption.service_account' + validators: + - validate.NoSeparator + modifiers: + - 'RequiresReplace' + + - name: 'network.access_scope' + validators: + - validate.NoSeparator + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'network.acl' + modifiers: + - 'UseStateForUnknown' + + - name: 'network.instance_address' + modifiers: + - 'UseStateForUnknown' + + - name: 'network.router_address' + modifiers: + - 'UseStateForUnknown' + + - name: 'status' + modifiers: + - 'UseStateForUnknown' + + - name: 'region' + modifiers: + - 'RequiresReplace' + + - name: 'retention_days' + modifiers: + - 'UseStateForUnknown' + + - name: 'edition' + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'version' + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'replicas' + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'storage' + modifiers: + - 'UseStateForUnknown' + + - name: 'storage.class' + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'storage.size' + modifiers: + - 'UseStateForUnknown' + + - name: 'flavor_id' + modifiers: + - 'UseStateForUnknown' + - 'RequiresReplace' + + - name: 'is_deletable' + modifiers: + - 'UseStateForUnknown' diff --git a/stackit/internal/services/sqlserverflexalpha/instance/resource.go b/stackit/internal/services/sqlserverflexalpha/instance/resource.go index 3a7a8dc3..8569af36 100644 --- a/stackit/internal/services/sqlserverflexalpha/instance/resource.go +++ b/stackit/internal/services/sqlserverflexalpha/instance/resource.go @@ -33,7 +33,8 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/types" sqlserverflex "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/sqlserverflexalpha" - "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/sqlserverflexalpha/wait" + wait "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/wait/sqlserverflexalpha" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" ) @@ -338,7 +339,7 @@ func (r *instanceResource) Schema(_ context.Context, _ resource.SchemaRequest, r Description: descriptions["status"], }, "encryption": schema.SingleNestedAttribute{ - Required: true, + Optional: true, PlanModifiers: []planmodifier.Object{ objectplanmodifier.RequiresReplace(), objectplanmodifier.UseStateForUnknown(), diff --git a/stackit/internal/services/sqlserverflexalpha/instance/resources_gen/instance_resource_gen.go b/stackit/internal/services/sqlserverflexalpha/instance/resources_gen/instance_resource_gen.go new file mode 100644 index 00000000..73293905 --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/instance/resources_gen/instance_resource_gen.go @@ -0,0 +1,1457 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/resource/schema" +) + +func InstanceResourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "backup_schedule": schema.StringAttribute{ + Required: true, + Description: "The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.", + MarkdownDescription: "The schedule for on what time and how often the database backup will be created. The schedule is written as a cron schedule.", + }, + "encryption": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "kek_key_id": schema.StringAttribute{ + Optional: true, + Description: "The key identifier", + MarkdownDescription: "The key identifier", + }, + "kek_key_ring_id": schema.StringAttribute{ + Optional: true, + Description: "The keyring identifier", + MarkdownDescription: "The keyring identifier", + }, + "kek_key_version": schema.StringAttribute{ + Optional: true, + Description: "The key version", + MarkdownDescription: "The key version", + }, + "service_account": schema.StringAttribute{ + Optional: true, + }, + }, + CustomType: EncryptionType{ + ObjectType: types.ObjectType{ + AttrTypes: EncryptionValue{}.AttributeTypes(ctx), + }, + }, + Optional: true, + Computed: true, + Description: "this defines which key to use for storage encryption", + MarkdownDescription: "this defines which key to use for storage encryption", + }, + "flavor_id": schema.StringAttribute{ + Required: true, + Description: "The id of the instance flavor.", + MarkdownDescription: "The id of the instance flavor.", + }, + "id": schema.StringAttribute{ + Computed: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "instance_id": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "name": schema.StringAttribute{ + Required: true, + Description: "The name of the instance.", + MarkdownDescription: "The name of the instance.", + }, + "network": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "access_scope": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The network access scope of the instance\n\n⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected.\n", + MarkdownDescription: "The network access scope of the instance\n\n⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected.\n", + Validators: []validator.String{ + stringvalidator.OneOf( + "PUBLIC", + "SNA", + ), + }, + Default: stringdefault.StaticString("PUBLIC"), + }, + "acl": schema.ListAttribute{ + ElementType: types.StringType, + Required: true, + Description: "List of IPV4 cidr.", + MarkdownDescription: "List of IPV4 cidr.", + }, + }, + CustomType: NetworkType{ + ObjectType: types.ObjectType{ + AttrTypes: NetworkValue{}.AttributeTypes(ctx), + }, + }, + Required: true, + Description: "the network configuration of the instance.", + MarkdownDescription: "the network configuration of the instance.", + }, + "project_id": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "retention_days": schema.Int64Attribute{ + Required: true, + Description: "The days for how long the backup files should be stored before cleaned up. 30 to 365", + MarkdownDescription: "The days for how long the backup files should be stored before cleaned up. 30 to 365", + }, + "storage": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "class": schema.StringAttribute{ + Required: true, + Description: "The storage class for the storage.", + MarkdownDescription: "The storage class for the storage.", + }, + "size": schema.Int64Attribute{ + Required: true, + Description: "The storage size in Gigabytes.", + MarkdownDescription: "The storage size in Gigabytes.", + }, + }, + CustomType: StorageType{ + ObjectType: types.ObjectType{ + AttrTypes: StorageValue{}.AttributeTypes(ctx), + }, + }, + Required: true, + Description: "The object containing information about the storage size and class.", + MarkdownDescription: "The object containing information about the storage size and class.", + }, + "version": schema.StringAttribute{ + Required: true, + Description: "The sqlserver version used for the instance.", + MarkdownDescription: "The sqlserver version used for the instance.", + Validators: []validator.String{ + stringvalidator.OneOf( + "2022", + ), + }, + }, + }, + } +} + +type InstanceModel struct { + BackupSchedule types.String `tfsdk:"backup_schedule"` + Encryption EncryptionValue `tfsdk:"encryption"` + FlavorId types.String `tfsdk:"flavor_id"` + Id types.String `tfsdk:"id"` + InstanceId types.String `tfsdk:"instance_id"` + Name types.String `tfsdk:"name"` + Network NetworkValue `tfsdk:"network"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + RetentionDays types.Int64 `tfsdk:"retention_days"` + Storage StorageValue `tfsdk:"storage"` + Version types.String `tfsdk:"version"` +} + +var _ basetypes.ObjectTypable = EncryptionType{} + +type EncryptionType struct { + basetypes.ObjectType +} + +func (t EncryptionType) Equal(o attr.Type) bool { + other, ok := o.(EncryptionType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t EncryptionType) String() string { + return "EncryptionType" +} + +func (t EncryptionType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + kekKeyIdAttribute, ok := attributes["kek_key_id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_id is missing from object`) + + return nil, diags + } + + kekKeyIdVal, ok := kekKeyIdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_id expected to be basetypes.StringValue, was: %T`, kekKeyIdAttribute)) + } + + kekKeyRingIdAttribute, ok := attributes["kek_key_ring_id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_ring_id is missing from object`) + + return nil, diags + } + + kekKeyRingIdVal, ok := kekKeyRingIdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_ring_id expected to be basetypes.StringValue, was: %T`, kekKeyRingIdAttribute)) + } + + kekKeyVersionAttribute, ok := attributes["kek_key_version"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_version is missing from object`) + + return nil, diags + } + + kekKeyVersionVal, ok := kekKeyVersionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_version expected to be basetypes.StringValue, was: %T`, kekKeyVersionAttribute)) + } + + serviceAccountAttribute, ok := attributes["service_account"] + + if !ok { + diags.AddError( + "Attribute Missing", + `service_account is missing from object`) + + return nil, diags + } + + serviceAccountVal, ok := serviceAccountAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`service_account expected to be basetypes.StringValue, was: %T`, serviceAccountAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return EncryptionValue{ + KekKeyId: kekKeyIdVal, + KekKeyRingId: kekKeyRingIdVal, + KekKeyVersion: kekKeyVersionVal, + ServiceAccount: serviceAccountVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewEncryptionValueNull() EncryptionValue { + return EncryptionValue{ + state: attr.ValueStateNull, + } +} + +func NewEncryptionValueUnknown() EncryptionValue { + return EncryptionValue{ + state: attr.ValueStateUnknown, + } +} + +func NewEncryptionValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (EncryptionValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing EncryptionValue Attribute Value", + "While creating a EncryptionValue value, a missing attribute value was detected. "+ + "A EncryptionValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("EncryptionValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid EncryptionValue Attribute Type", + "While creating a EncryptionValue value, an invalid attribute value was detected. "+ + "A EncryptionValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("EncryptionValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("EncryptionValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra EncryptionValue Attribute Value", + "While creating a EncryptionValue value, an extra attribute value was detected. "+ + "A EncryptionValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra EncryptionValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewEncryptionValueUnknown(), diags + } + + kekKeyIdAttribute, ok := attributes["kek_key_id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_id is missing from object`) + + return NewEncryptionValueUnknown(), diags + } + + kekKeyIdVal, ok := kekKeyIdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_id expected to be basetypes.StringValue, was: %T`, kekKeyIdAttribute)) + } + + kekKeyRingIdAttribute, ok := attributes["kek_key_ring_id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_ring_id is missing from object`) + + return NewEncryptionValueUnknown(), diags + } + + kekKeyRingIdVal, ok := kekKeyRingIdAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_ring_id expected to be basetypes.StringValue, was: %T`, kekKeyRingIdAttribute)) + } + + kekKeyVersionAttribute, ok := attributes["kek_key_version"] + + if !ok { + diags.AddError( + "Attribute Missing", + `kek_key_version is missing from object`) + + return NewEncryptionValueUnknown(), diags + } + + kekKeyVersionVal, ok := kekKeyVersionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`kek_key_version expected to be basetypes.StringValue, was: %T`, kekKeyVersionAttribute)) + } + + serviceAccountAttribute, ok := attributes["service_account"] + + if !ok { + diags.AddError( + "Attribute Missing", + `service_account is missing from object`) + + return NewEncryptionValueUnknown(), diags + } + + serviceAccountVal, ok := serviceAccountAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`service_account expected to be basetypes.StringValue, was: %T`, serviceAccountAttribute)) + } + + if diags.HasError() { + return NewEncryptionValueUnknown(), diags + } + + return EncryptionValue{ + KekKeyId: kekKeyIdVal, + KekKeyRingId: kekKeyRingIdVal, + KekKeyVersion: kekKeyVersionVal, + ServiceAccount: serviceAccountVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewEncryptionValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) EncryptionValue { + object, diags := NewEncryptionValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewEncryptionValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t EncryptionType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewEncryptionValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewEncryptionValueUnknown(), nil + } + + if in.IsNull() { + return NewEncryptionValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewEncryptionValueMust(EncryptionValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t EncryptionType) ValueType(ctx context.Context) attr.Value { + return EncryptionValue{} +} + +var _ basetypes.ObjectValuable = EncryptionValue{} + +type EncryptionValue struct { + KekKeyId basetypes.StringValue `tfsdk:"kek_key_id"` + KekKeyRingId basetypes.StringValue `tfsdk:"kek_key_ring_id"` + KekKeyVersion basetypes.StringValue `tfsdk:"kek_key_version"` + ServiceAccount basetypes.StringValue `tfsdk:"service_account"` + state attr.ValueState +} + +func (v EncryptionValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 4) + + var val tftypes.Value + var err error + + attrTypes["kek_key_id"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["kek_key_ring_id"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["kek_key_version"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["service_account"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 4) + + val, err = v.KekKeyId.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["kek_key_id"] = val + + val, err = v.KekKeyRingId.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["kek_key_ring_id"] = val + + val, err = v.KekKeyVersion.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["kek_key_version"] = val + + val, err = v.ServiceAccount.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["service_account"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v EncryptionValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v EncryptionValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v EncryptionValue) String() string { + return "EncryptionValue" +} + +func (v EncryptionValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "kek_key_id": basetypes.StringType{}, + "kek_key_ring_id": basetypes.StringType{}, + "kek_key_version": basetypes.StringType{}, + "service_account": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "kek_key_id": v.KekKeyId, + "kek_key_ring_id": v.KekKeyRingId, + "kek_key_version": v.KekKeyVersion, + "service_account": v.ServiceAccount, + }) + + return objVal, diags +} + +func (v EncryptionValue) Equal(o attr.Value) bool { + other, ok := o.(EncryptionValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.KekKeyId.Equal(other.KekKeyId) { + return false + } + + if !v.KekKeyRingId.Equal(other.KekKeyRingId) { + return false + } + + if !v.KekKeyVersion.Equal(other.KekKeyVersion) { + return false + } + + if !v.ServiceAccount.Equal(other.ServiceAccount) { + return false + } + + return true +} + +func (v EncryptionValue) Type(ctx context.Context) attr.Type { + return EncryptionType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v EncryptionValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "kek_key_id": basetypes.StringType{}, + "kek_key_ring_id": basetypes.StringType{}, + "kek_key_version": basetypes.StringType{}, + "service_account": basetypes.StringType{}, + } +} + +var _ basetypes.ObjectTypable = NetworkType{} + +type NetworkType struct { + basetypes.ObjectType +} + +func (t NetworkType) Equal(o attr.Type) bool { + other, ok := o.(NetworkType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t NetworkType) String() string { + return "NetworkType" +} + +func (t NetworkType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + accessScopeAttribute, ok := attributes["access_scope"] + + if !ok { + diags.AddError( + "Attribute Missing", + `access_scope is missing from object`) + + return nil, diags + } + + accessScopeVal, ok := accessScopeAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`access_scope expected to be basetypes.StringValue, was: %T`, accessScopeAttribute)) + } + + aclAttribute, ok := attributes["acl"] + + if !ok { + diags.AddError( + "Attribute Missing", + `acl is missing from object`) + + return nil, diags + } + + aclVal, ok := aclAttribute.(basetypes.ListValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`acl expected to be basetypes.ListValue, was: %T`, aclAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return NetworkValue{ + AccessScope: accessScopeVal, + Acl: aclVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewNetworkValueNull() NetworkValue { + return NetworkValue{ + state: attr.ValueStateNull, + } +} + +func NewNetworkValueUnknown() NetworkValue { + return NetworkValue{ + state: attr.ValueStateUnknown, + } +} + +func NewNetworkValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (NetworkValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing NetworkValue Attribute Value", + "While creating a NetworkValue value, a missing attribute value was detected. "+ + "A NetworkValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("NetworkValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid NetworkValue Attribute Type", + "While creating a NetworkValue value, an invalid attribute value was detected. "+ + "A NetworkValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("NetworkValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("NetworkValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra NetworkValue Attribute Value", + "While creating a NetworkValue value, an extra attribute value was detected. "+ + "A NetworkValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra NetworkValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewNetworkValueUnknown(), diags + } + + accessScopeAttribute, ok := attributes["access_scope"] + + if !ok { + diags.AddError( + "Attribute Missing", + `access_scope is missing from object`) + + return NewNetworkValueUnknown(), diags + } + + accessScopeVal, ok := accessScopeAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`access_scope expected to be basetypes.StringValue, was: %T`, accessScopeAttribute)) + } + + aclAttribute, ok := attributes["acl"] + + if !ok { + diags.AddError( + "Attribute Missing", + `acl is missing from object`) + + return NewNetworkValueUnknown(), diags + } + + aclVal, ok := aclAttribute.(basetypes.ListValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`acl expected to be basetypes.ListValue, was: %T`, aclAttribute)) + } + + if diags.HasError() { + return NewNetworkValueUnknown(), diags + } + + return NetworkValue{ + AccessScope: accessScopeVal, + Acl: aclVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewNetworkValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) NetworkValue { + object, diags := NewNetworkValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewNetworkValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t NetworkType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewNetworkValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewNetworkValueUnknown(), nil + } + + if in.IsNull() { + return NewNetworkValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewNetworkValueMust(NetworkValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t NetworkType) ValueType(ctx context.Context) attr.Value { + return NetworkValue{} +} + +var _ basetypes.ObjectValuable = NetworkValue{} + +type NetworkValue struct { + AccessScope basetypes.StringValue `tfsdk:"access_scope"` + Acl basetypes.ListValue `tfsdk:"acl"` + state attr.ValueState +} + +func (v NetworkValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 2) + + var val tftypes.Value + var err error + + attrTypes["access_scope"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["acl"] = basetypes.ListType{ + ElemType: types.StringType, + }.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 2) + + val, err = v.AccessScope.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["access_scope"] = val + + val, err = v.Acl.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["acl"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v NetworkValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v NetworkValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v NetworkValue) String() string { + return "NetworkValue" +} + +func (v NetworkValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + var aclVal basetypes.ListValue + switch { + case v.Acl.IsUnknown(): + aclVal = types.ListUnknown(types.StringType) + case v.Acl.IsNull(): + aclVal = types.ListNull(types.StringType) + default: + var d diag.Diagnostics + aclVal, d = types.ListValue(types.StringType, v.Acl.Elements()) + diags.Append(d...) + } + + if diags.HasError() { + return types.ObjectUnknown(map[string]attr.Type{ + "access_scope": basetypes.StringType{}, + "acl": basetypes.ListType{ + ElemType: types.StringType, + }, + }), diags + } + + attributeTypes := map[string]attr.Type{ + "access_scope": basetypes.StringType{}, + "acl": basetypes.ListType{ + ElemType: types.StringType, + }, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "access_scope": v.AccessScope, + "acl": aclVal, + }) + + return objVal, diags +} + +func (v NetworkValue) Equal(o attr.Value) bool { + other, ok := o.(NetworkValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.AccessScope.Equal(other.AccessScope) { + return false + } + + if !v.Acl.Equal(other.Acl) { + return false + } + + return true +} + +func (v NetworkValue) Type(ctx context.Context) attr.Type { + return NetworkType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v NetworkValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "access_scope": basetypes.StringType{}, + "acl": basetypes.ListType{ + ElemType: types.StringType, + }, + } +} + +var _ basetypes.ObjectTypable = StorageType{} + +type StorageType struct { + basetypes.ObjectType +} + +func (t StorageType) Equal(o attr.Type) bool { + other, ok := o.(StorageType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t StorageType) String() string { + return "StorageType" +} + +func (t StorageType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + classAttribute, ok := attributes["class"] + + if !ok { + diags.AddError( + "Attribute Missing", + `class is missing from object`) + + return nil, diags + } + + classVal, ok := classAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`class expected to be basetypes.StringValue, was: %T`, classAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return nil, diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return StorageValue{ + Class: classVal, + Size: sizeVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewStorageValueNull() StorageValue { + return StorageValue{ + state: attr.ValueStateNull, + } +} + +func NewStorageValueUnknown() StorageValue { + return StorageValue{ + state: attr.ValueStateUnknown, + } +} + +func NewStorageValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (StorageValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing StorageValue Attribute Value", + "While creating a StorageValue value, a missing attribute value was detected. "+ + "A StorageValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("StorageValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid StorageValue Attribute Type", + "While creating a StorageValue value, an invalid attribute value was detected. "+ + "A StorageValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("StorageValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("StorageValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra StorageValue Attribute Value", + "While creating a StorageValue value, an extra attribute value was detected. "+ + "A StorageValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra StorageValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewStorageValueUnknown(), diags + } + + classAttribute, ok := attributes["class"] + + if !ok { + diags.AddError( + "Attribute Missing", + `class is missing from object`) + + return NewStorageValueUnknown(), diags + } + + classVal, ok := classAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`class expected to be basetypes.StringValue, was: %T`, classAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return NewStorageValueUnknown(), diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + if diags.HasError() { + return NewStorageValueUnknown(), diags + } + + return StorageValue{ + Class: classVal, + Size: sizeVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewStorageValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) StorageValue { + object, diags := NewStorageValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewStorageValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t StorageType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewStorageValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewStorageValueUnknown(), nil + } + + if in.IsNull() { + return NewStorageValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewStorageValueMust(StorageValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t StorageType) ValueType(ctx context.Context) attr.Value { + return StorageValue{} +} + +var _ basetypes.ObjectValuable = StorageValue{} + +type StorageValue struct { + Class basetypes.StringValue `tfsdk:"class"` + Size basetypes.Int64Value `tfsdk:"size"` + state attr.ValueState +} + +func (v StorageValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 2) + + var val tftypes.Value + var err error + + attrTypes["class"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["size"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 2) + + val, err = v.Class.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["class"] = val + + val, err = v.Size.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["size"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v StorageValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v StorageValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v StorageValue) String() string { + return "StorageValue" +} + +func (v StorageValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "class": basetypes.StringType{}, + "size": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "class": v.Class, + "size": v.Size, + }) + + return objVal, diags +} + +func (v StorageValue) Equal(o attr.Value) bool { + other, ok := o.(StorageValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Class.Equal(other.Class) { + return false + } + + if !v.Size.Equal(other.Size) { + return false + } + + return true +} + +func (v StorageValue) Type(ctx context.Context) attr.Type { + return StorageType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v StorageValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "class": basetypes.StringType{}, + "size": basetypes.Int64Type{}, + } +} diff --git a/stackit/internal/services/sqlserverflexalpha/main.go b/stackit/internal/services/sqlserverflexalpha/main.go new file mode 100644 index 00000000..7ec38cdc --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/main.go @@ -0,0 +1 @@ +package sqlserverflexalpha diff --git a/stackit/internal/services/sqlserverflexalpha/sqlserverflex_acc_test.go b/stackit/internal/services/sqlserverflexalpha/sqlserverflex_acc_test.go index c98de26f..e918223a 100644 --- a/stackit/internal/services/sqlserverflexalpha/sqlserverflex_acc_test.go +++ b/stackit/internal/services/sqlserverflexalpha/sqlserverflex_acc_test.go @@ -1,6 +1,6 @@ // Copyright (c) STACKIT -package sqlserverflex_test +package sqlserverflexalpha_test import ( "context" diff --git a/stackit/internal/services/sqlserverflexalpha/testdata/resource-max.tf b/stackit/internal/services/sqlserverflexalpha/testdata/resource-max.tf index a0cf700a..b365f096 100644 --- a/stackit/internal/services/sqlserverflexalpha/testdata/resource-max.tf +++ b/stackit/internal/services/sqlserverflexalpha/testdata/resource-max.tf @@ -1,3 +1,4 @@ + variable "project_id" {} variable "name" {} variable "acl1" {} diff --git a/stackit/internal/services/sqlserverflexalpha/testdata/resource-min.tf b/stackit/internal/services/sqlserverflexalpha/testdata/resource-min.tf index 3953ddf1..3f17d5cc 100644 --- a/stackit/internal/services/sqlserverflexalpha/testdata/resource-min.tf +++ b/stackit/internal/services/sqlserverflexalpha/testdata/resource-min.tf @@ -1,3 +1,4 @@ + variable "project_id" {} variable "name" {} variable "flavor_cpu" {} diff --git a/stackit/internal/services/sqlserverflexalpha/user/datasources_gen/user_data_source_gen.go b/stackit/internal/services/sqlserverflexalpha/user/datasources_gen/user_data_source_gen.go new file mode 100644 index 00000000..3d252237 --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/user/datasources_gen/user_data_source_gen.go @@ -0,0 +1,1118 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func UserDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "instance_id": schema.StringAttribute{ + Required: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "page": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of the page of items list to be returned.", + MarkdownDescription: "Number of the page of items list to be returned.", + }, + "pagination": schema.SingleNestedAttribute{ + Attributes: map[string]schema.Attribute{ + "page": schema.Int64Attribute{ + Computed: true, + }, + "size": schema.Int64Attribute{ + Computed: true, + }, + "sort": schema.StringAttribute{ + Computed: true, + }, + "total_pages": schema.Int64Attribute{ + Computed: true, + }, + "total_rows": schema.Int64Attribute{ + Computed: true, + }, + }, + CustomType: PaginationType{ + ObjectType: types.ObjectType{ + AttrTypes: PaginationValue{}.AttributeTypes(ctx), + }, + }, + Computed: true, + }, + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "size": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "Number of items to be returned on each page.", + MarkdownDescription: "Number of items to be returned on each page.", + }, + "sort": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "Sorting of the users to be returned on each page.", + MarkdownDescription: "Sorting of the users to be returned on each page.", + Validators: []validator.String{ + stringvalidator.OneOf( + "id.asc", + "id.desc", + "index.desc", + "index.asc", + "name.desc", + "name.asc", + "status.desc", + "status.asc", + ), + }, + }, + "users": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "id": schema.Int64Attribute{ + Computed: true, + Description: "The ID of the user.", + MarkdownDescription: "The ID of the user.", + }, + "status": schema.StringAttribute{ + Computed: true, + Description: "The current status of the user.", + MarkdownDescription: "The current status of the user.", + }, + "username": schema.StringAttribute{ + Computed: true, + Description: "The name of the user.", + MarkdownDescription: "The name of the user.", + }, + }, + CustomType: UsersType{ + ObjectType: types.ObjectType{ + AttrTypes: UsersValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "List of all users inside an instance", + MarkdownDescription: "List of all users inside an instance", + }, + }, + } +} + +type UserModel struct { + InstanceId types.String `tfsdk:"instance_id"` + Page types.Int64 `tfsdk:"page"` + Pagination PaginationValue `tfsdk:"pagination"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Size types.Int64 `tfsdk:"size"` + Sort types.String `tfsdk:"sort"` + Users types.List `tfsdk:"users"` +} + +var _ basetypes.ObjectTypable = PaginationType{} + +type PaginationType struct { + basetypes.ObjectType +} + +func (t PaginationType) Equal(o attr.Type) bool { + other, ok := o.(PaginationType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t PaginationType) String() string { + return "PaginationType" +} + +func (t PaginationType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return nil, diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return nil, diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return nil, diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return nil, diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return nil, diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueNull() PaginationValue { + return PaginationValue{ + state: attr.ValueStateNull, + } +} + +func NewPaginationValueUnknown() PaginationValue { + return PaginationValue{ + state: attr.ValueStateUnknown, + } +} + +func NewPaginationValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (PaginationValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing PaginationValue Attribute Value", + "While creating a PaginationValue value, a missing attribute value was detected. "+ + "A PaginationValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid PaginationValue Attribute Type", + "While creating a PaginationValue value, an invalid attribute value was detected. "+ + "A PaginationValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("PaginationValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra PaginationValue Attribute Value", + "While creating a PaginationValue value, an extra attribute value was detected. "+ + "A PaginationValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra PaginationValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + pageAttribute, ok := attributes["page"] + + if !ok { + diags.AddError( + "Attribute Missing", + `page is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + pageVal, ok := pageAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`page expected to be basetypes.Int64Value, was: %T`, pageAttribute)) + } + + sizeAttribute, ok := attributes["size"] + + if !ok { + diags.AddError( + "Attribute Missing", + `size is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sizeVal, ok := sizeAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`size expected to be basetypes.Int64Value, was: %T`, sizeAttribute)) + } + + sortAttribute, ok := attributes["sort"] + + if !ok { + diags.AddError( + "Attribute Missing", + `sort is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + sortVal, ok := sortAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`sort expected to be basetypes.StringValue, was: %T`, sortAttribute)) + } + + totalPagesAttribute, ok := attributes["total_pages"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_pages is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalPagesVal, ok := totalPagesAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_pages expected to be basetypes.Int64Value, was: %T`, totalPagesAttribute)) + } + + totalRowsAttribute, ok := attributes["total_rows"] + + if !ok { + diags.AddError( + "Attribute Missing", + `total_rows is missing from object`) + + return NewPaginationValueUnknown(), diags + } + + totalRowsVal, ok := totalRowsAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`total_rows expected to be basetypes.Int64Value, was: %T`, totalRowsAttribute)) + } + + if diags.HasError() { + return NewPaginationValueUnknown(), diags + } + + return PaginationValue{ + Page: pageVal, + Size: sizeVal, + Sort: sortVal, + TotalPages: totalPagesVal, + TotalRows: totalRowsVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewPaginationValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) PaginationValue { + object, diags := NewPaginationValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewPaginationValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t PaginationType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewPaginationValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewPaginationValueUnknown(), nil + } + + if in.IsNull() { + return NewPaginationValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewPaginationValueMust(PaginationValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t PaginationType) ValueType(ctx context.Context) attr.Value { + return PaginationValue{} +} + +var _ basetypes.ObjectValuable = PaginationValue{} + +type PaginationValue struct { + Page basetypes.Int64Value `tfsdk:"page"` + Size basetypes.Int64Value `tfsdk:"size"` + Sort basetypes.StringValue `tfsdk:"sort"` + TotalPages basetypes.Int64Value `tfsdk:"total_pages"` + TotalRows basetypes.Int64Value `tfsdk:"total_rows"` + state attr.ValueState +} + +func (v PaginationValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 5) + + var val tftypes.Value + var err error + + attrTypes["page"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["size"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["sort"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["total_pages"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["total_rows"] = basetypes.Int64Type{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 5) + + val, err = v.Page.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["page"] = val + + val, err = v.Size.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["size"] = val + + val, err = v.Sort.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["sort"] = val + + val, err = v.TotalPages.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_pages"] = val + + val, err = v.TotalRows.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["total_rows"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v PaginationValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v PaginationValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v PaginationValue) String() string { + return "PaginationValue" +} + +func (v PaginationValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "page": v.Page, + "size": v.Size, + "sort": v.Sort, + "total_pages": v.TotalPages, + "total_rows": v.TotalRows, + }) + + return objVal, diags +} + +func (v PaginationValue) Equal(o attr.Value) bool { + other, ok := o.(PaginationValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Page.Equal(other.Page) { + return false + } + + if !v.Size.Equal(other.Size) { + return false + } + + if !v.Sort.Equal(other.Sort) { + return false + } + + if !v.TotalPages.Equal(other.TotalPages) { + return false + } + + if !v.TotalRows.Equal(other.TotalRows) { + return false + } + + return true +} + +func (v PaginationValue) Type(ctx context.Context) attr.Type { + return PaginationType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v PaginationValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "page": basetypes.Int64Type{}, + "size": basetypes.Int64Type{}, + "sort": basetypes.StringType{}, + "total_pages": basetypes.Int64Type{}, + "total_rows": basetypes.Int64Type{}, + } +} + +var _ basetypes.ObjectTypable = UsersType{} + +type UsersType struct { + basetypes.ObjectType +} + +func (t UsersType) Equal(o attr.Type) bool { + other, ok := o.(UsersType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t UsersType) String() string { + return "UsersType" +} + +func (t UsersType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return nil, diags + } + + idVal, ok := idAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute)) + } + + statusAttribute, ok := attributes["status"] + + if !ok { + diags.AddError( + "Attribute Missing", + `status is missing from object`) + + return nil, diags + } + + statusVal, ok := statusAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`status expected to be basetypes.StringValue, was: %T`, statusAttribute)) + } + + usernameAttribute, ok := attributes["username"] + + if !ok { + diags.AddError( + "Attribute Missing", + `username is missing from object`) + + return nil, diags + } + + usernameVal, ok := usernameAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`username expected to be basetypes.StringValue, was: %T`, usernameAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return UsersValue{ + Id: idVal, + Status: statusVal, + Username: usernameVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewUsersValueNull() UsersValue { + return UsersValue{ + state: attr.ValueStateNull, + } +} + +func NewUsersValueUnknown() UsersValue { + return UsersValue{ + state: attr.ValueStateUnknown, + } +} + +func NewUsersValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (UsersValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing UsersValue Attribute Value", + "While creating a UsersValue value, a missing attribute value was detected. "+ + "A UsersValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("UsersValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid UsersValue Attribute Type", + "While creating a UsersValue value, an invalid attribute value was detected. "+ + "A UsersValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("UsersValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("UsersValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra UsersValue Attribute Value", + "While creating a UsersValue value, an extra attribute value was detected. "+ + "A UsersValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra UsersValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewUsersValueUnknown(), diags + } + + idAttribute, ok := attributes["id"] + + if !ok { + diags.AddError( + "Attribute Missing", + `id is missing from object`) + + return NewUsersValueUnknown(), diags + } + + idVal, ok := idAttribute.(basetypes.Int64Value) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`id expected to be basetypes.Int64Value, was: %T`, idAttribute)) + } + + statusAttribute, ok := attributes["status"] + + if !ok { + diags.AddError( + "Attribute Missing", + `status is missing from object`) + + return NewUsersValueUnknown(), diags + } + + statusVal, ok := statusAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`status expected to be basetypes.StringValue, was: %T`, statusAttribute)) + } + + usernameAttribute, ok := attributes["username"] + + if !ok { + diags.AddError( + "Attribute Missing", + `username is missing from object`) + + return NewUsersValueUnknown(), diags + } + + usernameVal, ok := usernameAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`username expected to be basetypes.StringValue, was: %T`, usernameAttribute)) + } + + if diags.HasError() { + return NewUsersValueUnknown(), diags + } + + return UsersValue{ + Id: idVal, + Status: statusVal, + Username: usernameVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewUsersValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) UsersValue { + object, diags := NewUsersValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewUsersValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t UsersType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewUsersValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewUsersValueUnknown(), nil + } + + if in.IsNull() { + return NewUsersValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewUsersValueMust(UsersValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t UsersType) ValueType(ctx context.Context) attr.Value { + return UsersValue{} +} + +var _ basetypes.ObjectValuable = UsersValue{} + +type UsersValue struct { + Id basetypes.Int64Value `tfsdk:"id"` + Status basetypes.StringValue `tfsdk:"status"` + Username basetypes.StringValue `tfsdk:"username"` + state attr.ValueState +} + +func (v UsersValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 3) + + var val tftypes.Value + var err error + + attrTypes["id"] = basetypes.Int64Type{}.TerraformType(ctx) + attrTypes["status"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["username"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 3) + + val, err = v.Id.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["id"] = val + + val, err = v.Status.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["status"] = val + + val, err = v.Username.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["username"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v UsersValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v UsersValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v UsersValue) String() string { + return "UsersValue" +} + +func (v UsersValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "id": basetypes.Int64Type{}, + "status": basetypes.StringType{}, + "username": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "id": v.Id, + "status": v.Status, + "username": v.Username, + }) + + return objVal, diags +} + +func (v UsersValue) Equal(o attr.Value) bool { + other, ok := o.(UsersValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Id.Equal(other.Id) { + return false + } + + if !v.Status.Equal(other.Status) { + return false + } + + if !v.Username.Equal(other.Username) { + return false + } + + return true +} + +func (v UsersValue) Type(ctx context.Context) attr.Type { + return UsersType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v UsersValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "id": basetypes.Int64Type{}, + "status": basetypes.StringType{}, + "username": basetypes.StringType{}, + } +} diff --git a/stackit/internal/services/sqlserverflexalpha/user/resources_gen/user_resource_gen.go b/stackit/internal/services/sqlserverflexalpha/user/resources_gen/user_resource_gen.go new file mode 100644 index 00000000..2b456e79 --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/user/resources_gen/user_resource_gen.go @@ -0,0 +1,111 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + + "github.com/hashicorp/terraform-plugin-framework/resource/schema" +) + +func UserResourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "default_database": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The default database for a user of the instance.", + MarkdownDescription: "The default database for a user of the instance.", + }, + "host": schema.StringAttribute{ + Computed: true, + Description: "The host of the instance in which the user belongs to.", + MarkdownDescription: "The host of the instance in which the user belongs to.", + }, + "id": schema.Int64Attribute{ + Computed: true, + Description: "The ID of the user.", + MarkdownDescription: "The ID of the user.", + }, + "instance_id": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The ID of the instance.", + MarkdownDescription: "The ID of the instance.", + }, + "password": schema.StringAttribute{ + Computed: true, + Description: "The password for the user.", + MarkdownDescription: "The password for the user.", + }, + "port": schema.Int64Attribute{ + Computed: true, + Description: "The port of the instance in which the user belongs to.", + MarkdownDescription: "The port of the instance in which the user belongs to.", + }, + "project_id": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Optional: true, + Computed: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "roles": schema.ListAttribute{ + ElementType: types.StringType, + Required: true, + Description: "A list containing the user roles for the instance.", + MarkdownDescription: "A list containing the user roles for the instance.", + }, + "status": schema.StringAttribute{ + Computed: true, + Description: "The current status of the user.", + MarkdownDescription: "The current status of the user.", + }, + "uri": schema.StringAttribute{ + Computed: true, + Description: "The connection string for the user to the instance.", + MarkdownDescription: "The connection string for the user to the instance.", + }, + "user_id": schema.Int64Attribute{ + Optional: true, + Computed: true, + Description: "The ID of the user.", + MarkdownDescription: "The ID of the user.", + }, + "username": schema.StringAttribute{ + Required: true, + Description: "The name of the user.", + MarkdownDescription: "The name of the user.", + }, + }, + } +} + +type UserModel struct { + DefaultDatabase types.String `tfsdk:"default_database"` + Host types.String `tfsdk:"host"` + Id types.Int64 `tfsdk:"id"` + InstanceId types.String `tfsdk:"instance_id"` + Password types.String `tfsdk:"password"` + Port types.Int64 `tfsdk:"port"` + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Roles types.List `tfsdk:"roles"` + Status types.String `tfsdk:"status"` + Uri types.String `tfsdk:"uri"` + UserId types.Int64 `tfsdk:"user_id"` + Username types.String `tfsdk:"username"` +} diff --git a/stackit/internal/services/sqlserverflexalpha/version/datasource.go b/stackit/internal/services/sqlserverflexalpha/version/datasource.go new file mode 100644 index 00000000..c778526f --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/version/datasource.go @@ -0,0 +1,71 @@ +package sqlserverflexalpha + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-log/tflog" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/sqlserverflexalpha" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/conversion" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" + sqlserverflexUtils "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/utils" + + sqlserverflexalphaGen "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/version/datasources_gen" +) + +var ( + _ datasource.DataSource = (*versionDataSource)(nil) + _ datasource.DataSourceWithConfigure = (*versionDataSource)(nil) +) + +func NewVersionDataSource() datasource.DataSource { + return &versionDataSource{} +} + +type versionDataSource struct { + client *sqlserverflexalpha.APIClient + providerData core.ProviderData +} + +func (d *versionDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_sqlserverflexalpha_version" +} + +func (d *versionDataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = sqlserverflexalphaGen.VersionDataSourceSchema(ctx) +} + +// Configure adds the provider configured client to the data source. +func (d *versionDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + var ok bool + d.providerData, ok = conversion.ParseProviderData(ctx, req.ProviderData, &resp.Diagnostics) + if !ok { + return + } + + apiClient := sqlserverflexUtils.ConfigureClient(ctx, &d.providerData, &resp.Diagnostics) + if resp.Diagnostics.HasError() { + return + } + d.client = apiClient + tflog.Info(ctx, "SQL SERVER Flex version client configured") +} + +func (d *versionDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + var data sqlserverflexalphaGen.VersionModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Read API call logic + + // Example data value setting + // data.Id = types.StringValue("example-id") + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} diff --git a/stackit/internal/services/sqlserverflexalpha/version/datasources_gen/version_data_source_gen.go b/stackit/internal/services/sqlserverflexalpha/version/datasources_gen/version_data_source_gen.go new file mode 100644 index 00000000..cb9008f1 --- /dev/null +++ b/stackit/internal/services/sqlserverflexalpha/version/datasources_gen/version_data_source_gen.go @@ -0,0 +1,569 @@ +// Code generated by terraform-plugin-framework-generator DO NOT EDIT. + +package sqlserverflexalpha + +import ( + "context" + "fmt" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "strings" + + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +func VersionDataSourceSchema(ctx context.Context) schema.Schema { + return schema.Schema{ + Attributes: map[string]schema.Attribute{ + "project_id": schema.StringAttribute{ + Required: true, + Description: "The STACKIT project ID.", + MarkdownDescription: "The STACKIT project ID.", + }, + "region": schema.StringAttribute{ + Required: true, + Description: "The region which should be addressed", + MarkdownDescription: "The region which should be addressed", + Validators: []validator.String{ + stringvalidator.OneOf( + "eu01", + ), + }, + }, + "versions": schema.ListNestedAttribute{ + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "beta": schema.BoolAttribute{ + Computed: true, + Description: "Flag if the version is a beta version. If set the version may contain bugs and is not fully tested.", + MarkdownDescription: "Flag if the version is a beta version. If set the version may contain bugs and is not fully tested.", + }, + "deprecated": schema.StringAttribute{ + Computed: true, + Description: "Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT.", + MarkdownDescription: "Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT.", + }, + "recommend": schema.BoolAttribute{ + Computed: true, + Description: "Flag if the version is recommend by the STACKIT Team.", + MarkdownDescription: "Flag if the version is recommend by the STACKIT Team.", + }, + "version": schema.StringAttribute{ + Computed: true, + Description: "The sqlserver version used for the instance.", + MarkdownDescription: "The sqlserver version used for the instance.", + }, + }, + CustomType: VersionsType{ + ObjectType: types.ObjectType{ + AttrTypes: VersionsValue{}.AttributeTypes(ctx), + }, + }, + }, + Computed: true, + Description: "A list containing available sqlserver versions.", + MarkdownDescription: "A list containing available sqlserver versions.", + }, + }, + } +} + +type VersionModel struct { + ProjectId types.String `tfsdk:"project_id"` + Region types.String `tfsdk:"region"` + Versions types.List `tfsdk:"versions"` +} + +var _ basetypes.ObjectTypable = VersionsType{} + +type VersionsType struct { + basetypes.ObjectType +} + +func (t VersionsType) Equal(o attr.Type) bool { + other, ok := o.(VersionsType) + + if !ok { + return false + } + + return t.ObjectType.Equal(other.ObjectType) +} + +func (t VersionsType) String() string { + return "VersionsType" +} + +func (t VersionsType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) { + var diags diag.Diagnostics + + attributes := in.Attributes() + + betaAttribute, ok := attributes["beta"] + + if !ok { + diags.AddError( + "Attribute Missing", + `beta is missing from object`) + + return nil, diags + } + + betaVal, ok := betaAttribute.(basetypes.BoolValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`beta expected to be basetypes.BoolValue, was: %T`, betaAttribute)) + } + + deprecatedAttribute, ok := attributes["deprecated"] + + if !ok { + diags.AddError( + "Attribute Missing", + `deprecated is missing from object`) + + return nil, diags + } + + deprecatedVal, ok := deprecatedAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`deprecated expected to be basetypes.StringValue, was: %T`, deprecatedAttribute)) + } + + recommendAttribute, ok := attributes["recommend"] + + if !ok { + diags.AddError( + "Attribute Missing", + `recommend is missing from object`) + + return nil, diags + } + + recommendVal, ok := recommendAttribute.(basetypes.BoolValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`recommend expected to be basetypes.BoolValue, was: %T`, recommendAttribute)) + } + + versionAttribute, ok := attributes["version"] + + if !ok { + diags.AddError( + "Attribute Missing", + `version is missing from object`) + + return nil, diags + } + + versionVal, ok := versionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`version expected to be basetypes.StringValue, was: %T`, versionAttribute)) + } + + if diags.HasError() { + return nil, diags + } + + return VersionsValue{ + Beta: betaVal, + Deprecated: deprecatedVal, + Recommend: recommendVal, + Version: versionVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewVersionsValueNull() VersionsValue { + return VersionsValue{ + state: attr.ValueStateNull, + } +} + +func NewVersionsValueUnknown() VersionsValue { + return VersionsValue{ + state: attr.ValueStateUnknown, + } +} + +func NewVersionsValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (VersionsValue, diag.Diagnostics) { + var diags diag.Diagnostics + + // Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521 + ctx := context.Background() + + for name, attributeType := range attributeTypes { + attribute, ok := attributes[name] + + if !ok { + diags.AddError( + "Missing VersionsValue Attribute Value", + "While creating a VersionsValue value, a missing attribute value was detected. "+ + "A VersionsValue must contain values for all attributes, even if null or unknown. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("VersionsValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()), + ) + + continue + } + + if !attributeType.Equal(attribute.Type(ctx)) { + diags.AddError( + "Invalid VersionsValue Attribute Type", + "While creating a VersionsValue value, an invalid attribute value was detected. "+ + "A VersionsValue must use a matching attribute type for the value. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("VersionsValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+ + fmt.Sprintf("VersionsValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)), + ) + } + } + + for name := range attributes { + _, ok := attributeTypes[name] + + if !ok { + diags.AddError( + "Extra VersionsValue Attribute Value", + "While creating a VersionsValue value, an extra attribute value was detected. "+ + "A VersionsValue must not contain values beyond the expected attribute types. "+ + "This is always an issue with the provider and should be reported to the provider developers.\n\n"+ + fmt.Sprintf("Extra VersionsValue Attribute Name: %s", name), + ) + } + } + + if diags.HasError() { + return NewVersionsValueUnknown(), diags + } + + betaAttribute, ok := attributes["beta"] + + if !ok { + diags.AddError( + "Attribute Missing", + `beta is missing from object`) + + return NewVersionsValueUnknown(), diags + } + + betaVal, ok := betaAttribute.(basetypes.BoolValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`beta expected to be basetypes.BoolValue, was: %T`, betaAttribute)) + } + + deprecatedAttribute, ok := attributes["deprecated"] + + if !ok { + diags.AddError( + "Attribute Missing", + `deprecated is missing from object`) + + return NewVersionsValueUnknown(), diags + } + + deprecatedVal, ok := deprecatedAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`deprecated expected to be basetypes.StringValue, was: %T`, deprecatedAttribute)) + } + + recommendAttribute, ok := attributes["recommend"] + + if !ok { + diags.AddError( + "Attribute Missing", + `recommend is missing from object`) + + return NewVersionsValueUnknown(), diags + } + + recommendVal, ok := recommendAttribute.(basetypes.BoolValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`recommend expected to be basetypes.BoolValue, was: %T`, recommendAttribute)) + } + + versionAttribute, ok := attributes["version"] + + if !ok { + diags.AddError( + "Attribute Missing", + `version is missing from object`) + + return NewVersionsValueUnknown(), diags + } + + versionVal, ok := versionAttribute.(basetypes.StringValue) + + if !ok { + diags.AddError( + "Attribute Wrong Type", + fmt.Sprintf(`version expected to be basetypes.StringValue, was: %T`, versionAttribute)) + } + + if diags.HasError() { + return NewVersionsValueUnknown(), diags + } + + return VersionsValue{ + Beta: betaVal, + Deprecated: deprecatedVal, + Recommend: recommendVal, + Version: versionVal, + state: attr.ValueStateKnown, + }, diags +} + +func NewVersionsValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) VersionsValue { + object, diags := NewVersionsValue(attributeTypes, attributes) + + if diags.HasError() { + // This could potentially be added to the diag package. + diagsStrings := make([]string, 0, len(diags)) + + for _, diagnostic := range diags { + diagsStrings = append(diagsStrings, fmt.Sprintf( + "%s | %s | %s", + diagnostic.Severity(), + diagnostic.Summary(), + diagnostic.Detail())) + } + + panic("NewVersionsValueMust received error(s): " + strings.Join(diagsStrings, "\n")) + } + + return object +} + +func (t VersionsType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) { + if in.Type() == nil { + return NewVersionsValueNull(), nil + } + + if !in.Type().Equal(t.TerraformType(ctx)) { + return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type()) + } + + if !in.IsKnown() { + return NewVersionsValueUnknown(), nil + } + + if in.IsNull() { + return NewVersionsValueNull(), nil + } + + attributes := map[string]attr.Value{} + + val := map[string]tftypes.Value{} + + err := in.As(&val) + + if err != nil { + return nil, err + } + + for k, v := range val { + a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v) + + if err != nil { + return nil, err + } + + attributes[k] = a + } + + return NewVersionsValueMust(VersionsValue{}.AttributeTypes(ctx), attributes), nil +} + +func (t VersionsType) ValueType(ctx context.Context) attr.Value { + return VersionsValue{} +} + +var _ basetypes.ObjectValuable = VersionsValue{} + +type VersionsValue struct { + Beta basetypes.BoolValue `tfsdk:"beta"` + Deprecated basetypes.StringValue `tfsdk:"deprecated"` + Recommend basetypes.BoolValue `tfsdk:"recommend"` + Version basetypes.StringValue `tfsdk:"version"` + state attr.ValueState +} + +func (v VersionsValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) { + attrTypes := make(map[string]tftypes.Type, 4) + + var val tftypes.Value + var err error + + attrTypes["beta"] = basetypes.BoolType{}.TerraformType(ctx) + attrTypes["deprecated"] = basetypes.StringType{}.TerraformType(ctx) + attrTypes["recommend"] = basetypes.BoolType{}.TerraformType(ctx) + attrTypes["version"] = basetypes.StringType{}.TerraformType(ctx) + + objectType := tftypes.Object{AttributeTypes: attrTypes} + + switch v.state { + case attr.ValueStateKnown: + vals := make(map[string]tftypes.Value, 4) + + val, err = v.Beta.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["beta"] = val + + val, err = v.Deprecated.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["deprecated"] = val + + val, err = v.Recommend.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["recommend"] = val + + val, err = v.Version.ToTerraformValue(ctx) + + if err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + vals["version"] = val + + if err := tftypes.ValidateValue(objectType, vals); err != nil { + return tftypes.NewValue(objectType, tftypes.UnknownValue), err + } + + return tftypes.NewValue(objectType, vals), nil + case attr.ValueStateNull: + return tftypes.NewValue(objectType, nil), nil + case attr.ValueStateUnknown: + return tftypes.NewValue(objectType, tftypes.UnknownValue), nil + default: + panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state)) + } +} + +func (v VersionsValue) IsNull() bool { + return v.state == attr.ValueStateNull +} + +func (v VersionsValue) IsUnknown() bool { + return v.state == attr.ValueStateUnknown +} + +func (v VersionsValue) String() string { + return "VersionsValue" +} + +func (v VersionsValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) { + var diags diag.Diagnostics + + attributeTypes := map[string]attr.Type{ + "beta": basetypes.BoolType{}, + "deprecated": basetypes.StringType{}, + "recommend": basetypes.BoolType{}, + "version": basetypes.StringType{}, + } + + if v.IsNull() { + return types.ObjectNull(attributeTypes), diags + } + + if v.IsUnknown() { + return types.ObjectUnknown(attributeTypes), diags + } + + objVal, diags := types.ObjectValue( + attributeTypes, + map[string]attr.Value{ + "beta": v.Beta, + "deprecated": v.Deprecated, + "recommend": v.Recommend, + "version": v.Version, + }) + + return objVal, diags +} + +func (v VersionsValue) Equal(o attr.Value) bool { + other, ok := o.(VersionsValue) + + if !ok { + return false + } + + if v.state != other.state { + return false + } + + if v.state != attr.ValueStateKnown { + return true + } + + if !v.Beta.Equal(other.Beta) { + return false + } + + if !v.Deprecated.Equal(other.Deprecated) { + return false + } + + if !v.Recommend.Equal(other.Recommend) { + return false + } + + if !v.Version.Equal(other.Version) { + return false + } + + return true +} + +func (v VersionsValue) Type(ctx context.Context) attr.Type { + return VersionsType{ + basetypes.ObjectType{ + AttrTypes: v.AttributeTypes(ctx), + }, + } +} + +func (v VersionsValue) AttributeTypes(ctx context.Context) map[string]attr.Type { + return map[string]attr.Type{ + "beta": basetypes.BoolType{}, + "deprecated": basetypes.StringType{}, + "recommend": basetypes.BoolType{}, + "version": basetypes.StringType{}, + } +} diff --git a/pkg/postgresflexalpha/wait/wait.go b/stackit/internal/wait/postgresflexalpha/wait.go similarity index 76% rename from pkg/postgresflexalpha/wait/wait.go rename to stackit/internal/wait/postgresflexalpha/wait.go index 5c03789b..50ad9ea2 100644 --- a/pkg/postgresflexalpha/wait/wait.go +++ b/stackit/internal/wait/postgresflexalpha/wait.go @@ -1,4 +1,4 @@ -package wait +package postgresflexalpha import ( "context" @@ -53,6 +53,9 @@ func CreateInstanceWaitHandler( ) *wait.AsyncActionHandler[postgresflex.GetInstanceResponse] { instanceCreated := false var instanceGetResponse *postgresflex.GetInstanceResponse + maxWait := time.Minute * 45 + startTime := time.Now() + extendedTimeout := 0 handler := wait.New( func() (waitFinished bool, response *postgresflex.GetInstanceResponse, err error) { @@ -64,6 +67,9 @@ func CreateInstanceWaitHandler( if s == nil || s.Id == nil || *s.Id != instanceId || s.Status == nil { return false, nil, nil } + tflog.Debug(ctx, "waiting for instance ready", map[string]interface{}{ + "status": *s.Status, + }) switch *s.Status { default: return true, s, fmt.Errorf("instance with id %s has unexpected status %s", instanceId, *s.Status) @@ -74,15 +80,53 @@ func CreateInstanceWaitHandler( case InstanceStateUnknown: return false, nil, nil case InstanceStateProgressing: - return false, nil, nil - case InstanceStateSuccess: - if s.Network == nil || s.Network.InstanceAddress == nil { - tflog.Info(ctx, "Waiting for instance_address") + if time.Since(startTime) < maxWait { return false, nil, nil } - if s.Network.RouterAddress == nil { - tflog.Info(ctx, "Waiting for router_address") - return false, nil, nil + tflog.Warn( + ctx, + fmt.Sprintf( + "Wait handler still got status %s after %v for instance: %s", + InstanceStateProgressing, + maxWait, + instanceId, + ), + ) + if extendedTimeout < 3 { + maxWait = maxWait + time.Minute*5 + extendedTimeout = extendedTimeout + 1 + if *s.Network.AccessScope == "SNA" { + ready := true + if s.Network == nil || s.Network.InstanceAddress == nil { + tflog.Warn(ctx, "Waiting for instance_address") + ready = false + } + if s.Network.RouterAddress == nil { + tflog.Warn(ctx, "Waiting for router_address") + ready = false + } + if !ready { + return false, nil, nil + } + } + if s.IsDeletable == nil { + tflog.Warn(ctx, "Waiting for is_deletable") + return false, nil, nil + } + } + + instanceCreated = true + instanceGetResponse = s + case InstanceStateSuccess: + if *s.Network.AccessScope == "SNA" { + if s.Network == nil || s.Network.InstanceAddress == nil { + tflog.Warn(ctx, "Waiting for instance_address") + return false, nil, nil + } + if s.Network.RouterAddress == nil { + tflog.Info(ctx, "Waiting for router_address") + return false, nil, nil + } } instanceCreated = true instanceGetResponse = s @@ -138,21 +182,21 @@ func PartialUpdateInstanceWaitHandler( return true, s, fmt.Errorf("instance with id %s has unexpected status %s", instanceId, *s.Status) case InstanceStateEmpty: return false, nil, nil - case InstanceStateUnknown: + case InstanceStatePending: return false, nil, nil case InstanceStateProgressing: return false, nil, nil - case InstanceStatePending: - return false, nil, nil - case InstanceStateTerminating: - return false, nil, nil case InstanceStateSuccess: return true, s, nil + case InstanceStateTerminating: + return false, nil, nil + case InstanceStateUnknown: + return false, nil, nil case InstanceStateFailed: return true, s, fmt.Errorf("update failed for instance with id %s", instanceId) } }, ) - handler.SetTimeout(45 * time.Minute) + handler.SetTimeout(45 * time.Minute).SetSleepBeforeWait(30 * time.Second) return handler } diff --git a/pkg/postgresflexalpha/wait/wait_test.go b/stackit/internal/wait/postgresflexalpha/wait_test.go similarity index 99% rename from pkg/postgresflexalpha/wait/wait_test.go rename to stackit/internal/wait/postgresflexalpha/wait_test.go index 968552e4..0045239d 100644 --- a/pkg/postgresflexalpha/wait/wait_test.go +++ b/stackit/internal/wait/postgresflexalpha/wait_test.go @@ -1,6 +1,6 @@ // Copyright (c) STACKIT -package wait +package postgresflexalpha import ( "context" diff --git a/pkg/sqlserverflexalpha/wait/wait.go b/stackit/internal/wait/sqlserverflexalpha/wait.go similarity index 90% rename from pkg/sqlserverflexalpha/wait/wait.go rename to stackit/internal/wait/sqlserverflexalpha/wait.go index 7f2a4f02..cc766e52 100644 --- a/pkg/sqlserverflexalpha/wait/wait.go +++ b/stackit/internal/wait/sqlserverflexalpha/wait.go @@ -1,6 +1,6 @@ // Copyright (c) STACKIT -package wait +package sqlserverflexalpha import ( "context" @@ -24,7 +24,7 @@ const ( InstanceStateFailed = "Failed" ) -// Interface needed for tests +// APIClientInstanceInterface Interface needed for tests type APIClientInstanceInterface interface { GetInstanceRequestExecute(ctx context.Context, projectId, region, instanceId string) (*sqlserverflex.GetInstanceResponse, error) } @@ -53,6 +53,10 @@ func CreateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface case strings.ToLower(InstanceStateUnknown), strings.ToLower(InstanceStateFailed): return true, s, fmt.Errorf("create failed for instance with id %s", instanceId) default: + tflog.Info(ctx, "Wait (create) received unknown status", map[string]interface{}{ + "instanceId": instanceId, + "status": s.Status, + }) return false, s, nil } }) @@ -77,10 +81,14 @@ func UpdateInstanceWaitHandler(ctx context.Context, a APIClientInstanceInterface case strings.ToLower(InstanceStateUnknown), strings.ToLower(InstanceStateFailed): return true, s, fmt.Errorf("update failed for instance with id %s", instanceId) default: + tflog.Info(ctx, "Wait (update) received unknown status", map[string]interface{}{ + "instanceId": instanceId, + "status": s.Status, + }) return false, s, nil } }) - handler.SetSleepBeforeWait(2 * time.Second) + handler.SetSleepBeforeWait(15 * time.Second) handler.SetTimeout(45 * time.Minute) return handler } diff --git a/pkg/sqlserverflexalpha/wait/wait_test.go b/stackit/internal/wait/sqlserverflexalpha/wait_test.go similarity index 99% rename from pkg/sqlserverflexalpha/wait/wait_test.go rename to stackit/internal/wait/sqlserverflexalpha/wait_test.go index 67e0f0b5..7a54a922 100644 --- a/pkg/sqlserverflexalpha/wait/wait_test.go +++ b/stackit/internal/wait/sqlserverflexalpha/wait_test.go @@ -1,6 +1,6 @@ // Copyright (c) STACKIT -package wait +package sqlserverflexalpha import ( "context" diff --git a/stackit/provider.go b/stackit/provider.go index 8550fc7b..9d37dda4 100644 --- a/stackit/provider.go +++ b/stackit/provider.go @@ -16,15 +16,19 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/features" postgresFlexAlphaDatabase "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/database" postgresFlexAlphaFlavor "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavor" + postgresflexalphaFlavors "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavors" postgresFlexAlphaInstance "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance" postgresFlexAlphaUser "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/user" + sqlserverflexalphaDatabase "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/database" sqlserverFlexAlphaFlavor "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/flavor" sqlServerFlexAlphaInstance "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/instance" sqlserverFlexAlphaUser "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/user" + sqlserverflexalphaVersion "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/version" sdkauth "github.com/stackitcloud/stackit-sdk-go/core/auth" "github.com/stackitcloud/stackit-sdk-go/core/config" ) @@ -317,6 +321,7 @@ func (p *Provider) Schema(_ context.Context, _ provider.SchemaRequest, resp *pro // Configure prepares a stackit API client for data sources and resources. func (p *Provider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { + tflog.Info(ctx, "Configuring provider client") // Retrieve provider data and configuration var providerConfig providerModel diags := req.Config.Get(ctx, &providerConfig) @@ -495,10 +500,13 @@ func (p *Provider) DataSources(_ context.Context) []func() datasource.DataSource postgresFlexAlphaDatabase.NewDatabaseDataSource, postgresFlexAlphaInstance.NewInstanceDataSource, postgresFlexAlphaUser.NewUserDataSource, + postgresflexalphaFlavors.NewFlavorsDataSource, + sqlserverflexalphaVersion.NewVersionDataSource, sqlserverFlexAlphaFlavor.NewFlavorDataSource, sqlServerFlexAlphaInstance.NewInstanceDataSource, sqlserverFlexAlphaUser.NewUserDataSource, + sqlserverflexalphaDatabase.NewDatabaseDataSource, } } @@ -510,6 +518,7 @@ func (p *Provider) Resources(_ context.Context) []func() resource.Resource { postgresFlexAlphaUser.NewUserResource, sqlServerFlexAlphaInstance.NewInstanceResource, sqlserverFlexAlphaUser.NewUserResource, + sqlserverflexalphaDatabase.NewDatabaseResource, } return resources } diff --git a/stackit/testdata/provider-all-attributes.tf b/stackit/testdata/provider-all-attributes.tf index 895ea245..930fc553 100644 --- a/stackit/testdata/provider-all-attributes.tf +++ b/stackit/testdata/provider-all-attributes.tf @@ -1,3 +1,4 @@ + variable "project_id" {} variable "name" {} diff --git a/stackit/testdata/provider-credentials.tf b/stackit/testdata/provider-credentials.tf index 32c1d863..a0ed79f4 100644 --- a/stackit/testdata/provider-credentials.tf +++ b/stackit/testdata/provider-credentials.tf @@ -1,3 +1,4 @@ + variable "project_id" {} variable "name" {} diff --git a/stackit/testdata/provider-invalid-attribute.tf b/stackit/testdata/provider-invalid-attribute.tf index d5a11a2c..524610e6 100644 --- a/stackit/testdata/provider-invalid-attribute.tf +++ b/stackit/testdata/provider-invalid-attribute.tf @@ -1,3 +1,4 @@ + variable "project_id" {} variable "name" {} diff --git a/tools/copy.go b/tools/copy.go new file mode 100644 index 00000000..1453913a --- /dev/null +++ b/tools/copy.go @@ -0,0 +1,120 @@ +package tools + +import ( + "fmt" + "io" + "os" + "path/filepath" + "syscall" +) + +// Source - https://stackoverflow.com/a +// Posted by Oleg Neumyvakin, modified by community. See post 'Timeline' for change history +// Retrieved 2026-01-20, License - CC BY-SA 4.0 + +func CopyDirectory(scrDir, dest string) error { + entries, err := os.ReadDir(scrDir) + if err != nil { + return err + } + for _, entry := range entries { + sourcePath := filepath.Join(scrDir, entry.Name()) + destPath := filepath.Join(dest, entry.Name()) + + fileInfo, err := os.Stat(sourcePath) + if err != nil { + return err + } + + stat, ok := fileInfo.Sys().(*syscall.Stat_t) + if !ok { + return fmt.Errorf("failed to get raw syscall.Stat_t data for '%s'", sourcePath) + } + + switch fileInfo.Mode() & os.ModeType { + case os.ModeDir: + if err := CreateIfNotExists(destPath, 0o755); err != nil { + return err + } + if err := CopyDirectory(sourcePath, destPath); err != nil { + return err + } + case os.ModeSymlink: + if err := CopySymLink(sourcePath, destPath); err != nil { + return err + } + default: + if err := Copy(sourcePath, destPath); err != nil { + return err + } + } + + if err := os.Lchown(destPath, int(stat.Uid), int(stat.Gid)); err != nil { + return err + } + + fInfo, err := entry.Info() + if err != nil { + return err + } + + isSymlink := fInfo.Mode()&os.ModeSymlink != 0 + if !isSymlink { + if err := os.Chmod(destPath, fInfo.Mode()); err != nil { + return err + } + } + } + return nil +} + +func Copy(srcFile, dstFile string) error { + out, err := os.Create(dstFile) + if err != nil { + return err + } + + defer out.Close() + + in, err := os.Open(srcFile) + if err != nil { + return err + } + + defer in.Close() + + _, err = io.Copy(out, in) + if err != nil { + return err + } + + return nil +} + +func Exists(filePath string) bool { + if _, err := os.Stat(filePath); os.IsNotExist(err) { + return false + } + + return true +} + +func CreateIfNotExists(dir string, perm os.FileMode) error { + if Exists(dir) { + return nil + } + + if err := os.MkdirAll(dir, perm); err != nil { + return fmt.Errorf("failed to create directory: '%s', error: '%s'", dir, err.Error()) + } + + return nil +} + +func CopySymLink(source, dest string) error { + link, err := os.Readlink(source) + if err != nil { + return err + } + return os.Symlink(link, dest) +} diff --git a/tools/formats.go b/tools/formats.go new file mode 100644 index 00000000..b6677d02 --- /dev/null +++ b/tools/formats.go @@ -0,0 +1,53 @@ +package tools + +import ( + "regexp" + "strings" + "unicode" + "unicode/utf8" +) + +// snakeLetters will match to the first letter and an underscore followed by a letter +var snakeLetters = regexp.MustCompile("(^[a-z])|_[a-z0-9]") + +func ToPascalCase(in string) string { + inputSplit := strings.Split(in, ".") + + var ucName string + + for _, v := range inputSplit { + if len(v) < 1 { + continue + } + + firstChar := v[0:1] + ucFirstChar := strings.ToUpper(firstChar) + + if len(v) < 2 { + ucName += ucFirstChar + continue + } + + ucName += ucFirstChar + v[1:] + } + + return snakeLetters.ReplaceAllStringFunc(ucName, func(s string) string { + return strings.ToUpper(strings.ReplaceAll(s, "_", "")) + }) +} + +func ToCamelCase(in string) string { + pascal := ToPascalCase(in) + + // Grab first rune and lower case it + firstLetter, size := utf8.DecodeRuneInString(pascal) + if firstLetter == utf8.RuneError && size <= 1 { + return pascal + } + + return string(unicode.ToLower(firstLetter)) + pascal[size:] +} + +func ValidateSnakeCase(in string) bool { + return snakeLetters.MatchString(string(in)) +} diff --git a/tools/main.go b/tools/main.go new file mode 100644 index 00000000..9d65da5d --- /dev/null +++ b/tools/main.go @@ -0,0 +1,720 @@ +package tools + +import ( + "bytes" + "errors" + "fmt" + "io" + "log" + "log/slog" + "os" + "os/exec" + "path" + "path/filepath" + "regexp" + "strconv" + "strings" + "text/template" + + "github.com/ldez/go-git-cmd-wrapper/v2/clone" + "github.com/ldez/go-git-cmd-wrapper/v2/git" +) + +const ( + OAS_REPO_NAME = "stackit-api-specifications" + OAS_REPO = "https://github.com/stackitcloud/stackit-api-specifications.git" + GEN_REPO_NAME = "stackit-sdk-generator" + GEN_REPO = "https://github.com/stackitcloud/stackit-sdk-generator.git" +) + +type version struct { + verString string + major int + minor int +} + +func Build() error { + slog.Info("Starting Builder") + root, err := getRoot() + if err != nil { + log.Fatal(err) + } + if root == nil || *root == "" { + return fmt.Errorf("unable to determine root directory from git") + } + slog.Info("Using root directory", "dir", *root) + + slog.Info("Cleaning up old generator directory") + err = os.RemoveAll(path.Join(*root, GEN_REPO_NAME)) + if err != nil { + return err + } + + slog.Info("Cleaning up old packages directory") + err = os.RemoveAll(path.Join(*root, "pkg")) + if err != nil { + return err + } + + slog.Info("Creating generator dir", "dir", fmt.Sprintf("%s/%s", *root, GEN_REPO_NAME)) + genDir, err := createGeneratorDir(*root, GEN_REPO, GEN_REPO_NAME) + if err != nil { + return err + } + + slog.Info("Creating oas dir", "dir", fmt.Sprintf("%s/%s", *root, OAS_REPO_NAME)) + repoDir, err := createRepoDir(genDir, OAS_REPO, OAS_REPO_NAME) + if err != nil { + return fmt.Errorf("%s", err.Error()) + } + + slog.Info("Retrieving versions from subdirs") + // TODO - major + verMap, err := getVersions(repoDir) + if err != nil { + return fmt.Errorf("%s", err.Error()) + } + + slog.Info("Reducing to only latest or highest") + res, err := getOnlyLatest(verMap) + if err != nil { + return fmt.Errorf("%s", err.Error()) + } + + slog.Info("Creating OAS dir") + err = os.MkdirAll(path.Join(genDir, "oas"), 0755) + if err != nil { + return err + } + + slog.Info("Copying OAS files") + for service, item := range res { + baseService := strings.TrimSuffix(service, "alpha") + baseService = strings.TrimSuffix(baseService, "beta") + itemVersion := fmt.Sprintf("v%d%s", item.major, item.verString) + if item.minor != 0 { + itemVersion = itemVersion + "" + strconv.Itoa(item.minor) + } + srcFile := path.Join( + repoDir, + "services", + baseService, + itemVersion, + fmt.Sprintf("%s.json", baseService), + ) + dstFile := path.Join(genDir, "oas", fmt.Sprintf("%s.json", service)) + _, err = copyFile(srcFile, dstFile) + if err != nil { + return fmt.Errorf("%s", err.Error()) + } + } + + slog.Info("Cleaning up", "dir", repoDir) + err = os.RemoveAll(filepath.Dir(repoDir)) + if err != nil { + return fmt.Errorf("%s", err.Error()) + } + + slog.Info("Changing dir", "dir", genDir) + err = os.Chdir(genDir) + if err != nil { + return err + } + + slog.Info("Calling make", "command", "generate-go-sdk") + cmd := exec.Command("make", "generate-go-sdk") + var stdOut, stdErr bytes.Buffer + cmd.Stdout = &stdOut + cmd.Stderr = &stdErr + + if err = cmd.Start(); err != nil { + slog.Error("cmd.Start", "error", err) + return err + } + + if err = cmd.Wait(); err != nil { + var exitErr *exec.ExitError + if errors.As(err, &exitErr) { + slog.Error("cmd.Wait", "code", exitErr.ExitCode(), "error", err, "stdout", stdOut.String(), "stderr", stdErr.String()) + return fmt.Errorf("%s", stdErr.String()) + } + if err != nil { + slog.Error("cmd.Wait", "err", err) + return err + } + } + + slog.Info("Cleaning up go.mod and go.sum files") + cleanDir := path.Join(genDir, "sdk-repo-updated", "services") + dirEntries, err := os.ReadDir(cleanDir) + if err != nil { + return err + } + for _, entry := range dirEntries { + if entry.IsDir() { + err = deleteFiles( + path.Join(cleanDir, entry.Name(), "go.mod"), + path.Join(cleanDir, entry.Name(), "go.sum"), + ) + if err != nil { + return err + } + } + } + + slog.Info("Changing dir", "dir", *root) + err = os.Chdir(*root) + if err != nil { + return err + } + + slog.Info("Rearranging package directories") + err = os.MkdirAll(path.Join(*root, "pkg"), 0755) // noqa:gosec + if err != nil { + return err + } + srcDir := path.Join(genDir, "sdk-repo-updated", "services") + items, err := os.ReadDir(srcDir) + if err != nil { + return err + } + for _, item := range items { + if item.IsDir() { + slog.Info(" -> package", "name", item.Name()) + tgtDir := path.Join(*root, "pkg", item.Name()) + // no backup needed as we generate new + //bakName := fmt.Sprintf("%s.%s", item.Name(), time.Now().Format("20060102-150405")) + //if _, err = os.Stat(tgtDir); !os.IsNotExist(err) { + // err = os.Rename( + // tgtDir, + // path.Join(*root, "pkg", bakName), + // ) + // if err != nil { + // return err + // } + //} + err = os.Rename(path.Join(srcDir, item.Name()), tgtDir) + if err != nil { + return err + } + + // wait is placed outside now + //if _, err = os.Stat(path.Join(*root, "pkg", bakName, "wait")); !os.IsNotExist(err) { + // slog.Info(" Copying wait subfolder") + // err = os.Rename(path.Join(*root, "pkg", bakName, "wait"), path.Join(tgtDir, "wait")) + // if err != nil { + // return err + // } + //} + } + } + + slog.Info("Checking needed commands available") + err = checkCommands([]string{"tfplugingen-framework", "tfplugingen-openapi"}) + if err != nil { + return err + } + + slog.Info("Generating service boilerplate") + err = generateServiceFiles(*root, path.Join(*root, GEN_REPO_NAME)) + if err != nil { + return err + } + + slog.Info("Copying all service files") + err = CopyDirectory( + path.Join(*root, "generated", "internal", "services"), + path.Join(*root, "stackit", "internal", "services"), + ) + if err != nil { + return err + } + + err = createBoilerplate(*root, path.Join(*root, "stackit", "internal", "services")) + if err != nil { + return err + } + + slog.Info("Finally removing temporary files and directories") + //err = os.RemoveAll(path.Join(*root, "generated")) + //if err != nil { + // slog.Error("RemoveAll", "dir", path.Join(*root, "generated"), "err", err) + // return err + //} + + err = os.RemoveAll(path.Join(*root, GEN_REPO_NAME)) + if err != nil { + slog.Error("RemoveAll", "dir", path.Join(*root, GEN_REPO_NAME), "err", err) + return err + } + + slog.Info("Done") + return nil +} + +type templateData struct { + PackageName string + NameCamel string + NamePascal string + NameSnake string +} + +func fileExists(path string) bool { + _, err := os.Stat(path) + if os.IsNotExist(err) { + return false + } + if err != nil { + panic(err) + } + return true +} + +func createBoilerplate(rootFolder, folder string) error { + services, err := os.ReadDir(folder) + if err != nil { + return err + } + for _, svc := range services { + if !svc.IsDir() { + continue + } + resources, err := os.ReadDir(path.Join(folder, svc.Name())) + if err != nil { + return err + } + + var handleDS bool + var handleRes bool + var foundDS bool + var foundRes bool + + for _, res := range resources { + if !res.IsDir() { + continue + } + + resourceName := res.Name() + + dsFile := path.Join(folder, svc.Name(), res.Name(), "datasources_gen", fmt.Sprintf("%s_data_source_gen.go", res.Name())) + handleDS = fileExists(dsFile) + + resFile := path.Join(folder, svc.Name(), res.Name(), "resources_gen", fmt.Sprintf("%s_resource_gen.go", res.Name())) + handleRes = fileExists(resFile) + + dsGoFile := path.Join(folder, svc.Name(), res.Name(), "datasource.go") + foundDS = fileExists(dsGoFile) + + resGoFile := path.Join(folder, svc.Name(), res.Name(), "resource.go") + foundRes = fileExists(resGoFile) + + if handleDS && !foundDS { + slog.Info("Creating missing datasource.go", "service", svc.Name(), "resource", resourceName) + if !ValidateSnakeCase(resourceName) { + return errors.New("resource name is invalid") + } + + tplName := "data_source_scaffold.gotmpl" + err = writeTemplateToFile( + tplName, + path.Join(rootFolder, "tools", "templates", tplName), + path.Join(folder, svc.Name(), res.Name(), "datasource.go"), + &templateData{ + PackageName: svc.Name(), + NameCamel: ToCamelCase(resourceName), + NamePascal: ToPascalCase(resourceName), + NameSnake: resourceName, + }, + ) + if err != nil { + panic(err) + } + } + + if handleRes && !foundRes { + slog.Info("Creating missing resource.go", "service", svc.Name(), "resource", resourceName) + if !ValidateSnakeCase(resourceName) { + return errors.New("resource name is invalid") + } + + tplName := "resource_scaffold.gotmpl" + err = writeTemplateToFile( + tplName, + path.Join(rootFolder, "tools", "templates", tplName), + path.Join(folder, svc.Name(), res.Name(), "resource.go"), + &templateData{ + PackageName: svc.Name(), + NameCamel: ToCamelCase(resourceName), + NamePascal: ToPascalCase(resourceName), + NameSnake: resourceName, + }, + ) + if err != nil { + return err + } + } + } + } + return nil +} + +func ucfirst(s string) string { + if len(s) == 0 { + return "" + } + return strings.ToUpper(s[:1]) + s[1:] +} + +func writeTemplateToFile(tplName, tplFile, outFile string, data *templateData) error { + fn := template.FuncMap{ + "ucfirst": ucfirst, + } + + tmpl, err := template.New(tplName).Funcs(fn).ParseFiles(tplFile) + if err != nil { + return err + } + + var f *os.File + f, err = os.Create(outFile) + if err != nil { + return err + } + + err = tmpl.Execute(f, *data) + if err != nil { + return err + } + + err = f.Close() + if err != nil { + return err + } + return nil +} + +func generateServiceFiles(rootDir, generatorDir string) error { + // slog.Info("Generating specs folder") + err := os.MkdirAll(path.Join(rootDir, "generated", "specs"), 0755) + if err != nil { + return err + } + + specs, err := os.ReadDir(path.Join(rootDir, "service_specs")) + if err != nil { + return err + } + for _, spec := range specs { + if spec.IsDir() { + continue + } + // slog.Info("Checking spec", "name", spec.Name()) + r := regexp.MustCompile(`^([a-z-]+)_(.*)_config.yml$`) + matches := r.FindAllStringSubmatch(spec.Name(), -1) + if matches != nil { + fileName := matches[0][0] + service := matches[0][1] + resource := matches[0][2] + slog.Info( + "Found service spec", + "name", + spec.Name(), + "service", + service, + "resource", + resource, + ) + + for _, part := range []string{"alpha", "beta"} { + oasFile := path.Join(generatorDir, "oas", fmt.Sprintf("%s%s.json", service, part)) + if _, err = os.Stat(oasFile); !os.IsNotExist(err) { + // slog.Info("found matching oas", "service", service, "version", part) + scName := fmt.Sprintf("%s%s", service, part) + scName = strings.ReplaceAll(scName, "-", "") + err = os.MkdirAll(path.Join(rootDir, "generated", "internal", "services", scName, resource), 0755) + if err != nil { + return err + } + + // slog.Info("Generating openapi spec json") + specFile := path.Join(rootDir, "generated", "specs", fmt.Sprintf("%s_%s_spec.json", scName, resource)) + // noqa:gosec + cmd := exec.Command( + "tfplugingen-openapi", + "generate", + "--config", + path.Join(rootDir, "service_specs", fileName), + "--output", + specFile, + oasFile, + ) + out, err := cmd.Output() + if err != nil { + fmt.Printf("%s\n", string(out)) + return err + } + + // slog.Info("Creating terraform service resource files folder") + tgtFolder := path.Join(rootDir, "generated", "internal", "services", scName, resource, "resources_gen") + err = os.MkdirAll(tgtFolder, 0755) + if err != nil { + return err + } + + // slog.Info("Generating terraform service resource files") + // noqa:gosec + cmd2 := exec.Command( + "tfplugingen-framework", + "generate", + "resources", + "--input", + specFile, + "--output", + tgtFolder, + "--package", + scName, + ) + var stdOut, stdErr bytes.Buffer + cmd2.Stdout = &stdOut + cmd2.Stderr = &stdErr + + if err = cmd2.Start(); err != nil { + slog.Error("cmd.Start", "error", err) + return err + } + + if err = cmd2.Wait(); err != nil { + var exitErr *exec.ExitError + if errors.As(err, &exitErr) { + slog.Error("cmd.Wait", "code", exitErr.ExitCode(), "error", err) + return fmt.Errorf("%s", stdErr.String()) + } + if err != nil { + slog.Error("cmd.Wait", "err", err) + return err + } + } + + // slog.Info("Creating terraform service datasource files folder") + tgtFolder = path.Join(rootDir, "generated", "internal", "services", scName, resource, "datasources_gen") + err = os.MkdirAll(tgtFolder, 0755) + if err != nil { + return err + } + + // slog.Info("Generating terraform service resource files") + + // noqa:gosec + cmd3 := exec.Command( + "tfplugingen-framework", + "generate", + "data-sources", + "--input", + specFile, + "--output", + tgtFolder, + "--package", + scName, + ) + var stdOut3, stdErr3 bytes.Buffer + cmd3.Stdout = &stdOut3 + cmd3.Stderr = &stdErr3 + + if err = cmd3.Start(); err != nil { + slog.Error("cmd.Start", "error", err) + return err + } + + if err = cmd3.Wait(); err != nil { + var exitErr *exec.ExitError + if errors.As(err, &exitErr) { + slog.Error("cmd.Wait", "code", exitErr.ExitCode(), "error", err) + return fmt.Errorf("%s", stdErr.String()) + } + if err != nil { + slog.Error("cmd.Wait", "err", err) + return err + } + } + } + } + } + } + return nil +} + +func checkCommands(commands []string) error { + for _, commandName := range commands { + if !commandExists(commandName) { + return fmt.Errorf("missing command %s", commandName) + } + slog.Info("found", "command", commandName) + } + return nil +} + +func commandExists(cmd string) bool { + _, err := exec.LookPath(cmd) + return err == nil +} + +func deleteFiles(fNames ...string) error { + for _, fName := range fNames { + if _, err := os.Stat(fName); !os.IsNotExist(err) { + err = os.Remove(fName) + if err != nil { + return err + } + } + } + return nil +} + +func copyFile(src, dst string) (int64, error) { + sourceFileStat, err := os.Stat(src) + if err != nil { + return 0, err + } + + if !sourceFileStat.Mode().IsRegular() { + return 0, fmt.Errorf("%s is not a regular file", src) + } + + source, err := os.Open(src) + if err != nil { + return 0, err + } + defer source.Close() + + destination, err := os.Create(dst) + if err != nil { + return 0, err + } + defer destination.Close() + nBytes, err := io.Copy(destination, source) + return nBytes, err +} + +func getOnlyLatest(m map[string]version) (map[string]version, error) { + tmpMap := make(map[string]version) + for k, v := range m { + item, ok := tmpMap[k] + if !ok { + tmpMap[k] = v + } else { + if item.major == v.major && item.minor < v.minor { + tmpMap[k] = v + } + } + } + return tmpMap, nil +} + +func getVersions(dir string) (map[string]version, error) { + res := make(map[string]version) + children, err := os.ReadDir(path.Join(dir, "services")) + if err != nil { + return nil, err + } + + for _, entry := range children { + if entry.IsDir() { + versions, err := os.ReadDir(path.Join(dir, "services", entry.Name())) + if err != nil { + return nil, err + } + m, err2 := extractVersions(entry.Name(), versions) + if err2 != nil { + return m, err2 + } + for k, v := range m { + res[k] = v + } + } + } + return res, nil +} + +func extractVersions(service string, versionDirs []os.DirEntry) (map[string]version, error) { + res := make(map[string]version) + for _, vDir := range versionDirs { + if vDir.IsDir() { + r := regexp.MustCompile(`v([0-9]+)([a-z]+)([0-9]*)`) + matches := r.FindAllStringSubmatch(vDir.Name(), -1) + if matches == nil { + continue + } + svc, ver, err := handleVersion(service, matches[0]) + if err != nil { + return nil, err + } + + if svc != nil && ver != nil { + res[*svc] = *ver + } + } + } + return res, nil +} + +func handleVersion(service string, match []string) (*string, *version, error) { + if match == nil { + fmt.Println("no matches") + return nil, nil, nil + } + verString := match[2] + if verString != "alpha" && verString != "beta" { + return nil, nil, errors.New("unsupported version") + } + majVer, err := strconv.Atoi(match[1]) + if err != nil { + return nil, nil, err + } + if match[3] == "" { + match[3] = "0" + } + minVer, err := strconv.Atoi(match[3]) + if err != nil { + return nil, nil, err + } + resStr := fmt.Sprintf("%s%s", service, verString) + return &resStr, &version{verString: verString, major: majVer, minor: minVer}, nil +} + +func createRepoDir(root, repoUrl, repoName string) (string, error) { + oasTmpDir, err := os.MkdirTemp(root, "oas-tmp") + if err != nil { + return "", err + } + targetDir := path.Join(oasTmpDir, repoName) + _, err = git.Clone( + clone.Repository(repoUrl), + clone.Directory(targetDir), + ) + if err != nil { + return "", err + } + return targetDir, nil +} + +func createGeneratorDir(root, repoUrl, repoName string) (string, error) { + targetDir := path.Join(root, repoName) + _, err := git.Clone( + clone.Repository(repoUrl), + clone.Directory(targetDir), + ) + if err != nil { + return "", err + } + return targetDir, nil +} + +func getRoot() (*string, error) { + cmd := exec.Command("git", "rev-parse", "--show-toplevel") + out, err := cmd.Output() + if err != nil { + return nil, err + } + lines := strings.Split(string(out), "\n") + return &lines[0], nil +} diff --git a/tools/templates/data_source_scaffold.gotmpl b/tools/templates/data_source_scaffold.gotmpl new file mode 100644 index 00000000..38986c9f --- /dev/null +++ b/tools/templates/data_source_scaffold.gotmpl @@ -0,0 +1,51 @@ +package {{.PackageName}} + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + + "github.com/mhenselin/terraform-provider-stackitprivatepreview/pkg/{{.PackageName}}" + + {{.PackageName}}Gen "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/{{.PackageName}}/{{.NameSnake}}/datasources_gen" +) + +var _ datasource.DataSource = (*{{.NameCamel}}DataSource)(nil) + +func New{{.NamePascal}}DataSource() datasource.DataSource { + return &{{.NameCamel}}DataSource{} +} + +type {{.NameCamel}}DataSource struct{ + client *{{.PackageName}}.APIClient + providerData core.ProviderData +} + +func (d *{{.NameCamel}}DataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_{{.PackageName}}_{{.NameSnake}}" +} + +func (d *{{.NameCamel}}DataSource) Schema(ctx context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = {{.PackageName}}Gen.{{.NamePascal}}DataSourceSchema(ctx) +} + +func (d *{{.NameCamel}}DataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + var data {{.PackageName}}Gen.{{.NameCamel}}Model + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Read API call logic + + // Example data value setting + // data.Id = types.StringValue("example-id") + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} diff --git a/tools/templates/provider_scaffold.gotmpl b/tools/templates/provider_scaffold.gotmpl new file mode 100644 index 00000000..8c141ccc --- /dev/null +++ b/tools/templates/provider_scaffold.gotmpl @@ -0,0 +1,39 @@ +package {{.PackageName}} + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/provider" + "github.com/hashicorp/terraform-plugin-framework/resource" +) + +var _ provider.Provider = (*{{.NameCamel}}Provider)(nil) + +func New() func() provider.Provider { + return func() provider.Provider { + return &{{.NameCamel}}Provider{} + } +} + +type {{.NameCamel}}Provider struct{} + +func (p *{{.NameCamel}}Provider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) { + +} + +func (p *{{.NameCamel}}Provider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse) { + +} + +func (p *{{.NameCamel}}Provider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) { + resp.TypeName = "{{.NameSnake}}" +} + +func (p *{{.NameCamel}}Provider) DataSources(ctx context.Context) []func() datasource.DataSource { + return []func() datasource.DataSource{} +} + +func (p *{{.NameCamel}}Provider) Resources(ctx context.Context) []func() resource.Resource { + return []func() resource.Resource{} +} diff --git a/tools/templates/resource_scaffold.gotmpl b/tools/templates/resource_scaffold.gotmpl new file mode 100644 index 00000000..39ea764e --- /dev/null +++ b/tools/templates/resource_scaffold.gotmpl @@ -0,0 +1,208 @@ +package {{.PackageName}} + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/types" + + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/core" + "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/utils" + + {{.PackageName}}Gen "github.com/mhenselin/terraform-provider-stackitprivatepreview/stackit/internal/services/{{.PackageName}}/{{.NameSnake}}/resources_gen" +) + +var ( + _ resource.Resource = &{{.NameCamel}}Resource{} + _ resource.ResourceWithConfigure = &{{.NameCamel}}Resource{} + _ resource.ResourceWithImportState = &{{.NameCamel}}Resource{} + _ resource.ResourceWithModifyPlan = &{{.NameCamel}}Resource{} +) + +func New{{.NamePascal}}Resource() resource.Resource { + return &{{.NameCamel}}Resource{} +} + +type {{.NameCamel}}Resource struct{ + client *{{.PackageName}}.APIClient + providerData core.ProviderData +} + +func (r *{{.NameCamel}}Resource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_{{.PackageName}}_{{.NameSnake}}" +} + +func (r *{{.NameCamel}}Resource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = {{.PackageName}}Gen.{{.NamePascal}}ResourceSchema(ctx) +} + +// Configure adds the provider configured client to the resource. +func (r *{{.NameCamel}}Resource) Configure( + ctx context.Context, + req resource.ConfigureRequest, + resp *resource.ConfigureResponse, +) { + var ok bool + r.providerData, ok = conversion.ParseProviderData(ctx, req.ProviderData, &resp.Diagnostics) + if !ok { + return + } + + apiClientConfigOptions := []config.ConfigurationOption{ + config.WithCustomAuth(r.providerData.RoundTripper), + utils.UserAgentConfigOption(r.providerData.Version), + } + if r.providerData.PostgresFlexCustomEndpoint != "" { + apiClientConfigOptions = append(apiClientConfigOptions, config.WithEndpoint(r.providerData.PostgresFlexCustomEndpoint)) + } else { + apiClientConfigOptions = append(apiClientConfigOptions, config.WithRegion(r.providerData.GetRegion())) + } + apiClient, err := {{.PackageName}}.NewAPIClient(apiClientConfigOptions...) + if err != nil { + resp.Diagnostics.AddError( "Error configuring API client", fmt.Sprintf("Configuring client: %v. This is an error related to the provider configuration, not to the resource configuration", err)) + return + } + r.client = apiClient + tflog.Info(ctx, "{{.PackageName}}.{{.NamePascal}} client configured") +} + +func (r *{{.NameCamel}}Resource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + var data {{.PackageName}}Gen.{{.NamePascal}}Model + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // TODO: Create API call logic + + // Example data value setting + data.{{.NameCamel | ucfirst}}Id = types.StringValue("id-from-response") + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + + tflog.Info(ctx, "{{.PackageName}}.{{.NamePascal}} created") +} + +func (r *{{.NameCamel}}Resource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + var data {{.PackageName}}Gen.{{.NamePascal}}Model + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Read API call logic + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + + tflog.Info(ctx, "{{.PackageName}}.{{.NamePascal}} read") +} + +func (r *{{.NameCamel}}Resource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + var data {{.PackageName}}Gen.{{.NamePascal}}Model + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Update API call logic + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + + tflog.Info(ctx, "{{.PackageName}}.{{.NamePascal}} updated") +} + +func (r *{{.NameCamel}}Resource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + var data {{.PackageName}}Gen.{{.NamePascal}}Model + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + // Todo: Delete API call logic + + tflog.Info(ctx, "{{.PackageName}}.{{.NamePascal}} deleted") +} + +// ModifyPlan implements resource.ResourceWithModifyPlan. +// Use the modifier to set the effective region in the current plan. +func (r *{{.NameCamel}}Resource) ModifyPlan( + ctx context.Context, + req resource.ModifyPlanRequest, + resp *resource.ModifyPlanResponse, +) { // nolint:gocritic // function signature required by Terraform + var configModel {{.PackageName}}Gen.{{.NamePascal}}Model + // skip initial empty configuration to avoid follow-up errors + if req.Config.Raw.IsNull() { + return + } + resp.Diagnostics.Append(req.Config.Get(ctx, &configModel)...) + if resp.Diagnostics.HasError() { + return + } + + var planModel {{.PackageName}}Gen.{{.NamePascal}}Model + resp.Diagnostics.Append(req.Plan.Get(ctx, &planModel)...) + if resp.Diagnostics.HasError() { + return + } + + utils.AdaptRegion(ctx, configModel.Region, &planModel.Region, r.providerData.GetRegion(), resp) + if resp.Diagnostics.HasError() { + return + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, planModel)...) + if resp.Diagnostics.HasError() { + return + } +} + +// ImportState imports a resource into the Terraform state on success. +// The expected format of the resource import identifier is: project_id,zone_id,record_set_id +func (r *{{.NameCamel}}Resource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { + idParts := strings.Split(req.ID, core.Separator) + + // Todo: Import logic + if len(idParts) < 2 || idParts[0] == "" || idParts[1] == "" { + core.LogAndAddError( + ctx, &resp.Diagnostics, + "Error importing database", + fmt.Sprintf( + "Expected import identifier with format [project_id],[region],..., got %q", + req.ID, + ), + ) + return + } + + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("project_id"), idParts[0])...) + resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("region"), idParts[1])...) + // ... more ... + + core.LogAndAddWarning( + ctx, + &resp.Diagnostics, + "{{.PackageName | ucfirst}} database imported with empty password", + "The database password is not imported as it is only available upon creation of a new database. The password field will be empty.", + ) + tflog.Info(ctx, "{{.PackageName | ucfirst}} {{.NameCamel}} state imported") +}